:root {
  --infield: #5b1f1c;
  --infield-2: #7a2c25;
  --lager: #ee8a2f;
  --lager-deep: #b4561a;
  --ink: #2b1c16;
  --muted: #7a6458;
  --line: #eadfd3;
  --paper: #fcf8f2;
  --wash: #f5ece1;
  --danger: #b42318;
  --surface: #ffffff;   /* inputs, buttons, pop-ups */
  --on-lager: #2b1c16;  /* text on the orange buttons, same in both themes */
  --stage: #2b1c16;     /* behind photos and video, same in both themes */
  --accent: #9a3b22;    /* links, text, and borders in the accent color */
  --accent-strong: #5b1f1c;
  --rule: #5b1f1c;      /* heavy section rules */
  --like: #c42f45;
  --like-bg: #fff3f5;
  --like-line: #e0475c;
  --shadow: rgba(19, 36, 26, 0.15);
  color-scheme: light;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Dark palette. Applies when chosen, or when the system prefers dark and nothing was chosen. */
:root[data-theme="dark"] {
  --infield: #4a1816;
  --ink: #f3e8de;
  --muted: #bba596;
  --line: #3d2a23;
  --paper: #17100d;
  --wash: #231813;
  --danger: #ff8a7a;
  --surface: #1d1410;
  --accent: #f4a261;
  --accent-strong: #f6b17a;
  --rule: #b4561a;
  --like: #ff6f86;
  --like-bg: #3a1820;
  --like-line: #ff6f86;
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --infield: #4a1816;
    --ink: #f3e8de;
    --muted: #bba596;
    --line: #3d2a23;
    --paper: #17100d;
    --wash: #231813;
    --danger: #ff8a7a;
    --surface: #1d1410;
    --accent: #f4a261;
    --accent-strong: #f6b17a;
    --rule: #b4561a;
    --like: #ff6f86;
    --like-bg: #3a1820;
    --like-line: #ff6f86;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  padding-bottom: env(safe-area-inset-bottom);
}
img, video { max-width: 100%; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--lager); outline-offset: 2px; }
.muted { color: var(--muted); }

h1, h2, h3 { font-family: var(--display); font-weight: 900; line-height: 1.02; margin: 0 0 0.4em; }
h1 { font-size: clamp(2.4rem, 8vw, 3.6rem); }
h2 { font-size: 1.8rem; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.main { padding-top: 28px; padding-bottom: 72px; }

/* Header */
.site-header { background: var(--infield); color: #fff; padding-top: env(safe-area-inset-top); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 24px; padding-top: 14px; padding-bottom: 14px;
}
.brand {
  font-family: var(--display); font-weight: 900; font-size: 1.7rem; line-height: 1;
  color: var(--lager); text-decoration: none;
}
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; }
.nav a, .nav .link {
  color: #fff; text-decoration: none; font-weight: 700; font-size: 0.95rem;
  padding: 8px 0; border-bottom: 3px solid transparent;
}
.nav a[aria-current="page"] { border-bottom-color: var(--lager); }
.tabs { margin-left: auto; }
.tab-icon, .nav .short { display: none; }

/* Phones: main sections move to a tab bar fixed along the bottom (thumb reach, always visible).
   The header keeps the brand and the avatar; Users and Sign out live on the profile page. */
@media (max-width: 720px) {
  .header-inner { flex-wrap: nowrap; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
  .brand { font-size: 1.35rem; min-width: 0; }
  .nav .wide-only, .nav .long, .nav .me span { display: none; }
  .nav .me { padding: 4px 0; border-bottom: 0; }
  .nav .me .avatar { width: 32px; height: 32px; }
  .nav .me[aria-current="page"] .avatar { box-shadow: 0 0 0 3px var(--lager); }
  .tabs {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; margin: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    background: var(--infield); border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .tabs a {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px 7px; border-bottom: 0; font-size: 0.72rem; line-height: 1.1;
    color: rgba(255, 255, 255, 0.72);
  }
  .tabs a[aria-current="page"] { color: var(--lager); }
  .tabs a[aria-current="page"]::before {
    content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 3px;
    border-radius: 0 0 3px 3px; background: var(--lager);
  }
  .tab-icon, .nav .short { display: block; }
  .tab-icon { width: 24px; height: 24px; }
  .nav.tabs .dot { position: absolute; top: 6px; left: calc(50% + 7px); margin: 0; box-shadow: 0 0 0 2px var(--infield); }
  body.has-tabs { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
}
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 28px; font-size: 0.92rem; color: var(--muted); }
.site-footer a { font-weight: 700; }

/* Hero: the four-lap strip is the one loud thing on the site */
.hero {
  background: var(--infield); color: #fff; border-radius: 24px;
  padding: clamp(24px, 6vw, 56px); margin-bottom: 48px;
}
.hero-title {
  font-size: clamp(3.2rem, 14vw, 7rem); line-height: 0.88; color: var(--lager);
  margin: 0; text-wrap: balance;
}
.hero-sub { font-size: 1.3rem; margin: 0.7em 0 1.6em; }
.laps {
  list-style: none; padding: 0; margin: 0 0 32px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.lap { display: flex; flex-direction: column; gap: 10px; }
.lap-can {
  display: block; width: 28px; height: 48px; border-radius: 7px 7px 5px 5px;
  background: linear-gradient(90deg, var(--lager-deep), var(--lager) 45%, #ffc078 60%, var(--lager-deep));
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.45);
}
.lap-label {
  display: block; border-top: 4px solid #fff; padding-top: 8px;
  font-weight: 700; font-size: 0.85rem; line-height: 1.2;
}
@media (prefers-reduced-motion: no-preference) {
  .lap-can { animation: crack 420ms cubic-bezier(.2, .8, .3, 1.3) both; }
  .lap:nth-child(2) .lap-can { animation-delay: 140ms; }
  .lap:nth-child(3) .lap-can { animation-delay: 280ms; }
  .lap:nth-child(4) .lap-can { animation-delay: 420ms; }
  @keyframes crack { from { transform: translateY(14px) scale(0.85); opacity: 0; } }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* `hidden` always wins, even over components that set their own display (like .btn). */
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  color: inherit; background: transparent; border: 2px solid currentColor;
}
.btn-primary { background: var(--lager); border-color: var(--lager); color: var(--on-lager); }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* Year grid (home) */
.year-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.year-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
  border: 2px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none;
}
.year-tile:hover { border-color: var(--accent); }
.year-num { font-family: var(--display); font-weight: 900; font-size: 2.4rem; line-height: 1; }
.year-status { font-size: 0.85rem; color: var(--muted); }
.year-tile.posted .year-status { color: var(--accent); font-weight: 700; }

/* Year strip */
.year-strip {
  display: flex; gap: 6px; overflow-x: auto; margin: 0 0 24px; padding-bottom: 6px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.year-strip a {
  flex: none; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 700; font-variant-numeric: tabular-nums;
}
.year-strip a[aria-current="page"] { background: var(--infield); border-color: var(--infield); color: #fff; }

/* Results */
.results-year { font-size: clamp(4.5rem, 22vw, 9rem); line-height: 0.82; color: var(--accent-strong); margin-bottom: 0.15em; }
.division { margin-top: 40px; }
.division-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px;
  border-bottom: 4px solid var(--rule); padding-bottom: 6px;
}
.division-head h2, .division-head p { margin: 0; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result {
  display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: baseline; gap: 12px;
  padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.place { font-family: var(--display); font-weight: 900; font-size: 1.9rem; line-height: 1; color: var(--muted); }
.podium .place { color: var(--lager-deep); }
.name { font-weight: 700; overflow-wrap: anywhere; }
.notes { display: block; font-size: 0.9rem; color: var(--muted); }
.time { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; text-align: right; }
.time small { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.empty { padding: 24px; border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); }
.empty p { margin: 0.3em 0; }

/* Forms */
.narrow { max-width: 480px; }
.stack > * + * { margin-top: 16px; }
label { display: block; font-weight: 700; font-size: 0.95rem; }
input[type="email"], input[type="text"], input[type="search"], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 10px;
}
input[type="file"] { display: block; width: 100%; margin-top: 8px; font: inherit; font-weight: 400; }
.error { color: var(--danger); font-weight: 700; }
.flash { padding: 12px 16px; background: var(--wash); border-left: 4px solid var(--accent); border-radius: 6px; }

/* Upload */
.upload-panel { background: var(--wash); border-radius: 20px; padding: clamp(18px, 4vw, 28px); margin-bottom: 32px; }
.upload-panel h2 { margin-bottom: 0.5em; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row > label { flex: 1 1 140px; }
.field-row > .grow { flex: 3 1 240px; }
.year-pick select { max-width: 220px; }
.upload-status { list-style: none; padding: 0; margin: 16px 0 0; }
.upload-status:empty { display: none; }
.upload-status li {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.92rem;
}
.upload-status li > span:first-child { overflow-wrap: anywhere; }
.upload-status progress { grid-column: 1 / -1; width: 100%; height: 8px; accent-color: var(--accent); }
.upload-status .failed { color: var(--danger); }

/* Gallery */
.gallery {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px;
}
.tile { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--wash); }
.tile > a > img, .tile > video, .file-tile { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--stage); }
.tile > a > img { object-fit: cover; }
.tile > video { object-fit: contain; }
.file-tile { display: grid; place-items: center; padding: 16px; text-align: center; color: #fff; }
.tile-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; font-size: 0.92rem; }
.tile-meta form { margin-top: 4px; }
.danger-link {
  background: none; border: 0; padding: 0; font: inherit; font-size: 0.88rem;
  color: var(--danger); text-decoration: underline; cursor: pointer;
}

/* Users (admin) */
.user-list { list-style: none; padding: 0; margin: 0; }
.user-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-list .who { min-width: 0; overflow-wrap: anywhere; }
.user-stats { display: block; font-size: 0.88rem; }
.member-filter { margin: 4px 0 8px; }
.invite { margin: 16px 0 24px; }
.invite summary { display: inline-flex; list-style: none; cursor: pointer; }
.invite summary::-webkit-details-marker { display: none; }
.invite[open] summary { margin-bottom: 14px; }
.member-sorts { margin: 0 0 8px; }
.member-list li { padding: 0; }
.member-row { display: flex; align-items: center; gap: 14px; flex: 1; padding: 12px 0; color: inherit; text-decoration: none; }
.member-row strong { color: var(--accent); }
.member-row:hover strong { text-decoration: underline; }
.pending { margin-bottom: 28px; }
.name-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.pending .who { flex: 1; }
.pending-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pending-actions .tag-form { flex: 1 1 260px; }
code { font-size: 0.9em; }

/* Avatars & profile */
.avatar { display: inline-block; flex: none; border-radius: 50%; object-fit: cover; background: var(--wash); vertical-align: middle; }
.avatar-sm { width: 24px; height: 24px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 96px; height: 96px; box-shadow: 0 0 0 4px var(--lager); }
.nav .me { display: inline-flex; align-items: center; gap: 8px; }
.nav .me .avatar { box-shadow: 0 0 0 2px var(--lager); }
.byline { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
a.byline, .message-author { color: inherit; text-decoration: none; }
a.byline:hover, .message-author:hover { text-decoration: underline; }
.profile-card { display: flex; align-items: center; gap: 18px; margin: 8px 0 28px; }
.profile-card > div { display: flex; flex-direction: column; min-width: 0; }
.profile-name { font-family: var(--display); font-weight: 900; font-size: 2rem; line-height: 1.05; overflow-wrap: anywhere; }
.hint { font-size: 0.88rem; margin: 6px 0 0; }
.profile-h2 { margin-top: 40px; }
.avatar-options { display: grid; gap: 12px; }
.avatar-option { background: var(--wash); border-radius: 16px; padding: 16px; }
.avatar-option p { margin: 0 0 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Gallery tile text links to the item page */
.tile-link { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.tile-link:hover .tile-caption { text-decoration: underline; }
.upload-status .skipped { color: var(--muted); }

/* Item page */
.detail-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; font-weight: 700; }
.detail-step { display: inline-flex; gap: 16px; }
.detail { margin: 0; }
.detail-stage { position: relative; }
.detail-stage > a > img, .detail-stage > video {
  display: block; width: 100%; max-height: 78vh; object-fit: contain;
  background: var(--stage); border-radius: 14px;
}
.detail .file-tile { aspect-ratio: 4 / 3; border-radius: 14px; }
.detail-meta { padding-top: 14px; }
.detail-meta p { margin: 0 0 8px; }
.detail-caption { font-size: 1.25rem; font-weight: 700; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.detail-actions form { margin: 0; }

/* Updates feed */
.nav .dot {
  display: inline-block; width: 9px; height: 9px; margin-left: 5px; border-radius: 50%;
  background: var(--lager); vertical-align: 2px;
}
.updates { list-style: none; padding: 0; margin: 0; }
.update { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.update-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.update-text { color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.update-text:hover { text-decoration: underline; }
.update-when { font-size: 0.88rem; }
.new-pill {
  display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 999px;
  background: var(--lager); color: var(--on-lager); font-weight: 700; font-size: 0.78rem;
}
.update-thumbs { display: flex; gap: 6px; margin-top: 6px; }
.update-thumbs img { display: block; width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--wash); }

/* Item page arrows */
.arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(19, 36, 26, 0.6); color: #fff; text-decoration: none;
  font-size: 2rem; line-height: 1; padding-bottom: 4px;
}
.arrow:hover { background: rgba(19, 36, 26, 0.85); }
.arrow-prev { left: 10px; }
.arrow-next { right: 10px; }

/* Caption editing */
.caption-edit { margin: 0 0 10px; }
.caption-edit summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 0.92rem; }
.caption-edit form { margin-top: 8px; }

/* Tags */
.tags { margin: 14px 0; }
.tag-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 6px 3px 4px;
  background: var(--wash); border-radius: 999px; font-weight: 700; font-size: 0.92rem;
}
.tag a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; }
.tag-x { background: none; border: 0; padding: 0 4px; font: inherit; font-size: 1.1rem; line-height: 1; color: var(--muted); cursor: pointer; }
.tag-form { display: flex; gap: 8px; }
.tag-form input { margin-top: 0; flex: 1; min-width: 0; }
.tag-form .btn { min-height: 0; }

/* Chat */
.chat { margin-top: 36px; border-top: 4px solid var(--rule); padding-top: 16px; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.message { display: flex; gap: 12px; padding: 10px 0; }
.message-body { min-width: 0; flex: 1; }
.message-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message .danger-link { font-size: 0.8rem; }
.message form { margin: 2px 0 0; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form .combo { flex: 1; }
.chat-form textarea { margin-top: 0; width: 100%; resize: vertical; }
/* The chat box sits at the bottom of the page, so its @mention list opens upward. */
.combo-list.combo-up { top: auto; bottom: calc(100% + 4px); }
.message-text a { font-weight: 700; }
.update-quote { display: block; margin: 2px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--ink); overflow-wrap: anywhere; }
.update-quote::before, .update-quote::after { content: none; }

/* Gallery thumbnails & paging */
.video-thumb { position: relative; display: block; }
.video-thumb::after {
  content: "▶"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 52px; height: 52px; padding-left: 4px; border-radius: 50%;
  background: rgba(19, 36, 26, 0.65); color: #fff; font-size: 1.3rem;
}
.load-more { text-align: center; margin-top: 24px; }

/* Likes */
.tile-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.tile-actions form { margin: 0; }
.like { margin: 0; }
.like button {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 10px 0 8px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 0.9rem; color: var(--ink); cursor: pointer;
}
.like button[aria-pressed="true"] { border-color: var(--like-line); color: var(--like); background: var(--like-bg); }
.like .heart { font-size: 1.1rem; line-height: 1; }
.like .like-count:empty { display: none; }
.like-big button { min-height: 44px; padding: 0 16px 0 12px; font-size: 1rem; }
.like-big .heart { font-size: 1.35rem; }
.like-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0; }
.liked-by { font-size: 0.92rem; }

/* Sort strip */
.sort-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: -12px 0 20px; font-size: 0.92rem; }
.sort-strip a { color: var(--ink); text-decoration: none; font-weight: 700; padding: 4px 0; border-bottom: 3px solid transparent; }
.sort-strip a[aria-current="page"] { border-bottom-color: var(--lager); }
.tile-counts { display: inline-flex; align-items: center; gap: 8px; }
.chat-count { font-size: 0.88rem; font-weight: 700; color: var(--ink); text-decoration: none; }

/* Tag picker */
.combo { position: relative; flex: 1; min-width: 0; }
.combo input { margin-top: 0; }
.combo-list {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px var(--shadow);
}
.combo-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.combo-list li[aria-selected="true"] { background: var(--wash); }
.combo-list .combo-empty { color: var(--muted); font-weight: 400; cursor: default; }

/* Recently liked in the feed */
.update-icon {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--like-bg); color: var(--like); font-size: 1.5rem;
}
.update-likers { font-size: 0.92rem; color: var(--muted); }
.update-thumb { position: relative; display: block; }
.thumb-likes {
  position: absolute; right: 4px; bottom: 4px; padding: 0 6px; border-radius: 999px;
  background: var(--surface); color: var(--like); font-size: 0.75rem; font-weight: 700;
}
.update-more { font-size: 0.92rem; font-weight: 700; }

/* Theme switcher (footer) */
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.theme-switch { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; padding: 2px; }
.theme-switch button {
  background: none; border: 0; border-radius: 999px; padding: 4px 12px;
  font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--muted); cursor: pointer;
}
.theme-switch button[aria-pressed="true"] { background: var(--wash); color: var(--ink); }

/* Result links */
.person { display: inline-flex; align-items: center; gap: 4px; }
.person-link { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.link-x { background: none; border: 0; padding: 0 2px; font: inherit; color: var(--muted); cursor: pointer; }
.link-person { display: inline-block; font-weight: 400; }
.link-person summary { display: inline; cursor: pointer; color: var(--accent); font-size: 0.8rem; font-weight: 700; list-style: none; }
.link-person summary::-webkit-details-marker { display: none; }
.link-person[open] { display: block; margin: 6px 0; flex-basis: 100%; }
/* While linking, the form gets the row's full width (time drops below) so the name doesn't squeeze. */
.person:has(.link-person[open]) { display: flex; flex-wrap: wrap; }
.result:has(.link-person[open]) .who { grid-column: 2 / -1; }
.result:has(.link-person[open]) .time { grid-column: 2 / -1; text-align: left; }
.result .combo-list { overflow-wrap: normal; }
.link-person .tag-form { margin-top: 6px; }

/* Member pages */
.member-head h1 { margin: 0; }
.member-edit { font-size: 0.92rem; font-weight: 700; margin-top: 4px; }
.member-section { margin-top: 32px; }
.member-results .name { text-decoration: none; color: var(--ink); }
.member-strip {
  list-style: none; padding: 0; margin: 0 0 8px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(30%, 140px), 1fr)); gap: 8px;
}
.member-strip a { display: block; }
.member-strip img, .member-strip .file-tile {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--stage);
}

/* Share */
.share-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--ink); cursor: pointer;
}
.share-btn:hover { border-color: var(--accent); }
.member-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; }
.member-actions .member-edit { margin-top: 0; }
.results-head .share-btn { margin: 4px 0 8px; }

/* Notification settings on /profile */
.notify-prefs { margin-top: 20px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 4px; flex: none; }
.steps { margin: 8px 0; padding-left: 1.4em; }
.steps li { margin: 6px 0; }

/* On/off switch (notifications on /profile): a real checkbox, drawn as a sliding toggle. */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: var(--wash); border-radius: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track { position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--muted); transition: background 0.2s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.2s; }
.switch input:checked + .switch-track { background: var(--lager); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.6; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-thumb { transition: none; } }
