/* =========================================================
   COLOURS
   Each theme is a set of variables. Pick the active one with
   "theme" in data/family.js, or preview any theme by adding
   ?theme=oxblood to a page address.
   ========================================================= */
:root,
[data-theme="library"] {           /* bottle green and brass (default) */
  --bg: #F5F0E6;
  --surface: #FBF8F1;
  --surface-alt: #F8F3E8;
  --ink: #1E2420;
  --muted: #565B4F;
  --line: #DDD3BF;
  --line-strong: #B5A78B;
  --brand: #1F3A2E;          /* header, main buttons */
  --brand-ink: #F5F0E6;
  --brand-soft: #C9D3C6;     /* header links */
  --brand-field: #2B4A3B;    /* header search box */
  --accent: #B08D57;         /* brass: rules, rings, highlights */
  --accent-ink: #1E2420;
  --accent-text: #7A5A2A;    /* brass-coloured text and links */
  --accent-soft: #EFE5D0;
  --claret: #6B2430;
  --memory-bg: #E7E1D3;
  --memory-ink: #4A4A40;
}
[data-theme="oxblood"] {
  --bg: #F3ECE1; --surface: #FAF6EE; --surface-alt: #F6F0E5; --ink: #2A1E1C; --muted: #625048;
  --line: #DCCFBC; --line-strong: #B39E86; --brand: #4E1B22; --brand-ink: #F3ECE1; --brand-soft: #E5CFCF;
  --brand-field: #632A31; --accent: #A8864A; --accent-ink: #2A1E1C; --accent-text: #74592A; --accent-soft: #EFE3CB;
  --claret: #3F4A3C; --memory-bg: #E8DFD3; --memory-ink: #4F413C;
}
[data-theme="navy"] {
  --bg: #F4EFE6; --surface: #FBF8F2; --surface-alt: #F7F2E9; --ink: #1C2436; --muted: #535A68;
  --line: #DCD3C3; --line-strong: #B2A68F; --brand: #1C2436; --brand-ink: #F4EFE6; --brand-soft: #CBD0DB;
  --brand-field: #2A3449; --accent: #B38B59; --accent-ink: #1C2436; --accent-text: #7A5A30; --accent-soft: #F0E4D0;
  --claret: #7A2E36; --memory-bg: #E6E1D7; --memory-ink: #464B57;
}
[data-theme="ink"] {
  --bg: #F7F3EA; --surface: #FFFDF8; --surface-alt: #FAF7F0; --ink: #1F1E1C; --muted: #5A5650;
  --line: #E0D8C8; --line-strong: #B9AE98; --brand: #1F1E1C; --brand-ink: #F7F3EA; --brand-soft: #D6D1C6;
  --brand-field: #34322E; --accent: #9C7A3C; --accent-ink: #1F1E1C; --accent-text: #74592A; --accent-soft: #F0E6D0;
  --claret: #6B2430; --memory-bg: #E9E4DA; --memory-ink: #4B4842;
}
[data-theme="loden"] {
  --bg: #EFEBE2; --surface: #F8F6F0; --surface-alt: #F3F0E8; --ink: #23281F; --muted: #545A4E;
  --line: #D6D0C2; --line-strong: #ABA48F; --brand: #3B4536; --brand-ink: #EFEBE2; --brand-soft: #D3D8CB;
  --brand-field: #4A5644; --accent: #7A2E3A; --accent-ink: #F8F6F0; --accent-text: #7A2E3A; --accent-soft: #EFE0DD;
  --claret: #B59A63; --memory-bg: #E3DFD5; --memory-ink: #474C42;
}

/* ========================================================= */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: "Cormorant Garamond", Garamond, Georgia, serif; font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(34px, 5vw, 46px); }
h2 { font-size: 28px; }
.gm { font-family: "Noto Sans Gurmukhi", sans-serif; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 28px; }
.smallcaps { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.rule { border: 0; height: 1px; background: var(--accent); opacity: .7; margin: 0; }

/* ---------- header ---------- */
.site-header { background: var(--brand); color: var(--brand-ink); border-bottom: 3px double var(--accent); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--brand-ink); text-decoration: none; }
.brand:hover { color: var(--brand-ink); }
.brand svg { flex: none; }
.brand span { font-family: "Cormorant Garamond", Garamond, Georgia, serif; font-size: 27px; font-weight: 600; letter-spacing: .01em; }
.main-nav { display: flex; gap: 6px; }
.main-nav a { color: var(--brand-soft); text-decoration: none; padding: 10px 14px; border-bottom: 1px solid transparent; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.main-nav a:hover { color: var(--brand-ink); }
.main-nav a[aria-current="page"] { color: var(--brand-ink); border-bottom-color: var(--accent); }
.main-nav svg { display: none; }
.search { display: flex; align-items: center; gap: 8px; background: var(--brand-field); border: 1px solid rgba(255,255,255,.12); border-radius: 4px; padding: 0 14px; height: 44px; }
.search input { background: transparent; border: 0; color: var(--brand-ink); font: inherit; font-size: 15px; width: 200px; outline: none; }
.search input::placeholder { color: var(--brand-soft); opacity: .85; }

/* ---------- common bits ---------- */
main.wrap { padding-top: 34px; padding-bottom: 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
/* Gallery: the "old photographs" note sits in the space to the right of the page title */
.photo-ask { flex: 0 1 470px; padding: 18px 20px; }
.photo-ask-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.photo-ask h2 { font-size: 22px; margin: 0; }
.photo-ask p { margin: 0; font-size: 14px; line-height: 1.5; }
.photo-ask .wa-share { display: inline-block; }
body[data-page="gallery"] .page-head { align-items: flex-start; }
.photo-ask .wa-link.btn-primary { min-height: 40px; padding: 0 24px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); text-decoration: none; }
.photo-ask .wa-link.btn-primary:hover { border-color: var(--accent); color: var(--brand-ink); }
.photo-ask .wa-share { flex: none; }
.photo-ask .wa-pop { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; transform: none; }
@media (max-width: 760px) { .photo-ask { flex-basis: 100%; } }
/* wide screens: the note moves up and out towards the right edge, into the empty space */
@media (min-width: 1000px) {
  .photo-ask { margin-top: -26px; margin-right: min(0px, calc((1320px - 100vw) / 2 + 4px)); }
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 26px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 3px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; letter-spacing: .06em; text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--ink); background: var(--surface-alt); border-color: var(--accent); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--accent); }
.pill { display: inline-block; padding: 4px 12px; border-radius: 2px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; background: var(--surface-alt); color: var(--ink); border: 1px solid var(--line); }
.pill.living { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.pill.memory { background: var(--memory-bg); color: var(--memory-ink); border-color: transparent; }
.label { margin: 0 0 8px; font-family: inherit; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 3px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.chip:hover { color: var(--ink); border-color: var(--accent); }
.empty { color: var(--muted); font-style: italic; margin: 0; }
.confirm { margin: 16px 0 0; padding: 10px 14px; border-left: 3px solid var(--claret); background: var(--surface-alt); font-size: 14px; color: var(--ink); border-radius: 0; }
.confirm b { color: var(--claret); font-weight: 600; }

/* ---------- avatars ---------- */
.avatar { flex: none; border-radius: 50%; object-fit: cover; background: var(--accent-soft); }
.avatar.memory { filter: none; }
.avatar-fallback { flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); }
.avatar-fallback.memory { background: var(--memory-bg); color: var(--memory-ink); }

/* ---------- tree page ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.zoom { display: flex; border: 1px solid var(--line-strong); border-radius: 3px; overflow: hidden; background: var(--surface); }
.zoom button { min-width: 44px; height: 44px; border: 0; background: transparent; font: inherit; font-size: 18px; color: var(--ink); cursor: pointer; padding: 0 12px; }
.zoom button:last-child { font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.zoom button + button { border-left: 1px solid var(--line-strong); }
.zoom button:hover { background: var(--surface-alt); }
.tree-box { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; position: relative; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.tree-scroll { overflow: auto; max-height: 76vh; padding: 36px 18px 48px; cursor: grab; }
.tree-scroll.dragging { cursor: grabbing; user-select: none; }
.tree-size { margin: 0 auto; }
.tree { display: flex; justify-content: center; width: max-content; transform-origin: 0 0; }

/* connectors: classic nested-list technique */
.tree ul { position: relative; display: flex; justify-content: center; margin: 0; padding: 30px 0 0; list-style: none; }
.tree > ul { padding-top: 0; }
.tree li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 30px 6px 0; }
.tree li::before, .tree li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 30px; border-top: 1px solid var(--accent); }
.tree li::after { right: auto; left: 50%; border-left: 1px solid var(--accent); }
.tree li:only-child { padding-top: 0; }
.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:first-child::before, .tree li:last-child::after { border: 0; }
.tree li:last-child::before { border-right: 1px solid var(--accent); }
.tree ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 30px; border-left: 1px solid var(--accent); }
.tree > ul > li { padding-top: 0; }
.tree > ul > li::before, .tree > ul > li::after { display: none; }

/* a couple: side by side at the top of the tree, stacked below it to save width */
.unit { display: flex; flex-direction: column; align-items: center; }
.unit .amp { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 22px; line-height: 1; color: var(--accent-text); padding: 4px 0; }
.unit.row { flex-direction: row; gap: 4px; }
.unit.row .amp { padding: 0 8px; }
.pcard { width: 150px; min-height: 136px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; padding: 14px 8px 12px; border-radius: 3px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.pcard:hover { border-color: var(--accent); }
.pcard[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.pcard .tl { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); line-height: 1.3; }
.pcard .nm { font-family: "Cormorant Garamond", Georgia, serif; font-size: 19px; font-weight: 600; line-height: 1.1; }
.pcard .yr { font-size: 12px; color: var(--muted); }
.pcard.spouse { background: var(--surface-alt); }
.pcard.spouse[aria-pressed="true"] { background: var(--accent-soft); }

/* people: no boxes, couples close together, clear space between couples */
.pcard { width: 118px; height: 150px; padding: 8px 4px; gap: 5px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; }
.pcard.spouse { background: transparent; }
.pcard:hover { border: 0; }
.pcard:hover .nm { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pcard .avatar, .pcard .avatar-fallback { width: 64px !important; height: 64px !important; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.pcard .nm { font-size: 17px; }
.pcard.late .yr { font-size: 12px; font-style: italic; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.pcard[aria-pressed="true"], .pcard.spouse[aria-pressed="true"] { background: transparent; border: 0; box-shadow: none; }
.pcard[aria-pressed="true"] .avatar, .pcard[aria-pressed="true"] .avatar-fallback { box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px var(--brand); }
.pcard[aria-pressed="true"] .nm { color: var(--accent-text); }
.unit.row { align-items: flex-start; gap: 0; }
.unit .amp { display: none; }
.tree li { padding-left: 22px; padding-right: 22px; }

/* expand / collapse */
.tg { display: flex; flex-direction: column; align-items: center; }
.tg .stub { width: 2px; height: 12px; background: var(--branch, var(--accent)); }
.toggle { min-width: 36px; height: 36px; padding: 0 12px; border-radius: 18px; border: 2px solid var(--branch, var(--accent)); background: var(--surface); color: var(--branch, var(--accent-text)); font: inherit; font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer; }
.toggle:hover { background: color-mix(in srgb, var(--branch, var(--accent)) 14%, var(--surface)); }
.legend .swatches { display: flex; gap: 0; }
.legend .swatches i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -4px; }
.legend .swatches i:first-child { margin-left: 0; }
.legend-actions { margin-left: auto; gap: 8px; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }

/* ---------- slide-in person panel ---------- */
.drawer { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(420px, 92vw); background: var(--surface); border-left: 1px solid var(--accent); box-shadow: -18px 0 40px rgba(20, 24, 20, .18); transform: translateX(105%); transition: transform .28s ease; overflow-y: auto; padding: 22px 26px 32px; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); font-size: 22px; cursor: pointer; }
.drawer-close:hover { border-color: var(--accent); }
.drawer .portrait { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--accent); margin: 18px auto 0; }
.drawer .who { text-align: center; margin-top: 16px; }
.drawer .who h2 { font-size: 34px; }
.drawer .who .smallcaps { color: var(--accent-text); display: block; margin-bottom: 4px; }
.drawer .who .gm { margin-top: 4px; font-size: 17px; }
.drawer .who .pill { margin-top: 12px; }
.facts { margin: 22px 0 0; display: grid; grid-template-columns: 104px 1fr; gap: 10px 14px; font-size: 15px; border-top: 1px solid var(--line); padding-top: 18px; }
.facts dt { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding-top: 2px; }
.facts dd { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* ---------- person page ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 30px; align-items: center; }
.hero .photo { width: 176px; height: 176px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--accent); }
.hero .info { flex: 999 1 320px; min-width: 0; }
.hero .smallcaps { color: var(--accent-text); }
.hero .name-row { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 4px; }
.hero .gm { font-size: 17px; }
.pill-link { text-decoration: none; border-color: var(--accent); color: var(--accent-text); }
.pill-link:hover { background: var(--accent-soft); color: var(--ink); }
.hero .actions { flex: 1 1 200px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.bio { margin: 0; line-height: 1.7; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 56px 20px 1fr; column-gap: 12px; }
.events .y { font-family: "Cormorant Garamond", Georgia, serif; font-size: 20px; font-weight: 600; color: var(--accent-text); }
.events .rail { display: flex; flex-direction: column; align-items: center; }
.events .rail::before { content: ""; width: 9px; height: 9px; transform: rotate(45deg); background: var(--accent); margin-top: 8px; }
.events .rail::after { content: ""; flex: 1; width: 1px; background: var(--line); min-height: 24px; }
.events li:last-child .rail::after { background: transparent; }
.events .t { padding-bottom: 16px; }
.events .t b { display: block; }
.events .t span { font-size: 14px; color: var(--muted); }
.rel-group + .rel-group { margin-top: 18px; }
.rel { display: flex; align-items: center; gap: 12px; padding: 6px 8px; margin: 0 -8px; border-radius: 3px; color: var(--ink); text-decoration: none; min-height: 52px; }
.rel:hover { background: var(--surface-alt); color: var(--ink); }
.rel b { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 19px; font-weight: 600; line-height: 1.1; }
.rel span { font-size: 13px; color: var(--muted); }
.rel .rt { display: block; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }

/* ---------- people directory ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; text-decoration: none; color: var(--ink); text-align: left; font: inherit; padding: 0; cursor: pointer; width: 100%; }
.tile:hover { color: var(--ink); border-color: var(--accent); }
.tile img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.tile .tb { display: block; padding: 14px 16px 16px; }
.tile .tt { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 21px; font-weight: 600; line-height: 1.15; }
.tile .tm { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.person-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 12px; text-align: center; }
.person-tile .avatar, .person-tile .avatar-fallback { margin-bottom: 8px; }
.person-tile .tl { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }
.person-tile .tm { margin-top: 0; }
.filter-input { height: 46px; width: min(360px, 100%); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 14px; font: inherit; background: var(--surface); color: var(--ink); }

/* ---------- stories and photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-grid button { display: block; align-self: start; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; font: inherit; color: var(--ink); }
.photo-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 3px; }
.photo-grid small { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.featured { display: flex; flex-wrap: wrap; padding: 0; overflow: hidden; }
.featured img { flex: 1 1 320px; min-width: 0; object-fit: cover; aspect-ratio: 3 / 2; }
.featured .body { flex: 1 1 320px; padding: 28px; }
.featured h2 { font-size: 34px; margin: 12px 0 8px; }
.story-grid, .album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px; gap: 4px; }
.seg button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 2px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.story-body { max-width: 720px; }
.story-body p { font-size: 18px; line-height: 1.75; margin: 0 0 1.1em; }
.story-cover { width: 100%; max-height: 460px; object-fit: cover; border-radius: 4px; margin: 20px 0 28px; }
.invite { text-align: center; padding: 48px 24px; }
.invite h2 { margin-bottom: 8px; }
.invite p { margin: 0 auto 20px; max-width: 460px; color: var(--muted); }

/* ---------- lightbox ---------- */
dialog.lightbox { border: 0; padding: 0; background: transparent; overflow: visible; max-width: min(1100px, 94vw); width: 100%; }
dialog.lightbox::backdrop { background: rgba(12, 16, 13, .88); }
.lb-inner { position: relative; }
.lb-inner img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: 3px; background: #000; }
.lb-cap { color: #fff; margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.lb-cap a { color: #E6CFA0; }
.lb-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: #111; font-size: 22px; cursor: pointer; }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
.lb-close { position: absolute; top: -56px; right: 0; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 22px; cursor: pointer; }

/* ---------- footer ---------- */
.site-footer { border-top: 0; background: transparent; }
.site-footer .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px 16px; padding-top: 6px; padding-bottom: 10px; font-size: 13px; color: var(--muted); }
.site-footer .notice { grid-column: 2; }
.site-footer nav { grid-column: 3; justify-self: end; }
.site-footer nav { display: flex; gap: 18px; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 24px; padding-bottom: 96px; }
  .brand span { font-size: 23px; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .main-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--accent); display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; padding-bottom: env(safe-area-inset-bottom); }
  .main-nav a { flex-direction: column; gap: 2px; color: var(--muted); font-size: 11px; padding: 8px 4px; border-bottom: 0; border-top: 2px solid transparent; }
  .main-nav a:hover { color: var(--ink); }
  .main-nav a[aria-current="page"] { color: var(--accent-text); border-top-color: var(--accent); border-bottom: 0; }
  .main-nav svg { display: block; }
  .card { padding: 20px; }
  .hero { justify-content: center; text-align: center; }
  .hero .name-row { align-items: center; }
  .hero .actions { justify-content: center; }
  .hero .info .chips { justify-content: center; }
  .pcard { width: 108px; }
  .tree li { padding-left: 14px; padding-right: 14px; }
  .pcard .nm { font-size: 17px; }
  .tree-scroll { max-height: 66vh; }
  .legend { gap: 6px 14px; padding: 10px 14px; font-size: 13px; }
  .legend-actions { margin-left: 0; width: 100%; }
  .drawer { width: 100vw; border-left: 0; padding-bottom: 96px; }
  .site-footer { padding-bottom: 72px; }
  .site-footer .wrap { grid-template-columns: 1fr; justify-items: center; }
  .site-footer .notice, .site-footer nav { grid-column: 1; justify-self: center; }
}

/* header tagline */
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-top: 4px; }

/* blinking note in the footer */
.notice { margin: 0; text-align: center; font-weight: 600; color: var(--claret); animation: notice-blink 1.6s ease-in-out infinite; }
@keyframes notice-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .notice { animation: none; } }
@media (max-width: 760px) { .brand-text small { font-size: 10px; letter-spacing: .08em; } }

/* (Late) tag on profile and panel */
.late-tag { display: inline-block; font-size: 14px; font-style: italic; color: var(--muted); }
.drawer .who .late-tag { margin-top: 6px; }

/* WhatsApp correction link */
.wa-link { display: inline-flex; align-items: center; gap: 6px; }
.wa-num { white-space: nowrap; font-weight: 600; }

/* compact details panel */
.drawer { top: 92px; right: 20px; bottom: auto; width: 320px; max-height: calc(100vh - 112px); border: 1px solid var(--accent); border-radius: 6px; padding: 16px 20px 20px; }
.drawer .portrait { width: 96px; height: 96px; margin-top: 4px; }
.drawer .who { margin-top: 10px; }
.drawer .who h2 { font-size: 26px; }
.drawer .who .gm { font-size: 15px; }
.drawer .facts { margin-top: 14px; padding-top: 12px; gap: 6px 12px; grid-template-columns: 88px 1fr; font-size: 14px; }
.drawer .stack { margin-top: 16px; gap: 8px; }
.drawer .stack .btn { min-height: 40px; font-size: 13px; }
.drawer .confirm { margin-top: 12px; font-size: 13px; padding: 8px 12px; }
.drawer-close { top: 8px; right: 8px; width: 40px; height: 40px; }
@media (max-width: 760px) {
  .drawer { top: auto; right: 0; left: 0; bottom: 0; width: 100vw; max-height: 72vh; border: 0; border-top: 1px solid var(--accent); border-radius: 12px 12px 0 0; padding-bottom: 24px; transform: translateY(105%); }
  .drawer.open { transform: none; }
}

/* footer: share data, photographs and corrections on WhatsApp */
.wa-share { position: relative; }
.wa-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wa-link svg { color: #1F8F4E; }
.wa-link:hover { color: var(--ink); }
.wa-pop { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 240px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--accent); border-radius: 6px; box-shadow: 0 10px 30px rgba(20, 24, 20, .15); text-align: left; }
.wa-pop .wa-label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wa-pop .wa-num { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 22px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); user-select: all; white-space: nowrap; }
.wa-pop .btn { margin-top: 6px; font-size: 13px; }
@media (max-width: 760px) { .wa-pop { right: 50%; transform: translateX(50%); } }

/* WhatsApp reveal inside the details panel and profile: opens in place, under its button */
.wa-share.inline { display: flex; flex-direction: column; }
.wa-share.inline .wa-link { justify-content: center; text-decoration: none; color: var(--ink); min-height: 44px; }
.wa-share.inline .wa-link.btn-primary { color: var(--brand-ink); }
.wa-pop.inline { position: static; transform: none; min-width: 0; margin-top: 8px; box-shadow: none; }

/* Amar Singh: the person the site is about */
.pcard.focus .avatar, .pcard.focus .avatar-fallback { width: 84px !important; height: 84px !important; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent), 0 0 0 9px var(--accent-soft); }
.pcard.focus { width: 150px; height: 178px; }
.pcard.focus .nm { font-size: 21px; }
.pcard.focus .tl { color: var(--accent-text); font-weight: 700; }
.pcard.focus .ph::before { content: "\2726"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); color: var(--accent); font-size: 13px; line-height: 1; }
.wa-share.inline .wa-link.btn { border: 1px solid var(--line-strong); background: var(--surface); padding: 0 18px; font-size: 14px; font-weight: 600; letter-spacing: .06em; border-radius: 3px; }
.wa-share.inline .wa-link.btn:hover { border-color: var(--accent); background: var(--surface-alt); }
.wa-share.inline .wa-link.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.wa-share.inline .wa-link.btn-primary:hover { background: var(--brand); border-color: var(--accent); }
.drawer .wa-share.inline .wa-link.btn { font-size: 13px; min-height: 40px; }

/* line partners up: same photo slot and title line on both cards of a couple */
.pcard { height: auto; min-height: 0; }
.pcard .ph { position: relative; height: 66px; display: flex; align-items: center; justify-content: center; }
.unit.has-focus .pcard .ph { height: 92px; }
.pcard .tl { min-height: 13px; }
.pcard.focus { height: auto; }

/* "Showing the branch of ..." sits under "Show the whole family" */
.branch-box { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.branch-box #branch-note { font-size: 13px; }
.branch-box #branch-note:empty { display: none; }

/* share bar: under the search box, above the tree buttons, blinking */
.share-bar .wrap { display: flex; justify-content: flex-end; padding-top: 10px; }
.share-bar + main.wrap { padding-top: 14px; }
.share-bar .wa-link { font-weight: 600; animation: notice-blink 1.6s ease-in-out infinite; }
.share-bar .wa-link:hover, .share-bar .wa-link[aria-expanded="true"] { animation-play-state: paused; opacity: 1; }
.share-bar .wa-pop { top: calc(100% + 8px); bottom: auto; right: 0; }
@media (prefers-reduced-motion: reduce) { .share-bar .wa-link { animation: none; } }
@media (max-width: 760px) { .share-bar .wrap { justify-content: center; } .share-bar .wa-pop { right: 50%; transform: translateX(50%); } }

/* empty status line still takes its space, so the + buttons under couples sit level */
.pcard .yr { min-height: 16px; }

/* compact tree controls: Expand / Collapse stacked, smaller "Show the whole family" */
.toolbar { align-items: center; }
.stack-btns { display: flex; flex-direction: column; gap: 4px; }
.btn-mini { min-height: 28px; padding: 0 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.branch-box { gap: 2px; }
.branch-box #branch-note { font-size: 12px; line-height: 1.2; }

/* name with (Late) directly under it; the block keeps room for a two-line name so + buttons stay level */
.pcard .txt { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 58px; }
.pcard .yr { min-height: 0; line-height: 1.3; }
.pcard .yr:empty { display: none; }

/* which branch is showing: small italic note, bottom left of the tree */
.branch-note { position: absolute; left: 16px; bottom: 10px; margin: 0; font-size: 13px; font-style: italic; color: var(--muted); pointer-events: none; }
.stack-btns .btn-mini { width: 100%; }

/* ---------- gallery page ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 22px; align-items: start; }
.gallery-grid button { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; text-align: left; font: inherit; color: var(--ink); }
.gallery-grid img { width: 100%; max-width: 100%; height: auto; border: 1px solid var(--line-strong); border-bottom: 3px double var(--accent); border-radius: 3px; background: var(--surface-alt); }
.gallery-grid small { display: block; margin-top: 8px; font-size: 14px; color: var(--muted); }

/* ---------- pets page ---------- */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 22px; align-items: start; }
.pet-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.pet-slider { position: relative; border-bottom: 3px double var(--accent); }
.pet-slides { position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pet-slides::-webkit-scrollbar { display: none; }
.pet-slides button { flex: 0 0 100%; display: block; padding: 0; border: 0; background: none; cursor: zoom-in; scroll-snap-align: start; }
.pet-slides img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pet-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(251, 248, 241, .9); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.pet-nav.prev { left: 10px; }
.pet-nav.next { right: 10px; }
.pet-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.pet-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(251, 248, 241, .6); box-shadow: 0 0 2px rgba(0, 0, 0, .4); }
.pet-dots span.on { background: var(--accent); }
.pet-body { padding: 16px 18px 18px; }
.pet-body p { margin: 6px 0 0; }
.pet-body h2 .late-tag { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 15px; font-style: italic; font-weight: 400; color: var(--muted); }
.pet-body .pet-note { margin-top: 10px; line-height: 1.6; }
.invite .wa-share { max-width: 380px; margin: 0 auto; }
@media (min-width: 761px) {
  .main-nav { gap: 0; }
  .main-nav a { padding: 10px 8px; letter-spacing: .1em; }
  .search input { width: 116px; }
  .site-header .wrap { column-gap: 18px; }
}


/* ---------- tree page: the tree gets the whole screen ---------- */
body[data-page="tree"] .wrap { max-width: none; padding-left: 24px; padding-right: 24px; }
body[data-page="tree"] main.wrap { padding-top: 14px; padding-bottom: 6px; }
body[data-page="tree"] .page-head { margin-bottom: 12px; align-items: center; }
body[data-page="tree"] .page-head h1 { font-size: 34px; }
body[data-page="tree"] .page-head > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
body[data-page="tree"] .page-head p { margin: 0; }
/* the people and generations count sits on its own line under the heading */
body[data-page="tree"] #tree-count { order: 3; flex-basis: 100%; margin-top: -2px; }
.tree-title .gm-title { font-family: "Noto Sans Gurmukhi", sans-serif; font-weight: 500; font-size: .82em; color: var(--ink); }
.tree-title .tr { font-family: "Cormorant Garamond", Garamond, Georgia, serif; font-style: italic; font-weight: 500; font-size: .7em; color: var(--muted); }
body[data-page="tree"] .tree-scroll { padding: 20px 14px 34px; }
.share-inline .wa-link { font-size: 14px; font-weight: 600; animation: notice-blink 1.6s ease-in-out infinite; }
.share-inline .wa-link:hover, .share-inline .wa-link[aria-expanded="true"] { animation-play-state: paused; opacity: 1; }
.share-inline .wa-pop { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; }
/* tree page: "Share photos and corrections" above the − + Fit buttons */
.zoom-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.zoom-col .share-inline .wa-link { min-height: 28px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .share-inline .wa-link { animation: none; } }
@media (min-width: 761px) {
  body[data-page="tree"] { display: flex; flex-direction: column; height: 100vh; }
  body[data-page="tree"] main.wrap { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
  body[data-page="tree"] .tree-box { flex: 1; min-height: 360px; display: flex; flex-direction: column; }
  body[data-page="tree"] .tree-scroll { flex: 1; min-height: 0; max-height: none; }
}
@media (max-width: 760px) {
  body[data-page="tree"] .wrap { padding-left: 12px; padding-right: 12px; }
  body[data-page="tree"] .page-head h1 { font-size: 30px; }
  body[data-page="tree"] .tree-scroll { max-height: calc(100vh - 330px); max-height: calc(100dvh - 330px); min-height: 360px; }
  /* leave room for the menu bar fixed at the bottom of the screen, so the tree's lowest buttons can be reached */
  body[data-page="tree"] main.wrap { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
}
/* tighter spacing so the tree can be drawn larger */
.tree li { padding-left: 8px; padding-right: 8px; }
.pcard { width: 108px; }
/* couples sit close together; brothers and sisters have clear space between them */
.tree li { padding-left: 18px; padding-right: 18px; }
/* a couple sits close together; their names wrap so they stay under their own photos */
.unit.row > .pcard + .pcard { margin-left: -10px; }
.unit.row > .pcard:first-child:not(:last-child) { transform: translateX(11px); }
.unit.row > .pcard:last-child:not(:first-child) { transform: translateX(-11px); }
.unit.row > .pcard:not(:only-child) .nm { max-width: 72px; }
/* only couples whose long names would touch get a little more room */
.unit.row.roomy > .pcard + .pcard { margin-left: -12px; }
.unit.row.roomy > .pcard:first-child:not(:last-child), .unit.row.roomy > .pcard:last-child:not(:first-child) { transform: none; }
.unit.row.roomy > .pcard:not(:only-child) .nm { max-width: 90px; }
@media (max-width: 760px) { .tree li { padding-left: 12px; padding-right: 12px; } }

/* backup figure if a portrait file can't be loaded, in the same muted colours as the placeholders */
.avatar-sil { display: block; background: none !important; overflow: hidden; }
.avatar-sil .s-bg { fill: var(--sil-bg); }
.avatar-sil .s-fg { fill: var(--sil-fg); }
.avatar-sil .s-ini { fill: #fff; font-family: "Source Sans 3", system-ui, sans-serif; font-size: 8.5px; font-weight: 700; letter-spacing: .06em; }
.avatar-sil.g-m { --sil-bg: #CFCECA; --sil-fg: #7B848B; }
.avatar-sil.g-f { --sil-bg: #D2CFC6; --sil-fg: #848A7E; }
.avatar-sil.g-u { --sil-bg: #E3DBCB; --sil-fg: #A69A82; }

/* paw badge on the tree for people with a pet; opens the Pets page */
.pcard .ph .paw { position: absolute; top: -2px; right: calc(50% - 40px); width: 24px; height: 24px; border-radius: 50%; background: var(--surface); color: var(--accent-text); border: 1px solid var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.pcard .ph .paw:hover { background: var(--accent); color: var(--surface); }
.pet-card.pet-hit { box-shadow: 0 0 0 2px var(--accent); }
/* in a couple, the left person's paw sits on their outer (left) side so the spouse's card never covers it */
.unit.row > .pcard:first-child:not(:last-child) .ph .paw { right: auto; left: calc(50% - 40px); }

/* site-name notice: one centred line at the top of every page */
.top-notice { position: relative; padding: 8px 16px 0; text-align: center; }
.top-notice .notice { font-size: 14px; }
/* WhatsApp icon after the name notice */
.top-notice .notice { display: inline; }
.top-notice .wa-share { position: static; display: inline-block; vertical-align: middle; margin-left: 4px; }
.notice-wa.wa-link { min-height: 30px; min-width: 30px; justify-content: center; padding: 0 3px; gap: 0; text-decoration: none; }
.notice-wa.wa-link svg { width: 20px; height: 20px; }
.top-notice .wa-pop { top: calc(100% + 6px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
body[data-page="tree"] .top-notice { padding-top: 6px; }
.wa-pop .wa-name { font-family: "Cormorant Garamond", Georgia, serif; font-size: 22px; font-weight: 600; line-height: 1.1; color: var(--ink); margin-top: 2px; }

/* the tree's view buttons: the one in effect looks pressed */
.stack-btns .btn-mini[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .28); }
.stack-btns .btn-mini[aria-pressed="true"]:hover { background: var(--brand); color: var(--brand-ink); }

/* gallery slider: photos shown whole, one at a time, moving on every few seconds */
.slider { position: relative; }
/* cover flow: the photo in front, large; its neighbours turned towards it on either side,
   over a blurred wash of the current photo */
.sl-stage { position: relative; height: clamp(360px, 66vh, 760px); overflow: hidden; border-radius: 8px; background: var(--surface-alt); perspective: 1700px; }
.sl-ambient { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(46px) saturate(1.2); opacity: 0; transition: opacity 1.2s ease; will-change: opacity; }
.sl-ambient.on { opacity: .42; }
.sl-slide { position: absolute; top: 4%; bottom: 4%; left: 20%; width: 60%; margin: 0; opacity: 0; pointer-events: none; transform: translateX(110%) scale(.6) rotateY(-45deg); transition: transform 1.05s cubic-bezier(.45, .05, .25, 1), opacity 1.05s cubic-bezier(.45, .05, .25, 1); will-change: transform, opacity; backface-visibility: hidden; }
.sl-slide[data-pos="0"] { opacity: 1; z-index: 5; transform: none; pointer-events: auto; }
.sl-slide[data-pos="-1"] { opacity: .78; z-index: 4; transform: translateX(-60%) scale(.78) rotateY(34deg); pointer-events: auto; }
.sl-slide[data-pos="1"] { opacity: .78; z-index: 4; transform: translateX(60%) scale(.78) rotateY(-34deg); pointer-events: auto; }
.sl-slide[data-pos="-2"] { z-index: 3; transform: translateX(-110%) scale(.6) rotateY(45deg); }
.sl-slide[data-pos="2"] { z-index: 3; transform: translateX(110%) scale(.6) rotateY(-45deg); }
.sl-slide button { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: none; }
.sl-slide img { pointer-events: auto; }
.sl-slide[data-pos="0"] button { cursor: zoom-in; }
.sl-slide img { width: auto; height: auto; max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 2px 6px rgba(20, 24, 20, .18), 0 24px 48px rgba(20, 24, 20, .28); }
.sl-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--accent); background: rgba(251, 248, 241, .92); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.sl-nav:hover { background: var(--surface); }
.sl-nav.prev { left: 14px; }
.sl-nav.next { right: 14px; }
.sl-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 12px; }
.sl-cap { margin: 0; font-size: 15px; color: var(--muted); display: flex; gap: 12px; align-items: baseline; }
.sl-cap b { font-family: "Cormorant Garamond", Georgia, serif; font-size: 20px; font-weight: 600; color: var(--ink); }
.sl-count { font-size: 13px; letter-spacing: .08em; }
.sl-dots { display: flex; gap: 8px; }
.sl-dots button { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1px solid var(--accent); background: transparent; cursor: pointer; }
.sl-dots button[aria-current="true"] { background: var(--accent); }
@media (max-width: 760px) {
  .sl-stage { height: 64vh; }
  .sl-nav { width: 40px; height: 40px; }
  .sl-slide { left: 9%; width: 82%; }
  .sl-slide[data-pos="-1"] { transform: translateX(-74%) scale(.74) rotateY(28deg); }
  .sl-slide[data-pos="1"] { transform: translateX(74%) scale(.74) rotateY(-28deg); }
}
@media (prefers-reduced-motion: reduce) { .sl-slide, .sl-ambient { transition: none; } }

/* ---------- calendar page ---------- */
.cal-year { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); }
.cal-year button { width: 44px; height: 44px; border: 0; background: none; font: inherit; font-size: 22px; line-height: 1; color: var(--ink); cursor: pointer; }
.cal-year button:hover { background: var(--accent-soft); }
.cal-year span { min-width: 74px; text-align: center; font-family: "Cormorant Garamond", Georgia, serif; font-size: 26px; font-weight: 600; font-variant-numeric: lining-nums; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: -10px 0 20px; font-size: 14px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 8px; }
.k-birth { --k: var(--accent); }
.k-wedding { --k: var(--claret); }
.k-remember { --k: #8B8F87; }
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--k, var(--accent)); }

/* the year: twelve small months */
.cal-year-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mini { display: flex; flex-direction: column; justify-content: flex-start; width: 100%; padding: 14px 14px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.mini:hover, .mini:focus-visible { border-color: var(--accent); box-shadow: 0 8px 20px rgba(30, 36, 32, .08); transform: translateY(-2px); outline: none; }
.mini.current { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.mini-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-family: "Cormorant Garamond", Georgia, serif; font-size: 21px; font-weight: 600; }
.mini-c { font-family: "Source Sans 3", system-ui, sans-serif; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border-radius: 10px; padding: 1px 8px; }
.mini .wk, .mini .mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.mini .wk span { padding-bottom: 4px; font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--muted); }
.mini .cd { height: 30px; display: flex; flex-direction: column; align-items: center; padding-top: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.mini .cd .n { width: 20px; height: 20px; line-height: 20px; border-radius: 50%; }
.mini .cd.has .n { font-weight: 700; }
.mini .cd.today .n { background: var(--brand); color: var(--brand-ink); }
.mini .dots, .mv .dots { display: flex; gap: 2px; margin-top: 1px; }
.mini .dot { width: 5px; height: 5px; }

/* one month opened up */
.mv { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; animation: mv-open .28s ease-out; }
@keyframes mv-open { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.mv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.mv-nav { display: flex; align-items: center; gap: 10px; }
.mv-nav h2 { min-width: 220px; margin: 0; text-align: center; font-size: 30px; }
.mv-nav button { width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); font: inherit; font-size: 20px; line-height: 1; color: var(--ink); cursor: pointer; }
.mv-nav button:hover { border-color: var(--accent); background: var(--accent-soft); }
.mv-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.mv-grid .wd { padding: 8px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-alt); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.mv-grid .day { min-width: 0; min-height: 96px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.mv-grid .day.blank { background: var(--surface-alt); }
.mv-grid .day .n { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.mv-grid .day.today .n { background: var(--brand); color: var(--brand-ink); }
.mv-grid .day.focus { background: var(--accent-soft); }
.mv-grid .day .dots { display: none; }
.chip { flex: none; min-height: 0; display: block; padding: 2px 6px; border-left: 3px solid var(--k); border-radius: 3px; background: color-mix(in srgb, var(--k) 15%, var(--surface)); font-size: 12px; line-height: 1.35; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { background: color-mix(in srgb, var(--k) 28%, var(--surface)); }
.mv-empty { margin: 18px 0 0; }

/* lists of dates: the opened month, and "Coming up" */
.ev-list { list-style: none; margin: 18px 0 0; padding: 0; }
.ev { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.ev-date { flex: none; width: 42px; text-align: center; }
.ev-date b { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 26px; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums; }
.ev-date small { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ev-ph { flex: none; display: flex; }
.ev-ph > * { border: 2px solid var(--surface); border-radius: 50%; }
.ev-ph > * + * { margin-left: -16px; }
.ev-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-names { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-names a { font-weight: 600; color: var(--ink); text-decoration: none; }
.ev-names a:hover { color: var(--accent-text); text-decoration: underline; }
.ev-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; font-size: 13px; color: var(--muted); }
.ev-what .dot { transform: translateY(-1px); }
.ev-when { font-size: 12px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.ev-when::before { content: "·"; margin-right: 7px; color: var(--muted); font-weight: 400; }
.ev-when.now::before { content: none; }
.ev-when.now { padding: 1px 8px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); }
.cal-up h2 { margin-bottom: 4px; }
.cal-up .ev-list { margin-top: 8px; }
.cal-up .ev:first-child { border-top: 0; }
.cal-count { margin: 14px 0 4px; font-size: 13px; }
.cal-more { display: none; }
@media (min-width: 761px) { .cal-up { position: sticky; top: 16px; } }
@media (max-width: 1100px) and (min-width: 761px) { .cal-year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .cal-cols .col-side { order: -1; }
  #cal-up:not(.all) .ev:nth-child(n+6) { display: none; }
  .cal-more { display: inline-flex; margin-top: 6px; width: 100%; }
  .cal-year-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mini { padding: 10px 8px 6px; }
  .mini-h { font-size: 18px; }
  .mini .cd { height: 24px; font-size: 11px; }
  .mini .cd .n { width: 17px; height: 17px; line-height: 17px; }
  .mini .dot { width: 4px; height: 4px; }
  .mv { padding: 14px 10px; }
  .mv-nav h2 { min-width: 150px; font-size: 24px; }
  .mv-grid .wd { padding: 6px 2px; text-align: center; letter-spacing: .04em; font-size: 10px; }
  .mv-grid .day { min-height: 52px; padding: 4px 2px; align-items: center; }
  .mv-grid .chip { display: none; }
  .mv-grid .day .dots { display: flex; }
  .main-nav { grid-template-columns: repeat(6, 1fr); }
  .main-nav a { letter-spacing: .04em; font-size: 10px; }
}
@media (max-width: 760px) { .top-notice .wa-pop { left: 50%; right: auto; transform: translateX(-50%); } }
@media (min-width: 1360px) { .search input { width: 150px; } }

/* ---------- person page: their photographs as prints on a table ---------- */
.hero-photo { position: relative; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; cursor: zoom-in; }
.hero-photo .photo { display: block; transition: transform .25s ease; }
.hero-photo:hover .photo, .hero-photo:focus-visible .photo { transform: scale(1.03); }
.pic-badge { position: absolute; right: 6px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font-size: 12px; font-weight: 700; box-shadow: 0 0 0 2px var(--surface); }
.prints-hint { margin: 0 0 18px; font-size: 14px; }
.prints { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 8px; padding: 10px 6px 18px; }
.print { --tilt: 0deg; position: relative; flex: none; width: 200px; padding: 10px 10px 0; border: 0; background: #FFFDF8; box-shadow: 0 1px 2px rgba(30, 36, 32, .12), 0 8px 18px rgba(30, 36, 32, .12); transform: rotate(var(--tilt)); transition: transform .3s cubic-bezier(.2, .8, .3, 1.2), box-shadow .3s ease; cursor: zoom-in; font: inherit; text-align: center; }
.print + .print { margin-left: -14px; }
.print::before { content: ""; position: absolute; top: -9px; left: 50%; width: 64px; height: 20px; transform: translateX(-50%) rotate(calc(var(--tilt) * -1.4)); background: rgba(232, 222, 196, .78); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.print img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 28%; background: var(--accent-soft); }
.print-cap { display: block; min-height: 46px; padding: 9px 4px 10px; font-family: "Cormorant Garamond", Garamond, Georgia, serif; font-style: italic; font-size: 17px; line-height: 1.2; color: var(--muted); }
.print:hover, .print:focus-visible { z-index: 2; transform: rotate(0deg) translateY(-6px) scale(1.05); box-shadow: 0 2px 4px rgba(30, 36, 32, .12), 0 18px 34px rgba(30, 36, 32, .2); outline: none; }
.prints.one .print { width: 240px; }
@media (max-width: 760px) {
  /* phones: a row of prints to swipe through */
  .prints { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -18px; padding: 14px 24px 22px; gap: 0; -webkit-overflow-scrolling: touch; }
  .prints.one { justify-content: center; }
  .print { width: 62vw; max-width: 240px; scroll-snap-align: center; }
  .print + .print { margin-left: 12px; }
  .hero-photo { margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { .print, .hero-photo .photo { transition: none; } }

/* "Share photos and corrections" on the same row as the name notice, at its right-hand end */
.top-notice .share-bar .wrap { padding: 0; }
@media (min-width: 1180px) {
  .top-notice .share-bar { position: absolute; top: -3px; right: 0; left: 0; pointer-events: none; }
  .top-notice .share-bar .wrap { justify-content: flex-end; }
  .top-notice .share-bar .wa-share { pointer-events: auto; }
  body[data-page="tree"] .top-notice .share-bar .wrap { max-width: none; padding: 0 24px; }
}
@media (max-width: 1179px) { .top-notice .share-bar .wrap { justify-content: center; padding-top: 2px; } }
/* gallery slider: the names sit centred under the photo */
.sl-bar { flex-direction: column; justify-content: center; }
.sl-cap { justify-content: center; flex-wrap: wrap; text-align: center; }

/* person page: "Suggest an edit" on the name-notice row */
.notice-action .wa-share { display: inline-block; }
.notice-action .wa-link.btn-primary { min-height: 38px; padding: 0 18px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); text-decoration: none; animation: none; font-size: 14px; }
.notice-action .wa-link.btn-primary:hover { border-color: var(--accent); color: var(--brand-ink); }
.notice-action .wa-pop { top: calc(100% + 8px); bottom: auto; right: 0; left: auto; transform: none; }
@media (max-width: 1179px) { .notice-action .wrap { padding-top: 8px; } .notice-action .wa-pop { right: 50%; transform: translateX(50%); } }
@media (min-width: 1180px) { .top-notice .notice-action { top: 4px; } }
/* calendar: a wider "Coming up" column so names fit on one line */
@media (min-width: 761px) { .cal-cols .col-side { flex: 1 1 360px; } .cal-up { padding: 22px 22px 18px; } }
.cal-up .ev { gap: 10px; }
.cal-up .ev-ph .avatar, .cal-up .ev-ph svg { width: 34px !important; height: 34px !important; }
.cal-up .ev-ph > * + * { margin-left: -12px; }

/* children of one parent only: the line comes down from that parent's card */
.tree li[data-solo] > .tg, .tree li[data-solo] > ul { position: relative; left: var(--solo, 0px); }

/* ---------- Gallery: upload photographs ---------- */
.photo-ask-btns { display: flex; flex: none; align-items: center; gap: 8px; }
.photo-ask .btn#upload-photos { min-height: 40px; padding: 0 18px; gap: 7px; }
.up-dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(20, 24, 20, .3); }
.up-dlg::backdrop { background: rgba(20, 24, 20, .55); }
.up-form, .up-done { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 26px 26px 22px; }
.up-form h2, .up-done h2 { font-size: 28px; margin: 0; }
.up-lead { margin: -6px 0 2px; font-size: 14px; }
.up-x { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.up-x:hover { background: var(--accent-soft); color: var(--ink); }
.up-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 110px; padding: 16px; border: 1.5px dashed var(--line-strong); border-radius: 6px; background: var(--surface-alt); cursor: pointer; text-align: center; transition: border-color .15s ease, background .15s ease; }
.up-drop b { font-size: 16px; color: var(--accent-text); }
.up-drop small { font-size: 13px; color: var(--muted); }
.up-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.up-drop:hover, .up-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.up-drop.full { display: none; }
.up-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.up-tiles:empty { display: none; }
.up-tile { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: var(--accent-soft); }
.up-tile img { width: 100%; height: 100%; object-fit: cover; }
.up-tile button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.up-field { display: flex; flex-direction: column; gap: 6px; }
.up-field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.up-field input, .up-field textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 4px; padding: 10px 12px; width: 100%; }
.up-field input:focus, .up-field textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
.up-field textarea { resize: vertical; }
.up-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.up-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.up-send { min-width: 160px; }
.up-send.busy { opacity: .7; }
.up-status { margin: 0; font-size: 14px; color: var(--muted); }
.up-status.up-error, .up-warn { color: var(--claret); }
.up-done { align-items: center; text-align: center; padding: 34px 26px 26px; }
.up-done p { margin: 0; max-width: 400px; color: var(--muted); }
.up-tick { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); }
@media (max-width: 760px) { .photo-ask-head { flex-wrap: wrap; } .up-form, .up-done { padding: 22px 18px 18px; } }
/* an honour, e.g. Amar Singh's OBI, in brass */
.pill.pill-honour { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
/* "Go to the story" under a photo that has one */
.ph-story { margin-left: 10px; font-size: 14px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.lightbox .ph-story { color: #E8D3A8; }
/* a story's photo is shown whole (e.g. the inscribed stone), not cropped */
.story-cover { object-fit: contain !important; background: var(--surface-alt); max-height: 75vh; }
/* story: photo on top; a story told in both languages sits side by side (English left, Punjabi right) */
.story-cover-top { margin: 4px 0 24px; }
.story-title { text-align: center; }
.story-sub { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 21px; margin: 6px 0 0; color: var(--muted); }
.story-body:not(.story-en):not(.story-pa) { margin-top: 24px; }
.story-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; margin-top: 28px; }
.story-cols .story-body { max-width: none; }
.story-cols .story-pa { border-left: 1px solid var(--line); padding-left: 56px; margin-left: -28px; }
.story-cols h2 { font-size: 24px; margin: 0 0 18px; }
.story-en h2 { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-weight: 600; }
.story-pa h2 { font-family: "Noto Sans Gurmukhi", sans-serif; font-weight: 500; }
.story-pa p { font-family: "Noto Sans Gurmukhi", sans-serif; font-size: 18px; line-height: 1.9; }
.story-lang { display: none; }
@media (max-width: 860px) {
  .story-cols { grid-template-columns: 1fr; gap: 0; }
  .story-cols .story-pa { border-left: 0; padding-left: 0; margin-left: 0; border-top: 1px solid var(--line); padding-top: 28px; margin-top: 12px; scroll-margin-top: 90px; }
  .story-lang { display: block; text-align: center; margin-top: 10px; font-family: "Noto Sans Gurmukhi", sans-serif; font-weight: 500; color: var(--accent-text); }
}
/* photos can't be saved with a long-press or right-click */
img { -webkit-touch-callout: none; -webkit-user-drag: none; -webkit-user-select: none; user-select: none; }
/* "Share this profile / story / the Gallery" */
.share-link { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chips .share-link { background: none; font-family: inherit; line-height: inherit; }
.story-share { text-align: center; margin: 10px 0 0; }
.gallery-share { margin-top: 12px; }
.feat-btns { display: flex; flex-wrap: wrap; gap: 10px; }
/* Gallery heading and the "Old photographs appreciated" note share one row, without a gap in the middle */
@media (min-width: 761px) {
  body[data-page="gallery"] .page-head { flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 40px; }
  body[data-page="gallery"] .page-head > div:first-child { flex: none; }
  body[data-page="gallery"] .photo-ask { flex: 1 1 auto; margin: 0; display: grid; grid-template-columns: 1fr auto; column-gap: 28px; row-gap: 6px; align-items: center; }
  body[data-page="gallery"] .photo-ask-head { display: contents; }
  body[data-page="gallery"] .photo-ask h2 { grid-column: 1; grid-row: 1; }
  body[data-page="gallery"] .photo-ask p { grid-column: 1; grid-row: 2; }
  body[data-page="gallery"] .photo-ask-btns { grid-column: 2; grid-row: 1 / span 2; }
}
/* names under a Gallery photo open their profiles */
.sl-cap b a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.sl-cap b a:hover { color: var(--accent-text); }
/* a story without a photo: a newspaper-style tile, and the link to the original */
.tile-paper { display: flex; flex-direction: column; justify-content: center; gap: 8px; aspect-ratio: 3 / 2; padding: 22px; background: #F4EEDF; border-bottom: 3px double var(--line-strong); text-align: center; }
.tile-paper span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tile-paper b { font-family: "Cormorant Garamond", Georgia, serif; font-size: 26px; line-height: 1.15; color: var(--ink); }
.story-meta { margin: 8px 0 0; text-align: center; }
.story-source { margin: 8px 0 0; font-size: 17px; font-weight: 600; }
.story-source a { color: var(--accent-text); }
#story .story-body:not(.story-en):not(.story-pa) { max-width: none; }
.tile-paper b { font-size: 34px; font-style: italic; }
/* ---------- Stories page: a deck of story cards that moves on by itself, and the list of all stories ---------- */
.st-deck { position: relative; margin-bottom: 44px; }
.st-stack { display: grid; padding: 0 30px 26px 0; }
.st-card { grid-area: 1 / 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(30, 36, 32, .08), 0 14px 30px rgba(30, 36, 32, .12); transform-origin: 50% 100%;
  transition: transform .75s cubic-bezier(.3, .7, .2, 1), opacity .75s ease; }
.st-card[data-pos="0"] { z-index: 5; transform: none; }
.st-card[data-pos="1"] { z-index: 4; transform: translate(14px, 12px) rotate(1.4deg) scale(.985); }
.st-card[data-pos="2"] { z-index: 3; transform: translate(26px, 22px) rotate(2.6deg) scale(.97); }
.st-card[data-pos="far"] { z-index: 2; transform: translate(26px, 22px) rotate(2.6deg) scale(.97); opacity: 0; }
.st-card[data-pos="gone"] { z-index: 6; transform: translate(-60%, 24px) rotate(-7deg); opacity: 0; pointer-events: none; }
.st-card[data-pos]:not([data-pos="0"]) { pointer-events: none; }
.st-card.snap { transition: opacity .5s ease; }
.st-pic { display: block; min-height: 340px; background: var(--surface-alt); }
.st-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.st-paper { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; padding: 28px; background: #F4EEDF; text-align: center; box-sizing: border-box; }
.st-paper span { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.st-paper b { font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 52px; line-height: 1.05; color: var(--ink); }
.st-body { padding: 30px 32px; display: flex; flex-direction: column; align-items: flex-start; }
.st-body h2 { font-size: 34px; line-height: 1.12; margin: 14px 0 6px; }
.st-body h2 a { color: inherit; text-decoration: none; }
.st-meta { margin: 0 0 12px; font-size: 14px; }
.st-excerpt { margin: 0 0 22px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.st-body .feat-btns { margin-top: auto; }
.st-ctrl { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
.st-nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 20px; cursor: pointer; }
.st-nav:hover { border-color: var(--accent); }
.st-dots { display: flex; gap: 8px; }
.st-dots button { width: 26px; height: 4px; padding: 0; border: 0; border-radius: 2px; background: var(--line-strong); cursor: pointer; transition: background .3s, width .3s; }
.st-dots button.on { width: 44px; background: var(--accent); }
.st-list h2 { margin: 0 0 14px; }
.st-list ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.st-list li { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.st-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 18px; padding: 14px 4px; color: var(--ink); text-decoration: none; }
.st-row:hover b { color: var(--accent-text); }
.st-thumb { flex: none; width: 112px; height: 76px; border-radius: 3px; object-fit: cover; }
.st-thumb.st-paper { padding: 6px; gap: 2px; }
.st-thumb.st-paper span { font-size: 8px; letter-spacing: .08em; }
.st-thumb.st-paper b { font-size: 18px; }
.st-row-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-row-text b { font-family: "Cormorant Garamond", Georgia, serif; font-size: 22px; line-height: 1.2; }
.st-row-text .muted { font-size: 13px; }
.st-row-ex { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-row-share { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
@media (max-width: 760px) {
  .st-stack { padding: 0 14px 18px 0; }
  .st-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .st-pic { min-height: 0; aspect-ratio: 16 / 10; }
  .st-paper b { font-size: 40px; }
  .st-body { padding: 20px 20px 22px; }
  .st-body h2 { font-size: 27px; }
  .st-card[data-pos="1"] { transform: translate(8px, 8px) rotate(1deg) scale(.985); }
  .st-card[data-pos="2"], .st-card[data-pos="far"] { transform: translate(14px, 14px) rotate(2deg) scale(.97); }
  .st-thumb { width: 84px; height: 60px; }
  .st-row { gap: 12px; }
  .st-row-share { padding: 8px; font-size: 0; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { .st-card { transition: none; } }
@media (min-width: 761px) {
  .st-card { height: 430px; }
  .st-pic { min-height: 0; height: 100%; overflow: hidden; }
}
.st-pic, .st-row { text-decoration: none; }
/* a story's photo stays modest, so the first lines of the story show without scrolling */
.story-cover-top { max-height: 40vh; }
.story-meta a, .st-meta a { color: var(--accent-text); }
.story-cover-top { max-height: 30vh; margin: 2px 0 16px; }
.story-title { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.15; margin: 0; }
.story-share { margin-top: 8px; }
.story-share .btn { min-height: 38px; }
@media (max-width: 760px) { .story-cover-top { max-height: 26vh; } .story-title { font-size: 26px; } }
@media (max-width: 760px) {
  body[data-page="story"] .bc-here { display: none; }
  .story-cover-top { max-height: 22vh; margin-bottom: 12px; }
  .story-share .btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
  .story-meta { margin-top: 6px; font-size: 14px; }
  .story-lang { margin-top: 4px; }
  .story-cols { margin-top: 16px; }
  .story-cols h2 { font-size: 21px; margin-bottom: 10px; }
}
/* the "Share this ..." menu */
.share-menu { position: absolute; z-index: 60; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 10px 28px rgba(20, 24, 20, .18); display: flex; flex-direction: column; }
.share-menu a, .share-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 4px; background: none; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.share-menu a:hover, .share-menu button:hover, .share-menu a:focus-visible, .share-menu button:focus-visible { background: var(--accent-soft); outline: none; }
.share-menu a svg { color: #25D366; }
/* the active story dot fills up while that story is shown */
.st-dots button { position: relative; overflow: hidden; }
.st-dots button.on { background: var(--line-strong); }
.st-dots button.on::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: left; animation: st-fill var(--st-ms, 5000ms) linear forwards; }
@keyframes st-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .st-dots button.on { background: var(--accent); } .st-dots button.on::after { display: none; } }
/* ---------- tree: "son" / "daughter" on the lines ---------- */
/* the line from the parents lands on the child's own card when the child is shown with a husband or wife */
.tree li::before { right: calc(50% - var(--in, 0px)); width: calc(50% + var(--in, 0px)); }
.tree li::after { left: calc(50% + var(--in, 0px)); width: calc(50% - var(--in, 0px)); }
.tree .rel-tag { position: absolute; top: 8px; left: calc(50% + var(--in, 0px)); transform: translateX(-50%); z-index: 1; padding: 0 5px; background: var(--surface); font-family: "Cormorant Garamond", Georgia, serif; font-style: italic; font-size: 14px; line-height: 15px; color: var(--accent-text); white-space: nowrap; pointer-events: none; }
.tree li:only-child > .rel-tag { top: -22px; }
/* each family's line offset belongs to that family only; it must not carry down to the children's lines */
.tree li { --in: 0px; }
.tree li:not([data-solo]) { --solo: 0px; }
