/* Memorialis V2 — shared public and administration design system. */
@font-face { font-family: "Inter"; src: url('/assets/inter-latin.woff2') format('woff2'); font-style: normal; font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url('/assets/playfair-display-latin.woff2') format('woff2'); font-style: normal; font-weight: 600 700; font-display: swap; }
:root {
  --burgundy: #a6192e;
  --burgundy-dark: #891426;
  --burgundy-soft: #f8ecef;
  --red-dark: #891426;
  --background: #faf9f6;
  --background-alt: #f2f0ea;
  --surface: #ffffff;
  --text: #202124;
  --text-secondary: #686868;
  --text-muted: #949494;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --glass: rgba(255, 255, 255, .72);
  --glass-border: rgba(255, 255, 255, .68);
  --danger: #a6192e;
  --focus: rgba(166, 25, 46, .28);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(29, 24, 18, .04), 0 8px 22px rgba(29, 24, 18, .045);
  --shadow: 0 18px 50px rgba(38, 28, 22, .09);
  --shadow-float: 0 30px 90px rgba(38, 28, 22, .2);
  --shell: 1180px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  color: var(--text);
  background: var(--background);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.search-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--burgundy); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
svg { display: block; }
h1, h2, h3, h4 { margin: 0; color: var(--text); line-height: 1.12; text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-weight: 600; }
h1 { font-size: clamp(2.2rem, 4.5vw, 4rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); letter-spacing: -.025em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.shell { width: min(100% - 40px, var(--shell)); margin-inline: auto; }
main.shell { min-height: 58vh; padding-top: 54px; }
.main--home { padding-top: 0 !important; }
.main--auth { width: min(100% - 40px, 1320px); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.visually-empty { display: contents; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 1000; padding: 10px 16px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }
.eyebrow { margin: 0 0 10px; color: var(--burgundy); font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--text-secondary); }
.center { text-align: center; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--line); background: rgba(250, 249, 246, .88); -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
.header-bar { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--burgundy-dark); font-family: var(--serif); font-size: 1.4rem; font-weight: 700; line-height: 1; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.brand small { display: block; margin-top: 5px; color: var(--text-secondary); font-family: var(--sans); font-size: .56rem; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 3px; }
.nav a { display: inline-flex; min-height: 40px; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 12px; color: var(--text); font-size: .88rem; font-weight: 600; }
.nav a:hover { color: var(--burgundy); background: var(--burgundy-soft); text-decoration: none; }
.nav svg { width: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.nav kbd { padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text-muted); background: rgba(255,255,255,.7); font-family: inherit; font-size: .65rem; font-weight: 500; }
.nav .account-link { margin-left: 4px; padding-inline: 15px; color: #fff; background: var(--burgundy); }
.nav .account-link:hover { color: #fff; background: var(--burgundy-dark); }
.icon-button { display: inline-grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: rgba(255,255,255,.68); cursor: pointer; transition: .16s ease; }
.icon-button:hover { color: var(--burgundy); border-color: rgba(166,25,46,.22); background: #fff; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.menu-toggle { display: none; }

/* Buttons and form controls */
.btn { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border: 1px solid var(--burgundy); border-radius: 12px; color: #fff; background: var(--burgundy); box-shadow: 0 7px 18px rgba(166,25,46,.14); font-weight: 650; line-height: 1.2; cursor: pointer; transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.btn:hover { color: #fff; background: var(--burgundy-dark); text-decoration: none; box-shadow: 0 10px 24px rgba(166,25,46,.2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.secondary { color: var(--text); border-color: var(--line-strong); background: var(--surface); box-shadow: none; }
.btn.secondary:hover { color: var(--burgundy); border-color: rgba(166,25,46,.28); }
.btn.danger { border-color: #ad2638; background: #ad2638; }
.btn.small { min-height: 36px; padding: 7px 13px; border-radius: 9px; font-size: .82rem; }
form.stack { display: grid; gap: 20px; }
.field label, .filter-grid label { display: block; margin-bottom: 7px; color: var(--text); font-size: .83rem; font-weight: 650; }
.field input, .field select, .field textarea, .filter-grid input, .filter-grid select {
  width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text); background: #fff; transition: border-color .16s ease, box-shadow .16s ease;
}
.field textarea { min-height: 138px; resize: vertical; }
.field input[type="checkbox"], .field input[type="radio"] { width: auto; min-height: auto; padding: 0; }
.field input:focus, .field select:focus, .field textarea:focus, .filter-grid input:focus, .filter-grid select:focus { outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 4px var(--focus); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
fieldset { min-width: 0; margin: 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.55); }
legend { padding: 0 10px; color: var(--burgundy-dark); font-family: var(--serif); font-size: 1.2rem; font-weight: 700; }

/* Homepage */
.home-hero { display: grid; min-height: 610px; grid-template-columns: minmax(0, 3fr) minmax(380px, 2fr); margin-bottom: 0; border-bottom: 1px solid var(--line); }
.hero-copy { display: flex; flex-direction: column; justify-content: center; padding: 70px clamp(32px, 6vw, 82px) 70px 0; }
.hero-copy h1 { max-width: 670px; font-size: clamp(3.2rem, 7vw, 6.75rem); line-height: .98; }
.hero-copy .hero-intro { max-width: 590px; margin: 28px 0 34px; color: var(--text-secondary); font-size: clamp(1.05rem, 1.6vw, 1.35rem); line-height: 1.55; }
.hero-search { display: flex; width: min(100%, 660px); min-height: 68px; align-items: center; gap: 12px; padding: 8px 9px 8px 22px; border: 1px solid var(--line-strong); border-radius: 20px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); }
.hero-search svg { width: 22px; flex: none; fill: none; stroke: var(--text-muted); stroke-linecap: round; stroke-width: 1.8; }
.hero-search input { min-width: 0; flex: 1; padding: 8px 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 1rem; cursor: text; }
.hero-search button { width: 50px; height: 50px; flex: none; padding: 0; border: 0; border-radius: 50%; color: #fff; background: var(--burgundy); cursor: pointer; }
.hero-search button svg { width: 20px; margin: auto; stroke: currentColor; }
.hero-advanced { display: inline-block; margin-top: 17px; font-size: .86rem; font-weight: 650; }
.hero-image { position: relative; min-height: 520px; margin-right: calc((100vw - min(100vw - 40px, var(--shell))) / -2); overflow: hidden; }
.hero-image::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, var(--background) 0%, rgba(250,249,246,.2) 23%, transparent 52%), linear-gradient(0deg, rgba(32,33,36,.15), transparent 40%); }
.hero-image img { width: 100%; height: 100%; object-fit: cover; }
.hero-caption { position: absolute; right: 24px; bottom: 22px; z-index: 2; margin: 0; padding: 8px 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; color: #fff; background: rgba(20,20,20,.28); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: .72rem; }
.stats-strip { display: flex; align-items: stretch; justify-content: center; margin: 0; padding: 28px 0; border-bottom: 1px solid var(--line); }
.stat { min-width: 190px; padding: 5px 42px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .num { font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 700; line-height: 1; }
.stat .label { margin-top: 7px; color: var(--text-secondary); font-size: .73rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.home-section { padding-top: 76px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.section-heading p { max-width: 480px; margin: 8px 0 0; color: var(--text-secondary); }
h2.section { margin: 52px 0 24px; }
.featured-card { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.8fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.featured-card .featured-portrait { min-height: 350px; width: 100%; height: 100%; border-radius: 0; }
.featured-content { display: flex; flex-direction: column; justify-content: center; padding: clamp(30px, 6vw, 68px); }
.featured-content h3 { margin-bottom: 8px; font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 3.4rem); font-weight: 600; }
.featured-content h3 a { color: var(--text); }
.featured-content h3 a:hover { color: var(--burgundy); text-decoration: none; }
.featured-content .dates { color: var(--burgundy); font-weight: 650; }
.featured-content .summary { max-width: 630px; margin: 22px 0; color: var(--text-secondary); }
.featured-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--text-secondary); font-size: .86rem; }

/* Reusable cards and portraits */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card { display: flex; min-width: 0; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { border-color: rgba(166,25,46,.18); box-shadow: var(--shadow); transform: translateY(-3px); }
.card h3 { margin: 0 0 3px; }
.card h3 a { color: var(--text); }
.card .dates { color: var(--text-secondary); font-size: .85rem; }
.card .place { margin-top: 5px; color: var(--text); font-size: .8rem; }
.card .place.muted { margin-top: 1px; color: var(--text-secondary); }
.card .view { display: inline-block; margin-top: 9px; font-size: .78rem; font-weight: 700; }
.portrait { width: 72px; height: 88px; flex: 0 0 auto; border-radius: 12px; background: #f5f5f5; }
.portrait.is-photo { object-fit: cover; }
.portrait.is-placeholder { object-fit: contain; }
.portrait.lg { width: min(32vw, 290px); height: 370px; border-radius: 22px; }
.portrait.sm { width: 54px; height: 64px; border-radius: 9px; }
.portrait.xs { width: 34px; height: 40px; border-radius: 7px; }

/* Content panels and location pages */
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 36px; }
.page-intro p { max-width: 620px; margin: 12px 0 0; color: var(--text-secondary); }
.panel { margin: 22px 0; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.82); box-shadow: var(--shadow-sm); }
.panel h2 { margin-bottom: 18px; font-size: clamp(1.35rem, 2.5vw, 1.8rem); }
.field small { display: block; margin-top: 6px; color: var(--text-secondary); font-size: .72rem; }

/* Passwordless contributions */
.contribute-intro { padding: 24px 0 8px; }
.contribute-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 24px; align-items: start; }
.contribution-access { margin-top: 0; padding: clamp(28px, 5vw, 46px); }
.contribution-access form { max-width: 540px; margin-top: 24px; }
.contribution-steps { margin-top: 0; background: var(--burgundy-dark); color: #fff; }
.contribution-steps h2 { color: #fff; }
.contribution-steps ol { display: grid; gap: 22px; margin: 0; padding: 0; list-style: none; counter-reset: contribution-step; }
.contribution-steps li { position: relative; padding-left: 45px; counter-increment: contribution-step; }
.contribution-steps li::before { content: counter(contribution-step); position: absolute; left: 0; top: 0; display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; font-weight: 700; }
.contribution-steps strong, .contribution-steps span { display: block; }
.contribution-steps span { margin-top: 3px; color: rgba(255,255,255,.72); font-size: .82rem; }
.contributor-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; padding: 14px 18px; border: 1px solid #c8dece; border-radius: 13px; background: #eef7f0; }
.contributor-bar > div { display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 9px; }
.contributor-bar > div span:last-child { grid-column: 2; color: var(--text-secondary); font-size: .72rem; }
.verified-mark { display: grid; width: 28px; height: 28px; grid-row: span 2; place-items: center; border-radius: 50%; color: #fff; background: #477658; font-size: .8rem; }
.contributor-bar > a { font-size: .8rem; font-weight: 650; }
.contribution-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.contribution-choice { display: flex; align-items: center; gap: 16px; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: #fff; box-shadow: var(--shadow-sm); }
.contribution-choice:hover { border-color: rgba(166,25,46,.28); text-decoration: none; transform: translateY(-1px); }
.choice-icon { display: grid; width: 44px; height: 44px; flex: none; place-items: center; border-radius: 12px; color: var(--burgundy); background: var(--burgundy-soft); font-size: 1.25rem; }
.contribution-choice strong, .contribution-choice small { display: block; }
.contribution-choice small { margin-top: 4px; color: var(--text-secondary); font-size: .75rem; }
.contribution-form { max-width: 900px; margin-inline: auto; }
.submission-consent { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.submission-consent p { max-width: 640px; margin: 0; color: var(--text-secondary); font-size: .82rem; }
.result-card { max-width: 720px; margin: 50px auto; padding: clamp(34px, 7vw, 68px); }
.result-card h1 { font-size: clamp(2.3rem, 5vw, 4rem); }
.result-card > p:not(.eyebrow):not(.reference-number) { max-width: 560px; margin: 18px auto; color: var(--text-secondary); }
.result-card > div { display: flex; justify-content: center; gap: 10px; margin-top: 25px; }
.result-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 22px; place-items: center; border-radius: 50%; color: #fff; background: #477658; font-size: 1.35rem; }
.reference-number { display: inline-block; margin: 4px 0; padding: 7px 12px; border-radius: 999px; color: var(--burgundy-dark); background: var(--burgundy-soft); font-size: .8rem; font-weight: 700; }
.memorial-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; color: #6c5417; background: #fff4cc; font-size: .68rem; font-weight: 700; white-space: nowrap; }
.status--approved { color: #365f45; background: #e7f5eb; }
.status--rejected { color: #8f1528; background: #fbebee; }
.status--under_review { color: #315b7a; background: #e8f2f9; }
.status--needs_info { color: #734f18; background: #f8ead2; }
.prose { max-width: 72ch; color: #3f4043; font-size: 1.02rem; line-height: 1.85; white-space: pre-wrap; }
.location-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.location-card { display: flex; min-height: 170px; flex-direction: column; justify-content: space-between; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); transition: .2s ease; }
.location-card:hover { border-color: rgba(166,25,46,.2); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-3px); }
.location-card svg { width: 24px; margin-bottom: 30px; fill: none; stroke: var(--burgundy); stroke-linecap: round; stroke-width: 1.6; }
.location-card h2, .location-card h3 { margin-bottom: 6px; font-family: var(--serif); font-size: 1.35rem; }
.location-meta { color: var(--text-secondary); font-size: .83rem; }
.location-count { margin-top: 12px; color: var(--burgundy); font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.detail-hero { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; margin-bottom: 34px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.detail-hero .detail-meta { color: var(--text-secondary); }
.detail-actions { display: flex; gap: 10px; }

/* Search page */
.searchbox { display: flex; width: min(100%, 720px); gap: 10px; margin: 24px 0 18px; }
.searchbox input[type=search] { min-width: 0; min-height: 50px; flex: 1; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; }
.searchbox input[type=search]:focus { outline: 0; border-color: var(--burgundy); box-shadow: 0 0 0 4px var(--focus); }
details.panel summary { color: var(--text); font-weight: 650; cursor: pointer; }
details.panel summary::marker { color: var(--burgundy); }
.search-summary { margin: 26px 0; color: var(--text-secondary); }
.empty-state { padding: 60px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }

/* Memorial profile */
.memorial-hero { position: relative; display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: clamp(34px, 7vw, 92px); align-items: center; min-height: 470px; margin: -54px calc((100vw - min(100vw - 40px, var(--shell))) / -2) 0; padding: 70px max(20px, calc((100vw - min(100vw - 40px, var(--shell))) / 2)); overflow: hidden; background: var(--background-alt); }
.memorial-hero::after { content: ""; position: absolute; right: -12%; top: -50%; width: 55%; aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.48); filter: blur(3px); }
.memorial-portrait-wrap { position: relative; z-index: 1; justify-self: end; }
.memorial-portrait-wrap::before { content: ""; position: absolute; inset: 26px -20px -20px 20px; z-index: -1; border-radius: 24px; background: rgba(166,25,46,.09); }
.memorial-portrait-wrap .portrait { box-shadow: 0 26px 65px rgba(39,32,28,.19); }
.memorial-title { position: relative; z-index: 1; max-width: 730px; }
.memorial-title h1 { font-size: clamp(3rem, 7vw, 6.2rem); line-height: .96; }
.memorial-title .nickname { margin: 14px 0 0; color: var(--text-secondary); font-family: var(--serif); font-size: 1.2rem; }
.lifespan { margin-top: 24px; color: var(--burgundy); font-size: clamp(1rem, 2vw, 1.28rem); font-weight: 650; }
.profile-highlights { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 15px; color: var(--text-secondary); font-size: .88rem; }
.record-meta { margin-top: 25px; color: var(--text-muted); font-size: .75rem; }
.profile-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 52px; margin-top: 48px; }
.profile-nav { position: sticky; top: 96px; height: max-content; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.72); }
.profile-nav a { display: block; padding: 9px 11px; border-radius: 9px; color: var(--text-secondary); font-size: .82rem; font-weight: 600; }
.profile-nav a:hover { color: var(--burgundy); background: var(--burgundy-soft); text-decoration: none; }
.profile-content { min-width: 0; }
.profile-section { padding: 4px 0 46px; scroll-margin-top: 100px; }
.profile-section + .profile-section { padding-top: 42px; border-top: 1px solid var(--line); }
.profile-section > h2 { margin-bottom: 24px; }
.section-kicker { display: block; margin-bottom: 8px; color: var(--burgundy); font-family: var(--sans); font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.meta-grid { display: grid; grid-template-columns: minmax(120px, .45fr) 1fr; gap: 0 28px; margin: 0; }
.meta-grid dt, .meta-grid dd { padding: 13px 0; border-bottom: 1px solid var(--line); }
.meta-grid dt { color: var(--text-secondary); font-size: .82rem; font-weight: 650; }
.meta-grid dd { margin: 0; }
.obituary-card { padding: clamp(28px, 5vw, 50px); border-left: 3px solid var(--burgundy); background: var(--burgundy-soft); }
.family-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.rel { display: flex; align-items: center; gap: 14px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface); transition: .18s ease; }
.rel:hover { border-color: rgba(166,25,46,.22); box-shadow: var(--shadow-sm); text-decoration: none; transform: translateY(-2px); }
.rel .role { color: var(--burgundy); font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.rel .who { font-weight: 650; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; margin-left: 6px; padding: 0 0 28px 35px; border-left: 1px solid var(--line-strong); }
.timeline li:last-child { padding-bottom: 0; border-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 11px; height: 11px; border: 2px solid var(--background); border-radius: 50%; background: var(--burgundy); box-shadow: 0 0 0 1px var(--burgundy); }
.timeline .when { color: var(--burgundy); font-size: .76rem; font-weight: 650; }
.timeline .what { margin-top: 2px; font-family: var(--serif); font-size: 1.18rem; font-weight: 700; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.gallery img { width: 100%; aspect-ratio: 4/3; border-radius: 12px; object-fit: cover; transition: transform .2s ease; }
.gallery a { overflow: hidden; border-radius: 12px; }
.gallery a:hover img { transform: scale(1.025); }
.docs { margin: 0; padding: 0; list-style: none; }
.docs li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.docs svg { width: 20px; flex: none; fill: none; stroke: var(--burgundy); stroke-width: 1.6; }
.share-panel { display: grid; grid-template-columns: 170px 1fr; gap: 28px; align-items: center; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.qr-box img { width: 160px; height: 160px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.copy-feedback { min-height: 1.5em; margin: 9px 0 0; color: var(--text-secondary); font-size: .8rem; }

/* Family tree */
.pedigree { overflow-x: auto; padding: 4px 2px 12px; }
.ped-node { display: flex; align-items: center; }
.ped-box { display: flex; min-width: 164px; max-width: 190px; min-height: 58px; flex: 0 0 auto; align-items: center; gap: 9px; margin: 5px 0; padding: 8px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: #fff; }
.ped-box.filled:hover { border-color: var(--burgundy); text-decoration: none; }
.ped-box.empty { border-style: dashed; border-color: var(--line); background: rgba(255,255,255,.4); }
.ped-copy { min-width: 0; }
.ped-name, .ped-dates { display: block; }
.ped-name { overflow: hidden; font-size: .76rem; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; }
.ped-dates { margin-top: 2px; color: var(--text-secondary); font-size: .66rem; }
.ped-parents { position: relative; display: flex; flex-direction: column; justify-content: center; margin-left: 28px; }
.ped-node > .ped-parents::after { content: ""; position: absolute; left: -28px; top: 50%; width: 15px; height: 1px; background: var(--line-strong); }
.ped-node > .ped-parents::before { content: ""; position: absolute; left: -13px; top: 0; bottom: 0; width: 1px; background: var(--line-strong); }
.ped-parent { position: relative; }
.ped-parent::before { content: ""; position: absolute; left: -13px; top: 50%; width: 13px; height: 1px; background: var(--line-strong); }

/* Global search dialog */
.search-overlay { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 24px; }
.search-overlay[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(31,27,26,.42); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); cursor: default; }
.search-dialog { position: relative; display: flex; width: min(920px, 100%); max-height: min(85vh, 780px); flex-direction: column; overflow: hidden; border: 1px solid var(--glass-border); border-radius: 24px; background: var(--glass); box-shadow: var(--shadow-float); -webkit-backdrop-filter: blur(28px) saturate(150%); backdrop-filter: blur(28px) saturate(150%); animation: searchIn .28s ease-out both; }
@keyframes searchIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.search-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 26px 28px 18px; }
.search-dialog-head h2 { font-size: 2rem; }
.search-dialog-head p:not(.eyebrow) { margin: 5px 0 0; color: var(--text-secondary); font-size: .88rem; }
.global-search-form { display: flex; min-height: 62px; align-items: center; gap: 12px; margin: 0 28px 18px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(255,255,255,.82); box-shadow: var(--shadow-sm); }
.global-search-form > svg { width: 22px; flex: none; fill: none; stroke: var(--burgundy); stroke-linecap: round; stroke-width: 1.8; }
.global-search-form input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 1.03rem; }
.search-clear { border: 0; color: var(--burgundy); background: transparent; font-size: .75rem; font-weight: 650; cursor: pointer; }
.search-key { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--text-muted); font-size: .62rem; }
.search-workspace { display: grid; min-height: 0; flex: 1; grid-template-columns: 180px minmax(0,1fr); border-top: 1px solid var(--line); }
.search-categories { padding: 15px; border-right: 1px solid var(--line); }
.search-categories button, .search-categories a { display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: 9px; color: var(--text-secondary); background: transparent; text-align: left; font-size: .78rem; font-weight: 600; cursor: pointer; }
.search-categories button:hover, .search-categories a:hover, .search-categories .active { color: var(--burgundy); background: var(--burgundy-soft); text-decoration: none; }
.search-main { min-height: 0; overflow-y: auto; padding: 18px 20px 26px; }
.search-filters { margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.search-filters summary { padding: 0 0 13px; font-size: .78rem; font-weight: 700; cursor: pointer; }
.search-filters summary span { margin-left: 8px; color: var(--text-muted); font-weight: 500; }
.filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; padding-bottom: 16px; }
.filter-grid label { margin: 0; font-size: .68rem; }
.filter-grid input, .filter-grid select { min-height: 38px; margin-top: 5px; padding: 7px 9px; border-radius: 8px; font-size: .75rem; }
.filter-wide { grid-column: span 2; }
.search-status { padding: 12px 4px; color: var(--text-secondary); font-size: .78rem; }
.search-result-group + .search-result-group { margin-top: 17px; }
.search-group-title { margin: 0 0 6px; padding: 0 7px; color: var(--text-muted); font-size: .63rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.search-result { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: 11px; color: var(--text); }
button.search-result { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.search-result:hover, .search-result.is-active { background: rgba(248,236,239,.92); text-decoration: none; }
.search-result img, .search-result-icon { width: 42px; height: 48px; flex: none; border-radius: 8px; object-fit: cover; background: #f5f5f5; }
.search-result-icon { display: grid; place-items: center; color: var(--burgundy); }
.search-result-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.6; }
.search-result-copy { min-width: 0; }
.search-result-name { display: block; overflow: hidden; font-size: .86rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.search-result-sub { display: block; overflow: hidden; color: var(--text-secondary); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 45px 20px; text-align: center; color: var(--text-secondary); }
.search-dialog-foot { display: flex; align-items: center; gap: 18px; padding: 11px 24px; border-top: 1px solid var(--line); color: var(--text-muted); font-size: .66rem; }
.search-dialog-foot kbd { margin-right: 3px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.5); font-family: inherit; }
.search-dialog-foot button { margin-left: auto; border: 0; color: var(--text-secondary); background: transparent; font-size: inherit; cursor: pointer; }

/* Authentication */
.page-login .site-footer { margin-top: 0; }
.auth-layout { display: grid; min-height: 680px; grid-template-columns: 1.08fr .92fr; overflow: hidden; border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.auth-visual { position: relative; display: flex; min-height: 620px; flex-direction: column; justify-content: flex-end; padding: clamp(36px, 6vw, 70px); overflow: hidden; color: #fff; background: #312c28 url('/assets/memorialis-heritage.webp') center/cover no-repeat; }
.auth-visual::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(29,24,22,.78), rgba(29,24,22,.05) 65%); }
.auth-visual > div { position: relative; z-index: 1; }
.auth-visual h1 { color: #fff; font-size: clamp(2.6rem, 6vw, 5rem); }
.auth-visual .auth-tagline { margin: 10px 0 24px; font-size: .72rem; font-weight: 700; letter-spacing: .19em; text-transform: uppercase; }
.auth-visual p { max-width: 460px; color: rgba(255,255,255,.8); }
.auth-form-side { display: grid; place-items: center; padding: 40px; background: linear-gradient(145deg, var(--background), #fff); }
.login-panel { width: min(100%, 430px); padding: clamp(28px, 5vw, 48px); border: 1px solid var(--glass-border); border-radius: 24px; background: rgba(255,255,255,.72); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.login-panel h2 { font-size: 2.35rem; }
.login-panel > p { margin: 9px 0 28px; color: var(--text-secondary); }
.password-control { position: relative; }
.password-control input { padding-right: 54px; }
.password-toggle { position: absolute; right: 8px; bottom: 7px; display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 0; border-radius: 8px; color: var(--text-secondary); background: transparent; cursor: pointer; }
.password-toggle:hover { color: var(--burgundy); background: var(--burgundy-soft); }

/* Tables and administration */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; font-size: .86rem; }
th { color: var(--text-secondary); background: #f7f6f2; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(248,236,239,.38); }
.admin-shell { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 32px; }
.admin-shell > div { min-width: 0; }
.admin-shell table { display: block; overflow-x: auto; }
.admin-nav { position: sticky; top: 96px; height: max-content; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.admin-nav .admin-user { margin: 6px 8px 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--text-secondary); font-size: .74rem; }
.admin-nav a { display: block; padding: 9px 11px; border-radius: 9px; color: var(--text); font-size: .82rem; font-weight: 600; }
.admin-nav a:hover { color: var(--burgundy); background: var(--burgundy-soft); text-decoration: none; }
.admin-nav a.active { color: #fff; background: var(--burgundy); }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.admin-heading h1 { font-size: clamp(2.2rem, 4vw, 3.2rem); }
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.admin-stat { padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.admin-stat strong { display: block; font-family: var(--serif); font-size: 1.8rem; }
.admin-stat span { color: var(--text-secondary); font-size: .71rem; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; color: var(--burgundy-dark); background: var(--burgundy-soft); font-size: .7rem; font-weight: 650; }
.flash, .error-box { margin-bottom: 18px; padding: 12px 15px; border-radius: 11px; font-size: .86rem; font-weight: 550; }
.flash { color: #365f45; border: 1px solid #c8dece; background: #eef7f0; }
.error-box { color: #8f1528; border: 1px solid #e7bdc4; background: #fbebee; }
.tl-row { margin-top: 15px; padding-top: 15px; border-top: 1px dashed var(--line-strong); }
.tl-row:first-child { margin-top: 0; padding-top: 0; border: 0; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 34px 0; }
.pagination a, .pagination span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #fff; font-size: .8rem; }
.pagination .current { color: #fff; border-color: var(--burgundy); background: var(--burgundy); }
.status-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.status-tabs a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-secondary); background: #fff; font-size: .75rem; font-weight: 650; }
.status-tabs a:hover, .status-tabs a.active { color: #fff; border-color: var(--burgundy); background: var(--burgundy); text-decoration: none; }
.status-tabs span { display: inline-block; min-width: 20px; margin-left: 5px; padding: 1px 6px; border-radius: 999px; background: rgba(0,0,0,.08); text-align: center; }
.review-summary > div:first-child { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.review-summary dl { display: grid; grid-template-columns: 160px 1fr; margin: 0 0 22px; }
.review-summary dt, .review-summary dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.review-summary dt { color: var(--text-secondary); font-size: .78rem; }
.review-summary h3 { margin-top: 20px; }
.comparison-table th:first-child { width: 150px; }
.comparison-table td { min-width: 220px; white-space: normal; }
.comparison-table tr.changed td:last-child { background: #fffaf0; }
.change-mark { display: block; width: max-content; margin-top: 6px; padding: 2px 7px; border-radius: 999px; color: #734f18; background: #f8ead2; font-size: .62rem; font-weight: 700; }
.review-actions { display: flex; flex-wrap: wrap; gap: 9px; }

/* Footer */
.site-footer { margin-top: 90px; padding: 44px 0; border-top: 1px solid var(--line); background: var(--background-alt); }
.footer-grid { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 40px; }
.footer-brand { color: var(--burgundy-dark); font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.footer-grid p { margin: 4px 0 0; color: var(--text-secondary); font-size: .76rem; }
.footer-grid nav { display: flex; gap: 20px; }
.footer-grid nav a { color: var(--text-secondary); font-size: .78rem; font-weight: 600; }
.footer-grid .copyright { margin: 0; }

/* Focus and fallbacks */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header, .search-dialog, .login-panel { background: rgba(255,255,255,.96); }
  .search-backdrop { background: rgba(31,27,26,.65); }
}

@media (max-width: 980px) {
  .home-hero { grid-template-columns: 1.2fr .8fr; }
  .hero-copy h1 { font-size: clamp(3rem, 7vw, 5rem); }
  .cards, .location-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .profile-layout { grid-template-columns: 150px minmax(0,1fr); gap: 30px; }
  .auth-layout { grid-template-columns: .9fr 1.1fr; }
}

@media (max-width: 767px) {
  .shell { width: min(100% - 28px, var(--shell)); }
  main.shell { padding-top: 38px; }
  .header-bar { min-height: 64px; }
  .brand img { width: 32px; height: 32px; }
  .brand { font-size: 1.22rem; }
  .brand small { display: none; }
  .menu-toggle { display: inline-grid; }
  .nav { position: absolute; top: calc(100% + 8px); right: 14px; left: 14px; display: none; padding: 10px; border: 1px solid var(--glass-border); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
  .nav.is-open { display: block; }
  .nav a { width: 100%; }
  .nav .account-link { margin: 5px 0 0; }
  .nav kbd { display: none; }
  .home-hero { display: flex; min-height: 0; flex-direction: column; }
  .hero-copy { padding: 64px 0 44px; }
  .hero-copy h1 { font-size: clamp(3.2rem, 16vw, 5.2rem); }
  .hero-copy .hero-intro { margin: 22px 0 28px; }
  .hero-search { min-height: 60px; padding-left: 16px; border-radius: 17px; }
  .hero-search button { width: 44px; height: 44px; }
  .hero-image { min-height: 360px; margin: 0 calc((100vw - (100vw - 28px)) / -2); }
  .hero-image::before { background: linear-gradient(180deg, var(--background), transparent 30%), linear-gradient(0deg, rgba(32,33,36,.2), transparent 50%); }
  .stats-strip { justify-content: stretch; overflow-x: auto; }
  .stat { min-width: 33.333%; padding: 4px 16px; }
  .stat .num { font-size: 1.45rem; }
  .home-section { padding-top: 54px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .featured-portrait { min-height: 330px; max-height: 430px; }
  .featured-content { padding: 28px; }
  .cards, .location-grid { grid-template-columns: 1fr; }
  .page-intro, .detail-hero { align-items: flex-start; flex-direction: column; display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .contribute-grid, .contribution-actions { grid-template-columns: 1fr; }
  .submission-consent { align-items: stretch; flex-direction: column; }
  .contributor-bar { align-items: flex-start; flex-direction: column; }
  .result-card > div { align-items: stretch; flex-direction: column; }
  .review-summary dl { grid-template-columns: 1fr; }
  .review-summary dt { padding-bottom: 0; border-bottom: 0; }
  .review-summary dd { padding-top: 2px; }
  .searchbox { flex-direction: column; }
  .memorial-hero { grid-template-columns: 1fr; gap: 34px; margin: -38px -14px 0; padding-top: 54px; padding-bottom: 48px; text-align: center; }
  .memorial-hero::after { width: 100%; }
  .memorial-portrait-wrap { justify-self: center; }
  .portrait.lg { width: min(68vw, 280px); height: 350px; }
  .profile-highlights { justify-content: center; }
  .profile-layout { display: block; margin-top: 26px; }
  .profile-nav { position: sticky; top: 72px; z-index: 20; display: flex; margin: 0 -14px 34px; padding: 8px; overflow-x: auto; border-radius: 0; border-inline: 0; white-space: nowrap; }
  .profile-nav a { flex: none; }
  .family-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .share-panel { grid-template-columns: 1fr; text-align: center; }
  .qr-box { justify-self: center; }
  .share-actions { justify-content: center; }
  .search-overlay { align-items: end; padding: 0; }
  .search-dialog { width: 100%; max-height: 96dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .search-dialog-head { padding: 20px 18px 14px; }
  .search-dialog-head h2 { font-size: 1.6rem; }
  .global-search-form { min-height: 56px; margin: 0 18px 14px; }
  .search-key { display: none; }
  .search-workspace { display: flex; flex-direction: column; }
  .search-categories { display: flex; gap: 5px; padding: 10px 14px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .search-categories button, .search-categories a { width: auto; flex: none; white-space: nowrap; }
  .search-main { padding: 14px 16px 22px; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .search-dialog-foot { display: none; }
  .auth-layout { display: block; border-radius: 20px; }
  .auth-visual { min-height: 280px; padding: 32px 26px; }
  .auth-visual h1 { font-size: 3.2rem; }
  .auth-form-side { padding: 24px 16px 34px; }
  .login-panel { padding: 28px 22px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { position: static; display: flex; gap: 4px; overflow-x: auto; }
  .admin-nav .admin-user { display: none; }
  .admin-nav a { flex: none; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-grid nav { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .stats-strip { margin-inline: -14px; }
  .stat { min-width: 140px; }
  .card { align-items: flex-start; }
  .meta-grid { grid-template-columns: 1fr; }
  .meta-grid dt { padding-bottom: 0; border-bottom: 0; }
  .meta-grid dd { padding-top: 3px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-wide { grid-column: auto; }
  .admin-stat-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
