:root {
  color-scheme: light;
  --paper: #fffdf9;
  --paper-deep: #f4f0e8;
  --ink: #2d2926;
  --heading: #1e3a4f;
  --meta: #6f6962;
  --light-meta: #9c958e;
  --line: #ded7cd;
  --gold: #c9a96e;
  --gold-deep: #9e7c3d;
  --butterfly: #0066a1;
  --rose: #8b3a4a;
  --green: #48644b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
}

* { box-sizing: border-box; }
/* No CSS scroll-behavior: smooth — it re-animates every frame of the JS scroll tween and
   fights it (the "slingshot"). The JS smoothScrollTo is the single source of smoothness. */
html { min-height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100%;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
img, video { max-width: 100%; }
button, input, select { font: inherit; }
button, select, input { border-radius: 6px; }
button {
  min-height: 46px;
  border: 0;
  padding: 0 20px;
  background: var(--heading);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
/* No global button:hover — the navy fill stuck on touch/iPad and hid the text under it. */
button:disabled { opacity: 0.6; cursor: default; }
input:not([type="radio"]):not([type="checkbox"]), select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
input[type="radio"], input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--heading); }
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
a { color: inherit; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold-deep);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.gold-rule {
  width: 88px;
  height: 2px;
  margin: 20px auto;
  border: 0;
  background: var(--gold);
}
.gold-rule.short { width: 56px; margin: 14px auto; }
h1, h2, h3 {
  color: var(--heading);
  font-weight: 400;
  line-height: 1.12;
}
h1 {
  margin: 0;
  font-size: clamp(2.15rem, 7vw, 3.65rem);
}
h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
}
h3 { margin: 0; font-size: 1.3rem; }
.subtitle {
  margin: 0;
  color: var(--meta);
  font-size: clamp(1.05rem, 3.6vw, 1.25rem);
  font-style: italic;
}
.section-note, .provenance {
  margin: 10px 0 0;
  color: var(--meta);
  font-style: italic;
}

/* App shell: top bar on mobile, left sidebar on desktop; one view at a time */
.app-body { min-height: 100svh; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: max(8px, env(safe-area-inset-top)) 14px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.96);
  backdrop-filter: blur(14px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  color: var(--heading);
  text-decoration: none;
}
.brand-mark { width: 32px; height: auto; }
.brand-name {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand-name br { display: none; }
.sidebar-stat-line { display: block; }
.sidebar-stat-line + .sidebar-stat-line { margin-top: 2px; opacity: 0.85; }
.sidebar-stat {
  flex: 0 1 auto;
  margin: 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
}
.sidebar-stat .stat-sub { display: block; font-style: italic; font-weight: 500; font-size: 0.78rem; color: var(--meta); margin-bottom: 8px; }
.sidebar-stat .stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); }
.sidebar-stat .stat-row:first-child { border-top: 0; }
.sidebar-stat .stat-label { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--meta); }
.sidebar-stat .stat-num { font-family: var(--serif); font-weight: 400; font-size: 1.05rem; color: var(--heading); font-variant-numeric: tabular-nums; }
.primary-nav {
  display: flex;
  flex: 1;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
}
.primary-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}
.primary-nav a:hover { background: var(--paper-deep); color: var(--heading); }
.primary-nav a.active { background: var(--heading); color: #fff; }
.nav-icon { display: none; width: 22px; height: 22px; flex: none; }
/* "Special Times / By Year" segmented toggle (the two share one combined "Browse" nav item) */
.browse-switch { display: inline-flex; gap: 2px; margin: 0 0 22px; padding: 3px; background: var(--paper-deep); border: 1px solid var(--line); border-radius: 9px; }
.browse-switch a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: 7px; font-family: var(--sans); font-size: 0.85rem; font-weight: 700; color: var(--meta); text-decoration: none; }
.browse-switch a.bs-on { background: var(--heading); color: #fff; }
/* Journeys selector (#journeys view): the 3 trips as cards */
.journeys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.jcard { display: block; text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(60,40,20,.05); }
.jcard-cover { position: relative; display: block; aspect-ratio: 16/10; background: linear-gradient(140deg, var(--c, #9e7c3d), #2d2926); }
.jcard-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.jcard-cover::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 64px; background: linear-gradient(rgba(0,0,0,.42), transparent); pointer-events: none; z-index: 1; }
.jcard-region { position: absolute; top: 12px; left: 14px; z-index: 2; font-family: var(--sans); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.92); }
.jcard-pin { position: absolute; right: 14px; bottom: 12px; width: 34px; height: 34px; color: rgba(255,255,255,.45); }
.jcard-body { display: block; padding: 14px 16px 16px; }
.jcard-title { display: block; font-family: var(--serif); font-weight: 600; font-size: 21px; color: var(--heading); }
.jcard-meta { display: block; font-family: var(--sans); font-size: 13px; color: var(--meta); margin-top: 5px; }
.journeys-all { display: inline-block; margin-top: 22px; font-family: var(--sans); font-weight: 700; font-size: 14px; color: var(--heading); text-decoration: none; border: 1px solid var(--line); border-radius: 9px; padding: 11px 18px; }
/* Life Stories: book-cover cards (#stories view), cover = PDF page 1 */
.ls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px; }
.ls-card { display: flex; flex-direction: column; }
.ls-cover { display: block; aspect-ratio: 1 / 1.4; border-radius: 8px; overflow: hidden; background: var(--paper-deep); box-shadow: 0 6px 20px rgba(30,58,79,.16); }
.ls-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ls-info { padding: 13px 2px 0; }
.ls-title { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.2; color: var(--heading); }
.ls-who { font-family: var(--sans); font-size: 13px; color: var(--meta); margin-top: 3px; }
.ls-actions { display: flex; gap: 8px; margin-top: 12px; }
.ls-btn { display: inline-flex; align-items: center; min-height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid var(--line); font-family: var(--sans); font-weight: 700; font-size: 13px; color: var(--heading); text-decoration: none; }
.ls-btn.primary { background: var(--heading); color: #fff; border-color: var(--heading); }
@media (hover: hover) { .ls-cover { transition: transform .12s, box-shadow .12s; } .ls-card:hover .ls-cover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(30,58,79,.24); } }
/* Phones: compact horizontal cards (small cover left, info right) */
@media (max-width: 600px) {
  .ls-grid { grid-template-columns: 1fr; gap: 14px; }
  .ls-card { flex-direction: row; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .ls-cover { width: 76px; flex: none; box-shadow: 0 2px 8px rgba(30,58,79,.16); }
  .ls-info { padding: 0; flex: 1; min-width: 0; }
  .ls-title { font-size: 16px; }
  .ls-actions { margin-top: 9px; }
}
@media (hover: hover) { .jcard { transition: transform .12s, box-shadow .12s; } .jcard:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,58,79,.10); } }
/* Phones: compact horizontal trip cards (cover left, info right) */
@media (max-width: 600px) {
  .journeys-grid { grid-template-columns: 1fr; gap: 14px; }
  .jcard { display: flex; align-items: stretch; }
  .jcard-cover { width: 118px; flex: none; aspect-ratio: auto; }
  .jcard-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
  .jcard-title { font-size: 17px; }
}
.sidebar-logout { display: flex; }
.signout-button { display: inline-flex; align-items: center; gap: 8px; }
.icon-signout { width: 18px; height: 18px; flex: none; }
.settings-button {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  min-height: 42px;
  padding: 0 16px;
}
.icon-settings { width: 20px; height: 20px; flex: none; }
.settings-label { font-weight: 700; }
.sidebar-toggle {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.ghost-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--heading);
}
.danger-button {
  border: 1px solid #b98b8b;
  background: transparent;
  color: #7d2f2f;
}
body.modal-open { overflow: hidden; }
.user-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(30, 41, 48, 0.44);
}
.user-settings-panel {
  width: min(1040px, 100%);
  max-height: min(860px, calc(100svh - 40px));
  overflow: auto;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(30, 41, 48, 0.28);
}
.user-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.user-settings-head .eyebrow {
  margin-bottom: 6px;
}
.user-settings-head h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.05;
}
.user-settings-head .section-note {
  margin-top: 8px;
}
.user-settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--heading);
}
.user-settings-close svg { width: 20px; height: 20px; }
.settings-tabs {
  /* Flex row, not a fixed 2-col grid: fits any number of tabs on one line
     (the hardcoded 1fr 1fr wrapped the third tab onto a second row). */
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-deep);
}
.settings-tabs button { white-space: nowrap; border-radius: 6px; }
.settings-tabs button {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--meta);
}
.settings-tabs button[aria-selected="true"] {
  background: #fff;
  color: var(--heading);
  box-shadow: 0 1px 4px rgba(30, 41, 48, 0.1);
}
.ai-radio { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; font-size: .92rem; }
.ai-radio .section-note { margin: 0; }
.admin-nav { display: none; }
body.is-admin .admin-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.admin-nav-divider { display: block; height: 1px; background: var(--line); margin: 4px 0 8px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border-radius: 8px; color: var(--meta); font-size: 0.88rem; text-decoration: none; }
.admin-nav a:focus-visible { color: var(--heading); }
.admin-nav .nav-icon { width: 18px; height: 18px; flex: none; }
.admin-tools-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.admin-tools-cards a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--heading); font-weight: 600; font-size: .9rem; text-decoration: none;
}
.admin-tools-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  line-height: 1.9;
}
.admin-tools-links a { white-space: nowrap; }
.settings-tab-panel[hidden] {
  display: none;
}
.user-settings-section {
  display: grid;
  gap: 10px;
}
.user-settings-section + .user-settings-section {
  margin-top: 14px;
}
.user-settings-section h3 {
  margin: 0;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.user-create-form,
.user-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.1fr) 112px 98px auto;
  gap: 10px;
  align-items: end;
}
.user-create-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-deep);
}
.user-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.activity-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.activity-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) minmax(120px, 0.55fr);
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  align-items: baseline;
  font-family: var(--sans);
}
.activity-row:first-child { border-top: 0; }
.activity-time {
  color: var(--meta);
  font-size: 0.78rem;
  font-weight: 700;
}
.activity-main {
  overflow: hidden;
  color: var(--heading);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-meta {
  overflow: hidden;
  color: var(--meta);
  font-size: 0.78rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.activity-actions .ghost-button {
  min-height: 40px;
}
.user-row {
  grid-template-columns: minmax(118px, 0.72fr) minmax(128px, 0.88fr) minmax(148px, 1fr) 112px 98px minmax(170px, auto);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.user-row-summary {
  align-self: center;
  min-width: 0;
}
.user-row-summary strong {
  display: block;
  overflow: hidden;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-row-summary span {
  display: block;
  margin-top: 1px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.82rem;
}
.user-create-form label,
.user-row label {
  display: grid;
  gap: 3px;
  margin: 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.user-create-form input,
.user-create-form select,
.user-row input,
.user-row select {
  min-height: 38px;
  padding: 7px 10px;
}
.user-create-form button {
  min-height: 38px;
  padding-inline: 14px;
}
.user-enabled-check {
  min-height: 38px;
  display: flex !important;
  align-items: center;
  gap: 8px;
  color: var(--heading) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
.user-enabled-check input {
  width: 18px;
  min-height: 18px;
}
.user-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.user-row-actions button {
  min-width: 0;
  min-height: 38px;
  padding-inline: 12px;
}
/* hover background removed — no hover affordances (touch/iPad friendly) */
/* Kill the GLOBAL `button:hover { background: #16405c }` (navy fill that's unreadable and
   sticks on iPad) for the On This Day controls — no state change at all. */
.today-surprise, .today-surprise:hover, .today-surprise:focus, .today-surprise:focus-visible, .today-surprise:active,
.today-reflection-more, .today-reflection-more:hover, .today-reflection-more:focus, .today-reflection-more:focus-visible, .today-reflection-more:active,
.today-reflection-regen, .today-reflection-regen:hover, .today-reflection-regen:focus, .today-reflection-regen:focus-visible, .today-reflection-regen:active {
  background: transparent;
  outline: none;
}

.app-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0 20px 56px;
}

@media (min-width: 880px) {
  .layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    align-items: start;
  }
  .sidebar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    height: 100svh;
    gap: 16px;
    padding: 30px 20px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }
  .brand { flex-direction: column; align-items: flex-start; gap: 12px; }
  .brand-mark { width: 44px; }
  .brand-name { font-size: 1.02rem; }
  .brand-name br { display: inline; }
  .primary-nav { flex-direction: column; flex: 0; justify-content: flex-start; gap: 4px; }
  .primary-nav a { min-height: 44px; padding: 0 14px; font-size: 0.92rem; }
  .sidebar-toggle {
    flex-basis: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
  }
}

/* iPad portrait (761–879) uses the SAME layout as phones: a fixed bottom tab bar,
   with the brand + Sign-out icon up top. Handled by the max-width:879 block below. */

.cover {
  padding: clamp(18px, 4vh, 38px) 0 8px;
  text-align: center;
}
.compact-cover {
  display: grid;
  gap: 16px;
  justify-items: center;
}
.cover-photo { width: min(100%, 340px); }
/* Logged-in home: no cover photo (already seen on login) — slim title only. */
.home-intro { padding: clamp(6px, 2vh, 18px) 0 4px; }
.home-intro .names { font-size: 1.25rem; }
.framed-photo {
  width: min(100%, 300px);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 34px rgba(30, 58, 79, 0.12);
}
.framed-photo img {
  display: block;
  width: 100%;
  height: auto;
}
.cover-copy { text-align: center; }
.names {
  margin: 0;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
}
.occasion {
  margin: 4px 0 0;
  color: var(--light-meta);
  font-style: italic;
}
.stats-line {
  margin: 12px 0 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
}
.butterfly {
  display: inline-block;
  width: 42px;
  height: auto;
  margin-top: 24px;
  opacity: 0.92;
}

.section-head {
  max-width: 620px;
  margin: 0 auto 26px;
  text-align: center;
}
.section-head-left {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  text-align: left;
}
.section-head-left .gold-rule,
.section-head-left .gold-rule.short { margin-left: 0; }
section { scroll-margin-top: 82px; }
.dashboard, .view-section { padding-top: clamp(34px, 6vh, 58px); }
@media (max-width: 600px) { .dashboard, .view-section { padding-top: 22px; } }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.summary-tile {
  display: grid;
  gap: 6px;
  min-height: 136px;
  align-content: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(30, 58, 79, 0.06);
}
.summary-tile span {
  color: var(--gold-deep);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.summary-tile strong {
  color: var(--heading);
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1.1;
}
.summary-tile em {
  color: var(--meta);
  font-size: 0.95rem;
  font-style: italic;
}
.summary-tile:hover { border-color: var(--gold); }
/* ── On This Day: light header (no card) ──────────────────────────────────────────
   Left: arrows + date title. Right: "Year [All] · fwd (322)" cluster. */
.view-head.today-head { display: block; }      /* eyebrow stacks above the date/controls row */
.today-head-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;            /* controls vertically centred with the date + arrows */
  justify-content: space-between;
  gap: 10px 18px;
  margin-top: 6px;
}
.today-head-main { min-width: 0; }
.today-head .section-note { display: none; }   /* drop the "Letters and photos…" subtitle */
/* On This Day title: full month on desktop/iPad, 3-letter on phones. */
#todayTitle .md-short { display: none; }
@media (max-width: 600px) {
  #todayTitle .md-full { display: none; }
  #todayTitle .md-short { display: inline; }
}

/* Strip the bordered card off the date controls; lay them out inline, right-aligned. */
.date-tools.today-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.today-controls .ctl-hidden { display: none; }
.today-controls .ctl-year { display: flex; align-items: center; gap: 8px; }
.today-controls .ctl-year > span { display: none; }   /* dropdown reads "All years" — label is redundant */

/* The forwarded checkbox — a small CUSTOM box (native checkboxes can't be sized on iOS). */
.forward-bar .forward-check {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  letter-spacing: 0; text-transform: none;   /* beat .date-tools label (grid/uppercase) */
}
.forward-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 15px; height: 15px; min-height: 0; margin: 0; padding: 0;
  border: 1.5px solid var(--meta); border-radius: 4px; background: #fff;
  position: relative; cursor: pointer;
}
.forward-check input[type="checkbox"]:checked { background: var(--heading); border-color: var(--heading); }
.forward-check input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.forward-check input[type="checkbox"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fwd-text {
  display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  color: var(--meta); letter-spacing: 0; text-transform: none;
}
.forward-note { font-weight: 400; opacity: 0.7; }

/* In On This Day it sits in the right cluster after a "·". In All Letters, a small row. */
.today-controls #forwardBar { display: flex; align-items: center; }
.today-controls #forwardBar::before {
  content: "·"; color: var(--meta); opacity: 0.55; margin-right: 13px;
}
.filter-bar #forwardBar {
  grid-column: 1 / -1; margin-top: 2px; padding-top: 11px; border-top: 1px solid var(--line);
}
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  transition: background 0.15s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 58, 79, 0.35);
  transition: transform 0.15s ease;
}
.switch-input:checked + .switch-track { background: var(--heading); }
.switch-input:checked + .switch-track::after { transform: translateX(20px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }
.button-tile {
  width: 100%;
  min-height: 136px;
  background: #fff;
  color: inherit;
  text-align: left;
}
.button-tile:hover { background: #fff; }

/* Media: a card per letter with a photo thumbnail grid */
.media-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(30, 58, 79, 0.06);
  text-decoration: none;
}
.media-card:hover { border-color: var(--gold); }
.media-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--heading);
}
.media-card-meta {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--meta);
}
.media-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.media-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-deep);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A lone photo spans the full width instead of half a grid. */
.media-thumb:only-child { grid-column: 1 / -1; aspect-ratio: 16 / 10; }

.view-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.day-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-stepper h2 { margin: 0; }
.day-step-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--gold-deep);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.day-step-btn svg { width: 20px; height: 20px; }
.day-step-btn:hover { background: var(--paper-deep); border-color: var(--gold); }
.day-step-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.date-tools, .filter-bar {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.date-tools label, .filter-bar label {
  display: grid;
  gap: 5px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.filter-bar { margin-bottom: 22px; }
.wide-filter { min-width: 0; }

.year-groups, .archive-results { display: grid; gap: 26px; }
.year-group, .month-group {
  display: grid;
  gap: 14px;
}
.year-group > h3, .month-group > h3 {
  position: static;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.95);
  color: var(--gold-deep);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.month-group > h3 span { color: var(--heading); }
.letter-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  /* Size each card to its own content; without this, a short card stretches to
     match a tall neighbour and warps its pills/buttons (circle, square). */
  align-items: start;
}
.letter-card {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(30, 58, 79, 0.07);
}
/* Long URLs / unbreakable tokens must wrap, not blow out the grid width. */
.letter-card h3, .letter-preview, .detail-body, .detail-card { overflow-wrap: anywhere; min-width: 0; }
.letter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--light-meta);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.letter-meta span:first-child { color: var(--gold-deep); }
.letter-card h3 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
}
.letter-card h3 a { color: var(--heading); text-decoration: none; }
.letter-card h3 a:hover { text-decoration: underline; }

/* On This Day: a compact strip of a letter's photos as a preview. */
.thumb-strip { display: flex; flex-wrap: wrap; gap: 8px; text-decoration: none; }
.ot-thumb {
  width: 96px;
  height: 96px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ot-more { color: var(--meta); font-family: var(--sans); font-weight: 700; font-size: 0.95rem; }

/* The real photos/videos/audio shown inline when a card is expanded. */
.letter-media { margin-top: 4px; display: grid; gap: 12px; }
.letter-card.expanded .media-pills,
.letter-card.expanded .thumb-strip { display: none; }

/* On This Day reads as a single, comfortable column. */
#todayResults { max-width: 880px; }
#todayResults .letter-list { grid-template-columns: minmax(0, 1fr); }
.today-brief {
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(244, 240, 232, 0.58);
}
.today-brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.today-brief-kicker {
  margin: 0 0 4px;
  color: var(--gold-deep);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.today-brief-main {
  margin: 0;
  color: var(--heading);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.25;
}
.today-brief-sub {
  margin: 5px 0 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.today-surprise {
  /* Hidden for everyone per Andrew 2026-06-22 (not sure it's needed). Reversible — just
     remove this display:none to bring "Surprise me" back. */
  display: none;
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}
.today-empty { margin-bottom: 18px; }

/* On This Day reflection — a short woven story of the day, drawn from the family's own
   letters and photo folders. Reads as a quiet lead before the year-by-year cards.
   Responsive across desktop / iPad / phone via a fluid measure + type. */
.today-reflection {
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.today-reflection[hidden] { display: none; }
.today-reflection.is-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--meta);
  font-family: var(--sans);
  font-style: italic;
}
.today-reflection-note { font-size: 0.92rem; }
/* Preview + bottom "Read more / Show less" — click-only, no hover (works on iPad). */
.today-reflection.is-clamped .today-reflection-body {
  max-height: 6.2em;
  overflow: hidden;
  position: relative;
}
.today-reflection.is-clamped .today-reflection-body::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 3.4em;
  background: linear-gradient(to bottom, rgba(249, 246, 239, 0), rgba(249, 246, 239, 0.97));
  pointer-events: none;
}
.today-reflection-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 0;
}
.today-reflection-more {
  padding: 4px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--gold);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--gold-deep);
}
.today-reflection-regen {
  padding: 4px 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--meta);
  white-space: nowrap;
}
.today-reflection-body {
  max-width: none;            /* fill the card's full width */
}
/* Two readable columns on wide screens so the full width is used without
   stretching prose into over-long lines; collapses to one column below. */
@media (min-width: 1000px) {
  .today-reflection-body {
    column-count: 2;
    column-gap: 40px;
    column-fill: balance;
  }
  /* No break-inside:avoid — it shoved any paragraph that wouldn't fit wholesale into
     the next column, leaving a big gap at the foot of the first. Let prose flow and
     split at the column boundary so both columns fill evenly. */
}
.today-reflection-body p {
  margin: 0 0 0.8em;
  font-family: var(--serif);
  font-size: clamp(1.06rem, 1.0rem + 0.3vw, 1.17rem);
  line-height: 1.72;
  color: var(--ink);
}
/* Quoted italics read smaller at the same point size (serif italic has a lower x-height),
   so nudge them up a touch to match the upright body text. */
.today-reflection-body em { font-size: 1.04em; }
.today-reflection-body p:last-child { margin-bottom: 0; }
/* Emoji stay upright even inside *italic* quotes (the synthetic slant looks odd on them). */
.today-reflection-body .emoji { font-style: normal; }
@media (max-width: 600px) {
  .today-reflection { padding: 16px; }
  .today-reflection-body { max-width: none; }
  .today-reflection-body p { line-height: 1.68; }
}
.today-nearby {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.today-nearby-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.today-nearby-head h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.today-nearby-head p {
  margin: 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.86rem;
}
.today-nearby-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.today-nearby-card {
  width: auto;
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--heading);
  text-align: left;
}
.today-nearby-card span {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.15;
}
.today-nearby-card em {
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 600;
}
.today-nearby-card:hover { border-color: var(--gold); background: var(--paper-deep); }
.nas-day-media {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.section-kicker {
  margin-bottom: 6px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nas-day-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}
.nas-day-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3vw, 2rem);
  color: var(--heading);
}
.nas-day-head p {
  margin: 4px 0 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.92rem;
}
.nas-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}
.nas-media-tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  text-decoration: none;
}
.nas-media-tile::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid rgba(129, 115, 91, 0.22);
  border-top-color: var(--gold);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}
.nas-media-tile.is-loaded::before { display: none; }
.nas-media-tile img,
.nas-media-tile .nas-video-thumb {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transform: rotate(var(--media-rotation, 0deg));
  transform-origin: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.nas-media-tile.is-loaded img,
.nas-media-tile.is-loaded .nas-video-thumb {
  opacity: 1;
}
.nas-media-tile.upload-delete-failed,
.browse-folder-card.upload-delete-failed {
  outline: 3px solid rgba(178, 41, 41, 0.82);
  outline-offset: 2px;
}
.nas-media-placeholder,
.media-preparing {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}
.nas-media-tile:hover img,
.nas-media-tile:hover .nas-video-thumb { transform: rotate(var(--media-rotation, 0deg)) scale(1.025); }
.nas-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(18, 22, 26, 0.72);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  padding-left: 3px;
}
.nas-media-tile.is-unstreamable img { filter: saturate(0.85); }
.nas-media-tile.is-unstreamable .nas-play {
  padding-left: 0;
  font-family: var(--sans);
  font-weight: 900;
}
.nas-video-note {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(18, 22, 26, 0.72);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
}
.nas-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.92rem;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}
.nas-event {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.nas-event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0 0 10px;
}
.nas-event-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.nas-event-year { color: var(--meta); }
.nas-event-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--meta);
}
.nas-inline-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 16px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.nas-inline-loading.is-error { color: var(--gold-deep); }
.nas-more-button {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
}
.nas-more-button span {
  display: block;
  margin-top: 2px;
  color: var(--meta);
  font-size: 0.78rem;
  font-weight: 600;
}
.nas-more-button:hover { border-color: var(--gold); }
@keyframes spin { to { transform: rotate(360deg); } }
.letter-preview p, .detail-body p {
  margin: 0 0 1em;
}
.letter-preview p:last-child, .detail-body p:last-child { margin-bottom: 0; }
.media-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.media-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}
.text-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--heading);
}
.text-button:hover { background: var(--paper-deep); }
.open-button {
  border-color: var(--heading);
  background: var(--heading);
  color: var(--paper);
}
/* .open-button: no hover fill — stays readable on touch. */
.admin-curation {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-family: var(--sans);
}
.admin-mark {
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--meta);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.admin-mark.active {
  border-color: var(--gold);
  background: var(--paper-deep);
  color: var(--heading);
}
.admin-curation .admin-mark:hover { background: var(--paper); color: var(--meta); }
.admin-curation .admin-mark.active:hover { background: var(--paper-deep); color: var(--heading); }
.admin-curation.is-saving { opacity: 0.55; pointer-events: none; }
.admin-curation.is-error .admin-mark { border-color: #9b2f2f; }
/* Admin "Curate <-> Family view" toggle — sits in the forward bar, replaces the FWD
   checkbox while curating. */
.admin-mode-toggle {
  min-height: 28px;
  padding: 3px 11px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: var(--paper-deep);
  color: var(--heading);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* No hover/press visual: the global button:hover rule turns this navy and can stick. */
.admin-mode-toggle:hover,
.admin-mode-toggle:active,
.admin-mode-toggle:focus,
.admin-mode-toggle:focus-visible {
  border-color: var(--gold) !important;
  background: var(--paper-deep) !important;
  color: var(--heading) !important;
  box-shadow: none !important;
  outline: none !important;
}
.admin-mode-toggle[hidden] { display: none; }
/* Curate-view tags: letters that are off the family view, flagged so their state is obvious. */
.cur-tag {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.cur-tag-hidden { color: #9b2f2f; border-color: #d9adad; background: #fbf2f2; }
.cur-tag-fwd { color: var(--gold-deep); border-color: var(--gold); background: var(--paper-deep); }
.letter-card.cur-hidden h3 a { opacity: 0.7; }
.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--meta);
  background: #fff;
  text-align: center;
  font-style: italic;
}
.scroll-sentinel {
  width: 100%;
  height: 1px;
}

.detail-view {
  padding-top: 30px;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.inline-back-button {
  width: fit-content;
  margin: 0;
}
.detail-pager { display: flex; gap: 8px; flex: none; }
.pager-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--heading);
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;
}
.pager-btn:hover { border-color: var(--gold); }
.pager-btn.is-disabled { color: var(--light-meta); opacity: 0.4; pointer-events: none; }
.detail-card {
  max-width: 880px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(30, 58, 79, 0.08);
}
.detail-card h2 {
  margin: 14px 0 24px;
  font-size: clamp(1.85rem, 5vw, 2.8rem);
}
.detail-body {
  max-width: 76ch;
  font-size: clamp(1.06rem, 2vw, 1.18rem);
}
.detail-media {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.detail-media h3 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.media-admin-actions {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  z-index: 4;
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.nas-media-tile:hover .media-admin-actions,
.nas-media-tile:focus-within .media-admin-actions {
  opacity: 1;
  pointer-events: auto;
}
.media-admin-button {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 6px;
  background: rgba(30,58,79,0.92);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
}
.media-admin-button.icon {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}
.media-admin-button:hover,
.media-admin-button:focus-visible {
  background: var(--gold-deep);
  color: #fff;
}
.media-admin-button.danger {
  background: rgba(151, 36, 36, 0.94);
  border-color: rgba(255,255,255,0.78);
}
.media-admin-button.danger:hover,
.media-admin-button.danger:focus-visible {
  background: #b22929;
}
.media-admin-button.is-saving {
  opacity: 0.7;
  pointer-events: none;
}
.media-admin-button.is-error {
  background: #8b2f2f;
}
.folder-cover-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.browse-folder-card:hover .folder-cover-actions,
.browse-folder-card:focus-within .folder-cover-actions {
  opacity: 1;
  pointer-events: auto;
}
.cover-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(26, 34, 38, 0.54);
}
.cover-crop-dialog {
  width: min(92vw, 560px);
  max-height: min(92vh, 760px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(0,0,0,0.28);
}
.cover-crop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.cover-crop-head h3 {
  margin: 0;
  font-size: 1.35rem;
}
.cover-crop-close {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}
.cover-crop-close:hover,
.cover-crop-close:focus-visible {
  background: var(--paper-deep);
  color: var(--heading);
}
.cover-crop-preview {
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-deep);
}
.cover-crop-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-crop-tools {
  display: flex;
  justify-content: center;
  margin: -4px 0 16px;
}
.cover-crop-rotate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}
.cover-crop-rotate:hover,
.cover-crop-rotate:focus-visible {
  border-color: var(--gold);
  background: var(--paper-deep);
}
.cover-crop-controls {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  font-family: var(--sans);
}
.cover-crop-controls label {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;
  color: var(--meta);
  font-size: 0.82rem;
  font-weight: 800;
}
.cover-crop-controls label.is-disabled {
  opacity: 0.42;
}
.cover-crop-controls input {
  width: 100%;
  min-height: 34px;
  accent-color: var(--heading);
}
.cover-crop-controls input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 34px;
  background: transparent;
  cursor: pointer;
}
.cover-crop-controls input[type="range"]:disabled {
  cursor: not-allowed;
}
.cover-crop-controls input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}
.cover-crop-controls input[type="range"]:disabled::-webkit-slider-runnable-track {
  background: #e8e2d8;
}
.cover-crop-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--heading);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.cover-crop-controls input[type="range"]:disabled::-webkit-slider-thumb {
  background: #b9b0a5;
  box-shadow: none;
}
.cover-crop-controls input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}
.cover-crop-controls input[type="range"]:disabled::-moz-range-track {
  background: #e8e2d8;
}
.cover-crop-controls input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--heading);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.cover-crop-controls input[type="range"]:disabled::-moz-range-thumb {
  background: #b9b0a5;
  box-shadow: none;
}
.cover-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(26, 34, 38, 0.54);
}
.confirm-dialog {
  width: min(92vw, 430px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(0,0,0,0.28);
}
.confirm-head {
  margin-bottom: 10px;
}
.confirm-head h3 {
  margin: 0;
  font-size: 1.2rem;
}
.confirm-dialog p {
  margin: 0 0 18px;
  color: var(--body);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.45;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.confirm-danger {
  background: #8b2f2f;
}
.confirm-danger:hover,
.confirm-danger:focus-visible {
  background: #6f2525;
}
.browse-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
@media (hover: none) {
  .media-admin-actions {
    opacity: 1;
    pointer-events: auto;
  }
  .folder-cover-actions {
    opacity: 1;
    pointer-events: auto;
  }
}
.video-block {
  margin: 0;
}
.video-block { text-align: center; }
.video-block video {
  display: inline-block;
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-deep);
}
.video-thumb {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}
.video-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.video-block figcaption, .media-note {
  margin: 8px 0 0;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.88rem;
}
.video-download {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.video-download img {
  display: block;
  width: min(100%, 420px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid var(--heading);
  background: var(--heading);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}
/* .download-button: no hover fill — stays readable on touch. */
.audio-block {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.audio-block figcaption {
  margin: 0 0 10px;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.audio-block audio {
  width: 100%;
  min-height: 40px;
}
/* Media view: type filter chips + per-entry player blocks */
/* Media results is a focused single-column list (it carries inline players),
   so override the 2-column .letter-list grid it shares. */
#mediaResults { grid-template-columns: minmax(0, 1fr); }
.media-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  grid-column: 1 / -1;
  align-self: start;
}
.media-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}
.media-chip span { color: var(--light-meta); font-weight: 600; }
.media-chip:hover { border-color: var(--gold); }
.media-chip.active { background: var(--heading); color: #fff; border-color: var(--heading); }
.media-chip.active span { color: rgba(255, 255, 255, 0.72); }
/* Date-order toggle, pushed to the right of the filter chips. */
.media-order {
  margin-left: auto;
  width: auto;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.media-order:hover { border-color: var(--gold); }
@media (max-width: 480px) { .media-order { margin-left: 0; } }
.media-entry {
  display: grid;
  gap: 12px;
  padding: clamp(18px, 4vw, 26px);
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.media-entry h3 { margin: 0; }
.media-entry .letter-link { color: var(--heading); text-decoration: none; }
.media-entry .letter-link:hover { text-decoration: underline; }
/* Uniform-height rows: every thumbnail is the same height and keeps its own
   aspect ratio (width varies), so mixed portrait/landscape photos line up in
   tidy rows with nothing cropped. Tap opens the full image. */
.photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.photo-block {
  margin: 0;
  flex: 0 1 auto;
}
.photo-block a {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-deep);
  cursor: zoom-in;
}
.photo-block img {
  display: block;
  height: 168px;
  width: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
}
@media (min-width: 620px) {
  .photo-block img { height: 200px; }
}
@media (max-width: 460px) {
  .photo-block img { height: 132px; }
}
.detail-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.detail-nav a:last-child { text-align: right; }
.detail-nav a {
  color: var(--heading);
  font-family: var(--sans);
  font-weight: 800;
  text-decoration: none;
}
.detail-nav a:hover { text-decoration: underline; }

.login-page {
  display: grid;
  min-height: 100svh;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  place-items: center;
}
.login-cover {
  width: min(100%, 560px);
  text-align: center;
}
.login-cover .framed-photo { width: min(78vw, 260px); }
.login-form {
  display: grid;
  gap: 14px;
  width: min(100%, 380px);
  margin: 26px auto 0;
  text-align: left;
}
.login-form label {
  display: grid;
  gap: 6px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.form-error {
  min-height: 1.3em;
  margin: 0;
  color: var(--rose);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}
.login-footnote {
  margin: 18px 0 0;
  color: var(--light-meta);
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
}

.site-footer {
  margin-top: clamp(48px, 8vh, 76px);
  padding-top: 26px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-footer p {
  margin: 10px 0 0;
  color: var(--light-meta);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.footer-butterfly { width: 34px; }

@media (min-width: 680px) {
  .date-tools { grid-template-columns: 1fr 0.8fr 1fr auto auto; align-items: end; }
  .filter-bar { grid-template-columns: minmax(200px, 1fr) 170px 110px 130px auto; align-items: end; }
}

@media (min-width: 900px) {
  .letter-list,
  .year-group .letter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-card { margin: 0 auto; }
  /* The dashboard's six stats sit on one row. */
  #summaryTiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 879px) {
  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }
  /* On This Day header on phones: keep the date + Year/fwd controls on ONE row. */
  .today-head-row { gap: 8px; }
  .today-head-main { min-width: 0; }
  .today-head .day-stepper { gap: 5px; }
  .today-head .day-step-btn { width: 32px; height: 32px; }
  .today-head .day-step-btn svg { width: 15px; height: 15px; }
  .today-head h2 { font-size: 1.55rem; }
  .date-tools.today-controls { flex: 0 0 auto; flex-wrap: nowrap; margin: 0; gap: 9px; }
  .today-controls #forwardBar::before { content: none; }   /* drop the · on mobile */
  .today-brief { padding: 14px; }
  .today-brief-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .today-surprise { width: 100%; }
  .today-nearby-head {
    display: grid;
    gap: 4px;
  }
  .today-nearby-list { grid-template-columns: 1fr; }
  .today-nearby-card { width: 100%; }
  /* The multi-line stat list belongs in the desktop sidebar; the compact mobile/iPad
     header (with the bottom tab bar) stays clean without it. */
  .sidebar-stat { display: none; }
  /* Top bar: solid (not sticky), subtle tan; brand + Sign-out icon on row 1,
     counter on row 2. */
  .sidebar { flex-wrap: nowrap; backdrop-filter: none; background: var(--paper-deep); position: static; }
  .brand { order: 1; flex: 1 1 auto; min-width: 0; }
  .brand-name { min-width: 0; }
  .settings-button { order: 2; flex: none; margin-left: 0; padding: 6px; min-height: 0; width: auto; border: 0; background: transparent; }
  .settings-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.is-admin .admin-nav {
    order: 2;
    flex: none;
    flex-direction: row;
    gap: 4px;
    margin: 0 2px 0 auto;
  }
  .admin-nav-divider { display: none; }
  .admin-nav a {
    /* flex, NOT grid: with grid the hidden text label (font-size:0) still takes a
       second row and shoves the icon ~6px above centre (Andrew's iPhone finding). */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;                /* the desktop rule's 10px gap pairs with the zero-width label and drags the icon 5px off-centre */
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 999px;
    color: var(--heading);
    font-size: 0;
  }
  .admin-nav .nav-icon {
    display: block;
    width: 22px;
    height: 22px;
  }
  .admin-nav a[aria-current="page"] {
    background: var(--paper);
    box-shadow: inset 0 0 0 1px var(--line);
  }
  .sidebar-logout { order: 3; flex: none; margin-left: auto; }
  body.is-admin .sidebar-logout { margin-left: 4px; }   /* same rhythm as the 4px admin-nav gap */
  .sidebar-stat { order: 4; flex-basis: 100%; text-align: right; min-width: 0; }
  /* Sign out becomes an icon-only button in the header. */
  .signout-button { padding: 0; width: 36px; height: 36px; min-height: 0; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
  .signout-button:hover { background: transparent; }
  .signout-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .icon-signout { width: 22px; height: 22px; color: var(--heading); }
  .icon-settings { width: 22px; height: 22px; color: var(--heading); }

  /* Native tab bar: full-width, flush to the bottom edge, icon over label. */
  .primary-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    flex: 0;
    flex-wrap: nowrap;
    justify-content: space-around;
    gap: 0;
    padding: 8px 4px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 -2px 14px rgba(30, 58, 79, 0.07);
  }
  .primary-nav a {
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 0;
    padding: 2px;
    border-radius: 0;
    font-size: 0.66rem;
    font-weight: 600;
  }
  .primary-nav a:hover { background: transparent; }
  /* The six tabs share the row equally (min-width:0); full labels are too long, so
     swap each to its short form (data-short) on one line. Keeps every icon visible. */
  .primary-nav a { min-width: 0; }
  .primary-nav a span { white-space: nowrap; font-size: 0; line-height: 1.1; }
  .primary-nav a span::after { content: attr(data-short); font-size: 0.66rem; }
  .nav-icon { display: block; }
  .primary-nav a.active { background: transparent; color: var(--heading); }
  .primary-nav a.active .nav-icon { color: var(--gold-deep); }

  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary-tile { min-height: 0; padding: 14px; }
  .summary-tile strong { font-size: 1.4rem; }
  .summary-tile em { font-size: 0.82rem; }
  .year-group > h3, .month-group > h3 {
    top: 0;
  }
  /* Drop the decorative footer on phones — the tab bar owns the bottom edge. */
  .site-footer { display: none; }
  .detail-nav {
    grid-template-columns: 1fr;
  }
  .detail-nav a, .detail-nav a:last-child {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .app-shell { padding-inline: 14px; }
  .sidebar { padding-inline: 12px; }
  button { width: 100%; }
  #userSettingsButton { width: auto; }
  #logoutForm button { width: 36px; }   /* match the 36px header circles; auto shrank it to the bare 22px icon */
  /* More + Open letter share one row instead of stacking. */
  .card-actions { flex-wrap: nowrap; }
  .card-actions .text-button { flex: 1; width: auto; min-width: 0; }
}

/* On phones app.js drops the forwarded toggle here, at the bottom of the page,
   as a tidy card. Empty (so hidden) on desktop. */
.account-slot {
  margin-top: 24px;
}
.account-slot:empty { display: none; }
/* The forwarded toggle is hidden on non-letter views via the [hidden] attribute, but the
   display rules below (and the desktop .sidebar-toggle) would otherwise override it. Make
   [hidden] win everywhere — this is what actually hides it on iPad/iPhone. */
#forwardBar[hidden] { display: none !important; }
.account-slot .sidebar-toggle {
  display: block;
  flex-basis: auto;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-deep);
}

/* Compact filters on phones: the three dropdowns sit on one line; full-width
   fields/buttons span the row. Covers Archive filters + On This Day pickers. */
@media (max-width: 679px) {
  .filter-bar, .date-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
  }
  .filter-bar .wide-filter,
  .filter-bar #clearFilters,
  .date-tools button { grid-column: 1 / -1; }
  .filter-bar select, .date-tools select { padding-inline: 8px; }
}

@media (max-width: 760px) {
  .user-settings-overlay {
    align-items: stretch;
    padding: 10px;
  }
  .user-settings-panel {
    max-height: calc(100svh - 20px);
    padding: 18px;
  }
  .settings-tabs {
    width: 100%;
  }
  .settings-tabs button {
    flex: 1;
    padding: 0 8px;
  }
  .user-create-form,
  .user-row {
    grid-template-columns: 1fr;
  }
  .user-row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .user-row-summary {
    padding-bottom: 2px;
  }
  .activity-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .activity-meta { text-align: left; }
}

/* --- Photo lightbox ----------------------------------------------------- */
body.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: rgba(24, 26, 30, 0.86);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.lightbox[hidden] { display: none; }
.lightbox-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 920px);
}
.lightbox-frame {
  position: relative;
  width: auto;
  max-width: 100%;
  min-width: 120px;
  min-height: 120px;
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.lightbox-frame.is-photo,
.lightbox-frame.is-video {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
}
.lightbox-caption {
  position: relative;
  z-index: 3;
  align-self: stretch;
  margin: 0;
  padding: 10px 2px 0;
  color: rgba(48, 42, 36, 0.68);
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lightbox-caption span { display: block; text-align: left; }
.lightbox-caption:empty { display: none; }
.lightbox-frame.is-loading::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  /* Visible on any backdrop: white arc + neutral-grey ring, with a soft dark halo
     so it still reads when the frame/image behind it is light. */
  border: 3px solid rgba(150, 150, 150, 0.4);
  border-top-color: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.55));
  animation: spin 0.8s linear infinite;
}
.lightbox-frame .lightbox-media {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  max-height: 78vh;
  height: auto;
  transition: opacity 0.18s ease;
}
.lightbox-frame.is-loading .lightbox-media { opacity: 0; }
.lightbox-photo-box {
  position: relative;
  display: block;
  overflow: visible;
}
.lightbox-photo-box > img.lightbox-media {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  max-height: none;
}
/* Blur-up: thumbnail placeholder shows blurred, then sharpens when full-res swaps in. */
.lightbox-frame img.lightbox-media { transition: filter 0.35s ease, opacity 0.18s ease, transform 0.18s ease; }
.lightbox-frame img.lightbox-media.lb-blur { filter: blur(14px); }
.lightbox-frame.is-photo .lightbox-media {
  width: auto;
  height: auto;
  max-width: 896px;
  max-height: 736px;
  /* No object-fit: the JS sizes the element to the photo's true aspect (one dimension +
     auto), so the white frame hugs the image with just its static 12px padding — no letterbox. */
}
.lightbox-frame.is-photo .lightbox-photo-box > img.lightbox-media {
  max-width: none;
  max-height: none;
}
.lightbox-frame img.lightbox-media { width: auto; }
/* Year section headers inside a multi-source Special collection (e.g. Mt Binga
   2017 / 2020). Spans the full grid width so each year's photos sit under it. */
.nas-media-grid .special-year-head {
  grid-column: 1 / -1;
  margin: 18px 2px 2px;
  font-family: var(--serif, Georgia, serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading, #2a2a2a);
  border-bottom: 1px solid var(--line, #e2ddd4);
  padding-bottom: 6px;
}
.nas-media-grid .special-year-head:first-child { margin-top: 0; }
/* Browse-by-Year drill-down breadcrumbs */
.browse-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.browse-crumb {
  border: 0; background: none; padding: 2px 2px; cursor: pointer;
  font-family: var(--sans); font-size: 0.86rem; font-weight: 600; color: var(--gold, #b08d57);
}
.browse-crumb:hover { text-decoration: underline; }
.browse-crumb-sep { color: var(--meta); opacity: 0.6; }
.browse-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.browse-heading {
  font-family: var(--serif, Georgia, serif); font-size: 1.4rem; font-weight: 600;
  color: var(--heading, #2a2a2a); margin: 0;
}
.browse-folder-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.browse-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.browse-nav-button span {
  color: var(--gold);
  font-size: 1rem;
  line-height: 1;
}
.browse-nav-button:hover {
  border-color: var(--gold);
  background: var(--paper-deep);
}
.browse-folder-section {
  margin: 16px 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.browse-folder-section + .nas-media-grid {
  margin-top: 4px;
}
.special-grid.browse-folder-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-items: stretch;
}
.browse-folder-card {
  min-height: 236px;
}
.browse-folder-card .special-card-thumb {
  flex: 0 0 auto;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--line);
}
.browse-folder-card .special-card-title {
  display: block;
  flex: 0 0 auto;
  padding: 11px 12px 3px;
  color: var(--heading);
  font-family: var(--serif, Georgia, serif);
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.browse-folder-card .special-card-meta {
  display: block;
  margin-top: auto;
  padding: 3px 12px 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .browse-crumbs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 5px;
    margin: 0 0 12px;
    text-align: left;
  }
  .browse-crumb {
    flex: 0 0 auto;
    width: auto;
    padding: 2px 0;
  }
  .browse-crumb-sep { flex: 0 0 auto; }
  .browse-heading-row {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
  }
  .browse-heading { width: 100%; }
  .browse-folder-nav {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 0 0;
  }
  .browse-nav-button {
    flex: 1 1 0;
    width: auto;
    min-height: 36px;
    justify-content: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 0.78rem;
  }
  .browse-folder-section {
    margin: 14px 0 22px;
    padding-bottom: 20px;
  }
  .special-grid.browse-folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .browse-folder-card {
    min-height: 198px;
  }
  .browse-folder-card .special-card-title {
    padding: 9px 9px 2px;
    font-size: 0.9rem;
    line-height: 1.22;
  }
  .browse-folder-card .special-card-meta {
    padding: 3px 9px 10px;
    font-size: 0.76rem;
  }
}
/* Interactive family-tree pedigree diagram */
.ped-hint { font-size: 0.85rem; color: var(--meta); margin: 0 0 10px; }
.ped-viewport {
  position: relative; overflow: hidden;
  height: min(72vh, 720px); width: 100%;
  border: 1px solid var(--line, #e2ddd4); border-radius: 12px;
  background: var(--bg-tint, #faf8f3);
  background-image: radial-gradient(rgba(129,115,91,0.10) 1px, transparent 1px);
  background-size: 22px 22px;
  cursor: grab; touch-action: none; user-select: none;
}
.ped-viewport.dragging { cursor: grabbing; }
.ped-canvas { position: absolute; top: 0; left: 0; transform-origin: top left; will-change: transform; }
.ped-links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.ped-link { fill: none; stroke: var(--gold, #b08d57); stroke-width: 1.6; opacity: 0.55; }
.ped-node {
  position: absolute; display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; text-align: left; cursor: pointer;
  background: var(--card, #fff); border: 1px solid var(--line, #d9d2c4);
  border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.ped-node:hover { border-color: var(--gold, #b08d57); box-shadow: 0 4px 12px rgba(0,0,0,0.14); z-index: 5; }
.ped-node-thumb {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 8px; overflow: hidden;
  background: var(--line, #e7e1d6); display: block;
}
.ped-node-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ped-node-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ped-node-name {
  font-family: var(--serif, Georgia, serif); font-size: 0.84rem; font-weight: 600;
  color: var(--heading, #2a2a2a); line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ped-node-meta { font-family: var(--sans); font-size: 0.7rem; color: var(--meta); }
.ped-zoom-controls { position: absolute; top: 10px; right: 10px; z-index: 6; display: flex; gap: 4px; }
.ped-zoom-controls button {
  width: 32px; height: 32px; border: 1px solid var(--line, #d9d2c4); border-radius: 8px;
  background: rgba(255,255,255,0.92); color: var(--heading, #2a2a2a);
  font-size: 1.1rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ped-zoom-controls button:hover { border-color: var(--gold, #b08d57); }
.ped-extras { margin-top: 28px; }
.ped-extra-group { margin-bottom: 18px; }
/* Family Tree generation section headings */
.family-section-head {
  font-family: var(--serif, Georgia, serif);
  font-size: 1.2rem; font-weight: 600; color: var(--heading, #2a2a2a);
  border-bottom: 1px solid var(--line, #e2ddd4);
  padding-bottom: 6px; margin: 28px 2px 14px;
}
.family-section-head:first-child { margin-top: 0; }
/* Cassettes & LPs audio list — collapsible categories */
/* Cassettes & LPs: category cards are launchers in a grid; tapping drills into a full-width
   panel for that category (filterable + paginated), instead of expanding in place. */
.audio-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.audio-cat-card { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; }
.audio-cat-card:hover { border-color: var(--gold); }
.audio-cat-name { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; flex: 1; }
.audio-cat-count { color: var(--meta); font-size: 0.82rem; white-space: nowrap; }
.audio-cat-go { color: var(--gold-deep); font-weight: 700; }
.audio-panel-head { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 2px; flex-wrap: wrap; }
.audio-panel-head h3 { font-family: var(--serif); font-size: 1.6rem; margin: 0; }
.audio-panel-count { color: var(--meta); font-size: 0.9rem; }
.audio-filter { width: 100%; max-width: 540px; margin: 12px 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--paper); }
.audio-track-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px) { .audio-track-list { grid-template-columns: 1fr 1fr; gap: 12px; } }
.audio-track { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.audio-track-head { display: flex; flex-direction: column; margin-bottom: 7px; }
.audio-track-title { font-family: var(--serif); font-weight: 600; line-height: 1.3; }
.audio-track-folder { color: var(--meta); font-size: 0.78rem; margin-top: 1px; }
.audio-track audio { width: 100%; height: 36px; }
.audio-group[open] { padding-bottom: 6px; }
.audio-group-title {
  display: flex; align-items: baseline; gap: 10px;
  cursor: pointer; user-select: none; list-style: none;
  font-family: var(--serif, Georgia, serif);
  font-size: 1.1rem; font-weight: 600; color: var(--heading, #2a2a2a);
  padding: 12px 14px; background: var(--card, #fff);
}
.audio-group-title::-webkit-details-marker { display: none; }
.audio-group-title::before {
  content: "▸"; display: inline-block; color: var(--gold, #b08d57);
  transition: transform 0.15s ease; font-size: 0.9em;
}
.audio-group[open] > .audio-group-title::before { transform: rotate(90deg); }
.audio-group .audio-list { padding: 4px 14px 8px; }
.audio-group-count { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: var(--meta); }
.audio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.audio-item {
  display: grid; gap: 8px;
  padding: 12px 14px; border: 1px solid var(--line, #e2ddd4); border-radius: 10px;
  background: var(--card, #fff);
}
.audio-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.audio-item-title { font-weight: 600; color: var(--heading, #2a2a2a); }
.audio-item-folder { font-size: 0.78rem; color: var(--meta); }
.audio-item audio { width: 100%; height: 36px; }
/* Accurate video loading indicator: shows "Preparing…" while the NAS spins up the
   transcode (nothing buffered yet), then a real "Loading NN%" (buffered ÷ known
   total duration) as segments arrive, and hides the moment playback starts. It's
   an additive overlay with pointer-events:none so it never intercepts the video
   controls or interferes with decoding. */
.lightbox-frame .video-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: opacity 0.25s ease;
}
.lightbox-frame .video-loading.is-hidden { opacity: 0; }
/* Let the video size to its own aspect ratio (portrait or landscape) within the
   max bounds, so the frame wraps it snugly with no side padding. */
.lightbox-frame video.lightbox-media { width: auto; max-width: min(86vw, 760px); background: #000; }
.lightbox-download {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: min(86vw, 760px);
  color: var(--heading);
  font-family: var(--sans);
}
.lightbox-download img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  border-radius: 6px;
}
.lightbox-count {
  margin: 0;
  min-width: 66px;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}
/* Single image (no page count): collapse the empty count so it doesn't reserve its 66px and
   shove the location pin off-centre — the pin then sits truly centred. */
.lightbox-count:empty { display: none; }
.lightbox-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.lightbox-map {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.62);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.08s ease;
}
.lightbox-map svg { width: 19px; height: 19px; display: block; }
.lightbox-map:hover,
.lightbox-map:focus-visible {
  outline: none;
  background: rgba(28, 28, 30, 0.8);
}
.lightbox-map:active { transform: scale(0.94); }
.lightbox-map[hidden] { display: none; }
/* Pin prev/next to the viewport edges (not the photo) so no image size can shift
   them — they stay put while you page through. */
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 110;
}
/* Sit just outside the widest a photo/video can be (image max-width is
   min(92vw, 920px), so half is min(46vw, 460px)); clamped so they stay
   on-screen on phones. Fixed position => they never move between images. */
.lightbox-nav.lb-prev { right: min(calc(50% + min(46vw, 460px) + 14px), calc(100% - 52px)); left: auto; }
.lightbox-nav.lb-next { left: min(calc(50% + min(46vw, 460px) + 14px), calc(100% - 52px)); right: auto; }
/* Bare overlay icons — no circle, no fill, no shadow. Just the glyph. */
.lightbox-close,
.lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, transform 0.08s ease;
}
.lightbox-close svg,
.lightbox-nav svg { width: 20px; height: 20px; display: block; }
.lightbox-close:hover,
.lightbox-nav:hover { opacity: 0.7; }
.lightbox-close:active { transform: scale(0.9); }
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible { outline: none; opacity: 0.7; }
.lightbox-nav {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: rgba(18, 22, 26, 0.18);
}
.lightbox-nav svg { width: 28px; height: 28px; }
.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(18, 22, 26, 0.34);
}
/* The stage is focused on open (tabindex -1) for Escape/screen-readers — no blue ring. */
.lightbox-stage:focus, .lightbox:focus { outline: none; }
/* X sits on the image itself (top-right of the frame). */
/* Elegant ✕: a small frosted circle straddling the top-right corner of the frame. */
.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  z-index: 7;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.lightbox-close svg { width: 15px; height: 15px; }

/* Bigger prev/next arrows for touch devices (iPad/iPhone) in the lightbox. */
@media (pointer: coarse) {
  .lightbox .lightbox-nav { width: 68px; height: 68px; }
}
.lightbox-nav[hidden] { display: none; }
@media (max-width: 600px) {
  .lightbox { padding: 12px; gap: 4px; }
  .lightbox-frame { padding: 8px; }
  .lightbox-frame img { max-height: 70vh; }
  .lightbox-close { width: 36px; height: 36px; }
  /* On phones the archive counter wraps to two cramped rows — drop it; the brand
     and tab bar are enough. (iPad portrait keeps it: it fits on one line there.) */
  .sidebar-stat { display: none; }
}

/* ---- Special Collections (undated folders) ---- */
.special-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.special-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-deep);
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  color: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.special-card:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(33, 27, 18, 0.12);
  transform: translateY(-2px);
  background: var(--paper-deep);
  color: inherit;
}
.special-card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  overflow: hidden;
}
.special-card-thumb.is-placeholder {
  display: grid;
  place-items: center;
}
.special-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.special-card-thumb img.cover-img {
  opacity: 0;
  transition: opacity 0.18s ease;
}
.special-card-thumb.is-loaded img.cover-img {
  opacity: 1;
}
/* Mix Books: each cover is a tight-cropped book with its own baked drop shadow, so
   show the whole book (no cropping), centred on the paper, all the same box size. */
.mixbook-card .special-card-thumb {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px 6px;
}
.mixbook-card .special-card-thumb img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
/* The whole card is a link, so kill the default underlines: the title reads as a clean
   heading, and "Open the book" becomes a quiet gold prompt that only underlines on hover. */
.mixbook-card { text-decoration: none; color: inherit; }
.mixbook-card .special-card-title {
  text-decoration: none;
  color: var(--ink);
}
.mixbook-card .special-card-meta {
  text-decoration: none;
  color: var(--gold-deep);
  font-weight: 600;
  padding-top: 3px;
}
.mixbook-card:hover .special-card-title { color: var(--gold-deep); }
.mixbook-card:hover .special-card-meta { text-decoration: underline; }
.special-card-title {
  padding: 10px 12px 2px;
  font-weight: 600;
  line-height: 1.3;
}
.special-card-meta {
  padding: 0 12px 12px;
  font-size: 0.82rem;
  color: var(--ink-soft, #6c6453);
}
/* Mum's Books = a Recipe Book group above the Mix Books grid. Each group has its
   own heading; the recipe card shows the portrait front-cover filling the thumb. */
.book-group + .book-group { margin-top: 30px; }
.book-group-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 170px));
  gap: 16px;
}
/* Caption sits on clean near-white with a hairline divider, so the text panel reads
   as its own band instead of blending into the cream cover above it. */
.recipe-card { text-decoration: none; color: inherit; background: var(--paper); }
.recipe-card:hover { background: var(--paper); }
.recipe-card .special-card-thumb { aspect-ratio: 3 / 4; background: var(--paper); border-bottom: 1px solid var(--line); }
.recipe-card .special-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-card .special-card-title { text-decoration: none; color: var(--ink); }
.recipe-card:hover .special-card-title { color: var(--gold-deep); }
.recipe-card-meta { padding-bottom: 2px; }
.recipe-card-cta { color: var(--gold-deep); font-weight: 600; padding-top: 0; }
.recipe-card:hover .recipe-card-cta { text-decoration: underline; }
/* Phones: compact horizontal recipe-book card (cover left, text right) */
@media (max-width: 600px) {
  .recipe-grid { grid-template-columns: 1fr; }
  .recipe-card { display: grid; grid-template-columns: 72px 1fr; column-gap: 14px; align-items: center; padding: 12px; }
  .recipe-card .special-card-thumb { grid-column: 1; grid-row: 1 / span 3; width: 72px; aspect-ratio: 3 / 4; border-bottom: 0; border-radius: 8px; }
  .recipe-card .special-card-title { grid-column: 2; padding: 0; }
  .recipe-card .special-card-meta { grid-column: 2; padding: 2px 0 0; }
}
.special-collection-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.special-collection-head h3 { margin: 0; }
.special-collection-head .section-note { width: 100%; margin: 0; }

/* Loading placeholder over a lightbox video: the poster image + a spinner (so
   Safari doesn't show a bare black box while it buffers). Hidden once playing. */
.lightbox-frame { position: relative; }
.lightbox-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
}
.lightbox-loading.is-on { display: flex; }
.lightbox-loading img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.5;
}
.lightbox-loading .spinner {
  position: relative;
  z-index: 1;
  width: 46px;
  height: 46px;
  border-width: 4px;
}

/* Family Tree card context (the branch breadcrumb under the title) */
.special-card-context {
  padding: 0 12px 2px;
  font-size: 0.72rem;
  color: var(--ink-soft, #8a8270);
  line-height: 1.25;
}

/* ---- Family Tree: curated descendant view (Mum & Dad at the centre) ------- */
.famtree { margin: 0 0 8px; }
.famtree-ancestors-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: fit-content; max-width: 100%;
  justify-content: center;
  padding: 9px 14px; margin: 0 auto 24px;
  border: 1px dashed var(--line); border-radius: 8px; background: var(--paper-deep);
}
.famtree-up-label {
  font-family: var(--sans); font-size: 0.66rem; font-weight: 800;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--gold-deep);
}
.famtree-up-text { font-family: var(--sans); font-size: 0.82rem; color: var(--meta); }

.famtree-gen-label {
  margin: 0 0 12px; text-align: center;
  font-family: var(--sans); font-size: 0.64rem; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--light-meta);
}

.famtree-couple { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.famtree-amp { font-family: var(--serif); font-size: 1.3rem; color: var(--light-meta); }
.famtree-person {
  width: 168px; padding: 12px; text-align: center;
  border: 1px solid var(--gold); border-radius: 8px; background: #fff;
  box-shadow: 0 8px 20px rgba(30, 58, 79, 0.06);
}
.famtree-avatar {
  height: 56px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: var(--paper-deep);
  font-family: var(--serif); font-size: 1.25rem; color: var(--heading);
}
.famtree-name { font-family: var(--serif); color: var(--heading); }
.famtree-anchor .famtree-name { font-size: 1.05rem; margin-top: 8px; }
.famtree-dates { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; color: var(--gold-deep); }

.famtree-trunk { width: 1px; height: 22px; margin: 8px auto 16px; background: var(--line); }

.famtree-groups { display: grid; gap: 12px; }
.famtree-group {
  display: grid; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  box-shadow: 0 8px 20px rgba(30, 58, 79, 0.05);
}
.famtree-parent .famtree-name { font-size: 1.15rem; }
.famtree-parent .famtree-dates { margin-top: 3px; }
.famtree-spouse {
  margin-left: 6px; font-family: var(--serif); font-style: italic;
  font-weight: 400; font-size: 0.9rem; color: var(--meta); letter-spacing: 0;
}

.famtree-kids { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.famtree-kid {
  min-width: 124px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper);
}
.famtree-kid-name { font-family: var(--serif); font-size: 0.98rem; color: var(--heading); }
.famtree-kid-sub { font-family: var(--sans); font-size: 0.66rem; color: var(--light-meta); }
.famtree-nokids {
  align-self: center; font-family: var(--sans); font-size: 0.82rem;
  font-style: italic; color: var(--light-meta);
}

.famtree-kid.has-great { border-color: var(--gold); }
.famtree-great {
  margin-top: 8px; padding: 6px 9px;
  border: 1px solid var(--gold); border-radius: 7px; background: #fff;
}
/* Match the sibling cards' name size so the newest great-grandchild is gently
   highlighted (gold border + badge), not oversized. */
.famtree-great .famtree-name { font-size: 0.9rem; }
.famtree-great .famtree-dates { font-size: 0.66rem; }
.famtree-great .famtree-badge { font-size: 0.5rem; }
.famtree-badge {
  display: block; margin-bottom: 2px;
  font-family: var(--sans); font-size: 0.55rem; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-deep);
}
.famtree-parents { margin-top: 3px; font-family: var(--sans); font-size: 0.62rem; font-style: italic; color: var(--light-meta); }

.famtree-note {
  margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line);
  text-align: center; font-style: italic; color: var(--meta);
}
.famtree-unavailable {
  margin: 18px 0 0; text-align: center; font-style: italic;
  font-family: var(--sans); font-size: 0.86rem; color: var(--light-meta);
}
.famtree-heading {
  margin: 42px 0 6px; font-family: var(--serif); font-weight: 400;
  color: var(--heading); font-size: 1.3rem;
}

@media (min-width: 680px) {
  .famtree-group { grid-template-columns: 196px 1fr; align-items: start; }
  .famtree-parent { padding-right: 16px; border-right: 1px solid var(--line); }
}

/* ---- Family tree: phone + tablet refinements ----------------------------- */
/* Couple cards scale with the viewport so Mum & Dad stay side by side down to
   small phones before wrapping. */
.famtree-person { width: min(168px, 41vw); }
.famtree-couple { gap: 10px; }

/* iPad / tablet: two-column family groups already kick in at 680px; give the
   parent column a touch more room and let grandkids breathe. */
@media (min-width: 680px) {
  .famtree-kid { min-width: 132px; }
}

/* Small phones: tighten padding, let grandkids fill the row evenly, and keep
   the great-grandchild card readable. */
@media (max-width: 520px) {
  .famtree-group { padding: 13px 13px; }
  .famtree-kids { gap: 7px; }
  .famtree-kid { flex: 1 1 132px; min-width: 0; }
  .famtree-great { padding: 9px 10px; }
  .famtree-ancestors-strip { padding: 9px 12px; }
  .famtree-heading { margin-top: 34px; font-size: 1.2rem; }
}

/* Very small phones (iPhone SE width): shrink the couple cards a little more so
   they never force a horizontal scroll. */
@media (max-width: 360px) {
  .famtree-person { width: min(168px, 44vw); padding: 10px; }
  .famtree-avatar { height: 48px; font-size: 1.1rem; }
}

/* ---- Family tree: tappable people, ancestor cards, person page ----------- */
.famtree-tappable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s; }
.famtree-tappable:hover { border-color: var(--gold); box-shadow: 0 8px 20px rgba(201, 169, 110, 0.25); }
.famtree-tappable:active { transform: scale(0.99); }
.famtree-tappable:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- People -------------------------------------------------------------- */
.people-note {
  max-width: 760px;
  margin: 0 0 18px;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
}
.people-group + .people-group {
  margin-top: 26px;
}
.people-group-title {
  margin: 0 0 10px;
  color: var(--gold-deep);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 24px 14px;
  align-items: start;
}
.people-card {
  display: block;
  min-width: 0;
  min-height: 142px;
  padding: 6px 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: center;
  text-decoration: none;
  box-shadow: none;
}
.people-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.people-cover {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--heading);
  font-family: var(--serif);
  font-size: 1.5rem;
  box-shadow: 0 2px 10px rgba(34, 31, 24, .08);
}
.people-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}
.people-cover.is-face-crop img {
  position: absolute;
  width: auto;
  height: auto;
  max-width: none;
  object-fit: unset;
}
.people-body {
  min-width: 0;
  display: block;
}
.people-name {
  display: block;
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--heading);
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-count {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: .78rem;
  line-height: 1.25;
  color: var(--meta);
}
.people-count { font-weight: 700; }
.people-public-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.people-detail-cover {
  width: 76px;
  height: 76px;
  margin: 0;
}
.people-photo-sort {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.people-photo-sort button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--meta);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}
.people-photo-sort button.active {
  border-color: var(--heading);
  background: var(--heading);
  color: #fff;
}
.people-photo-sort button:hover,
.people-photo-sort button:focus-visible {
  border-color: var(--gold);
}
@media (max-width: 520px) {
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 16px 10px; }
  .people-card { min-height: 126px; }
  .people-cover { width: 78px; height: 78px; }
  .people-public-detail-head { grid-template-columns: 1fr; }
  .people-detail-cover { width: 86px; height: 86px; }
}

.famtree-ancestors { display: grid; gap: 18px; }
.famtree-anc-group .famtree-gen-label { text-align: left; margin-bottom: 10px; }
.famtree-anc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.famtree-anc-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px; row-gap: 1px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
/* Avatar spans both rows on the left; name on top, dates UNDERNEATH it (never collide). */
.famtree-anc-card .famtree-avatar { grid-row: 1 / 3; }
.famtree-anc-card .famtree-name { grid-column: 2; grid-row: 1; min-width: 0; font-size: 0.98rem; line-height: 1.15; }
.famtree-anc-card .famtree-dates { grid-column: 2; grid-row: 2; font-size: 0.68rem; }
.famtree-avatar.small {
  width: 38px; height: 38px; flex: 0 0 38px;
  font-size: 0.95rem; border-radius: 50%;
}

/* Life-story PDFs surfaced at the top of the Family Tree */
.lifestories { margin: 0 0 28px; }
.lifestories-note { margin: 4px 0 14px; color: var(--meta); font-style: italic; }
.lifestories-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.lifestory-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 9px;
  background: var(--paper-deep); text-decoration: none; color: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.lifestory-card:hover { border-color: var(--gold); box-shadow: 0 6px 18px rgba(33, 27, 18, 0.12); transform: translateY(-2px); }
.lifestory-icon { font-size: 1.5rem; flex: none; }
.lifestory-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lifestory-title { font-family: var(--serif); font-size: 1.05rem; color: var(--heading); line-height: 1.2; }
.lifestory-who { font-family: var(--sans); font-size: 0.78rem; color: var(--meta); margin-top: 2px; }
.lifestory-cta { font-family: var(--sans); font-size: 0.8rem; font-weight: 700; color: var(--gold-deep); flex: none; white-space: nowrap; }
.lifestory-actions { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.lifestory-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--heading);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.lifestory-action.primary {
  border-color: var(--gold);
  background: var(--heading);
  color: var(--paper);
}
@media (max-width: 640px) {
  .lifestory-card { gap: 10px; padding: 13px 14px; }
  .lifestory-icon { font-size: 1.35rem; }
  .lifestory-actions { gap: 5px; }
  .lifestory-action { min-height: 32px; padding: 0 9px; font-size: 0.68rem; }
}

/* Person page */
.person-page { width: 100%; max-width: none; }
.person-page > .ghost-button { margin-bottom: 20px; }
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.person-avatar {
  width: 64px; height: 64px; flex: 0 0 64px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--gold);
  background: var(--paper-deep);
  font-family: var(--serif); font-size: 1.5rem; color: var(--heading);
}
.person-name { margin: 0; font-family: var(--serif); font-weight: 400; color: var(--heading); font-size: clamp(1.5rem, 4vw, 2rem); }
.person-meta { margin: 4px 0 0; font-family: var(--sans); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; color: var(--gold-deep); }
.person-bio p { margin: 0 0 1.1em; font-size: 1.06rem; line-height: 1.7; }
.person-bio p:last-child { margin-bottom: 0; }
.person-sources {
  margin: 22px 0 0;
  font-family: var(--sans); font-size: 0.82rem; font-style: italic; color: var(--meta);
}
.famtree-kid-note { margin-top: 4px; font-family: var(--sans); font-size: 0.66rem; font-style: italic; color: var(--meta); }

/* --- Ancestors: married-couple boxes, Dad's side (blue) vs Mum's side (gold) --- */
.ftc-legend { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 0.85rem; color: var(--meta); margin: 2px 0 16px; }
.ftc-legend em { color: var(--meta); }
.ftc-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.ftc-dot.dad { background: #3a6094; }
.ftc-dot.mum { background: var(--gold-deep); }
.ftc-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 640px) { .ftc-sides { grid-template-columns: 1fr; gap: 14px; } }
.ftc-side-label { font-size: 0.74rem; letter-spacing: 0.09em; text-transform: uppercase; font-weight: 700; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 2px solid; }
.ftc-dad .ftc-side-label { color: #3a6094; border-color: #3a6094; }
.ftc-mum .ftc-side-label { color: var(--gold-deep); border-color: var(--gold); }
.ftc-gen { margin-bottom: 16px; }
.ftc-gen-label { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--meta); margin: 0 0 7px; }
.ftc-couple { background: var(--paper); border: 1px solid var(--line); border-left-width: 4px; border-radius: 9px; padding: 10px 13px; margin-bottom: 9px; }
.ftc-dad .ftc-couple { border-left-color: #3a6094; }
.ftc-mum .ftc-couple { border-left-color: var(--gold); }
.ftc-names { font-family: var(--serif); font-size: 1.04rem; line-height: 1.4; }
.ftc-amp { color: var(--meta); margin: 0 5px; }
.ftc-name.famtree-tappable { cursor: pointer; border-bottom: 1px solid transparent; }
.ftc-name.famtree-tappable:hover { border-bottom-color: currentColor; }
.ftc-name.is-greyed { color: #b1aaa0; }
.ftc-sub { font-size: 0.82rem; margin-top: 3px; font-variant-numeric: tabular-nums; }
.ftc-dad .ftc-sub { color: #3a6094; }
.ftc-mum .ftc-sub { color: var(--gold-deep); }
.ftc-deeper { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.ftc-deeper-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ftc-deeper-card { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; font-family: var(--serif); }
.ftc-deeper-card.famtree-tappable { cursor: pointer; }
.ftc-deeper-card.famtree-tappable:hover { border-color: var(--gold); }
.ftc-deeper-card em { color: var(--meta); font-size: 0.86rem; }

/* ===================== On This Day v2 (merged in from otd-v2.css) ===================== */
/* On This Day v2 — scoped restyle (hero + card grid). Inert unless body has .otd2-on.
   Reuses the existing brief, cards data, lightbox, letter reader and .nas-media-grid. */
/* zoom scales the whole On This Day page content ~7% smaller (text+cards+hero+spacing,
   proportionally) — scoped to .otd2 so the sidebar/nav is untouched. */
.otd2{max-width:1280px;margin:0 auto;width:100%;zoom:.88}
/* base caps #todayResults at 880px for the old single-column read; widen for v2 (scoped via :has so the old OTD is untouched) */
#todayResults:has(.otd2){max-width:none}
.otd2 .nas-media-grid{width:100% !important;grid-template-columns:repeat(auto-fill,minmax(130px,1fr)) !important}

/* hero = the existing .today-brief, restyled */
/* hero band = AI summary with the featured photo floated in, text wraps around + below it */
.otd2-hero{position:relative;background:var(--paper-deep);border:1px solid var(--line);border-radius:16px;overflow:hidden;padding:clamp(22px,3.2vw,40px)}
.otd2-hero::before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px;background:var(--gold);z-index:1}
.otd2-hero-img{float:right;width:min(40%,640px);margin:4px 0 16px 28px;position:relative;aspect-ratio:4/3;border-radius:10px;overflow:hidden;background:#cdbfa8}
.otd2-hero-img img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.otd2-hero-cap{position:absolute;left:12px;bottom:12px;background:rgba(30,58,79,.86);color:#fff;font-family:var(--sans);font-size:11px;font-weight:600;padding:5px 10px;border-radius:6px;backdrop-filter:blur(3px)}
.otd2 .today-brief{background:transparent;border:0;border-radius:0;overflow:visible;padding:0;margin:0;display:block}
.otd2 .today-brief-head{display:block}
.otd2 .today-surprise{margin-top:12px}
.otd2 .today-brief-kicker{font-family:var(--sans);font-size:.78rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--gold-deep);margin:0}
.otd2 .today-brief-main{font-family:var(--serif);font-weight:600;color:var(--heading);font-size:clamp(22px,3.4vw,32px);line-height:1.12;margin:10px 0 0;letter-spacing:-.01em}
.otd2 .today-brief-sub{font-family:var(--sans);font-size:.85rem;color:var(--meta);margin:8px 0 0}
.otd2 .today-reflection{font-family:var(--serif);font-size:clamp(15.5px,1.9vw,18px);line-height:1.6;color:var(--ink);margin:14px 0 0;max-width:none}
.otd2 .today-reflection-body{column-count:auto !important;column-width:auto !important;column-gap:normal !important;max-width:none}
.otd2 .today-reflection p{margin:0 0 10px}
.otd2 .today-reflection p:first-of-type::first-letter{font-family:var(--serif);font-weight:600;color:var(--gold-deep);font-size:3em;line-height:.8;float:left;margin:6px 12px 0 0}

/* card grid */
.otd2-sec{margin-top:30px}
.otd2-lbl{font-family:var(--sans);font-size:.74rem;font-weight:800;letter-spacing:.16em;text-transform:uppercase;color:var(--light-meta)}
.otd2-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:16px;margin-top:14px}
.otd2-card{display:block;width:100%;text-align:left;text-decoration:none;color:inherit;background:#fff;border:1px solid var(--line);border-radius:13px;overflow:hidden;cursor:pointer;padding:0;font:inherit}
.otd2-ph{display:block;position:relative;aspect-ratio:5/3;background:#cdbfa8}
.otd2-ph img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.otd2-yr{position:absolute;left:10px;top:10px;background:rgba(30,58,79,.86);color:#fff;font-family:var(--sans);font-size:10.5px;font-weight:700;padding:3px 8px;border-radius:5px}
.otd2-tag{position:absolute;left:10px;top:10px;background:var(--heading);color:#fff;font-family:var(--sans);font-size:10px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;padding:3px 8px;border-radius:5px}
.otd2-card .otd2-tag + .otd2-yr{left:auto;right:10px}
.otd2-badge{position:absolute;right:10px;bottom:10px;background:rgba(30,58,79,.86);color:#fff;font-family:var(--sans);font-size:10.5px;font-weight:700;padding:3px 8px;border-radius:5px}
.otd2-b{display:block;padding:14px 16px}
.otd2-ago{display:block;font-family:var(--sans);font-size:.72rem;font-weight:700;color:var(--gold-deep)}
.otd2-t{display:block;font-family:var(--serif);font-weight:600;color:var(--heading);font-size:18px;line-height:1.2;margin-top:5px}
.otd2-s{display:block;font-family:var(--sans);font-size:.78rem;color:var(--meta);margin-top:5px}
.otd2-card.otd2-lettertext .otd2-s{font-style:italic;font-family:var(--serif)}
/* text-only letter: subject + body excerpt panel instead of a photo */
.otd2-lead{display:flex;flex-direction:column;justify-content:center;aspect-ratio:5/3;position:relative;background:var(--paper-deep);border-bottom:1px solid var(--line);padding:18px;overflow:hidden}
.otd2-lsubj{font-family:var(--serif);font-weight:600;color:var(--heading);font-size:17px;line-height:1.25;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.otd2-x{font-family:var(--serif);font-style:italic;color:var(--meta);font-size:13.5px;line-height:1.4;margin-top:8px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}

/* photo-card → event grid view (reuses existing .nas-media-grid styles) */
.otd2-back{display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:0 14px;margin-bottom:14px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--heading);font-family:var(--sans);font-weight:700;font-size:.9rem;cursor:pointer}

@media (hover:hover){
  .otd2-card{transition:transform .12s, box-shadow .12s}
  .otd2-card:hover{transform:translateY(-2px);box-shadow:0 8px 20px rgba(30,58,79,.10)}
}
/* Phones: drop the hero photo (a floated image is cramped on a narrow screen) — the
   summary reads cleanly on its own; the memory cards below still carry the photos. */
@media (max-width:600px){
  .otd2-hero{padding:16px}
  .otd2-hero-img{display:none}
  .otd2 .today-brief-kicker{font-size:.72rem}
  .otd2 .today-brief-main{font-size:clamp(25px,7vw,30px);line-height:1.1;margin-top:6px}
  .otd2 .today-brief-sub{font-size:.82rem;margin-top:6px}
}
@media (max-width:820px){ .otd2-grid{grid-template-columns:1fr 1fr} }
@media (max-width:520px){ .otd2-grid{grid-template-columns:1fr} }
