/* Mootstead design tokens and the accessibility floor (VISUAL-DESIGN-SYSTEM.md).
   Ground, not glass: chalk and warm stone, peat and ink, moss and lichen, and
   one ember, used once on a screen for the instant a Moment is made.
   Hand-written in the token shape the contrast check reads: primitives and
   semantic names in the root block, the dark theme in the media query and
   again under data-theme. Light is the default; dark follows the device only.
   No closing braces inside comments in the token blocks: the reader stops at the first one. */

@font-face {
  font-family: "Alegreya";
  src: url("/fonts/alegreya-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("/fonts/alegreya-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Ground: chalk and warm stone. Text: peat and ink. */
  --colour-neutral-0: #fbf9f4;
  --colour-neutral-50: #f4f1ea;
  --colour-neutral-100: #ebe5d9;
  --colour-neutral-200: #d8cfbe;
  --colour-neutral-400: #8a7d6b;
  --colour-neutral-600: #5a4b3e;
  --colour-neutral-900: #1e1b18;

  /* The living colour, steps 50 to 900: lichen to moss. 500 is the light action. */
  --colour-accent-50: #eef1e4;
  --colour-accent-100: #dfe6cc;
  --colour-accent-300: #9daa7c;
  --colour-accent-500: #3f5a36;
  --colour-accent-600: #32492b;
  --colour-accent-700: #273a22;
  --colour-accent-900: #1c2a19;

  /* Ember: the one warm accent. */
  --colour-ember-500: #a2461f;
  --colour-ember-300: #e08a5f;

  --colour-positive-100: #e6efdf;
  --colour-positive-500: #3f5a36;
  --colour-caution-100: #f6ecd6;
  --colour-caution-500: #7f5a12;
  --colour-critical-100: #f7e3dc;
  --colour-critical-500: #9b2f1c;

  --font-family-display: "Alegreya", Georgia, "Times New Roman", serif;
  --font-family-sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;

  --font-size-xs: 0.8125rem;
  --font-size-sm: 0.9375rem;
  --font-size-base: 1.0625rem;
  --font-size-md: 1.25rem;
  --font-size-lg: 1.5rem;
  --font-size-xl: 1.875rem;
  --font-size-2xl: 2.375rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --spacing-scale: pair 0.5rem, between 1rem, submit 1.5rem;

  --radius: 10px;
  --radius-small: 6px;
  --touch: 48px;
  --measure: 62ch;

  /* Motion: one curve, three durations. */
  --curve: cubic-bezier(0.2, 0, 0, 1);
  --tap: 90ms;
  --ease-t: 200ms;
  --enter: 320ms;

  --surface: var(--colour-neutral-50);
  --surface-sunken: var(--colour-neutral-100);
  --surface-raised: var(--colour-neutral-0);
  --border: var(--colour-neutral-200);
  --border-strong: var(--colour-neutral-400);
  --text: var(--colour-neutral-900);
  --text-muted: var(--colour-neutral-600);
  --text-inverse: var(--colour-neutral-0);
  --action: var(--colour-accent-500);
  --action-hover: var(--colour-accent-600);
  --action-quiet: var(--colour-accent-50);
  --focus-ring: var(--colour-accent-500);
  --ember: var(--colour-ember-500);
  --danger: var(--colour-critical-500);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --colour-neutral-0: #2a241f;
  --colour-neutral-50: #1e1b18;
  --colour-neutral-100: #262119;
  --colour-neutral-200: #3d352c;
  --colour-neutral-400: #a39684;
  --colour-neutral-600: #cfc5b5;
  --colour-neutral-900: #f4f1ea;
  --colour-positive-100: #1c2a19;
  --colour-positive-500: #b6c497;
  --colour-caution-100: #33270e;
  --colour-caution-500: #e5c27a;
  --colour-critical-100: #3a1a12;
  --colour-critical-500: #f0a08a;
  --action: var(--colour-accent-300);
  --action-hover: #b6c497;
  --action-quiet: var(--colour-accent-900);
  --focus-ring: var(--colour-accent-300);
  --ember: var(--colour-ember-300);
  --text-inverse: #1e1b18;
  }
}
:root[data-theme="dark"] {
  --colour-neutral-0: #2a241f;
  --colour-neutral-50: #1e1b18;
  --colour-neutral-100: #262119;
  --colour-neutral-200: #3d352c;
  --colour-neutral-400: #a39684;
  --colour-neutral-600: #cfc5b5;
  --colour-neutral-900: #f4f1ea;
  --colour-positive-100: #1c2a19;
  --colour-positive-500: #b6c497;
  --colour-caution-100: #33270e;
  --colour-caution-500: #e5c27a;
  --colour-critical-100: #3a1a12;
  --colour-critical-500: #f0a08a;
  --action: var(--colour-accent-300);
  --action-hover: #b6c497;
  --action-quiet: var(--colour-accent-900);
  --focus-ring: var(--colour-accent-300);
  --ember: var(--colour-ember-300);
  --text-inverse: #1e1b18;
}

/* ---- The floor ---- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: 1.55;
  font-variant-numeric: lining-nums tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; animation-timeline: auto !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .button:hover, .button--quiet:hover, .button--danger:hover { transform: none; }
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

h1, h2, h3 { margin: 0 0 var(--space-3); font-family: var(--font-family-display); font-weight: 700; line-height: 1.12; text-wrap: balance; }
h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }
p { margin: 0 0 var(--space-4); max-width: var(--measure); }
a { color: var(--action); text-underline-offset: 0.18em; }
strong { font-weight: 700; }
code { font-size: var(--font-size-sm); overflow-wrap: anywhere; }

.skip { position: absolute; left: -9999px; top: 0; padding: var(--space-3); background: var(--surface-raised); color: var(--text); }
.skip:focus { left: var(--space-3); top: var(--space-3); z-index: 10; }
.hidden { display: none !important; }
.quiet { color: var(--text-muted); font-size: var(--font-size-sm); }
.eyebrow { color: var(--text-muted); font-size: var(--font-size-sm); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: var(--space-2); }

/* ---- Frame ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-4) var(--space-2); max-width: 44rem; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text); text-decoration: none; }
.brand .mark { color: var(--action); }
.wordmark { font-family: var(--font-family-display); font-weight: 700; font-size: var(--font-size-md); letter-spacing: 0.01em; }
.nav { max-width: 44rem; margin: 0 auto; padding: 0 var(--space-4); }
.nav ul { display: flex; gap: var(--space-2); list-style: none; margin: 0; padding: 0; overflow-x: auto; }
.nav a { display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 var(--space-3); border-radius: var(--radius-small); color: var(--text-muted); text-decoration: none; font-weight: 700; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-sunken); }
.main { max-width: 44rem; margin: 0 auto; padding: var(--space-4); }
.foot { max-width: 44rem; margin: var(--space-6) auto 0; padding: var(--space-4); border-top: 1px solid var(--border); }
.foot ul { display: flex; flex-wrap: wrap; gap: var(--space-4); list-style: none; margin: 0; padding: 0; font-size: var(--font-size-sm); }

/* ---- Panels and text ---- */
.panel { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); margin-bottom: var(--space-4); }
.hero { text-align: center; padding: var(--space-6) var(--space-2) var(--space-5); }
.hero .mark { color: var(--action); }
.hero p { margin-left: auto; margin-right: auto; }
.lede { font-size: var(--font-size-md); }
.prose h2 { margin-top: var(--space-5); font-size: var(--font-size-lg); }
.plain { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
.plain li { margin-bottom: var(--space-2); }
.facts { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-4); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }
@media (max-width: 34rem) { .facts { grid-template-columns: 1fr; } .facts dd { margin-bottom: var(--space-3); } }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-small); background: var(--colour-positive-100); }
.notice--error { background: var(--colour-critical-100); color: var(--text); border-left: 4px solid var(--danger); }
.nudge { background: var(--action-quiet); }
.quote { padding-left: var(--space-3); border-left: 3px solid var(--border-strong); white-space: pre-wrap; }

/* ---- Buttons and forms (button protocol: one shape, three intents) ---- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--touch); padding: 0 var(--space-5);
  border: 2px solid var(--action); border-radius: var(--radius-small);
  background: var(--action); color: var(--text-inverse);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background-color var(--tap) var(--curve), border-color var(--tap) var(--curve), transform var(--tap) var(--curve);
}
@media (hover: hover) { .button:hover { background: var(--action-hover); border-color: var(--action-hover); color: var(--text-inverse); transform: translateY(-1px); } }
.button:active { background: var(--action-hover); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button--quiet { background: transparent; color: var(--action); }
@media (hover: hover) { .button--quiet:hover { background: var(--action-quiet); color: var(--action); transform: translateY(-1px); } }
.button--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
@media (hover: hover) { .button--danger:hover { background: var(--colour-critical-100); border-color: var(--danger); color: var(--danger); transform: translateY(-1px); } }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
.actions.stack { flex-direction: column; align-items: stretch; }
.form { margin: 0 0 var(--space-4); }
.form.inline { display: inline; margin: 0; }
label { display: block; font-weight: 700; margin: var(--space-3) 0 var(--space-2); }
label.check { display: flex; gap: var(--space-2); align-items: flex-start; font-weight: 400; }
input, select, textarea { width: 100%; min-height: var(--touch); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--surface-raised); color: var(--text); font: inherit; }
input[type="checkbox"] { width: 1.4rem; min-height: 1.4rem; margin-top: 0.15rem; }
input[type="file"] { padding: var(--space-3); }

/* ---- Lists of people and Moments ---- */
.people, .moments, .devices, .notes, .queue, .photos { list-style: none; margin: 0; padding: 0; }
.people li, .moments li, .devices li, .notes li, .queue li { padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.people li:first-child, .moments li:first-child, .devices li:first-child, .notes li:first-child, .queue li:first-child { border-top: 0; }
.moments a { display: flex; flex-direction: column; min-height: var(--touch); color: var(--text); text-decoration: none; }
.who { display: block; font-weight: 700; }
.meta { display: block; color: var(--text-muted); font-size: var(--font-size-sm); }
.devices li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.photos li { margin-bottom: var(--space-4); }
.photos img, .held img { display: block; width: 100%; height: auto; border-radius: var(--radius-small); }
.report { margin-top: var(--space-3); }
.report summary { color: var(--text-muted); font-size: var(--font-size-sm); cursor: pointer; min-height: var(--touch); display: inline-flex; align-items: center; }
.code-text { font-size: var(--font-size-xl); font-weight: 700; letter-spacing: 0.14em; }

/* ---- The Moment: a seal, not a post ---- */
.seal { text-align: center; background: var(--surface-raised); border: 2px solid var(--action); border-radius: 50% / 18%; padding: var(--space-6) var(--space-5); margin-bottom: var(--space-4); }
.seal .mark { color: var(--action); }
.seal-line { font-family: var(--font-family-display); font-size: var(--font-size-lg); margin: var(--space-3) auto; }
.seal-when { color: var(--text-muted); margin-left: auto; margin-right: auto; }
.made { color: var(--ember); }
.welcome { text-align: center; }
.welcome .mark { color: var(--ember); }

/* ---- The exchange ---- */
.code { margin: var(--space-4) auto; text-align: center; }
.code img, .code svg { width: min(78vw, 300px); height: auto; aspect-ratio: 1; background: #ffffff; border-radius: var(--radius-small); padding: var(--space-2); }
.code figcaption { color: var(--text-muted); font-size: var(--font-size-sm); margin-top: var(--space-2); }
.viewfinder { position: relative; width: min(86vw, 360px); aspect-ratio: 1; margin: var(--space-3) auto; border-radius: var(--radius); overflow: hidden; background: var(--colour-neutral-900); }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; }

/* ---- Console ---- */
.console .who { display: flex; align-items: center; gap: var(--space-3); font-size: var(--font-size-sm); color: var(--text-muted); }
.table { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
.table th, .table td { text-align: left; padding: var(--space-2); border-top: 1px solid var(--border); }
