/* Family Photos — cozy/nostalgic design system.
   Warm paper, framed-print cards, dusty-blue accent, terracotta highlight.
   Whole-family first; large, legible, high-contrast for older readers too. */

:root {
  /* Paper & Ink — editorial family photobook.
     Paper #f5f3ee, soft border #e8e4dd, ink #2d2d2d, deep #0d0d0d, one warm accent. */
  --paper:#f5f3ee; --card:#fbf9f4; --card-2:#eae4d6; --ink:#2d2d2d; --muted:#6b6a66;
  --line:#e2ddd2; --accent:#2f6b4f; --accent-deep:#25563f; --terra:#2f6b4f;
  --stage:#141210;
  /* Legacy aliases kept so downstream rules and tests keep resolving. */
  --hairline:var(--line); --highlight:var(--terra);
  --head:"DM Serif Display","Cormorant Garamond",Georgia,"Times New Roman",serif;
  --sans:"Fira Sans",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --shadow:0 1px 0 rgba(20,15,10,.04), 0 8px 20px -14px rgba(20,15,10,.18);
  --shadow-lift:0 1px 0 rgba(20,15,10,.05), 0 18px 34px -18px rgba(20,15,10,.28);
  --radius:4px;
  --radius-sm:2px;
  --radius-md:6px;
  --radius-lg:8px;
  --radius-xl:10px;
  --radius-2xl:12px;
  --react-bg:rgba(47,107,79,.10);
  --base:17px;
}
:root.textsize-1 { --base:21px; }
:root.textsize-2 { --base:24px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

* { box-sizing:border-box; }
html { font-size:var(--base); }
body {
  margin:0; color:var(--ink); font-family:var(--sans); line-height:1.55;
  background:var(--paper);
}
a { color:var(--accent); }
h1 { font-family:var(--head); font-weight:400; font-size:2.6rem; letter-spacing:-.01em; line-height:1.05; margin:0 0 1rem; color:var(--ink); }
h2 { font-family:var(--head); font-weight:400; font-size:1.9rem; letter-spacing:-.005em; line-height:1.15; margin:2.4rem 0 .8rem; }

/* Masthead + nav */
.mast {
  padding:1.65rem 1.65rem 0; border-bottom:1px solid var(--line);
  background:var(--paper);
}
.mast-top { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.brand { font-family:var(--head); font-weight:400; font-size:1.7rem; letter-spacing:0; text-decoration:none; color:var(--ink); }
.mast-tools { display:flex; align-items:center; gap:10px 14px; flex-wrap:wrap; }
.mast-settings { position:relative; }
.mast-settings-toggle {
  display:inline-flex; align-items:center; justify-content:center;
  list-style:none; cursor:pointer;
  min-height:44px; min-width:44px;
  border:1px solid var(--line); font-size:1.2rem;
}
.mast-settings-toggle::-webkit-details-marker { display:none; }
.mast-settings:not([open]) .mast-settings-panel { display:none; }
.mast-settings[open] .mast-settings-panel {
  display:flex; flex-direction:column; align-items:flex-start; gap:8px;
  position:absolute; top:100%; left:0; z-index:20;
  max-width:calc(100vw - 32px);
  background:var(--paper); border:1px solid var(--line); padding:12px; margin-top:6px;
  box-shadow:0 4px 12px rgba(0,0,0,.15);
}
.textsize { display:inline-flex; gap:4px; }
.textsize-btn { min-height:44px; min-height:2.6rem; min-width:44px; border:1px solid var(--line); background:transparent; color:var(--ink); border-radius:0; font-family:var(--sans); font-weight:600; cursor:pointer; }
.textsize-btn[aria-pressed="true"], .textsize-btn.active { background:var(--ink); color:var(--paper); border-color:var(--ink); }
.signed-in { color:var(--muted); font-size:.72rem; letter-spacing:.16em; text-transform:uppercase; }
.tabs { display:flex; gap:2px; flex-wrap:wrap; padding:1.3rem 0 0; margin-top:.82rem; border-top:1px solid var(--line); }
.tab { text-decoration:none; color:var(--muted); font-family:var(--sans); font-weight:500; font-size:.82rem; letter-spacing:.14em; text-transform:uppercase; padding:0 14px; min-height:44px; min-height:2.6rem; display:inline-flex; align-items:center; border-radius:0; border-bottom:2px solid transparent; }
.tab:not(.active):hover { color:var(--ink); border-bottom-color:var(--line); }
.tab.active { color:var(--ink); background:transparent; border-bottom-color:var(--terra); box-shadow:none; }
.tab-add { color:var(--terra); border-bottom-color:transparent; }
.tab-admin { color:var(--muted); }

@media (max-width: 640px) {
  .tabs { flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .tabs::-webkit-scrollbar { display:none; }
  .tab { flex:0 0 auto; padding:0 12px; }
}

main { padding:2.6rem 1.65rem 5.6rem; max-width:78rem; margin:0 auto; }

.sort-toggle-wrap { margin:0 0 1rem; }
.sort-toggle { font-size:.82rem; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); text-decoration:none; min-height:44px; min-height:2.6rem; display:inline-flex; align-items:center; }
.sort-toggle:hover { color:var(--ink); }

/* Album cards — framed prints */
.album-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:2.1rem 1.4rem; }
.album-card { display:block; text-decoration:none; color:var(--ink); background:transparent; border:none; border-radius:0; padding:0; box-shadow:none; transition:opacity .15s ease; min-height:44px; }
.album-card:hover { transform:none; box-shadow:none; opacity:.85; }
.album-cover { width:100%; aspect-ratio:4/3; object-fit:cover; display:block; border-radius:var(--radius-sm); background:#eae4d6; }
.album-card-title { font-family:var(--head); font-weight:400; font-size:1.35rem; letter-spacing:-.005em; padding:14px 0 2px; line-height:1.15; }
.album-card-count { padding:0; color:var(--muted); font-size:.78rem; letter-spacing:.14em; text-transform:uppercase; }

/* Photo grids */
.photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:.6rem; }
.photo-thumb { display:block; position:relative; min-height:44px; aspect-ratio:1/1; border-radius:var(--radius-lg); overflow:hidden; box-shadow:none; background:var(--card-2); }
.photo-thumb img { width:100%; height:100%; aspect-ratio:1/1; object-fit:cover; display:block; }
.photo-thumb-loading img { opacity:0; }
.photo-thumb img.loaded { opacity:1; transition:opacity .2s ease; }
.photo-thumb-loading {
  animation: pulse 1.5s ease-in-out infinite;
  background: var(--card-2);
}
.video-badge {
  position:absolute; bottom:6px; right:6px;
  display:flex; align-items:center; justify-content:center;
  width:24px; height:24px; border-radius:50%;
  background:rgba(47,42,34,.65); color:#fff; font-size:.7rem;
  pointer-events:none;
}


.page-hint { color:var(--muted); font-size:.85rem; margin:0 0 1rem; }

/* ---- Review carousel (shared: person-page Suggestions + untagged-faces
   page) ---- One slide visible at a time. The dark .carousel-stage is
   nested inside each slide and contains ONLY the photo plus prev/next nav
   overlay buttons — matching photo.html's .photo-viewer which wraps only
   the image. Everything else (info text, name/skip or confirm/reject
   forms) sits below in normal page flow with no dark background. */
.carousel { display:flex; flex-direction:column; }
.carousel-counter { text-align:center; color:var(--muted); font-size:.85rem; margin-bottom:.5rem; }
.carousel-stage { position:relative; background:var(--stage); border-radius:var(--radius-sm); overflow:hidden; padding:1.5rem; display:flex; justify-content:center; box-shadow:0 30px 60px -30px rgba(20,15,10,.35); margin-bottom:.75rem; touch-action:pan-y; }
.carousel-nav { position:absolute; top:0; bottom:0; width:clamp(56px,12%,120px); min-width:44px; display:flex; align-items:center; justify-content:center; font-size:3rem; color:#fff; z-index:2; background:transparent; border:none; cursor:pointer; text-shadow:0 1px 6px rgba(0,0,0,.55),0 0 2px rgba(0,0,0,.4); transition:background .2s ease; }
.carousel-nav-prev { left:0; }
.carousel-nav-prev:hover:not(:disabled) { background:linear-gradient(90deg,rgba(0,0,0,.25) 0%,transparent 100%); }
.carousel-nav-next { right:0; }
.carousel-nav-next:hover:not(:disabled) { background:linear-gradient(270deg,rgba(0,0,0,.25) 0%,transparent 100%); }
.carousel-nav:disabled { color:rgba(255,255,255,.3); pointer-events:none; background:transparent; cursor:default; }
.carousel-nav:focus-visible { outline:2px solid #fff; outline-offset:-4px; }
.carousel-photo-wrap { position:relative; display:inline-block; line-height:0; transition:transform .18s ease; transform-origin:0 0; }
.carousel-photo-wrap.is-zoomed { touch-action:none; }
.carousel-photo { display:block; max-width:100%; max-height:60vh; width:auto; height:auto; border-radius:var(--radius-sm); cursor:zoom-in; }
.carousel-photo.zoomed { max-height:none; cursor:zoom-out; object-fit:contain; }
.carousel-stagetools { position:absolute; top:12px; right:12px; display:flex; gap:8px; z-index:3; }
.carousel:focus { outline:2px solid Highlight; outline-offset:4px; border-radius:var(--radius); }
.carousel:focus:not(:focus-visible) { outline:none; }

/* Photo viewer — nav as transparent edge overlays */
.photo-viewer { position:relative; min-height:60vh; background:var(--stage); border-radius:var(--radius-sm); overflow:hidden; padding:0; box-shadow:0 30px 60px -30px rgba(20,15,10,.35); text-align:center; touch-action:pan-y; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
.photo-full {
  display:block; width:100%; max-height:80vh; object-fit:contain;
  background:var(--stage); margin:0 auto;
  cursor:zoom-in;
  transition:transform .18s ease; transform-origin:center center;
}
.nav-zone {
  position:absolute; top:0; bottom:0; width:clamp(56px,12%,120px); min-width:44px;
  display:flex; align-items:center; justify-content:center;
  font-size:3rem; text-decoration:none; color:#fff; z-index:2;
  background:transparent; text-shadow:0 1px 6px rgba(0,0,0,.55),0 0 2px rgba(0,0,0,.4);
  transition:background .2s ease;
}
.nav-zone-prev { left:0; }
.nav-zone-prev:hover { background:linear-gradient(90deg,rgba(0,0,0,.25) 0%,transparent 100%); }
.nav-zone-next { right:0; }
.nav-zone-next:hover { background:linear-gradient(270deg,rgba(0,0,0,.25) 0%,transparent 100%); }
.nav-zone:focus-visible { outline:2px solid #fff; outline-offset:-4px; }
.nav-zone-disabled { color:rgba(255,255,255,.3); pointer-events:none; background:transparent; }

/* On videos the native controls bar at the bottom (~44px) overlaps the nav
   zones, so shorten them so they don't cover the controls. */
.photo-viewer:has(video) .nav-zone { bottom:52px; }
.photo-viewer:has(video) .nav-zone-prev:hover { background:linear-gradient(90deg,rgba(0,0,0,.25) 0%,transparent 50%); }
.photo-viewer:has(video) .nav-zone-next:hover { background:linear-gradient(270deg,rgba(0,0,0,.25) 0%,transparent 50%); }

/* Hide the browser's native video loading spinner that appears on top of
   the poster while the video source is being fetched. The poster is set
   via the poster="" attribute and renders underneath the overlay. */
video.photo-full::-webkit-media-controls-start-playback-button { display:none!important; }
video.photo-full::-webkit-media-controls-overlay-play-button { display:none!important; }
/* Keep the poster always visible; the spinner stays hidden. */
.download-link { display:inline-flex; align-items:center; text-decoration:none; }
.photo-title { font-family:var(--head); font-weight:400; font-size:2.2rem; letter-spacing:-.01em; line-height:1.1; margin:1.6rem 0 .3rem; }

/* People chips */
.people-chips { display:flex; flex-wrap:wrap; gap:.6rem; margin-top:1rem; }
.person-chip { display:inline-flex; align-items:center; min-height:2.1rem; padding:0 14px; border:1px solid var(--line); border-radius:999px; text-decoration:none; color:var(--ink); font-family:var(--sans); font-size:.85rem; background:var(--card); }
.person-chip:hover { border-color:var(--accent); }

/* Tag chips */
.tag-chips { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:1rem; }
.tag-chip { display:inline-flex; align-items:center; gap:.4rem; min-height:1.9rem; padding:0 12px; border:1px solid var(--line); border-radius:999px; font-family:var(--sans); font-size:.8rem; background:var(--card); }
.tag-chip a { color:var(--ink); text-decoration:none; }
.tag-chip a:hover { color:var(--accent); }

/* Comments */
.comments { margin-top:2rem; }
.comment-list { list-style:none; padding:0; }
.comment { border-top:1px solid var(--line); padding:.9rem 0; }
.comment-author { font-family:var(--head); font-weight:800; }
.comment-body { margin:.25rem 0 0; font-size:1.05rem; }
.comment-form { margin-top:1.5rem; display:flex; flex-direction:column; gap:.5rem; }
.comment-form label { font-family:var(--head); font-weight:800; }

/* Forms + buttons */
.form-input, .form-textarea, .form-select, .comment-form textarea {
  font-size:.95rem; padding:.4rem .55rem; border:1px solid var(--line); border-radius:var(--radius-lg); font-family:inherit; background:var(--card); min-height:34px;
}
.form-input, .form-textarea { display:block; width:100%; }
.form-label { display:block; font-family:var(--head); font-weight:800; font-size:.9rem; margin-bottom:.25rem; }
.form-input-narrow { max-width:22rem; }
.form-help { font-size:.85rem; color:var(--muted); margin:.25rem 0; }
details.form-help summary { cursor:pointer; color:var(--muted); }
details.form-help[open] summary { color:var(--ink); }
details.form-help ol { margin:.5rem 0 0; padding-left:1.2rem; }
.admin-section { border-top:1px solid var(--line); padding-top:1.5rem; margin-top:2rem; }
.form-select { display:block; }
.form-input-inline { padding:.3rem .5rem; border:1px solid var(--line); border-radius:calc(var(--radius) - 2px); font-size:.85rem; }
.form-inline { display:inline; }
.form-group { margin-bottom:.5rem; }
.mt-1 { margin-top:1rem; }
/* Elements toggled by the edit-mode button (ui.js) rely on the native
   hidden attribute. Author rules that set their own `display` (e.g.
   .move-photos-bar) otherwise outrank the browser's built-in [hidden]
   style, so this reasserts it at matching specificity. */
.edit-only[hidden] { display:none; }
.btn-primary, .comment-form button { min-height:2.1rem; font-family:var(--sans); font-weight:600; font-size:.82rem; letter-spacing:.12em; text-transform:uppercase; background:var(--ink); color:var(--paper); border:none; border-radius:0; padding:.55rem 1.3rem; cursor:pointer; }
.btn-primary:hover, .comment-form button:hover { background:var(--terra); }
.btn-primary-sm { min-height:2rem; font-size:.78rem; letter-spacing:.12em; text-transform:uppercase; padding:.4rem 1rem; background:var(--ink); color:var(--paper); border:none; border-radius:0; cursor:pointer; font-family:var(--sans); font-weight:600; }
.btn-danger { min-height:2rem; font-size:.85rem; padding:.35rem .8rem; background:#a8432b; color:#fff; border:none; border-radius:var(--radius-lg); cursor:pointer; }
.btn-danger-sm { min-height:1.75rem; font-size:.78rem; padding:.35rem .7rem; background:#a8432b; color:#fff; border:none; border-radius:var(--radius-lg); cursor:pointer; font-family:var(--sans); font-weight:600; }
.btn-text { background:none; border:none; color:var(--accent); font-size:1rem; cursor:pointer; padding:0; min-height:1.9rem; text-decoration:underline; }
.btn-text:disabled { opacity:.45; cursor:not-allowed; text-decoration:none; }
.chip-remove-form { display:inline; }

/* Results, admin tables, admin nav, picker */
.result-list { font-size:1rem; list-style:none; padding:0; }
.result-item { padding:.5rem 0; border-bottom:1px solid var(--line); }
.admin-table { width:100%; border-collapse:collapse; font-size:.9rem; }
.admin-table th { text-align:left; font-family:var(--sans); font-weight:600; font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; padding:.8rem .6rem; border-bottom:1px solid var(--line); }
.admin-table td { padding:.8rem .6rem; border-bottom:1px solid var(--line); }
.admin-table td .form-inline { display:inline-flex; gap:.35rem; margin:.15rem .5rem .15rem 0; align-items:center; }
.admin-nav-list { list-style:none; padding:0; margin:1.5rem 0 2.5rem; display:grid; grid-template-columns:repeat(auto-fit,minmax(14rem,1fr)); gap:.75rem; }
.admin-nav-item { margin:0; }
.admin-nav-link { display:block; padding:1rem 1.1rem; border-radius:var(--radius); border:1px solid var(--line); background:var(--card); color:var(--ink); font-family:var(--head); font-size:1.05rem; font-weight:700; text-decoration:none; transition:border-color .2s ease, color .2s ease, transform .2s ease, background .2s ease; }
.admin-nav-link:hover { background:var(--card); color:var(--accent); border-color:var(--accent); transform:translateY(-1px); }
.picker-link { display:inline-flex; align-items:center; min-height:44px; padding:.75rem 1.5rem; border:1px solid var(--accent); border-radius:var(--radius-xl); text-decoration:none; color:var(--accent); font-family:var(--head); font-weight:800; font-size:1.1rem; }

.video-processing-notice { text-align:center; color:var(--muted); padding:2rem 1rem; }
.video-processing-notice p { margin:0 0 1rem; }

/* Add chooser (new pages) */
.add-album-list { list-style:none; padding:0; display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px; }
.add-album-list a { display:flex; align-items:center; min-height:64px; padding:0 1rem; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); text-decoration:none; color:var(--ink); font-family:var(--head); font-weight:800; box-shadow:var(--shadow); }
.album-description { color:var(--muted); }

/* Viewer tools + engagement */
.bar { display:flex; align-items:center; gap:14px; padding:12px 0; }
.bar .spacer, .engage .spacer { flex:1; }
.date-line { color:var(--muted); font-size:.82rem; letter-spacing:.14em; text-transform:uppercase; margin:.25rem 0 1.4rem; }

.stagetools { position:absolute; top:12px; right:12px; display:flex; gap:8px; z-index:3; }
.stagetool { background:rgba(0,0,0,.45); color:#fff; border:none; border-radius:var(--radius-lg); padding:8px 12px; font-family:var(--head); font-weight:700; font-size:.85rem; cursor:pointer; min-height:44px; min-height:2.6rem; }
.viewer-tools { display:flex; gap:10px; flex-wrap:wrap; padding:12px 0; align-items:center; justify-content:center; }
.photo-full.zoomed { max-height:none; cursor:zoom-out; object-fit:contain; }

.engage { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:12px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); margin-bottom:1rem; }
.react-form { display:inline-flex; gap:8px; flex-wrap:wrap; margin:0; }
.react { background:var(--card); border:1px solid var(--line); border-radius:999px; padding:7px 13px; cursor:pointer; font-size:1rem; min-height:44px; min-height:2.6rem; }
.react.on { border-color:var(--accent); background:var(--react-bg); color:var(--ink); }
.react .n { color:var(--muted); font-size:.85rem; font-weight:600; }
.fav-form { margin:0; }
.fav { background:var(--card); border:1px solid var(--line); border-radius:var(--radius-lg); padding:8px 14px; cursor:pointer; font-family:var(--head); font-weight:700; font-size:.9rem; min-height:44px; min-height:2.6rem; }
.fav.on { background:var(--react-bg); border-color:var(--accent); color:var(--accent); }

.chip-av { width:26px; height:26px; border-radius:50%; object-fit:cover; margin-right:8px; background:#e2d7c0; vertical-align:middle; }

/* Token input wraps */
.token-input-wrap { display:flex; flex-direction:column; gap:.35rem; }
.token-input-inner { display:flex; flex-wrap:wrap; gap:.35rem; align-items:center; border:1px solid var(--line); border-radius:var(--radius-lg); padding:.25rem .35rem; background:var(--card); min-height:38px; }
.token-input-inner .token-input { border:none; background:transparent; outline:none; min-height:28px; padding:.15rem .2rem; flex:1; min-width:100px; font-size:.9rem; }
.token-input-inner .token-input:focus { outline:none; box-shadow:none; }

.token-chip {
  display:inline-flex; align-items:center; gap:.3rem;
  min-height:26px; padding:0 .6rem;
  border:1px solid var(--line); border-radius:999px;
  font-family:var(--sans); font-size:.78rem;
  background:var(--card); color:var(--ink);
  cursor:pointer; user-select:none;
  transition:opacity .15s ease;
}
.token-chip:hover { border-color:var(--accent); }
.token-chip.removing { opacity:.3; pointer-events:none; }
.token-chip-remove { border:none; background:transparent; padding:0 .15rem; font-size:.72rem; color:var(--muted); min-height:auto; line-height:1; }
.token-chip-remove:hover { color:var(--accent); }

/* Existing remove buttons are now spans, not forms */
.chip-remove-form { display:none; }

.comment-when { color:var(--muted); font-size:.8rem; font-weight:500; }
.heart-form { margin:.4rem 0 0; }
.heart { background:none; border:none; color:var(--muted); cursor:pointer; font-size:.9rem; padding:4px 0; min-height:44px; }
.heart.on { color:var(--terra); font-weight:700; }

/* ---- Timeline ---- */
.timeline-wrap { display: grid; grid-template-columns: 9rem minmax(0,1fr); gap: 2rem; align-items: start; }
.year-rail {
  position: sticky; top: 1rem; align-self: start;
  display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 2rem); overflow-y: auto; overscroll-behavior: contain;
  padding: .25rem .5rem .25rem 0;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.decade-label {
  font-size: .75rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); opacity: .55;
  padding: .75rem .75rem .25rem; text-align: right;
  pointer-events: none;
}
.year-rail-link {
  color: var(--muted); text-decoration: none;
  font-weight: 600; font-size: 1.05rem; line-height: 1;
  display: flex; align-items: center; justify-content: flex-end;
  min-height: 44px; padding: .5rem .75rem;
  border-radius: var(--radius-lg);
  transition: color .12s ease, background .12s ease;
}
.year-rail-link:hover { color: var(--ink); background: var(--card); }
.year-rail-link.is-current { color: #fff; background: var(--accent); font-size: 1.15rem; font-weight: 700; font-family: var(--head); }
.timeline { min-width: 0; }
.tl-year { scroll-margin-top: 5rem; content-visibility: auto; contain-intrinsic-size: auto 800px; }
.tl-month { scroll-margin-top: 9rem; }
.tl-year-head { position:sticky; top:0; z-index:2; margin:0; padding:.5rem 0; background:var(--paper); color:var(--ink); font-family:var(--head); font-weight:400; font-size:3.2rem; letter-spacing:-.015em; border-bottom:1px solid var(--line); }
.tl-month + .tl-month { margin-top: 2.25rem; }
.tl-month { margin: 1rem 0 1.75rem; }
.tl-month-head { position:sticky; top:4.4rem; z-index:1; margin:0 0 .6rem; padding:.3rem 0; background:var(--paper); color:var(--ink); font-family:var(--sans); font-size:.95rem; font-weight:700; letter-spacing:.02em; }
.empty-state { padding: 2rem 0; }

/* Compact horizontal rail on narrow screens: sticks under the mast, scrolls sideways. */
@media (max-width: 780px) {
  .timeline-wrap { display: block; }
  .year-rail {
    position: sticky; top: 0; z-index: 3;
    flex-direction: row; align-items: center; gap: 0;
    max-height: none; overflow-x: auto; overflow-y: hidden;
    padding: .35rem .25rem; margin: 0 -.5rem .75rem;
    background: var(--paper);
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .decade-label { display: none; }
  .year-rail-link {
    margin: 0; padding: .35rem .7rem;
    min-height: 40px; scroll-snap-align: center;
    border-radius: 0;
  }
  .year-rail-link.is-current { color: #fff; background: var(--accent); border-radius: var(--radius-lg); }
  .year-rail { scroll-snap-type: x proximity; }
  .tl-year { scroll-margin-top: 3.5rem; }
  .tl-year-head { font-size: 2.2rem; }
}

/* Back-to-top pill — appears via .is-scrolled on <body>. */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 40px; padding: 0 14px;
  background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-weight: 600; font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase;
  border: none; border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(20,15,10,.45);
  cursor: pointer; opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
body.is-scrolled .to-top { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { background: var(--terra); }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---- Search ---- */
.search-form {
  margin: 1rem 0 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
}
.search-row {
  display: flex; gap: 10px;
}
.search-form .search-text {
  flex: 1; padding: 0 16px; min-height: 52px;
  border: 1px solid var(--line); border-radius: var(--radius-xl);
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 1.05rem;
}
.search-form .search-text:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.btn-search {
  min-height: 52px; padding: 0 22px;
  border-radius: var(--radius-xl); border: none;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 1.05rem; cursor: pointer;
  font-family: var(--sans);
  transition: background .15s ease;
}
.btn-search:hover { background: var(--accent-deep); }
.search-advanced { margin-top: .25rem; }
.search-advanced summary {
  cursor: pointer; font-size: .95rem; font-weight: 600;
  color: var(--accent); display: inline-flex; align-items: center;
  gap: 6px; min-height: 36px; list-style: none;
}
.search-advanced summary::-webkit-details-marker { display: none; }
.search-advanced[open] summary { color: var(--ink); }
.search-advanced-fields {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: .75rem;
}
.search-advanced-fields select {
  font: inherit; padding: .5rem .75rem; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--card); color: var(--ink); font-size: .95rem;
}
.search-advanced-fields select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.results { margin-top: 1rem; }

/* ---- Inline album create ---- */
.new-album-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0 1.5rem; }
.new-album-input { font: inherit; padding: .5rem .6rem; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--card); color: var(--ink); flex: 1 1 16rem; min-width: 12rem; }

/* Person page tools */
.person-tools { display:flex; gap:.6rem; align-items:center; margin-top:1rem; }

/* Face box overlay on person thumbnails */
.person-face-box {
  position:absolute; border:2px solid #e00; border-radius:var(--radius-sm); pointer-events:none;
  box-shadow:0 0 0 1px rgba(0,0,0,.15); transition:border-width .12s ease, opacity .15s ease, box-shadow .15s ease, outline .15s ease;
}
.person-face-box.zoomed { border-color:rgba(238,0,0,.65); }
.person-face-box.clickable { pointer-events:auto; cursor:pointer; }
.person-face-box.clickable:hover { border-color:#e00; box-shadow:0 0 0 3px rgba(238,0,0,.25); z-index:4; }
.person-face-box.clickable:focus-visible { outline:2px solid var(--accent); outline-offset:1px; z-index:4; }
@media (hover: none) and (pointer: coarse) {
  .zoom-stage .person-face-box.clickable { min-width:44px; min-height:44px; }
  .zoom-stage .person-face-box.clickable:active { outline:3px solid #e00; outline-offset:2px; z-index:4; }
}
.faces-hidden .person-face-box { display:none; }
.faces-hidden .person-face-box.highlight { display:block; }
.person-face-thumb { overflow:hidden; }

/* Person chip highlight on face box hover */
.person-chip.highlight { background:rgba(238,0,0,.12); border-color:#e00; }

.person-face-box.highlight {
  border-width:3px; border-color:#e00; box-shadow:0 0 0 3px rgba(238,0,0,.25); z-index:4;
}

/* Carousel face box ⇄ info area bidirectional highlight */
.carousel .untagged-actions.highlight,
.carousel .untagged-info.highlight {
  background:rgba(238,0,0,.06); border-radius:var(--radius);
}

/* Shared zoom stage — absolute-positioned child face boxes
   scale/translate with the zoomed container. Like carousel-photo-wrap
   but used on the standalone photo viewer page. */
.zoom-stage {
  position:relative; display:inline-block; line-height:0;
  overflow:hidden; border-radius:var(--radius-sm);
  transform-origin:0 0;
  vertical-align:top;
}
.zoom-stage.is-zoomed { touch-action:none; }
.zoom-stage img { display:block; max-width:100%; }
.zoom-stage .person-face-box {
  position:absolute; pointer-events:auto; cursor:pointer; border-style:solid;
}
.zoom-stage .person-face-box.clickable { border-color:#e00; transition:border-width .12s ease, opacity .15s ease, box-shadow .15s ease, outline .15s ease; }
.zoom-stage .person-face-box.clickable:hover { box-shadow:0 0 0 3px rgba(238,0,0,.25); z-index:4; }
.zoom-stage .person-face-box.clickable:focus-visible { outline:2px solid var(--accent); outline-offset:1px; z-index:4; }
@media (hover: none) and (pointer: coarse) {
  .zoom-stage .person-face-box.clickable { min-width:44px; min-height:44px; }
  .zoom-stage .person-face-box.clickable:active { outline:3px solid #e00; outline-offset:2px; z-index:4; }
}

/* Larger grid for person-page thumbnails, and a fixed-height slot around
   each one so every card is the same height regardless of a photo's own
   aspect ratio (face-box photos use their true ratio via an inline
   aspect-ratio style, unchanged) — keeps the row of controls below every
   thumbnail aligned. The thumbnail's own size/crop and face-box
   percentage math are untouched; only the outer slot is new. No zoom
   here — clicking a thumbnail opens /photos/{id} directly. The thumbnail
   needs an explicit height:100% (not auto) — .photo-thumb-slot is a
   row-direction flex container with align-items:center (not stretch), so
   a child with only aspect-ratio and auto width/height has no definite
   dimension to size from and collapses to its min-height:44px fallback
   instead of filling the slot. */
.person-photo-grid { grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); }
.photo-thumb-slot { height:200px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.photo-thumb-slot .photo-thumb { height:100%; width:auto; max-width:100%; }

/* ---- Untagged faces ---- */
.people-actions { display:flex; flex-wrap:wrap; align-items:center; gap:.6rem 1rem; }
.untagged-link { font-size:.85rem; font-weight:600; }
.untagged-info { padding:.5rem .75rem; display:flex; flex-direction:row; flex-wrap:wrap; justify-content:space-between; align-items:flex-start; font-size:.85rem; }
.untagged-info-left { display:flex; flex-direction:column; gap:.15rem; }
.untagged-date { color:var(--muted); font-size:.78rem; }
.face-group-badge { display:inline-block; width:fit-content; font-size:.72rem; font-weight:600; color:var(--muted); background:var(--hairline); padding:.1rem .5rem; border-radius:999px; }
.untagged-actions { display:flex; flex-wrap:wrap; gap:.35rem; align-items:flex-start; padding:.5rem .75rem .75rem; border-top:1px solid var(--hairline); }
.untagged-form { display:flex; flex-wrap:wrap; gap:.35rem; flex:1 0 100%; }
.untagged-form button { order:2; }
.untagged-input { order:1; flex:1; font:inherit; font-size:.85rem; padding:.35rem .5rem; border:1px solid var(--hairline); border-radius:var(--radius-lg); background:var(--paper); color:var(--ink); min-width:0; }
.untagged-skip-form { flex-shrink:0; }
.group-photo-strip { display:flex; gap:4px; flex-wrap:wrap; margin-top:4px; }
.group-photo-thumb { width:72px; height:72px; object-fit:cover; border-radius:var(--radius-md); border:1px solid var(--hairline); }
.group-photo-thumb-link { display:inline-flex; }
.face-select-label { font-size:.78rem; color:var(--muted); display:inline-flex; align-items:center; gap:3px; cursor:pointer; }

/* ---- People management ---- */
.new-person-form { display: flex; gap: .6rem; align-items: center; margin: 1rem 0 1.5rem; }
.new-person-input { font: inherit; padding: .5rem .6rem; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--card); color: var(--ink); flex: 0 1 20rem; }
.people-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.person-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: .5rem .75rem; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius-2xl); }
.person-row-main { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); flex: 1 1 12rem; min-width: 0; }
.person-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #e9dfca; flex: 0 0 auto; }
.person-av-blank { display: inline-block; }
.person-row-name { font-weight: 700; }
.person-row-count { color: var(--muted); font-size: .9rem; }
.person-row-suggested { color: var(--muted); opacity: 0.55; font-size: .9rem; }
.person-row-tools { display: none; flex-wrap: wrap; gap: .5rem; align-items: center; }
.people-list.edit-mode .person-row-tools { display: flex; }
.person-row-tools input, .person-row-tools select { font: inherit; padding: .35rem .5rem; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--paper); color: var(--ink); }
.person-rename-form, .person-merge-form { display: flex; gap: .35rem; align-items: center; }
.person-photo { position:relative; display:flex; flex-direction:column; gap:.25rem; }
.set-cover-form { text-align: center; }
.suggestion-actions { display: flex; gap: .35rem; justify-content: center; }
.suggestion-actions form { margin: 0; }
.suggestion-actions .btn-primary-sm { font-size: .72rem; padding: .15rem .5rem; }

/* ---- Admin: member management cards ---- */
.member-add { margin:1.5rem 0 2rem; }
.member-add-label { display:block; font-family:var(--sans); font-weight:600; font-size:.72rem; letter-spacing:.18em; text-transform:uppercase; color:var(--muted); margin-bottom:.3rem; }

.member-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}
.member-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2xl);
  padding: 1rem 1.1rem;
  box-shadow: 0 4px 16px rgba(60, 45, 20, 0.10);
}
.member-card-revoked { opacity: 0.6; }

.member-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.member-card-name {
  font-family: var(--head);
  font-weight: 800;
  font-size: 1.1rem;
}
.member-card-email {
  color: var(--muted);
  margin-left: 0.5rem;
  font-size: 0.9rem;
}
.member-card-email-none { font-style: italic; }

.member-role-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.member-role-viewer { background: #e7ded0; color: var(--ink); }
.member-role-contributor { background: var(--accent); color: #fff; }
.member-role-admin { background: var(--highlight); color: #fff; }

.member-card-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}
.member-card-revoked-note { font-style: italic; }

.member-card-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.member-role-form { gap: 0.4rem; }
.member-role-label {
  font-family: var(--head);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---- Photo viewer keyboard/focus/fullscreen enhancements ---- */
.stagetool:hover { background: rgba(0,0,0,.65); }
.stagetool:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.stagetool[aria-pressed="true"] { background: var(--terra); color: #fff; }
.stagetool[disabled] { opacity: .45; cursor: not-allowed; }

.photo-viewer.is-fullscreen { border-radius: 0; box-shadow: none; background: #000; }
.photo-viewer.is-fullscreen .photo-full {
  max-height: 100vh; max-width: 100vw;
  width: 100%; height: 100vh; object-fit: contain;
}
.photo-viewer:fullscreen { background: #000; }



/* Toggle row below the viewer (keyboard shortcuts + details) */
.viewer-foot { display:flex; gap:1.25rem; justify-content:flex-end; padding-top:.75rem; }

/* Keyboard shortcut cheatsheet under the viewer */
.viewer-shortcuts { color: var(--muted); font-size: .85rem; }
.viewer-shortcuts summary {
  cursor: pointer; min-height: 32px; display: inline-flex; align-items: center;
  font-family: var(--sans); font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; font-size: .72rem; color: var(--muted);
}
.viewer-shortcuts summary:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; border-radius: var(--radius); }
.viewer-shortcuts[open] summary { color: var(--ink); }
.viewer-shortcuts ul { list-style: none; padding: .5rem 0 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.viewer-shortcuts kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--radius);
}

/* Photo details panel (EXIF-derived date/location/device + edit forms). */
.photo-details { text-align: right; }
.photo-details > summary {
  cursor: pointer; display: inline-flex; align-items: center; min-height: 32px;
  font-family: var(--sans); font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; font-size: .72rem; color: var(--muted);
  list-style: none;
}
.photo-details > summary::-webkit-details-marker { display: none; }
.photo-details > summary:hover { color: var(--ink); }
.photo-details > summary:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; border-radius: var(--radius); }
.photo-details[open] > summary { color: var(--ink); }
.photo-details-body {
  text-align: left; margin-top: 8px; padding: .9rem 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  min-width: 480px;
}
.photo-details dl { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: .35rem 1.5rem; padding: 0; margin: 0; }
.photo-details dt { font-family: var(--sans); font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.photo-details dd { margin: 0; color: var(--ink); }
.meta-edit { margin-top: .75rem; }
.meta-edit > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center;
  font-family: var(--sans); font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; font-size: .7rem; color: var(--accent);
}
.meta-edit > summary::-webkit-details-marker { display: none; }
.meta-edit > summary:focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; border-radius: var(--radius); }
.meta-edit[open] > summary { color: var(--ink); }
.meta-edit-form { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; margin-top: .75rem; }
.meta-edit-form label { font-family: var(--head); font-weight: 800; font-size: .85rem; }
.meta-edit-form .form-input { width: 100%; }

@media (max-width: 860px) {
  .photo-details-body { width: 100%; max-width: 100%; min-width: 0; }
  .photo-details dl { grid-template-columns: auto 1fr; }
}

/* Home dashboard quick-action row */
.home-ed-quickactions {
  display: flex; gap: .75rem; flex-wrap: wrap;
  padding-bottom: 2rem; margin-bottom: 2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.home-ed .home-ed-qa {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: 0 1.25rem;
  border: 1px solid var(--line); color: var(--ink);
  font-family: var(--sans); font-size: .95rem; font-weight: 500;
  background: var(--card); border-radius: 999px;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.home-ed .home-ed-qa:hover, .home-ed .home-ed-qa:focus-visible { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.home-ed .home-ed-qa-primary { background: var(--accent); color: var(--paper); border-color: var(--accent); font-weight: 600; }
.home-ed .home-ed-qa-primary:hover, .home-ed .home-ed-qa-primary:focus-visible { background: transparent; color: var(--accent); border-color: var(--accent); }

/* ---- Home dashboard — Deep Study editorial ---- */
/* Scoped under .home-ed. Colors use shared theme tokens (--paper, --card, --ink, --muted, --line, --accent). */
.home-ed {
  /* full-bleed breakout independent of parent padding */
  margin: 0 calc(-50vw + 50%) 0; padding: 3.5rem 0 6rem;
  background: var(--paper); color: var(--ink);
}
.home-ed a { color: inherit; text-decoration: none; }
.home-ed-inner { max-width: 82rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }

/* Editorial masthead (home body only) */
.home-ed-mast {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 2rem; margin-bottom: 3rem; border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.home-ed-eyebrow { margin: 0 0 .5rem; font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; color: var(--accent); }
.home-ed-title { font-family: var(--head); font-weight: 400; font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.02; letter-spacing: -.015em; color: var(--ink); margin: 0; }
.home-ed-mast-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.home-ed-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.25rem; border: 1px solid color-mix(in srgb, var(--ink) 28%, transparent); color: var(--ink); font-family: var(--sans); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.home-ed-btn:hover, .home-ed-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.home-ed-btn-primary { background: var(--accent); color: var(--paper); border-color: var(--accent); font-weight: 700; }
.home-ed-btn-primary:hover, .home-ed-btn-primary:focus-visible { background: transparent; color: var(--accent); }

/* Grid split: 8 / 4 */
.home-ed-grid { display: grid; grid-template-columns: 1fr; gap: 3rem; }
@media (min-width: 960px) { .home-ed-grid { grid-template-columns: 2fr 1fr; gap: 3rem; } }
.home-ed-main { min-width: 0; display: flex; flex-direction: column; gap: 4rem; }

/* Rule + label used for section markers */
.home-ed-rule { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.home-ed-rule-line { flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.home-ed-rule-label { margin: 0; font-family: var(--sans); font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 600; }

/* Featured hero */
.home-ed-feature { position: relative; display: block; overflow: hidden; background: var(--card); aspect-ratio: 16/9; transition: opacity .2s ease; }
.home-ed-feature:hover { opacity: .95; }
.home-ed-feature-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-ed-feature-shade { position: absolute; inset: 0; background: linear-gradient(to top, var(--paper) 0%, color-mix(in srgb, var(--paper) 15%, transparent) 50%, transparent 100%); pointer-events: none; }
.home-ed-feature-caption { position: absolute; left: 2rem; right: 2rem; bottom: 1.5rem; color: var(--ink); }
.home-ed-feature-title { margin: 0 0 .35rem; font-family: var(--head); font-size: clamp(1.4rem, 3vw, 2.4rem); line-height: 1.1; }
.home-ed-feature-meta { margin: 0; color: var(--accent); font-style: italic; font-size: .9rem; font-weight: 300; }

/* Album section head with left gold bar */
.home-ed-section-head { margin: 0; padding-left: 1rem; border-left: 2px solid var(--accent); font-family: var(--head); font-style: italic; font-size: 1.9rem; line-height: 1; color: var(--ink); font-weight: 400; }
.home-ed-section-head-standalone { margin-bottom: 1.75rem; }
.home-ed-section-headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.home-ed-section-link { font-family: var(--sans); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; color: var(--muted); white-space: nowrap; transition: color .15s ease; }
.home-ed-section-link:hover, .home-ed-section-link:focus-visible { color: var(--accent); }

/* Recent Collections grid */
.home-ed-albums { display: grid; grid-template-columns: 1fr; gap: 3rem 2rem; }
@media (min-width: 640px) { .home-ed-albums { grid-template-columns: 1fr 1fr; } }
.home-ed-album { display: flex; flex-direction: column; gap: 1rem; transition: opacity .2s ease; }
.home-ed-album:hover { opacity: .88; }
.home-ed-album-cover { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: var(--card); }
.home-ed-album-cover-blank { background: var(--card); }
.home-ed-album-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.home-ed-album-title { margin: 0; font-family: var(--sans); font-weight: 500; font-size: 1.15rem; line-height: 1.3; color: var(--ink); }
.home-ed-album-count { text-align: right; }
.home-ed-album-num { display: block; font-family: var(--head); font-size: 1.25rem; line-height: 1; color: var(--accent); }
.home-ed-album-unit { display: block; margin-top: .2rem; font-size: .65rem; letter-spacing: .2em; text-transform: uppercase; color: color-mix(in srgb, var(--ink) 45%, transparent); }

/* Most reacted horizontal strip */
.home-ed-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); gap: .5rem; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .5rem; }
.home-ed-strip-item { position: relative; aspect-ratio: 1/1; background: var(--card); overflow: hidden; scroll-snap-align: start; }
.home-ed-strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s ease; }
.home-ed-strip-item:hover img { opacity: .82; }

/* Sidebar */
.home-ed-side { display: flex; flex-direction: column; gap: 3rem; }
.home-ed-card { background: var(--card); border: 1px solid color-mix(in srgb, var(--ink) 5%, transparent); padding: 2rem; display: flex; flex-direction: column; gap: 2.5rem; }
.home-ed-side-head { margin: 0 0 1rem; font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); font-weight: 700; font-family: var(--sans); }
.home-ed-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.home-ed-thumb { position: relative; aspect-ratio: 1/1; background: var(--paper); overflow: hidden; }
.home-ed-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s ease; }
.home-ed-thumb:hover img { opacity: .8; }
.home-ed-badge { position: absolute; bottom: 4px; right: 4px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: .6rem; pointer-events: none; }

.home-ed-faces { display: flex; flex-wrap: wrap; gap: .4rem; }
.home-ed-face { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .75rem; background: var(--paper); border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); font-size: .78rem; color: var(--ink); min-height: 34px; transition: border-color .15s ease, color .15s ease; }
.home-ed-face:hover, .home-ed-face:focus-visible { border-color: var(--accent); color: var(--accent); }
.home-ed-face-num { color: color-mix(in srgb, var(--ink) 40%, transparent); font-size: .7rem; font-variant-numeric: tabular-nums; }
.home-ed-face:hover .home-ed-face-num, .home-ed-face:focus-visible .home-ed-face-num { color: var(--accent); }

.home-ed-nav { border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); padding-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.home-ed-nav-link { display: flex; align-items: center; justify-content: space-between; font-size: .95rem; color: var(--ink); min-height: 32px; transition: color .15s ease; }
.home-ed-nav-link:hover, .home-ed-nav-link:focus-visible { color: var(--accent); }
.home-ed-nav-hint { font-family: var(--head); font-style: italic; opacity: 0; transition: opacity .2s ease; font-size: .95rem; }
.home-ed-nav-link:hover .home-ed-nav-hint, .home-ed-nav-link:focus-visible .home-ed-nav-hint { opacity: .7; }

.home-ed-quote { margin: 0; padding: 1.5rem 1.5rem 1.5rem 1.75rem; border-left: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); font-style: italic; }
.home-ed-quote p { margin: 0; font-family: var(--head); font-size: 1.15rem; line-height: 1.5; color: var(--ink); }
.home-ed-quote cite { display: block; margin-top: 1rem; font-style: normal; font-size: .68rem; letter-spacing: .28em; text-transform: uppercase; opacity: .5; }

/* Focus rings for keyboard nav */
.home-ed a:focus-visible, .home-ed button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Undo toast */
.undo-toast { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; background: var(--ink); color: var(--paper); font-size: .9rem; margin: 0 auto; max-width: 48rem; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.undo-toast-btn { background: var(--accent); color: var(--paper); border: none; padding: .3rem .8rem; border-radius: var(--radius); cursor: pointer; font-size: .85rem; font-weight: 600; }

/* Touch targets: bump controls under the ~44px guideline on touch-only
   input, without shrinking desktop mouse-driven density. Keyed on
   pointer/hover capability rather than viewport width since touch input
   isn't reliably correlated with a narrow screen. */
@media (hover: none) and (pointer: coarse) {
  .btn-primary, .comment-form button {
    min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  .btn-primary-sm {
    min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }
  .tag-chip { min-height: 44px; }
}

/* ============================================================
   Shared structural — consolidated from theme files
   (identical in both theme-light.css and theme-deep.css)
   ============================================================ */

/* ---- Album editorial layout ---- */
.album-editorial { max-width:78rem; margin:0 auto; padding:1rem 0 3rem; }
.album-ed-head { border-bottom:1px solid var(--line); padding-bottom:1.25rem; margin-bottom:1.5rem; }
.album-ed-kicker { color:var(--accent); font-family:var(--sans); font-weight:600; font-size:.72rem; letter-spacing:.22em; text-transform:uppercase; margin:0 0 .5rem; }
.album-ed-title { font-family:var(--head); font-size:clamp(2.2rem,5vw,3.6rem); line-height:1.05; margin:0; color:var(--ink); }
.album-ed-lede { color:var(--muted); font-size:1.05rem; max-width:44rem; margin:.9rem 0 0; line-height:1.55; font-family:var(--head); font-style:italic; }
.album-ed-meta { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-top:1.1rem; flex-wrap:wrap; }
.album-ed-count { color:var(--muted); font-family:var(--sans); font-size:.74rem; letter-spacing:.18em; text-transform:uppercase; }
.album-ed-add { display:inline-flex; align-items:center; padding:.55rem 1rem; }

/* ---- Album editorial mosaic ---- */
.album-ed-mosaic { display:grid; grid-template-columns:repeat(4,1fr); grid-auto-flow:dense; gap:.5rem; }
.album-ed-mosaic .album-ed-tile { aspect-ratio:1/1; overflow:hidden; margin:0; border-radius:var(--radius); background:var(--card-2); position:relative; cursor:default; }
.album-ed-mosaic .album-ed-tile[data-draggable] { cursor:grab; }
.album-ed-mosaic .album-ed-tile[data-draggable]:active { cursor:grabbing; }
.album-ed-mosaic .album-ed-tile a { display:block; width:100%; height:100%; }
.album-ed-mosaic .album-ed-tile img { width:100%; height:100%; object-fit:cover; display:block; transition:transform .6s ease; }
.album-ed-mosaic .album-ed-tile img.loaded { opacity:1; }
.album-ed-mosaic .album-ed-tile:hover img { transform:scale(1.05); }
.album-ed-mosaic .album-ed-tile:first-child { grid-column:1/-1; aspect-ratio:16/9; box-shadow:var(--shadow-lift); }
.album-ed-mosaic .album-ed-tile:first-child a { display:block; width:100%; height:100%; }
.album-ed-mosaic .album-ed-tile:first-child img { transition:transform .8s ease; }
.album-ed-mosaic .album-ed-tile:first-child:hover img { transform:scale(1.02); }
.album-ed-mosaic .album-ed-tile .set-cover-form { position:absolute; bottom:8px; left:8px; margin:0; text-align:left; z-index:2; }
.album-ed-mosaic .album-ed-tile .set-cover-form .btn-text { background:rgba(20,15,10,.6); color:#fff; padding:.3rem .6rem; border-radius:999px; font-size:.68rem; text-decoration:none; letter-spacing:.04em; }
.album-ed-mosaic .album-ed-tile .photo-select { position:absolute; top:8px; left:8px; z-index:2; width:20px; height:20px; }

/* ---- Mosaic irregular grid + editing ---- */
.album-ed-mosaic .album-ed-tile:nth-child(11n+4) { grid-column:span 2; grid-row:span 2; aspect-ratio:auto; }
.album-ed-mosaic.is-editing .album-ed-tile:nth-child(11n+4) { grid-column:span 1; grid-row:span 1; aspect-ratio:1/1; }
@media (max-width:720px) {
  .album-ed-mosaic { grid-template-columns:repeat(2,1fr); }
  .album-ed-mosaic .album-ed-tile:nth-child(11n+4) { grid-column:span 1; grid-row:span 1; aspect-ratio:1/1; }
}

/* ---- Drag-and-drop reordering ---- */
.album-ed-tile.is-dragging { opacity:.4; }
.album-ed-tile.drag-over { outline:2px dashed var(--accent); outline-offset:-2px; border-radius:var(--radius); }
.drag-handle { position:absolute; top:8px; right:8px; z-index:2; font-size:1.2rem; line-height:1; color:var(--muted); cursor:grab; user-select:none; }
.album-ed-tile[data-draggable]:active .drag-handle { cursor:grabbing; }

/* ---- Move-photos bar ---- */
.move-photos-bar { display:flex; align-items:center; flex-wrap:wrap; gap:.6rem; margin-bottom:.8rem; }
.move-photos-bar select { min-height:34px; }
.move-photos-bar .move-photos-label { margin:0; flex-basis:100%; font-size:.85rem; }
.move-photos-bar .move-selected-count { font-size:.8rem; color:var(--muted); margin-left:auto; }

/* ---- Person photo set-cover overlay ---- */
.person-photo .set-cover-form { position:absolute; bottom:8px; left:8px; margin:0; text-align:left; z-index:2; }
.person-photo .set-cover-form .btn-text { background:rgba(20,15,10,.6); color:#fff; padding:.3rem .6rem; border-radius:999px; font-size:.68rem; text-decoration:none; letter-spacing:.04em; }

/* ---- Album editorial facts ---- */
.album-ed-facts { display:flex; flex-wrap:wrap; gap:1rem 2.2rem; margin:1rem 0 0; padding:0; color:var(--muted); }
.album-ed-fact { margin:0; }
.album-ed-fact dt { font-family:var(--sans); font-weight:600; font-size:.68rem; letter-spacing:.22em; text-transform:uppercase; color:var(--muted); margin:0 0 .2rem; }
.album-ed-fact dd { margin:0; color:var(--ink); font-family:var(--head); font-size:1rem; line-height:1.35; }

/* ---- Photo viewer bar: breadcrumb + counter ---- */
.viewer-bar { align-items:center; gap:1rem; }
.viewer-crumb { display:inline-flex; align-items:center; gap:.7rem; text-decoration:none; color:var(--ink); padding:.35rem .55rem; border-radius:var(--radius); transition:background .2s ease, color .2s ease; }
.viewer-crumb:hover { background:var(--card); color:var(--accent); }
.viewer-crumb-arrow { color:var(--muted); font-size:1.1rem; line-height:1; }
.viewer-crumb:hover .viewer-crumb-arrow { color:var(--accent); }
.viewer-crumb-label { display:inline-flex; flex-direction:column; line-height:1.1; }
.viewer-crumb-kicker { font-family:var(--sans); font-weight:600; font-size:.62rem; letter-spacing:.22em; text-transform:uppercase; color:var(--muted); }
.viewer-crumb-title { font-family:var(--head); font-size:1rem; color:inherit; max-width:22rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.viewer-counter { display:inline-flex; align-items:baseline; gap:.1rem; padding:.3rem .65rem; border:1px solid var(--line); border-radius:999px; background:var(--card); color:var(--muted); font-family:var(--sans); font-size:.78rem; letter-spacing:.08em; }
.viewer-counter-n { color:var(--ink); font-weight:700; }
.viewer-counter-sep { margin:0 .2rem; opacity:.55; }
@media (max-width:640px) {
  .viewer-crumb-title { max-width:10rem; font-size:.95rem; }
  .viewer-counter { font-size:.72rem; padding:.25rem .55rem; }
}

/* ---- Mobile nav bar: bottom text-strip inside photo-viewer ---- */
.mobile-nav-bar { display: none; }
.mobile-nav-placeholder { color: var(--muted); opacity: .4; min-width: 60px; text-align: center; font-size: .85rem; font-family: var(--sans); font-weight: 600; }

@media (max-width: 640px) {
  .nav-zone { display: none; }
  .mobile-nav-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: var(--card);
    border-top: 1px solid var(--line);
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 4;
  }
  .mobile-nav-prev, .mobile-nav-next {
    min-height: 44px; min-width: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none; color: var(--ink);
    font-family: var(--sans); font-weight: 600; font-size: .85rem;
    padding: 8px 16px; border-radius: var(--radius-lg);
    background: var(--card-2); border: 1px solid var(--line);
    transition: background .15s ease, border-color .15s ease;
  }
  .mobile-nav-prev:hover, .mobile-nav-next:hover { border-color: var(--accent); color: var(--accent); }
  .mobile-nav-counter {
    font-family: var(--sans); font-size: .78rem; color: var(--muted);
  }
}

/* ---- Mobile: chunkier photo page layout ---- */
@media (max-width: 640px) {
  html { touch-action: manipulation; }
  main { padding: 12px 12px 96px; }
  .photo-viewer { min-height: 45vh; }
  .photo-title { font-size: 1.4rem; margin-top: 1.2rem; }
  .date-line { margin-bottom: .8rem; }
  .viewer-bar .viewer-crumb-kicker { display: none; }
  .viewer-tools { gap: 6px; }
  .viewer-tools .stagetool { font-size: .75rem; padding: 6px 10px; min-height: 40px; }
  .viewer-foot { justify-content: flex-start; }
  .photo-details > summary { min-height: 40px; }
}

/* ---- Back link ---- */
.back-link { display:inline-flex; align-items:center; gap:.5rem; margin-top:2.5rem; padding:.45rem .8rem; border-radius:999px; border:1px solid var(--line); color:var(--muted); text-decoration:none; font-family:var(--sans); font-size:.7rem; letter-spacing:.2em; text-transform:uppercase; transition:color .2s ease, border-color .2s ease; }
.back-link:hover { color:var(--accent); border-color:var(--accent); }
.back-link:not(.viewer-crumb)::before { content:"←"; font-size:1rem; letter-spacing:0; }

/* ---- Flash messages ---- */
.flash { color:var(--accent); font-family:var(--head); font-size:1.05rem; margin:0 0 .75rem; }

/* ---- Signin page ---- */
.signin { text-align:center; max-width:28rem; margin:3rem auto 0; }
.signin-lead { color:var(--muted); margin:0 0 1.5rem; }
.signin-btn { display:inline-block; text-decoration:none; }
.signin-note { color:var(--muted); margin:1.25rem 0 0; font-size:.85rem; }

/* ---- Join page ---- */
.join-request { max-width:28rem; margin:0 auto; }
.join-request-form { margin-top:1rem; display:flex; flex-direction:column; gap:.75rem; }

/* ---- Person suggestions CTA ---- */
.person-suggestions-cta { margin:.5rem 0 1rem; }

/* ---- Untagged/suggestions toolbar ---- */
.untagged-toolbar { display:flex; gap:.75rem; align-items:center; margin:.75rem 0 1rem; }
.untagged-toggle { font-size:.82rem; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); text-decoration:none; min-height:44px; display:inline-flex; align-items:center; }
.untagged-toggle:hover { color:var(--accent); }

/* ---- Suggestions filter context ---- */
.suggestions-filter-context { margin:0 0 .5rem; font-size:.85rem; }
.suggestions-filter-context a { color:var(--muted); text-decoration:none; }
.suggestions-filter-context a:hover { color:var(--accent); }

/* ---- Page description ---- */
.page-description { color:var(--muted); margin:0 0 1rem; }

/* ---- Admin section headings + form group ---- */
.admin-section > h2, .admin-sub-h2 { font-family:var(--sans); font-weight:600; font-size:.78rem; letter-spacing:.22em; text-transform:uppercase; color:var(--muted); margin:2rem 0 1rem; }
.admin-section .form-group { margin-bottom:.9rem; }

/* ---- Deleted items ---- */
.deleted-list { list-style:none; padding:0; margin:1.5rem 0; display:grid; gap:.75rem; }
.deleted-item { display:grid; grid-template-columns:72px 1fr auto; gap:1rem; align-items:center; padding:.8rem; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); }
.deleted-thumb { width:72px; height:72px; object-fit:cover; border-radius:calc(var(--radius) - 2px); background:var(--card-2); }
.deleted-meta { min-width:0; }
.deleted-name { color:var(--ink); font-family:var(--head); font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.deleted-when { color:var(--muted); font-size:.82rem; margin-top:.15rem; }

/* ---- Join requests ---- */
.join-requests { margin:1.5rem 0 2rem; }
.join-request-cards { list-style:none; padding:0; margin:1rem 0 0; display:grid; gap:.75rem; }
.join-request-card { padding:1rem 1.1rem; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.join-request-note { color:var(--muted); margin:.5rem 0 .8rem; font-style:italic; }
.join-request-actions { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.join-request-approve { display:flex; gap:.5rem; align-items:center; margin:0; }

/* ---- Member add form ---- */
.member-add-form { display:grid; grid-template-columns:repeat(auto-fit,minmax(12rem,1fr)); gap:.75rem 1rem; align-items:end; margin-top:1rem; }
.member-add-field { min-width:0; }
.member-add-form button { grid-column:1/-1; justify-self:start; }

/* ---- Theme toggle + signout (shared structural) ---- */
.theme-toggle { display:inline-flex; gap:4px; }
.theme-toggle form { margin:0; }
.signout-form .btn-text { text-decoration:none; letter-spacing:.14em; text-transform:uppercase; font-size:.72rem; }

/* ---- Mobile: token input & chip sizing ---- */
@media (max-width: 640px) {
  .token-input-wrap { width: 100%; }
  .token-input-inner { width: 100%; }
  .token-input { width: 100%; font-size: 16px; }
  .token-chip-remove { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .person-chip { min-height: 44px; }
  .tag-chip { min-height: 44px; }
  .people-chips, .tag-chips { gap: 6px; }
}

/* ---- Suggestion picker (pill row) ---- */
.suggestion-picker {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin: .75rem 0 1.25rem;
}
.suggestion-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 40px; padding: .45rem .9rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--muted);
  font-family: var(--sans); font-size: .88rem; font-weight: 500;
  cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.suggestion-pill:hover, .suggestion-pill:focus-visible {
  border-color: var(--accent); color: var(--accent);
}
.suggestion-pill.active, .suggestion-pill[aria-pressed="true"] {
  border-color: var(--accent); background: var(--accent); color: var(--paper);
  font-weight: 600;
}
.suggestion-pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5em; height: 1.5em; padding: 0 .35em;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: .78em; font-weight: 600;
}
.suggestion-pill.active .suggestion-pill-count,
.suggestion-pill[aria-pressed="true"] .suggestion-pill-count {
  background: color-mix(in srgb, var(--paper) 20%, transparent);
}

/* ---- Decision card (suggestions) ---- */
.decision-card {
  display: grid; grid-template-columns: 1fr;
  gap: 1.25rem; margin-top: .75rem;
}
@media (min-width: 760px) {
  .decision-card {
    grid-template-columns: 3fr 2fr;
    gap: 2rem; align-items: start;
  }
}
.decision-card-media {
  min-width: 0;
}
.decision-card-panel {
  display: flex; flex-direction: column; gap: 1rem;
}
.decision-question {
  margin: 0; font-family: var(--head); font-size: 1.3rem;
  color: var(--ink); line-height: 1.3;
}
.decision-question strong { color: var(--accent); }

/* Bigger touch-target suggestion buttons */
.suggestion-actions {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.suggestion-actions .btn-primary-sm {
  min-height: 44px; padding: .55rem 1.2rem;
  font-size: .9rem;
}

/* ---- Admin nav tiles ---- */
.admin-nav-icon {
  font-size: 1.6rem; line-height: 1;
  display: block; margin-bottom: .35rem;
}
.admin-nav-label {
  display: block; font-family: var(--sans); font-weight: 600;
  font-size: .95rem; color: var(--ink); margin-bottom: .2rem;
}
.admin-nav-desc {
  display: block; font-family: var(--sans); font-weight: 400;
  font-size: .78rem; color: var(--muted); line-height: 1.3;
}

/* ---- Admin card sections ---- */
.admin-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ---- Confirm person modal ---- */
#confirm-person-modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 28rem;
  box-shadow: var(--shadow);
  background: var(--card);
  color: var(--ink);
}
#confirm-person-modal::backdrop {
  background: rgba(0,0,0,.35);
}
#confirm-person-modal p {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.4;
}
.confirm-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
}
#confirm-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
#confirm-candidates .candidate-btn {
  font-family: var(--sans);
  font-size: .82rem;
  padding: .25rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
#confirm-candidates .candidate-btn:hover {
  background: var(--line);
}
