/* ───────── Fonts (files in public/fonts/, section 3) ───────── */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Fallback";
  src: local("Helvetica Neue"), local("Arial"), local("Roboto");
  size-adjust: 103%;
  ascent-override: 97%;
  descent-override: 28%;
  line-gap-override: 0%;
}

/* ───────── Fixed tokens: the same in both themes ───────── */
:root {
  /* type */
  --sans: "Geist", "Geist Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-status: clamp(1.75rem, 1.2rem + 2.6vw, 3rem);       /* status sentence when it is the hero */
  --fs-quote: clamp(1.375rem, 1rem + 1.6vw, 2rem);         /* opening words on the hero photograph */
  --fs-h2: clamp(1.5rem, 1.25rem + 1.2vw, 2.25rem);
  --fs-h3: clamp(1.25rem, 1.15rem + 0.6vw, 1.5rem);
  --fs-num: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-story: 1.125rem;                                    /* the travellers' words: 18 px */
  --fs-body: 1.0625rem;                                    /* 17 px */
  --fs-ui: 0.9375rem;                                      /* 15 px */
  --fs-sm: 0.8125rem;                                      /* 13 px: nothing on any page is smaller */
  --measure: 62ch;

  /* space: 4 px grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-7: 36px; --s-8: 48px; --s-9: 64px; --s-10: 96px;
  --gutter: 16px;
  --section-gap: 64px;
  --content: 1200px;      /* widest the page gets */
  --feed: 776px;          /* story column: 64 px day gutter + about 62ch */
  --page: 35rem;          /* posting and manage column */

  /* shape */
  --r-xs: 6px; --r-ctl: 10px; --r-md: 12px; --r-card: 16px; --r-lg: 20px; --r-sheet: 22px; --r-full: 999px;

  /* motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-press: 120ms; --t-enter: 200ms; --t-sheet: 320ms; --t-photo: 400ms; --t-draw: 1000ms;

  /* layers */
  --z-stick: 40; --z-map-full: 60; --z-toast: 90; --z-lightbox: 95; --z-skip: 100;

  /* sea state: a data scale, never themed (2.3) */
  --wave-1: #FCFDBF; --wave-2: #FE9F6D; --wave-3: #DE4968; --wave-4: #8C2981; --wave-5: #3B0F70;

  /* on a photograph: the hero is always a dark plate, in both themes (2.4) */
  --photo-ink: 3 8 19;                 /* use as rgb(var(--photo-ink) / .64) */
  --on-photo: #FFFFFF;
  --on-photo-2: rgb(255 255 255 / .88);
  --on-photo-dark: #06121C;            /* text on the white and green pills that sit on photographs */
  --photo-pill: #FFFFFF;
  --photo-pill-hover: #D9F6F8;
  --photo-new: #63EFB3;
  --photo-plate: radial-gradient(120% 80% at 15% 0%, #12495A, transparent 60%),
                 radial-gradient(100% 70% at 90% 10%, #0E4634, transparent 60%), #0B1422;

  /* lightbox: always dark */
  --lb-text: #ECF1F5; --lb-text-2: #ABB8C3; --lb-text-3: #8796A4;
}

/* ───────── Theme: polar night (default) ───────── */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070E1A; --surface: #0E1725; --raised: #182231; --sunken: #030813;
  --border: #242E3E; --border-control: #6F7C8C; --hairline: rgb(255 255 255 / .08);
  --text: #ECF1F5; --text-2: #ABB8C3; --text-3: #8796A4;
  --accent: #85E3E8; --accent-strong: #AAF0F4; --on-accent: #06121C; --accent-tint: #04313C;
  --aurora: #63EFB3;
  --ok: #65E0A5; --ok-tint: #0B2E1E;
  --warn: #F2C36A; --warn-tint: #34260C;
  --danger: #FE8A88; --danger-tint: #3F1919; --on-danger: #06121C;
  --toast-bg: #ECF1F5; --toast-ink: #070E1A;
  --glass: rgb(14 23 37 / .78); --scrim: rgb(2 6 14 / .96);
  --shadow-low: none; --shadow-high: none;
  --wash-a: rgb(133 227 232 / .13); --wash-b: rgb(99 239 179 / .09);
  --photo-edge: rgb(255 255 255 / .09);
  --wave-edge: #ABB8C3;
  --sun-day: #FFD98A; --sun-twilight: #5B8DB8; --sun-night: #6F7C8C;
  /* map (read by the map script; also used by the drawn fallback) */
  --map-sea: #0A1626; --map-land: #1B2738; --map-ice: #2C3E55; --map-shelf: #22344A; --map-coast: #465B75;
  --map-label: #93A6BA; --map-halo: #0A1626; --map-ink: #ECF1F5; --map-casing: #EAF2F8;
  --map-planned: #8796A4; --map-none: #ABB8C3; --map-core: #0A1626; --map-accent: #85E3E8;
  --ship-edge: #06121C; --pin-edge: #F4F8FB;
}

/* ───────── Theme: polar day ───────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F6FAFD; --surface: #FFFFFF; --raised: #FFFFFF; --sunken: #EBF2F7;
    --border: #D8E1E9; --border-control: #748291; --hairline: rgb(13 27 47 / .08);
    --text: #0D1B2F; --text-2: #445469; --text-3: #5D6C7F;
    --accent: #006484; --accent-strong: #004F6C; --on-accent: #FFFFFF; --accent-tint: #DAF4FA;
    --aurora: #008F5B;
    --ok: #006D45; --ok-tint: #DBF6E7;
    --warn: #83560D; --warn-tint: #FBEDD1;
    --danger: #BE2323; --danger-tint: #FFE7E4; --on-danger: #FFFFFF;
    --toast-bg: #0D1B2F; --toast-ink: #F6FAFD;
    --glass: rgb(255 255 255 / .8); --scrim: rgb(4 10 20 / .96);
    --shadow-low: 0 1px 2px rgb(13 27 47 / .06), 0 2px 8px rgb(13 27 47 / .06);
    --shadow-high: 0 2px 4px rgb(13 27 47 / .06), 0 12px 32px rgb(13 27 47 / .14);
    --wash-a: rgb(0 100 132 / .09); --wash-b: rgb(0 143 91 / .06);
    --photo-edge: transparent;
    --wave-edge: #445469;
    --sun-day: #A86400; --sun-twilight: #4C7FA8; --sun-night: #445469;
    --map-sea: #DDEAF3; --map-land: #C3CCD6; --map-ice: #FFFFFF; --map-shelf: #EEF5FA; --map-coast: #9DB2C5;
    --map-label: #4C6278; --map-halo: #EEF5FA; --map-ink: #0D1B2F; --map-casing: #0D1B2F;
    --map-planned: #5D6C7F; --map-none: #445469; --map-core: #FFFFFF; --map-accent: #006484;
    --ship-edge: #FFFFFF; --pin-edge: #F4F8FB;
  }
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #F6FAFD; --surface: #FFFFFF; --raised: #FFFFFF; --sunken: #EBF2F7;
  --border: #D8E1E9; --border-control: #748291; --hairline: rgb(13 27 47 / .08);
  --text: #0D1B2F; --text-2: #445469; --text-3: #5D6C7F;
  --accent: #006484; --accent-strong: #004F6C; --on-accent: #FFFFFF; --accent-tint: #DAF4FA;
  --aurora: #008F5B;
  --ok: #006D45; --ok-tint: #DBF6E7;
  --warn: #83560D; --warn-tint: #FBEDD1;
  --danger: #BE2323; --danger-tint: #FFE7E4; --on-danger: #FFFFFF;
  --toast-bg: #0D1B2F; --toast-ink: #F6FAFD;
  --glass: rgb(255 255 255 / .8); --scrim: rgb(4 10 20 / .96);
  --shadow-low: 0 1px 2px rgb(13 27 47 / .06), 0 2px 8px rgb(13 27 47 / .06);
  --shadow-high: 0 2px 4px rgb(13 27 47 / .06), 0 12px 32px rgb(13 27 47 / .14);
  --wash-a: rgb(0 100 132 / .09); --wash-b: rgb(0 143 91 / .06);
  --photo-edge: transparent;
  --wave-edge: #445469;
  --sun-day: #A86400; --sun-twilight: #4C7FA8; --sun-night: #445469;
  --map-sea: #DDEAF3; --map-land: #C3CCD6; --map-ice: #FFFFFF; --map-shelf: #EEF5FA; --map-coast: #9DB2C5;
  --map-label: #4C6278; --map-halo: #EEF5FA; --map-ink: #0D1B2F; --map-casing: #0D1B2F;
  --map-planned: #5D6C7F; --map-none: #445469; --map-core: #FFFFFF; --map-accent: #006484;
  --ship-edge: #FFFFFF; --pin-edge: #F4F8FB;
}

/* ───────── Responsive tokens ───────── */
@media (min-width: 400px) { :root { --gutter: 20px; } }
@media (min-width: 900px) { :root { --gutter: 32px; } }
@media (min-width: 960px) { :root { --section-gap: 96px; } }

/* ───────── Reader preferences ───────── */
/* This selector list is deliberate: it out-ranks or follows every theme block above. Do not shorten it to :root. */
@media (prefers-contrast: more) {
  :root:not([data-theme]), [data-theme] {
    --border: var(--border-control); --text-2: var(--text); --text-3: var(--text); --glass: var(--surface);
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root:not([data-theme]), [data-theme] { --glass: var(--surface); }
}
