/*
 * Light Catchers: one stylesheet for the Worker pages (src/views/layout.tsx)
 * and the Hugo pages (site/layouts).
 *
 * Calm neutrals so photos carry the colour, one warm accent, soft rounded
 * shapes, small and quick motion. No inline styles anywhere (the CSP forbids
 * them), so everything a page needs is a class here.
 *
 * Theme: light by default, dark when the device prefers it, unless the
 * visitor picked one (data-theme="light" | "dark" on <html>, set server-side
 * from a cookie).
 */

/* ------------------------------------------------------------ tokens -- */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --surface-3: #e5e3dc;
  --line: #e3e1da;
  /* Edges that identify a control or a state: 3:1 or more against the page,
     cards and grey tracks (1.4.11). --line is for decoration only. */
  --control-line: #85837b;
  --fg: #19191b;
  --muted: #64645f;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-fg: #ffffff;
  --accent-soft: #fdeee4;
  --err: #b42318;
  --err-soft: #fdecea;
  --ok: #18794e;
  --ok-soft: #e6f4ec;
  --warn: #8a4b00;
  --warn-soft: #fcf0d6;
  --stage: #ebe9e3;
  --shadow-1: 0 1px 2px rgb(20 20 18 / .05), 0 1px 1px rgb(20 20 18 / .03);
  --shadow-2: 0 6px 20px -6px rgb(20 20 18 / .14), 0 2px 6px -2px rgb(20 20 18 / .06);
  --shadow-3: 0 18px 48px -12px rgb(20 20 18 / .25);
  --glass: rgb(246 245 242 / .78);

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --pill: 999px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --fast: 140ms;
  --mid: 240ms;
  --slow: 420ms;

  --gutter: 16px;
  --bar-h: 60px;
  --tabbar-h: 64px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101012;
    --surface: #18181b;
    --surface-2: #222226;
    --surface-3: #2c2c31;
    --line: #2a2a2f;
    --control-line: #75757c;
    --fg: #f2f2ef;
    --muted: #a3a39d;
    --accent: #fb923c;
    --accent-strong: #fdba74;
    --accent-fg: #1a1209;
    --accent-soft: #2b1d12;
    --err: #ff8a7a;
    --err-soft: #2e1714;
    --ok: #5fd39b;
    --ok-soft: #12261c;
    --warn: #f5c062;
    --warn-soft: #2a2110;
    --stage: #0a0a0b;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-2: 0 8px 24px -8px rgb(0 0 0 / .6);
    --shadow-3: 0 20px 50px -12px rgb(0 0 0 / .7);
    --glass: rgb(16 16 18 / .72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101012;
  --surface: #18181b;
  --surface-2: #222226;
  --surface-3: #2c2c31;
  --line: #2a2a2f;
  --control-line: #75757c;
  --fg: #f2f2ef;
  --muted: #a3a39d;
  --accent: #fb923c;
  --accent-strong: #fdba74;
  --accent-fg: #1a1209;
  --accent-soft: #2b1d12;
  --err: #ff8a7a;
  --err-soft: #2e1714;
  --ok: #5fd39b;
  --ok-soft: #12261c;
  --warn: #f5c062;
  --warn-soft: #2a2110;
  --stage: #0a0a0b;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 8px 24px -8px rgb(0 0 0 / .6);
  --shadow-3: 0 20px 50px -12px rgb(0 0 0 / .7);
  --glass: rgb(16 16 18 / .72);
  color-scheme: dark;
}

/* -------------------------------------------------------------- base -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem); font-weight: 750; margin: 0 0 1rem; letter-spacing: -.025em; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 2rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; }
p { margin: 0 0 1rem; }
code { font-family: var(--mono); font-size: .92em; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.prewrap { white-space: pre-line; overflow-wrap: anywhere; }
.brief { white-space: pre-line; font-size: 1.05rem; max-width: 42rem; }
.flag { color: var(--err); }
/* In-page links land below the sticky bar. */
[id] { scroll-margin-top: calc(var(--bar-h) + 1rem); }
.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 100; padding: .5rem 1rem;
  background: var(--surface); border-radius: var(--pill); box-shadow: var(--shadow-2); }
.skip:focus { top: .5rem; }

/* ----------------------------------------------------------- layout -- */
.narrow { width: 100%; max-width: 32rem; margin: 0 auto; padding: 1.75rem var(--gutter) 2.5rem; flex: 1 0 auto; }
.narrow.wide { max-width: 68rem; }

/* Top bar: glassy, sticky. */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  min-height: var(--bar-h); padding: .5rem var(--gutter);
  padding-top: max(.5rem, env(safe-area-inset-top));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  view-transition-name: topbar;
}
/* The frosted glass is on a layer behind the bar, not the bar itself: a
   backdrop-filter on .bar would make it the containing block for the fixed
   phone tab bar inside it, pinning that to the top. */
.bar::before, .tabbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--glass); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 750; letter-spacing: -.02em;
  font-size: 1.05rem; color: var(--fg); text-decoration: none; }
.brand:hover { color: var(--fg); }
/* The logo: a firefly in a jar (/logo.svg, /favicon.svg). Its own colours work on light and dark. */
.brand::before {
  content: ""; width: 1.75rem; height: 1.75rem; flex: none; margin: -.15rem 0;
  background: url(/logo.svg) center / contain no-repeat;
  transition: transform var(--slow) var(--ease-spring);
}
.brand:hover::before { transform: rotate(-8deg) scale(1.08); }
.bar nav.guest { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem 1rem; margin-left: auto; }
.bar nav.guest a:not(.button) { color: var(--fg); text-decoration: none; font-weight: 550; }
/* On phones the footer carries it, as on the app's own pages; the bar wraps if it still doesn't fit. */
@media (max-width: 720px) { .bar nav.guest .bar-extra { display: none; } }

/* Main nav. Wide screens: inline in the top bar. */
.tabbar { display: flex; align-items: center; gap: .25rem; }
.tabbar::before { display: none; }
.tabbar a, .tabbar .tab-button {
  position: relative; display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .8rem; border-radius: var(--pill);
  color: var(--muted); text-decoration: none; font: inherit; font-weight: 600; font-size: .95rem;
  background: none; border: 0; box-shadow: none; cursor: pointer; min-height: 40px;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.tabbar a:hover, .tabbar .tab-button:hover { color: var(--fg); background: var(--surface-2); }
.tabbar [aria-current="page"] { color: var(--fg); background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--control-line); }
.tabbar .tab-button:active { transform: none; }
.tabbar .tab-fallback { display: none; }
@supports not selector(:popover-open) {
  .tabbar .tab-button { display: none; }
  .tabbar .tab-fallback { display: inline-flex; }
}
.tab-icon { position: relative; display: inline-flex; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.tabbar .count { position: absolute; top: -.45rem; right: -.65rem; margin: 0; }
.tabbar a:has(.count) .tab-label { margin-left: .4rem; }

/* Phones: the same nav becomes a tab bar along the bottom, in thumb reach. */
@media (max-width: 720px) {
  .tabbar {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    justify-content: space-around; gap: 0;
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    view-transition-name: tabbar;
  }
  .tabbar a, .tabbar .tab-button {
    flex: 1 1 0; flex-direction: column; gap: .15rem; padding: .35rem 0; min-height: 52px;
    font-size: .7rem; font-weight: 600; border-radius: var(--r-sm); justify-content: center;
  }
  .tabbar::before { display: block; }
  .tabbar a:hover, .tabbar .tab-button:hover, .tabbar [aria-current="page"] { background: none; box-shadow: none; }
  .tabbar [aria-current="page"] { color: var(--accent); }
  .tabbar [aria-current="page"] .tab-icon { transform: translateY(-1px); }
  .tab-icon { padding: .2rem 1rem; border-radius: var(--pill); transition: background-color var(--mid) var(--ease), transform var(--mid) var(--ease-spring); }
  /* Filled, not tinted: the current tab must differ by more than hue (1.4.1, 1.4.11). */
  .tabbar [aria-current="page"] .tab-icon { background: var(--accent); color: var(--accent-fg); }
  .tabbar .count { top: -.2rem; right: .35rem; }
  .tabbar a:has(.count) .tab-label { margin-left: 0; }
  .tabbar a:active .tab-icon, .tabbar .tab-button:active .tab-icon { transform: scale(.9); }
  .signed-in .narrow { padding-bottom: calc(var(--tabbar-h) + 2rem + env(safe-area-inset-bottom)); }
  .signed-in .foot { padding-bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); }
  .bar { min-height: 52px; }
}
@media (max-width: 360px) { .tabbar .tab-label { font-size: .62rem; } }

/* Account menu: a native popover (opens and light-dismisses without
   script). A dropdown under the bar on wide screens, a sheet on phones. */
.menu {
  inset: auto; position: fixed; top: calc(var(--bar-h) + .25rem); right: var(--gutter);
  width: min(20rem, calc(100vw - 2 * var(--gutter)));
  margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow-3);
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity var(--mid) var(--ease), transform var(--mid) var(--ease),
    overlay var(--mid) allow-discrete, display var(--mid) allow-discrete;
}
.menu:popover-open { opacity: 1; transform: none; }
@starting-style { .menu:popover-open { opacity: 0; transform: translateY(-6px) scale(.98); } }
.menu::backdrop { background: rgb(0 0 0 / 0); transition: background-color var(--mid) var(--ease), overlay var(--mid) allow-discrete, display var(--mid) allow-discrete; }
.menu-who { display: flex; flex-direction: column; padding: .4rem .6rem .7rem; margin: 0 0 .25rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.menu-links { list-style: none; margin: .25rem 0; padding: 0; }
.menu-links a, .menu-logout button {
  display: flex; align-items: center; gap: .7rem; width: 100%; padding: .65rem .6rem; border-radius: var(--r-sm);
  color: var(--fg); text-decoration: none; font-weight: 550;
}
.menu-links a:hover { background: var(--surface-2); color: var(--fg); }
.menu-links .icon, .menu-logout .icon { color: var(--muted); }
.menu .theme-switch { margin: .5rem 0; }
.menu-logout { margin: 0; padding-top: .25rem; border-top: 1px solid var(--line); }
.menu-logout button { justify-content: flex-start; font-weight: 550; }
@media (max-width: 720px) {
  .menu {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none;
    padding: .75rem var(--gutter) calc(1rem + env(safe-area-inset-bottom));
    border-radius: var(--r-lg) var(--r-lg) 0 0; border-width: 1px 0 0;
    transform: translateY(100%); transform-origin: bottom center;
    transition-duration: var(--slow);
  }
  .menu::before { content: ""; display: block; width: 2.5rem; height: 4px; border-radius: var(--pill);
    background: var(--surface-3); margin: 0 auto .75rem; }
  .menu:popover-open { transform: none; }
  @starting-style { .menu:popover-open { transform: translateY(100%); } }
  .menu:popover-open::backdrop { background: rgb(0 0 0 / .35); }
  @starting-style { .menu:popover-open::backdrop { background: rgb(0 0 0 / 0); } }
  .menu-links a, .menu-logout button { padding: .8rem .6rem; }
}

/* Segmented theme switch. */
.theme-switch { display: flex; gap: .2rem; padding: .25rem; margin: 0; border-radius: var(--pill); background: var(--surface-2); }
.theme-switch button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 36px; padding: .35rem .6rem; border: 0; border-radius: var(--pill);
  background: none; color: var(--muted); font-size: .85rem; font-weight: 600; box-shadow: none;
}
.theme-switch button:hover { color: var(--fg); background: none; transform: none; }
/* Selected pills carry a 3:1 ring, not just a lighter fill (1.4.11). */
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--control-line); }
.theme-switch .icon { width: 1rem; height: 1rem; }

/* Footer. */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; padding: 1.5rem var(--gutter);
  border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--fg); }
.foot .theme-switch { margin-left: auto; }

/* ------------------------------------------------------------ forms -- */
form { margin: 0 0 1rem; }
form.inline { display: inline; margin: 0; }
form.alt { padding-top: 1.25rem; border-top: 1px solid var(--line); }
.field { display: block; margin: 0 0 1.1rem; }
.field span { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .35rem; }
.field small, .check small { display: block; color: var(--muted); margin-top: .3rem; font-size: .85rem; }
/* 16px text, so iOS doesn't zoom the page when a field is focused. */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local],
input[type=number], input[type=search], input[type=url], input:not([type]), textarea, select {
  width: 100%; min-height: 46px; padding: .65rem .85rem; font: inherit; font-size: 16px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--control-line); border-radius: var(--r-sm);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
select { width: auto; max-width: 100%; padding-right: 2rem; }
textarea { line-height: 1.5; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: var(--fg); }
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
input[type=file] { font: inherit; max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: .75rem; padding: .55rem 1rem; border: 0; border-radius: var(--pill);
  background: var(--surface-2); color: var(--fg); cursor: pointer;
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 1.1rem; padding: .6rem 1rem 1rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.choice { display: flex; gap: .55rem; align-items: center; padding: .4rem 0; }
.check { display: flex; gap: .7rem; align-items: flex-start; margin: 0 0 1.1rem; }
.check input { margin-top: .25rem; flex: none; }
.check label { cursor: pointer; }
.optional { font-style: normal; font-weight: 400; color: var(--muted); }
/* The field a rejected form points at: red edge plus the notice's text (never colour alone). */
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] {
  border-color: var(--err); box-shadow: 0 0 0 3px var(--err-soft);
}

/* ---------------------------------------------------------- buttons -- */
button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .6rem 1.25rem; border-radius: var(--pill); cursor: pointer;
  font: inherit; font-weight: 650; line-height: 1.2; text-decoration: none;
  background: var(--accent); color: var(--accent-fg); border: 1px solid transparent;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform var(--fast) var(--ease), background-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), color var(--fast) var(--ease);
}
button:hover, a.button:hover { background: var(--accent-strong); color: var(--accent-fg); }
:root[data-theme="dark"] button:hover, :root[data-theme="dark"] a.button:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
button:active, a.button:active { transform: scale(.97); }
button.secondary, a.button.secondary { background: var(--surface-2); color: var(--fg); box-shadow: none; }
button.secondary:hover, a.button.secondary:hover { background: var(--surface-3); color: var(--fg); }
button.ghost { background: none; color: var(--fg); box-shadow: none; }
button.ghost:hover { background: var(--surface-2); color: var(--fg); }
button.small, a.button.small { min-height: 36px; padding: .4rem .9rem; font-size: .9rem; }
button.link { min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--accent);
  font-weight: 500; text-decoration: underline; text-underline-offset: .18em; border-radius: 4px; }
button.link:hover { background: none; color: var(--accent-strong); }
button.link:active { transform: none; }
button[aria-pressed="true"].secondary { background: var(--accent-soft); color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.row.spread { justify-content: space-between; }
.row.spread h2 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; align-items: center; margin-top: 1.5rem; }

/* ------------------------------------------------- cards and lists -- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.1rem 1.25rem; margin: 0 0 1rem; box-shadow: var(--shadow-1);
}
.card h2 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card img { max-width: 100%; height: auto; border-radius: var(--r); }
.danger { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); margin-top: 2.5rem; }
.danger h2 { color: var(--err); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  padding: .75rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list.card { padding: .25rem 1.25rem; margin: 0 0 1rem; }

.notice {
  display: block; padding: .8rem 1rem; margin: 0 0 1rem; border-radius: var(--r);
  background: var(--surface-2); border: 0; animation: drop-in var(--slow) var(--ease) both;
}
.notice.error { background: var(--err-soft); color: var(--err); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice a { color: inherit; font-weight: 600; }

.tag { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 600; padding: .15rem .55rem;
  border-radius: var(--pill); background: var(--surface-2); color: var(--muted); border: 0; white-space: nowrap; }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag + .tag { margin-left: .3rem; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.15rem; height: 1.15rem;
  margin-left: .3rem; padding: 0 .3rem; border-radius: var(--pill); background: var(--accent); color: var(--accent-fg);
  font-size: .68rem; font-weight: 750; line-height: 1; box-shadow: 0 0 0 2px var(--bg); animation: pop var(--slow) var(--ease-spring) both; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0 0 1rem; padding: .25rem; border-radius: var(--pill);
  background: var(--surface-2); width: fit-content; max-width: 100%; }
.tabs a, .tabs strong { padding: .4rem .9rem; border-radius: var(--pill); font-size: .9rem; font-weight: 600; text-decoration: none; }
.tabs a { color: var(--muted); }
.tabs a:hover { color: var(--fg); }
.tabs strong { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--control-line); }
@media (max-width: 720px) { .tabs { border-radius: var(--r); } }

/* ---------------------------------------------------------- photos -- */
/* Grid of thumbnails: square crops, rounded, a gentle lift on hover. */
.grid, .review { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 1rem .75rem;
  grid-template-columns: repeat(auto-fill, minmax(min(46%, 12rem), 1fr)); }
.review { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.grid li { display: flex; flex-direction: column; gap: .4rem; min-width: 0; font-size: .9rem; }
.grid li > a:first-child { display: block; border-radius: var(--r); overflow: hidden; background: var(--surface-2);
  box-shadow: var(--shadow-1); transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
@media (hover: hover) {
  .grid li > a:first-child:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
  .grid li > a:first-child:hover img { transform: scale(1.04); }
  .badges .card:not(.locked):hover { transform: translateY(-2px) rotate(-.4deg); }
}
.grid li > a:first-child:active { transform: scale(.98); }
.grid img, .review img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; display: block;
  background: var(--surface-2); transition: transform var(--slow) var(--ease); }
.review img { border-radius: var(--r); }
.public-decision .check { margin: .5rem 0; }
.public-decision .row { margin-top: .5rem; }
.grid img, .review img, .photo img, .sequence img { animation: fade-in var(--slow) var(--ease) both; }

/* A single photo on a quiet stage, never cropped. */
.photo { margin: 0 0 1.25rem; }
.photo img { width: auto; max-width: 100%; max-height: min(78vh, 60rem); height: auto; margin: 0 auto; display: block;
  border-radius: var(--r); box-shadow: var(--shadow-2); }
.photo figcaption { margin-top: .75rem; font-size: 1.05rem; }
@media (max-width: 720px) {
  .photo { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .photo img { border-radius: 0; box-shadow: none; max-height: 80vh; }
  .photo figcaption { padding: 0 var(--gutter); }
}
.sequence { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.sequence .card { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.sequence img { width: 100%; height: auto; border-radius: var(--r); display: block; }
.mini img { width: 3rem; height: 3rem; object-fit: cover; border-radius: var(--r-sm); display: block; }

.exif { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .4rem 1.25rem; margin: 0 0 1rem; font-size: .95rem; }
.exif dt { color: var(--muted); }
.exif dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.votes { margin: 0 0 1.25rem; }
.vote-count { font-size: .875rem; color: var(--muted); }
.comments { margin-top: 2rem; }
.comments .list li { align-items: flex-start; }
.comment-meta { margin: 0 0 .2rem; }
.comment-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.comments details { margin-top: .4rem; }
summary { cursor: pointer; color: var(--accent-strong); font-weight: 550; }

/* --------------------------------------------------------- badges -- */
.badges { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); }
.badges .card { margin: 0; display: flex; flex-direction: column; gap: .3rem; transition: transform var(--mid) var(--ease); }
.badges .emoji { font-size: 2.2rem; line-height: 1; }
.badges .locked .emoji { filter: grayscale(1); opacity: .5; }
progress { accent-color: var(--accent); }
.badges progress { width: 100%; }
.streak .big { font-size: 1.6rem; font-weight: 750; }
.podium strong { font-size: 1.05rem; }

/* ------------------------------------------------- tables and stats -- */
.table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-weight: 600; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.you td { font-weight: 700; background: var(--accent-soft); }
.table tr.gap td { color: var(--muted); text-align: center; padding: .1rem; }
.table progress { width: 6rem; }
.table code { overflow-wrap: anywhere; }
.stats { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
.stats li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .85rem 1rem; color: var(--muted); font-size: .9rem; box-shadow: var(--shadow-1); }
.stats .big { display: block; font-size: 1.6rem; font-weight: 750; color: var(--fg); letter-spacing: -.02em; }
.search { display: grid; gap: .25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); align-items: end; }
.search .wide { grid-column: 1 / -1; }
.search select, .search input[type=search] { width: 100%; }
.pager { margin: 1rem 0; }

/* --------------------------------------------- Home and class page -- */
.lead { font-size: 1.1rem; color: var(--muted); max-width: 42rem; }
.eyebrow { display: block; margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.section-head { margin: 2rem 0 .75rem; }
.section-head h2 { margin: 0; }
.empty { padding: 1rem 1.1rem; border-radius: var(--r); background: var(--surface-2); color: var(--muted); }
.empty-state { text-align: center; padding: 2rem 1.25rem; }
.empty-state .button { margin-top: .5rem; }
.empty-icon { display: inline-flex; padding: .9rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: .75rem; }
.empty-icon .icon { width: 1.75rem; height: 1.75rem; }

/* Status pills. */
.pills { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: var(--pill);
  font-size: .78rem; font-weight: 650; line-height: 1.4; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.err { background: var(--err-soft); color: var(--err); }

/* A whole card is one link: the title's link stretches over it. Other
   controls in the card sit above it (position: relative; z-index: 1). */
.stretched { color: inherit; text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.stretched:hover { color: inherit; }
.stretched:focus-visible { outline: none; }
.stretched:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Quick links as chips; a single scrolling row on phones. */
.chips { display: flex; gap: .5rem; margin: 0 0 1.25rem; overflow-x: auto; scrollbar-width: none;
  margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding: .1rem var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-weight: 600; font-size: .9rem;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease); }
.chips a:hover { background: var(--surface-2); color: var(--fg); }
.chips a:active { transform: scale(.97); }
@media (min-width: 721px) { .chips { flex-wrap: wrap; margin-left: 0; margin-right: 0; padding: 0; overflow: visible; } }

/* Teacher's class code. */
.code-card .code-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.code-card h2.eyebrow { margin: 0 0 .15rem; }
.code-card .code { color: var(--accent); }

/* Lists of rows (to-do, homework, past challenges): soft rounded rows. */
.todo, .rows { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.todo a, .rows li {
  position: relative; display: flex; align-items: center; gap: .85rem; padding: .75rem .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1);
  color: var(--fg); text-decoration: none;
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease), border-color var(--mid) var(--ease);
}
.todo a:active, .rows li:active { transform: scale(.99); }
@media (hover: hover) {
  .todo a:hover, .rows li:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--surface-3); color: var(--fg); }
}
.todo-icon, .row-thumb { flex: none; display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted); overflow: hidden; }
.todo-icon.challenge { background: var(--accent-soft); color: var(--accent); }
.todo-icon.homework { background: var(--ok-soft); color: var(--ok); }
.row-thumb { position: relative; }
.row-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.todo-text, .row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
/* Titles wrap rather than cut off with an ellipsis: at 320 px or with larger
   text spacing, a cut title is lost content (1.4.10, 1.4.12). */
.todo-text > *, .row-text > * { min-width: 0; }
.todo-text strong, .row-text strong { display: block; overflow-wrap: anywhere; }
.todo .pill, .rows .pills { flex: none; margin: 0; }
.rows .pills { position: relative; z-index: 1; justify-content: flex-end; }
@media (max-width: 480px) {
  .rows li { flex-wrap: wrap; }
  .rows .pills { width: 100%; padding-left: 3.6rem; justify-content: flex-start; }
}

/* Class cards on Home: cover photo on top. */
.class-cards { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.class-card { position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
.class-card:active { transform: scale(.99); }
.cover { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); overflow: hidden; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--slow) var(--ease); animation: fade-in var(--slow) var(--ease) both; }
.cover-empty { display: grid; place-items: center; height: 100%; color: var(--accent); opacity: .6; }
.cover-empty .icon { width: 2.5rem; height: 2.5rem; }
.class-card-body { padding: .9rem 1.1rem 1.1rem; }
.class-card h3 { margin: 0 0 .2rem; font-size: 1.1rem; }
.class-card p { margin: 0; }
@media (hover: hover) {
  .class-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
  .class-card:hover .cover img { transform: scale(1.04); }
}
.join { max-width: 32rem; }

/* Open challenges: a card each, with a strip of the newest photos. */
.challenge-cards { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.challenge-card { position: relative; display: flex; flex-direction: column; gap: .9rem; padding: 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
.challenge-card:active { transform: scale(.99); }
@media (hover: hover) { .challenge-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); } }
.challenge-card h3 { margin: .15rem 0 .2rem; font-size: 1.2rem; }
.challenge-card-head p { margin: 0; }
.challenge-card-head .pills { margin-top: .6rem; }
.strip { list-style: none; padding: 0; margin: auto 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.strip li { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.strip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade-in var(--slow) var(--ease) both; }
.strip .more { display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.strip li:nth-child(4).more { grid-column: 4; }
.strip-empty { margin: auto 0 0; padding: .75rem; border-radius: var(--r-sm); background: var(--surface-2); text-align: center; }

/* People, folded away until wanted. */
details.card > summary { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; list-style: none; color: var(--fg); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > summary::after { content: ""; width: .55rem; height: .55rem; margin-left: .25rem; flex: none; align-self: center;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px);
  transition: transform var(--mid) var(--ease); }
details.card > summary > .muted { margin-left: auto; }
details.card[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.card[open] > summary { margin-bottom: .75rem; }
details.card[open] > :not(summary) { animation: rise var(--mid) var(--ease) both; }
.people-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.people-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.people-list li:last-child { border-bottom: 0; }
.person { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .5rem; }
.person .muted { width: 100%; overflow-wrap: anywhere; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  font-weight: 700; font-size: .9rem; }
.avatar.pic { object-fit: cover; background: var(--surface-2); }
.avatar.large { width: 6rem; height: 6rem; font-size: 2.4rem; }
.avatar.a0 { background: #fde7d9; color: #9a3412; }
.avatar.a1 { background: #dcefe3; color: #17603d; }
.avatar.a2 { background: #dde8f8; color: #1f4f8f; }
.avatar.a3 { background: #efe2f6; color: #6b2f8a; }
.avatar.a4 { background: #fbf0cf; color: #7a5200; }
.avatar.a5 { background: #e3e7ea; color: #3c4a55; }

/* ------------------------------------------- challenge and photo -- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: -.5rem 0 .75rem; }
.crumbs a { display: inline-flex; align-items: center; gap: .2rem; font-weight: 600; font-size: .9rem; text-decoration: none; }
.crumbs .icon { width: 1rem; height: 1rem; }
.page-pills { margin: 0 0 1rem; gap: .5rem .75rem; }
.page-pills .button { margin-left: auto; }
.brief { padding: 1rem 1.1rem; border-radius: var(--r); background: var(--surface-2); }

/* Your entry: a compact card, not a second copy of the photo. */
.entry h2 { margin-bottom: .75rem; }
.entry-row { display: flex; gap: 1rem; align-items: flex-start; }
.entry-thumb { position: relative; flex: none; width: 7rem; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--surface-2); display: block; }
.entry-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.entry-thumb.processing { display: grid; place-items: center; }
.entry-text { flex: 1; min-width: 0; }
.entry-text .pills { margin: 0 0 .75rem; }
.entry-text .row { gap: .5rem; }
.entry-caption { margin: 0 0 .4rem; font-weight: 600; overflow-wrap: anywhere; }
.pill .icon { width: .85rem; height: .85rem; }
.spinner { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* The class's photos: a masonry wall, each photo at its own shape. */
/* Photo walls (src/views/wall.tsx): tiles, or a mosaic of whole photos. */
.wall { list-style: none; padding: 0; margin: 0 0 1rem; }
.wall li { min-width: 0; animation: rise var(--slow) var(--ease) both; }
.wall.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(46%, 11rem), 1fr)); }
@media (min-width: 721px) { .wall.tiles { gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); } }
.wall.tiles img { aspect-ratio: 1; object-fit: cover; }
/* Each photo's width grows with its shape (ar4..ar30 = 0.4..3.0 wide per
   1 tall), so a row's photos share one height. A photo grows to at most 1.5
   times its starting size, so a row that breaks early (a panorama that didn't
   fit) stays a sensible height; all of its photos hit the same cap, so they
   still match. The filler soaks up the last row's spare space. */
.wall.mosaic { display: flex; flex-wrap: wrap; gap: 4px; --unit: .8rem; }
@media (min-width: 721px) { .wall.mosaic { --unit: 1.15rem; } }
.wall.mosaic::after { content: ''; flex: 999 1 0; }
.wall.mosaic li { max-width: 100%; }
.wall.mosaic a { border-radius: 3px; box-shadow: none; }
.wall.mosaic img { object-fit: cover; }
.wall.mosaic .wall-meta { padding: 1.5rem .5rem .4rem; font-size: .75rem; }
.wall.mosaic .ar4 { flex: 4 1 calc(4 * var(--unit)); max-width: min(100%, calc(4 * var(--unit) * 1.5)); } .wall.mosaic .ar4 img { aspect-ratio: 4 / 10; }
.wall.mosaic .ar5 { flex: 5 1 calc(5 * var(--unit)); max-width: min(100%, calc(5 * var(--unit) * 1.5)); } .wall.mosaic .ar5 img { aspect-ratio: 5 / 10; }
.wall.mosaic .ar6 { flex: 6 1 calc(6 * var(--unit)); max-width: min(100%, calc(6 * var(--unit) * 1.5)); } .wall.mosaic .ar6 img { aspect-ratio: 6 / 10; }
.wall.mosaic .ar7 { flex: 7 1 calc(7 * var(--unit)); max-width: min(100%, calc(7 * var(--unit) * 1.5)); } .wall.mosaic .ar7 img { aspect-ratio: 7 / 10; }
.wall.mosaic .ar8 { flex: 8 1 calc(8 * var(--unit)); max-width: min(100%, calc(8 * var(--unit) * 1.5)); } .wall.mosaic .ar8 img { aspect-ratio: 8 / 10; }
.wall.mosaic .ar9 { flex: 9 1 calc(9 * var(--unit)); max-width: min(100%, calc(9 * var(--unit) * 1.5)); } .wall.mosaic .ar9 img { aspect-ratio: 9 / 10; }
.wall.mosaic .ar10 { flex: 10 1 calc(10 * var(--unit)); max-width: min(100%, calc(10 * var(--unit) * 1.5)); } .wall.mosaic .ar10 img { aspect-ratio: 10 / 10; }
.wall.mosaic .ar11 { flex: 11 1 calc(11 * var(--unit)); max-width: min(100%, calc(11 * var(--unit) * 1.5)); } .wall.mosaic .ar11 img { aspect-ratio: 11 / 10; }
.wall.mosaic .ar12 { flex: 12 1 calc(12 * var(--unit)); max-width: min(100%, calc(12 * var(--unit) * 1.5)); } .wall.mosaic .ar12 img { aspect-ratio: 12 / 10; }
.wall.mosaic .ar13 { flex: 13 1 calc(13 * var(--unit)); max-width: min(100%, calc(13 * var(--unit) * 1.5)); } .wall.mosaic .ar13 img { aspect-ratio: 13 / 10; }
.wall.mosaic .ar14 { flex: 14 1 calc(14 * var(--unit)); max-width: min(100%, calc(14 * var(--unit) * 1.5)); } .wall.mosaic .ar14 img { aspect-ratio: 14 / 10; }
.wall.mosaic .ar15 { flex: 15 1 calc(15 * var(--unit)); max-width: min(100%, calc(15 * var(--unit) * 1.5)); } .wall.mosaic .ar15 img { aspect-ratio: 15 / 10; }
.wall.mosaic .ar16 { flex: 16 1 calc(16 * var(--unit)); max-width: min(100%, calc(16 * var(--unit) * 1.5)); } .wall.mosaic .ar16 img { aspect-ratio: 16 / 10; }
.wall.mosaic .ar17 { flex: 17 1 calc(17 * var(--unit)); max-width: min(100%, calc(17 * var(--unit) * 1.5)); } .wall.mosaic .ar17 img { aspect-ratio: 17 / 10; }
.wall.mosaic .ar18 { flex: 18 1 calc(18 * var(--unit)); max-width: min(100%, calc(18 * var(--unit) * 1.5)); } .wall.mosaic .ar18 img { aspect-ratio: 18 / 10; }
.wall.mosaic .ar19 { flex: 19 1 calc(19 * var(--unit)); max-width: min(100%, calc(19 * var(--unit) * 1.5)); } .wall.mosaic .ar19 img { aspect-ratio: 19 / 10; }
.wall.mosaic .ar20 { flex: 20 1 calc(20 * var(--unit)); max-width: min(100%, calc(20 * var(--unit) * 1.5)); } .wall.mosaic .ar20 img { aspect-ratio: 20 / 10; }
.wall.mosaic .ar21 { flex: 21 1 calc(21 * var(--unit)); max-width: min(100%, calc(21 * var(--unit) * 1.5)); } .wall.mosaic .ar21 img { aspect-ratio: 21 / 10; }
.wall.mosaic .ar22 { flex: 22 1 calc(22 * var(--unit)); max-width: min(100%, calc(22 * var(--unit) * 1.5)); } .wall.mosaic .ar22 img { aspect-ratio: 22 / 10; }
.wall.mosaic .ar23 { flex: 23 1 calc(23 * var(--unit)); max-width: min(100%, calc(23 * var(--unit) * 1.5)); } .wall.mosaic .ar23 img { aspect-ratio: 23 / 10; }
.wall.mosaic .ar24 { flex: 24 1 calc(24 * var(--unit)); max-width: min(100%, calc(24 * var(--unit) * 1.5)); } .wall.mosaic .ar24 img { aspect-ratio: 24 / 10; }
.wall.mosaic .ar25 { flex: 25 1 calc(25 * var(--unit)); max-width: min(100%, calc(25 * var(--unit) * 1.5)); } .wall.mosaic .ar25 img { aspect-ratio: 25 / 10; }
.wall.mosaic .ar26 { flex: 26 1 calc(26 * var(--unit)); max-width: min(100%, calc(26 * var(--unit) * 1.5)); } .wall.mosaic .ar26 img { aspect-ratio: 26 / 10; }
.wall.mosaic .ar27 { flex: 27 1 calc(27 * var(--unit)); max-width: min(100%, calc(27 * var(--unit) * 1.5)); } .wall.mosaic .ar27 img { aspect-ratio: 27 / 10; }
.wall.mosaic .ar28 { flex: 28 1 calc(28 * var(--unit)); max-width: min(100%, calc(28 * var(--unit) * 1.5)); } .wall.mosaic .ar28 img { aspect-ratio: 28 / 10; }
.wall.mosaic .ar29 { flex: 29 1 calc(29 * var(--unit)); max-width: min(100%, calc(29 * var(--unit) * 1.5)); } .wall.mosaic .ar29 img { aspect-ratio: 29 / 10; }
.wall.mosaic .ar30 { flex: 30 1 calc(30 * var(--unit)); max-width: min(100%, calc(30 * var(--unit) * 1.5)); } .wall.mosaic .ar30 img { aspect-ratio: 30 / 10; }
.wall li:nth-child(2) { animation-delay: 40ms; } .wall li:nth-child(3) { animation-delay: 80ms; }
.wall li:nth-child(4) { animation-delay: 120ms; } .wall li:nth-child(n+5) { animation-delay: 160ms; }
.wall a { position: relative; display: block; border-radius: var(--r); overflow: hidden; background: var(--surface-2);
  box-shadow: var(--shadow-1); color: #fff; text-decoration: none; transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
.wall img { width: 100%; height: auto; display: block; transition: transform var(--slow) var(--ease); }
.wall-meta { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem;
  padding: 2rem .7rem .55rem; font-size: .82rem; font-weight: 600;
  background: linear-gradient(to top, rgb(0 0 0 / .62), rgb(0 0 0 / 0)); }
.wall-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall .vote-count { flex: none; display: inline-flex; align-items: center; gap: .2rem; color: rgb(255 255 255 / .92); font-size: .8rem; }
.wall .vote-count .icon { width: .9rem; height: .9rem; }
.wall .tag { background: rgb(255 255 255 / .9); color: #333; }
.wall a:active { transform: scale(.98); }
@media (hover: hover) {
  .wall.tiles a:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
  .wall a:hover { color: #fff; }
  .wall a:hover img { transform: scale(1.03); }
}

/* One photo: a stage for the image, details beside it on wide screens. */
.photo-page h1 { font-size: 1.35rem; margin-bottom: .35rem; }
.photo-page .crumbs { margin: 0 0 1rem; }
.viewer { display: grid; gap: 1.25rem; margin-bottom: 1rem; }
@media (min-width: 960px) { .viewer { grid-template-columns: minmax(0, 1fr) 19rem; gap: 2rem; align-items: start; } }
.stage { position: relative; margin: 0; display: grid; place-items: center; min-height: 12rem;
  background: var(--stage); border-radius: var(--r-lg); padding: clamp(.75rem, 2vw, 1.5rem); scroll-margin-top: calc(var(--bar-h) + .5rem); }
.stage img { width: auto; height: auto; max-width: 100%; max-height: min(76vh, 56rem); border-radius: var(--r-sm);
  box-shadow: var(--shadow-3); animation: settle var(--slow) var(--ease) both; }
@keyframes settle { from { opacity: 0; transform: scale(.985); } }
.stage-nav { position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: 50%; color: #fff; background: rgb(20 20 20 / .45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: .85; transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), background-color var(--fast) var(--ease); }
.stage-nav.prev { left: .75rem; } .stage-nav.next { right: .75rem; }
.stage-nav:hover { opacity: 1; color: #fff; background: rgb(20 20 20 / .65); }
.stage-nav:active { transform: scale(.92); }
@media (max-width: 720px) {
  .stage { margin: 0 calc(-1 * var(--gutter)); border-radius: 0; padding: 0; min-height: 0; scroll-margin-top: 52px; }
  .stage img { max-height: 70vh; border-radius: 0; box-shadow: none; width: 100%; object-fit: contain; }
  .stage-nav { width: 2.5rem; height: 2.5rem; }
  .stage-nav.prev { left: .5rem; } .stage-nav.next { right: .5rem; }
}
.details { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.byline { display: flex; align-items: center; gap: .75rem; }
.byline div { display: flex; flex-direction: column; }
.caption { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.action-bar { display: flex; align-items: center; gap: .9rem; padding: .5rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.vote-total { color: var(--muted); }
.vote-total strong { color: var(--fg); }
.comment-jump { margin-left: auto; display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.comment-jump:hover { color: var(--fg); }
button.vote { background: var(--surface-2); color: var(--fg); box-shadow: none; padding: .55rem 1.1rem; }
button.vote:hover { background: var(--surface-3); color: var(--fg); }
button.vote .icon { transition: transform var(--mid) var(--ease-spring), fill var(--fast) var(--ease); }
button.vote:hover .icon { transform: scale(1.12); }
button.vote.on { background: var(--accent-soft); color: var(--accent); }
button.vote.on .icon { fill: currentColor; animation: pop var(--slow) var(--ease-spring) both; }
.exif-card { padding: 1rem 1.1rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.exif-card h2 { display: flex; align-items: center; gap: .45rem; margin: 0 0 .75rem; font-size: 1rem; }
.exif-card h2 .icon { color: var(--muted); width: 1.1rem; height: 1.1rem; }
.exif-card .exif { margin: 0; font-size: .9rem; }
.exif-card p { margin: .75rem 0 0; }

/* Comments as a quiet thread. */
.comments { margin-top: 2rem; max-width: 44rem; }
.thread { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .9rem; }
.thread li { display: flex; gap: .7rem; align-items: flex-start; animation: rise var(--slow) var(--ease) both; }
.bubble { flex: 1; min-width: 0; padding: .6rem .9rem; border-radius: 4px var(--r) var(--r) var(--r); background: var(--surface-2); }
.thread form.inline { flex: none; }
.thread button.ghost { color: var(--muted); }
.comment-form { padding: 1rem 1.1rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }

/* ------------------------------------------------------------ upload -- */
.picker { position: relative; display: block; margin: 0 0 1.1rem; }
/* The real input covers the face, so a tap goes straight to it. */
.picker-target { position: relative; display: block; }
.picker input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; font-size: 0; }
.picker-face { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; min-height: 6.5rem;
  border: 2px dashed var(--control-line); border-radius: var(--r-lg); background: var(--surface-2);
  transition: border-color var(--mid) var(--ease), background-color var(--mid) var(--ease), transform var(--fast) var(--ease); }
.picker-icon { flex: none; display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); transition: transform var(--mid) var(--ease-spring); }
.picker-empty, .picker-chosen { display: flex; flex-direction: column; gap: .1rem; }
.picker-chosen { display: none; }
.picker-hint { display: block; margin-top: .45rem; color: var(--muted); font-size: .85rem; }
.picker:hover .picker-face { border-color: var(--accent); }
.picker:hover .picker-icon { transform: scale(1.06) rotate(-6deg); }
.picker:active .picker-face { transform: scale(.99); }
.picker:focus-within .picker-face { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.picker:has(input:valid) .picker-face { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.picker:has(input:valid) .picker-icon { background: var(--ok); color: var(--surface); animation: pop var(--slow) var(--ease-spring) both; }
.picker:has(input:valid) .picker-empty { display: none; }
.picker:has(input:valid) .picker-chosen { display: flex; }
.picker:has(input:valid) .picker-chosen strong { color: var(--ok); }
/* Upload looks ready only once there's something to send (still clickable,
   so the browser can say what's missing). */
.upload-form:has(input[type=file]:invalid) button[type=submit] { background: var(--surface-2); color: var(--fg); box-shadow: none; }
.upload-form button[type=submit] { transition: background-color var(--mid) var(--ease), color var(--mid) var(--ease), transform var(--fast) var(--ease); }

.preparing { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.1rem; margin: 0 0 1rem;
  border-radius: var(--r); background: var(--accent-soft); animation: drop-in var(--slow) var(--ease) both; }
.preparing p { margin: 0 0 .25rem; }
.preparing .button { margin-top: .5rem; }
.preparing .spinner { flex: none; margin-top: .1rem; }

/* ---------------------------------------------------------- homework -- */
.stats .of { font-size: 1rem; font-weight: 600; color: var(--muted); }
.rows li.quiet { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.rows li.quiet:hover { transform: none; box-shadow: none; }
.rows .icon { color: var(--muted); flex: none; }
.byline .pills { margin: 0 0 0 auto; }
.byline { flex-wrap: wrap; margin-bottom: 1rem; }

/* Add photos -> Hand in -> Teacher reviews. */
.steps { list-style: none; display: flex; padding: 0; margin: .25rem 0 1.25rem; counter-reset: step; }
.steps li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
  font-size: .8rem; font-weight: 600; color: var(--muted); }
.steps li + li::before { content: ""; position: absolute; top: .85rem; right: 50%; width: 100%; height: 2px; background: var(--surface-3); z-index: 0; }
.steps li.done + li::before, .steps li.done + li.done::before { background: var(--ok); }
.step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--surface-2); border: 2px solid var(--control-line); font-size: .8rem; font-weight: 750; color: var(--muted);
  transition: background-color var(--mid) var(--ease), border-color var(--mid) var(--ease); }
.steps li.done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.steps li.now { color: var(--fg); }
.steps li.now .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-fg);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); animation: pop var(--slow) var(--ease-spring) both; }

/* The student's photos in order: numbered squares with small tools. */
.work .sequence { grid-template-columns: repeat(auto-fill, minmax(min(46%, 9rem), 1fr)); gap: .9rem .75rem; margin-bottom: 1.25rem; }
.seq { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.seq-photo { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.seq-photo a, .seq-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.seq-wait, .seq-failed { position: absolute; inset: 0; display: grid; place-items: center; color: var(--err); }
.seq-num { position: absolute; top: .4rem; left: .4rem; display: grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem;
  border-radius: var(--pill); background: rgb(0 0 0 / .55); color: #fff; font-size: .78rem; font-weight: 750; pointer-events: none; }
.seq-caption { margin: 0; font-size: .875rem; overflow-wrap: anywhere; }
.seq-caption-edit summary { font-size: .875rem; }
.seq-caption-edit form { margin-top: .5rem; }
.seq-tools { display: flex; align-items: center; gap: .1rem; }
.seq-tools .seq-remove { margin-left: auto; }
button.icon-only { min-width: 36px; padding: .3rem; }
button.icon-only .icon { width: 1.1rem; height: 1.1rem; }
.hand-in { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding-top: 1rem; margin: 0; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .hand-in button { width: 100%; } }

/* One student's work, read in order like a photo essay. */
.statement { margin: 0 0 1.5rem; padding: .25rem 0 .25rem 1rem; border-left: 3px solid var(--accent); font-size: 1.1rem; white-space: pre-line; max-width: 44rem; }
.essay { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: 1.75rem; max-width: 52rem; }
.essay li { display: flex; flex-direction: column; gap: .4rem; animation: rise var(--slow) var(--ease) both; }
.essay img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; background: var(--stage); border-radius: var(--r); box-shadow: var(--shadow-2); }
.essay-num { font-size: .8rem; font-weight: 650; color: var(--muted); }
.essay-caption { margin: 0; max-width: 44rem; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .essay { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
  .essay img { border-radius: 0; box-shadow: none; }
  .essay-num, .essay-caption { padding: 0 var(--gutter); }
}
.decision { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

/* ------------------------------------------ badges, boards, inbox -- */
.streak-hero { position: relative; overflow: hidden; padding: 1.25rem 1.4rem; margin: 0 0 1.5rem; border-radius: var(--r-lg);
  background: var(--surface-2); }
.streak-hero.on { background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--warn-soft) 70%, var(--surface))); }
.streak-hero h2 { margin: 0 0 .4rem; }
.streak-hero p { margin: 0; }
.streak-hero .big { display: inline-block; font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin-right: .35rem;
  animation: pop var(--slow) var(--ease-spring) both; }
.streak-hero.on .big { color: var(--accent); }
.streak-hero .streak-text { display: block; margin-top: .4rem; }
.streak-hero .muted + .muted { margin-top: .4rem; }
.badges { gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(46%, 11rem), 1fr)); }
.badges .card { padding: 1rem; align-items: flex-start; animation: rise var(--slow) var(--ease) both; }
.badges li:nth-child(2) { animation-delay: 40ms; } .badges li:nth-child(3) { animation-delay: 80ms; }
.badges li:nth-child(n+4) { animation-delay: 120ms; }
.badges .card:not(.locked) .emoji { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%;
  background: var(--accent-soft); font-size: 1.7rem; margin-bottom: .25rem; }
.badges .locked { background: var(--surface-2); box-shadow: none; border-color: transparent; }
.badges .locked .emoji { width: 3.25rem; height: 3.25rem; display: grid; place-items: center; font-size: 1.7rem; margin-bottom: .25rem; }
.badges .card .muted { font-size: .85rem; }
progress { appearance: none; -webkit-appearance: none; height: .5rem; border: 0; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: var(--pill); }
progress::-webkit-progress-value { background: var(--accent); border-radius: var(--pill); }
progress::-moz-progress-bar { background: var(--accent); border-radius: var(--pill); }

/* Leaderboard: a ranked list, medals for the top three. */
.board { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.board-row { display: grid; grid-template-columns: 1.6rem 2.6rem auto 1fr auto; align-items: center; gap: .6rem;
  padding: .6rem .9rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  animation: rise var(--slow) var(--ease) both; }
.board-row:nth-child(2) { animation-delay: 40ms; } .board-row:nth-child(3) { animation-delay: 80ms; } .board-row:nth-child(n+4) { animation-delay: 120ms; }
.board-row .medal { font-size: 1.3rem; text-align: center; }
.board-row .place { font-weight: 750; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-row .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .score { text-align: right; white-space: nowrap; }
.board-row.top-1 { background: linear-gradient(90deg, color-mix(in srgb, #f5c062 22%, var(--surface)), var(--surface)); }
.board-row.top .place { color: var(--fg); }
.board-row.you { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-1); }
.board-gap { text-align: center; color: var(--muted); }
@media (max-width: 480px) {
  .board-row { grid-template-columns: 1.4rem 2.4rem auto 1fr; }
  .board-row .score { grid-column: 3 / -1; text-align: left; margin-top: -.35rem; font-size: .9rem; }
  .board-row .score .muted { display: inline; }
}

/* Wide tables scroll inside their card, the first column held still. */
/* Positioned, so an .sr-only header inside (absolute) stays in the scroll box
   instead of widening the page. */
.table-wrap { position: relative; overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
.table-wrap .table { display: table; min-width: 34rem; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.sticky-first th:first-child, .sticky-first td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }

/* Notifications. */
.inbox { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .4rem; }
.inbox a, .inbox .note { position: relative; display: flex; gap: .8rem; align-items: flex-start; padding: .8rem .95rem; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none;
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
.inbox a:active { transform: scale(.99); }
@media (hover: hover) { .inbox a:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); color: var(--fg); } }
.inbox .dot { flex: none; width: .55rem; height: .55rem; margin-top: .5rem; border-radius: 50%; background: transparent; }
.inbox .unread .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inbox .unread a, .inbox .unread .note { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); font-weight: 600; }
.inbox li:not(.unread) a, .inbox li:not(.unread) .note { background: transparent; border-color: transparent; }
.note-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; overflow-wrap: anywhere; }
.note-text .muted { font-weight: 400; }

/* Search: one bar, filters folded away. */
.search-form { margin-bottom: 1.25rem; }
.search-bar { display: flex; align-items: center; gap: .5rem; padding: .35rem .35rem .35rem .9rem; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--control-line); box-shadow: var(--shadow-1);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.search-bar .icon { color: var(--muted); }
.search-bar input[type=search] { flex: 1; min-width: 0; border: 0; background: none; box-shadow: none; padding: .4rem 0; min-height: 40px; }
.search-bar input[type=search]:focus-visible { box-shadow: none; }
.filters { margin-top: .75rem; padding: .25rem 1rem; border-radius: var(--r); background: var(--surface-2); }
.filters[open] { padding-bottom: 1rem; }
.filters > summary { padding: .5rem 0; display: flex; align-items: center; gap: .25rem; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::before { content: ""; width: .45rem; height: .45rem; margin-right: .35rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--mid) var(--ease); }
.filters[open] > summary::before { transform: rotate(45deg); }
.filters .search { margin-top: .5rem; }
.wall-under { margin: .4rem .1rem 0; display: flex; flex-direction: column; gap: .05rem; font-size: .82rem; }
.pager { margin: 1.25rem 0; }

/* Photo of the Month. */
.prize { display: inline-flex; gap: .4rem; align-items: center; padding: .5rem .9rem; border-radius: var(--pill); background: var(--warn-soft); color: var(--warn); }
.row-thumb.trophy { font-size: 1.4rem; background: var(--warn-soft); }
.podium { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(46%, 13rem), 1fr)); }
.podium li { display: flex; flex-direction: column; gap: .45rem; animation: rise var(--slow) var(--ease) both; }
.podium li:nth-child(2) { animation-delay: 80ms; } .podium li:nth-child(3) { animation-delay: 160ms; } .podium li:nth-child(4) { animation-delay: 240ms; }
.podium a { position: relative; display: block; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-2); }
.podium img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--slow) var(--ease); }
.podium-1st_place a { box-shadow: 0 0 0 3px #f5c062, var(--shadow-2); }
.podium-label { position: absolute; left: .6rem; top: .6rem; padding: .25rem .65rem; border-radius: var(--pill);
  background: rgb(255 255 255 / .92); color: #1b1b1b; font-weight: 750; font-size: .85rem; box-shadow: var(--shadow-1); }
.podium-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; padding: 0 .2rem; }
@media (hover: hover) { .podium a:hover img { transform: scale(1.04); } }
.grid li.picked > a:first-child { box-shadow: 0 0 0 3px var(--accent), var(--shadow-2); }

/* ---------------------------------------------------- account pages -- */
.foot { margin-top: auto; }
main.auth { max-width: 27rem; }
main.auth h1 { font-size: 1.7rem; margin-bottom: .5rem; }
main.auth .lead { margin-bottom: 1.5rem; }
@media (min-width: 721px) {
  main.auth { flex: 0 0 auto; margin: 3rem auto; padding: 2.25rem 2.25rem 1.75rem; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
}
main.auth form > button[type=submit], main.auth .google { width: 100%; }
main.auth form.alt { border-top: 0; padding-top: 0; margin-top: .25rem; }
main.auth form.alt::before { content: "or"; display: block; margin: 0 0 1rem; text-align: center; color: var(--muted); font-size: .85rem;
  background: linear-gradient(var(--line), var(--line)) left center / calc(50% - 1.5rem) 1px no-repeat,
              linear-gradient(var(--line), var(--line)) right center / calc(50% - 1.5rem) 1px no-repeat; }
.auth-links { text-align: center; margin: .5rem 0 0; }
.agree { font-size: .85rem; text-align: center; margin: 1rem 0 0; }
/* Turnstile's widget is 65px tall and at least 300px wide; the space is kept
   so the button doesn't jump when it loads, and a 320px screen clips its logo
   rather than scrolling sideways. Keyboard focus inside it is Cloudflare's
   frame, which draws its own ring; Chrome doesn't report that focus to this
   page's CSS, so there's no ring to add here. */
.human-check { margin: .25rem 0 1rem; overflow: hidden; }
.human-check .cf-turnstile { min-height: 65px; }
.human-check noscript .notice { margin: 0; }
form .agree { margin: 0 0 1rem; }
.auth-switch { text-align: center; margin: 1.25rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.auth-icon { font-size: 2.75rem; line-height: 1; margin: 0 0 .75rem; animation: pop var(--slow) var(--ease-spring) both; }
main.auth details { margin-top: 1rem; }

/* "I am a…": two big choices. */
.role-cards { border: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.role-cards legend { padding: 0; margin-bottom: .5rem; font-weight: 600; font-size: .95rem; }
.role-cards label { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1rem .75rem;
  border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); font-weight: 650; cursor: pointer;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease), transform var(--fast) var(--ease); }
.role-cards input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.role-emoji { font-size: 2rem; line-height: 1; transition: transform var(--mid) var(--ease-spring); }
.role-cards label:hover { border-color: var(--surface-3); }
.role-cards label:active { transform: scale(.98); }
.role-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.role-cards label:has(input:checked) .role-emoji { transform: scale(1.12) rotate(-6deg); }
.role-cards label:has(input:focus-visible) { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.name-cards > p { grid-column: 1 / -1; margin: 0 0 .25rem; }
.name-cards label { padding: .85rem .75rem; font-size: 1.05rem; text-align: center; }
.name-now { font-size: 1.25rem; font-weight: 700; margin: .25rem 0 .75rem; }
.card h2 .icon { display: inline-block; vertical-align: -3px; margin-right: .35rem; color: var(--muted); }

/* ------------------------------------------------------------- staff -- */
button.destructive { background: var(--err); color: #fff; box-shadow: none; }
button.destructive:hover { background: color-mix(in srgb, var(--err) 85%, black); color: #fff; }
:root[data-theme="dark"] button.destructive { color: #1a0d0b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.destructive { color: #1a0d0b; } }
.card > .table-wrap:only-child { margin-top: -.25rem; margin-bottom: -.25rem; }
.card .table-wrap .table th { background: var(--surface); }
@media (max-width: 720px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: var(--pill); }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a, .tabs strong { flex: none; white-space: nowrap; }
}

/* ----------------------------------------------------------- misc -- */
.qr { width: 12rem; max-width: 100%; background: #fff; padding: .6rem; border-radius: var(--r); }
.qr svg { display: block; width: 100%; height: auto; }
.codes { columns: 2; padding-left: 1.2rem; font-family: var(--mono); }
.code { font: 700 1.6rem/1.2 var(--mono); letter-spacing: .15em; }
.inbox li.unread a { font-weight: 700; }
.inbox li.unread { position: relative; }

/* Hugo pages. */
/* Contents list on the long static pages (site/layouts/_default/single.html). */
.toc { margin: 1.25rem 0 2rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.toc h2 { margin: 0 0 .5rem; font-size: 1rem; }
.toc ul { margin: 0; padding-left: 1.1rem; }
.toc li + li { margin-top: .3rem; }

/* ------------------------------------------------------------ home -- */
.home { padding-top: 1rem; }
.hero { display: grid; gap: 2rem 3rem; align-items: center; margin: 1.5rem 0 3rem; }
@media (min-width: 900px) { .hero { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); margin: 3rem 0 4.5rem; } }
.hero h1 { font-size: clamp(2.4rem, 1.4rem + 4vw, 4rem); line-height: 1.05; letter-spacing: -.02em; margin: .25rem 0 1rem; }
.hero-lead { font-size: clamp(1.2rem, 1rem + .8vw, 1.5rem); font-weight: 600; line-height: 1.35; margin: 0 0 .75rem; max-width: 34rem; }
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 34rem; }
.hero .actions .button { padding-inline: 1.4rem; }
/* The pretend challenge card. */
.hero-art { display: grid; place-items: center; }
.mock-card { width: min(100%, 22rem); display: flex; flex-direction: column; gap: .6rem; padding: 1.25rem;
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  rotate: 2deg; }
.mock-title { font-size: 1.5rem; font-weight: 800; }
.mock-text { color: var(--muted); }
.mock-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .25rem 0; }
.mock-tiles span { aspect-ratio: 1; display: grid; place-items: center; font-size: 1.6rem; border-radius: var(--r-sm); }
.mock-tiles .t1 { background: linear-gradient(135deg, #fed7aa, #fb923c); }
.mock-tiles .t2 { background: linear-gradient(135deg, #fef3c7, #f59e0b); }
.mock-tiles .t3 { background: linear-gradient(135deg, #bfdbfe, #60a5fa); }
.mock-tiles .t4 { background: linear-gradient(135deg, #bbf7d0, #4ade80); }
.mock-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .mock-card { rotate: none; } }

.home-section { margin: 0 0 3.5rem; scroll-margin-top: 5rem; }
.home-section > h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); margin: 0 0 1.25rem; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.step { position: relative; padding: 1.25rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.step-emoji { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%; font-size: 1.7rem;
  background: var(--accent-soft); margin-bottom: .75rem; }
.step-num { position: absolute; top: 1rem; right: 1.1rem; font-size: 1.6rem; font-weight: 800; color: var(--line);
  font-variant-numeric: tabular-nums; }
.step h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }
.audiences { display: grid; gap: 1rem; }
@media (min-width: 800px) { .audiences { grid-template-columns: 1fr 1fr; } }
.audience h2 { font-size: 1.35rem; }
.emoji-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.emoji-list li { display: grid; grid-template-columns: 1.75rem 1fr; gap: .5rem; align-items: start; }
.emoji-list li > span:first-child { font-size: 1.2rem; line-height: 1.4; }
.emoji-list p { margin: 0; }
.safety { padding: 1.5rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.safety-grid { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .9rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.safety-grid li { display: flex; gap: .75rem; align-items: flex-start; }
.safety-emoji { flex: none; font-size: 1.5rem; line-height: 1.2; }
.cta { text-align: center; padding: 2.5rem 1.25rem; border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line); }
.cta p { max-width: 34rem; margin-inline: auto; }
.cta .actions { justify-content: center; }
/* The gallery's newest photos, added to the home page by the Worker. */
.recent { margin: 0 0 3.5rem; }
.recent h2 { margin-top: 0; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }

/* ---------------------------------------------------------- motion -- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* Each page eases in. Between pages, the browser cross-fades (where it
   supports view transitions) while the bars hold still. */
main { animation: rise var(--slow) var(--ease) both; }
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fade-out 160ms var(--ease) both; }
::view-transition-new(root) { animation: fade-in 220ms var(--ease) both; }

/* Windows contrast themes (forced colours) drop box-shadows and background
   colours, which draw several focus rings and every "selected" cue here.
   Outlines survive, in system colours. */
@media (forced-colors: active) {
  input:focus-visible, textarea:focus-visible, select:focus-visible,
  .picker:focus-within .picker-face, .search-bar:focus-within,
  .role-cards label:has(input:focus-visible) { outline: 2px solid Highlight; outline-offset: 2px; }
  .search-bar input[type=search]:focus-visible { outline: none; }
  /* Selected: a border, so focus (an outline) still changes something on top. */
  .tabbar [aria-current="page"], .theme-switch button[aria-pressed="true"], .tabs strong { border: 2px solid CanvasText; }
  .steps li.now .step-dot { outline: 2px solid CanvasText; outline-offset: 2px; }
  .seq-num { border: 1px solid CanvasText; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop {
    animation-duration: 1ms !important; animation-delay: 0s !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* New challenge: "Suggest a challenge", and the example photo. */
.suggest { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  margin: 0 0 1.25rem; padding: .75rem 1rem; border: 1px dashed var(--line); border-radius: var(--r); }
.suggest p { margin: 0; flex: 1 1 14rem; }
.example-field { margin: 0 0 1.25rem; min-inline-size: 0; }
.example-field input[type="file"] { max-width: 100%; min-width: 0; }
.example-current { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 0 0 1rem; }
.example-current img { width: 7rem; height: auto; border-radius: var(--r-sm); }
.example-current .check { margin: 0; }
figure.example { margin: 1rem 0 1.5rem; max-width: 34rem; }
figure.example img { display: block; width: 100%; height: auto; border-radius: var(--r); }
figure.example figcaption { margin-top: .4rem; }

/* A student's name in a class: first name, then the initial beside it. */
.name-card { border-color: var(--accent); }
.name-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 11rem); gap: 0 1rem; align-items: start; }
.name-form button { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 30rem) { .name-form { grid-template-columns: minmax(0, 1fr); } }

/* Tiles or mosaic: two links, the current one filled. */
.view-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.view-switch a { padding: .35rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.view-switch a[aria-current="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--control-line); }
@media (forced-colors: active) { .view-switch a[aria-current="true"] { border: 2px solid CanvasText; } }

/* The photo page's image opens the full-screen viewer. */
.stage-open { position: relative; display: block; color: #fff; text-decoration: none; cursor: zoom-in; }
.stage-hint { position: absolute; right: .6rem; bottom: .6rem; display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .6rem; border-radius: 999px; background: rgb(0 0 0 / .6); font-size: .8rem; font-weight: 600; }
.stage-hint .icon { width: 1rem; height: 1rem; }
.stage-open:focus-visible { outline-offset: 3px; }

/* Full-screen viewer (/dashboard/photos/:id/view): the photo alone, on black. */
.fs-page, .fs-body { height: 100%; background: #000; color: #f4f4f5; color-scheme: dark; }
.fs-body { margin: 0; overflow: hidden; }
.fs-body main { height: 100dvh; }
.fs-stage { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
/* Fills the screen whatever the photo's size; contain keeps its shape. */
.fs-stage img { display: block; width: 100vw; height: 100dvh; object-fit: contain; }
.fs-caption { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(42rem, calc(100vw - 2rem)); display: flex; gap: .6rem; align-items: baseline; padding: .45rem .9rem;
  border-radius: 999px; background: rgb(0 0 0 / .7); font-size: .9rem; line-height: 1.35; }
.fs-caption span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-count { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.fs-nav, .fs-close { position: fixed; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%;
  background: rgb(0 0 0 / .55); color: #fff; text-decoration: none; }
.fs-nav { top: 50%; transform: translateY(-50%); }
.fs-nav.prev { left: max(.75rem, env(safe-area-inset-left)); }
.fs-nav.next { right: max(.75rem, env(safe-area-inset-right)); }
.fs-close { top: max(.75rem, env(safe-area-inset-top)); right: max(.75rem, env(safe-area-inset-right)); }
.fs-nav .icon, .fs-close .icon { width: 1.5rem; height: 1.5rem; }
.fs-nav:hover, .fs-close:hover { background: rgb(0 0 0 / .8); color: #fff; }
.fs-nav:focus-visible, .fs-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (forced-colors: active) { .fs-nav, .fs-close, .fs-caption { border: 2px solid CanvasText; } }

/* The profile picture page. */
.profile-now { display: flex; align-items: center; gap: 1rem 1.25rem; margin: 0 0 1.5rem; flex-wrap: wrap; }
.profile-now p { flex: 1 1 14rem; margin: 0; }

/* --------------------------------------------------- wide screens -- */
/* More room for reading and forms, and much more for walls of photos. */
@media (min-width: 900px) { .narrow { max-width: 40rem; } }
@media (min-width: 1100px) { .narrow.wide { max-width: 80rem; } }

/* Dashboard: what needs doing on the left, classes on the right. Class page:
   the class on the left, its people and invitations on the right. DOM order
   is reading order in both, so the keyboard follows the eye. */
.dash, .split { display: grid; gap: 0 2.5rem; align-items: start; }
.dash-side > :first-child > h2:first-child, .dash-side > :first-child h2:first-of-type { margin-top: 0; }
@media (min-width: 1000px) {
  .dash { grid-template-columns: minmax(17rem, 23rem) minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); }
  .split-side { padding-top: .25rem; }
  .split-side > details { margin-top: 0; }
}

/* Policies: the contents beside the text, in view while reading. */
.doc-body { max-width: 44rem; }
@media (min-width: 1100px) {
  .has-toc { display: grid; grid-template-columns: 15rem minmax(0, 44rem); gap: 0 3.5rem; justify-content: center; align-items: start; }
  .has-toc > h1 { grid-column: 1 / -1; }
  .has-toc .toc { position: sticky; top: calc(var(--bar-h) + 1.5rem); margin: .5rem 0 0; max-height: calc(100vh - var(--bar-h) - 3rem); overflow: auto; }
}

/* A challenge's brief and its example photo, side by side when there's room. */
@media (min-width: 900px) {
  .ch-intro.has-example { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 26rem); gap: 0 2rem; align-items: start; }
  .ch-intro.has-example figure.example { margin-top: 0; }
}
.doc-body h2, .home-section { scroll-margin-top: calc(var(--bar-h) + 1rem); }
.dash-main .section-head { margin-top: 0; }
.dash-main .section-head h2 { margin-top: 0; }
/* Level with "Your classes", which shares its row with a button. */
@media (min-width: 1000px) { .dash-side > :first-child > h2:first-child { min-height: 2.5rem; display: flex; align-items: center; margin-bottom: .75rem; } }
