/*
  Mimosa design system: the shared stylesheet for every mimosa.works web page.
  Link it first, then a page stylesheet:  <link rel="stylesheet" href="/orca.css">

  Tokens are stable API: pages use the semantic tokens (--bg, --text, --accent…), not the raw palette.
  Theme follows the system; force one with <html data-theme="light|dark">.
  Colors use light-dark(), so each token is defined once for both themes.
*/

:root {
  color-scheme: light dark;

  /* Raw palette, taken from a mimosa at dusk and at brunch: a plum evening sky, warm cream paper, citrus,
     champagne gold and a mimosa blossom's pink. Green is only for success. */
  --dusk-950: #0e0a14;
  --dusk-900: #15101c;
  --dusk-800: #1b1524;
  --ink-950: #0f0e0b;
  --ink-900: #1a1813;
  --ink-800: #26231c;
  --ink-700: #38342a;
  --ink-600: #534d40;
  --ink-500: #70695a;
  --ink-400: #96907f;
  --ink-300: #bdb8a8;
  --ink-200: #ddd8ca;
  --ink-100: #eee9dc;
  --ink-50: #faf6ec;
  --citrus-600: #c2570a;
  --citrus-500: #f0811a;
  --citrus-400: #ffa033;
  --citrus-300: #ffc46b;
  --amber-400: #f2c66d;
  --blossom-400: #f3a4b5;
  --leaf-500: #2f9e68;
  --leaf-400: #6fcf97;
  --red-500: #e5484d;
  --red-400: #ff6369;

  /* Semantic colors */
  --bg: light-dark(var(--ink-50), var(--dusk-950));
  --bg-elevated: light-dark(#fffdf8, var(--dusk-900));
  --surface: light-dark(rgb(255 253 247 / 0.78), rgb(246 240 227 / 0.045));
  --surface-strong: light-dark(#fffdf8, var(--dusk-800));
  --surface-sunken: light-dark(var(--ink-100), rgb(0 0 0 / 0.3));
  --border: light-dark(rgb(26 24 19 / 0.1), rgb(246 240 227 / 0.09));
  --border-strong: light-dark(rgb(26 24 19 / 0.18), rgb(246 240 227 / 0.18));
  --text: light-dark(var(--ink-900), #f6f0e3);
  --text-muted: light-dark(var(--ink-600), #c5bfaf);
  --text-subtle: light-dark(var(--ink-500), rgb(214 207 190 / 0.6));
  --accent: light-dark(var(--citrus-600), var(--citrus-400));
  --accent-hover: light-dark(#a04606, var(--citrus-300));
  --accent-text: light-dark(#fffaf0, #1b1206);
  --accent-soft: light-dark(rgb(194 87 10 / 0.09), rgb(255 160 51 / 0.13));
  --highlight: light-dark(#b34a6e, var(--blossom-400));
  --warm: var(--amber-400);
  --success: light-dark(#1f7a4f, var(--leaf-400));
  --danger: light-dark(#cc2f36, var(--red-400));
  --success-soft: light-dark(rgb(47 158 104 / 0.1), rgb(111 207 151 / 0.12));
  --danger-soft: light-dark(rgb(229 72 77 / 0.09), rgb(255 99 105 / 0.12));
  --focus-ring: light-dark(var(--citrus-600), var(--citrus-300));
  --glow: light-dark(rgb(194 87 10 / 0.24), rgb(255 138 31 / 0.36));

  /* Shadows */
  --shadow-sm: 0 1px 2px light-dark(rgb(13 20 36 / 0.06), rgb(0 0 0 / 0.3));
  --shadow-md: 0 1px 2px light-dark(rgb(13 20 36 / 0.05), rgb(0 0 0 / 0.3)), 0 8px 24px -6px light-dark(rgb(13 20 36 / 0.1), rgb(0 0 0 / 0.45));
  --shadow-lg: 0 2px 4px light-dark(rgb(13 20 36 / 0.04), rgb(0 0 0 / 0.3)), 0 30px 60px -18px light-dark(rgb(83 60 20 / 0.22), rgb(0 0 0 / 0.65));

  /* Type */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
  --text-4xl: clamp(2.1rem, 1.5rem + 2.6vw, 3.25rem);
  --text-5xl: clamp(2.6rem, 1.6rem + 4.4vw, 4.75rem);
  --text-6xl: clamp(3rem, 1.6rem + 6vw, 6.25rem);
  --leading-tight: 1.04;
  --leading-snug: 1.25;
  --leading-normal: 1.55;
  --tracking-display: -0.045em;
  --tracking-tight: -0.02em;
  --tracking-caps: 0.12em;
  --weight-regular: 400;
  --weight-medium: 520;
  --weight-semibold: 620;
  --weight-bold: 720;

  /* Spacing (4px grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --section-gap: clamp(4.5rem, 3rem + 7vw, 9rem);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-pill: 999px;

  /* Layout */
  --container: 74rem;
  --container-narrow: 44rem;
  --gutter: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
  --header-height: 4rem;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 420ms;
  --dur-slower: 800ms;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; --dur-slower: 0ms; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + var(--space-4)); }
body {
  margin: 0;
  min-height: 100vh;
  font: var(--weight-regular) var(--text-base) / var(--leading-normal) var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); line-height: var(--leading-snug); text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }
::selection { background: var(--accent); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: var(--radius-xs); }
.pixel { image-rendering: pixelated; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 100; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-text); font-weight: var(--weight-semibold); text-decoration: none; }
.skip-link:focus { top: var(--space-3); }

/* Layout */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }

/* Simple pages (download, sign-in, status): <main class="container container--narrow page-main"> */
.page-main { padding-block: var(--space-16) var(--space-24); }
.page-lead { margin-block: var(--space-3) var(--space-8); }

/* Typography helpers */
.eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); font: var(--weight-semibold) var(--text-xs) / 1 var(--font-mono); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: light-dark(#8a5a00, var(--amber-400)); }
/* One bubble before each eyebrow: the page's small signature. */
.eyebrow::before { content: ""; width: 0.55em; height: 0.55em; border: 1.5px solid currentColor; border-radius: 50%; flex: none; }
.display { font-family: var(--font-serif); font-size: var(--text-6xl); line-height: var(--leading-tight); letter-spacing: -0.028em; font-weight: 600; }
.title { font-family: var(--font-serif); font-size: var(--text-4xl); line-height: 1.1; letter-spacing: -0.022em; font-weight: 600; }
.lead { font-size: clamp(var(--text-lg), 1rem + 0.6vw, var(--text-xl)); line-height: 1.5; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.gradient-text {
  background: linear-gradient(100deg, light-dark(#c2570a, #ff8a1f) 0%, light-dark(#d98a0b, #ffc24a) 55%, light-dark(#b34a6e, #ffe0a3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-style: italic; padding-inline-end: 0.08em;
}

/* Buttons: .btn plus a variant. .button is kept as an alias of the primary button. */
.btn, .button {
  --btn-bg: var(--surface-strong);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.75rem; padding: 0 var(--space-5);
  border: 1px solid var(--btn-border); border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font: var(--weight-semibold) var(--text-sm) / 1 var(--font-sans); letter-spacing: -0.005em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.btn:hover, .button:hover { color: var(--btn-fg); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active, .button:active { transform: translateY(0) scale(0.98); }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.btn--primary, .button {
  --btn-bg: var(--accent); --btn-fg: var(--accent-text); --btn-border: transparent;
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.16), rgb(255 255 255 / 0));
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.25) inset, 0 10px 30px -8px var(--glow);
}
.btn--primary:hover, .button:hover { --btn-bg: var(--accent-hover); box-shadow: 0 1px 0 rgb(255 255 255 / 0.25) inset, 0 16px 40px -8px var(--glow); }
.btn--secondary { --btn-bg: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; box-shadow: none; }
.btn--ghost:hover { --btn-bg: var(--accent-soft); box-shadow: none; }
.btn--sm { min-height: 2.25rem; padding: 0 var(--space-4); font-size: var(--text-sm); }
.btn--lg { min-height: 3.25rem; padding: 0 var(--space-6); font-size: var(--text-base); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* Cards */
.card {
  position: relative;
  padding: var(--space-6);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
}
.card--interactive { transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.card--interactive:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.card h3 { font-size: var(--text-lg); }
.card p { color: var(--text-muted); }

/* Pills and badges */
.pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text-muted);
  font-size: var(--text-sm); line-height: 1.6;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.badge { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.15em 0.6em; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font: var(--weight-semibold) var(--text-xs) / 1.6 var(--font-sans); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; flex: none; }
.dot--live { background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: orca-pulse 2s var(--ease-out) infinite; }
@keyframes orca-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 100% { box-shadow: 0 0 0 0.5rem transparent; } }

/* Forms (sign-in and status pages) */
.field { display: grid; gap: var(--space-2); }
.label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-muted); }
.input {
  width: 100%; min-height: 2.75rem; padding: 0 var(--space-4);
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-strong); color: var(--text);
  font: inherit;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.input::placeholder { color: var(--text-subtle); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* Notices */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4) var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--text); }
.notice--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.notice--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* Spinner */
.spinner { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: orca-spin 0.8s linear infinite; }
@keyframes orca-spin { to { transform: rotate(360deg); } }

/* Site header: <header class="site-header"><div class="container site-header__inner">…</div></header> */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.site-header[data-scrolled], .site-header--solid {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom-color: var(--border);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); height: var(--header-height); }
.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--text); font: 600 1.3rem / 1 var(--font-serif); letter-spacing: -0.015em; text-decoration: none; }
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; image-rendering: pixelated; }
.site-nav { display: flex; align-items: center; gap: var(--space-1); }
.site-nav a:not(.btn) { padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill); color: var(--text-muted); font-size: var(--text-sm); font-weight: var(--weight-medium); text-decoration: none; transition: color var(--dur-fast), background-color var(--dur-fast); }
.site-nav a:not(.btn):hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
/* The light/dark switch (theme.js): hidden until the script runs, and it shows the mode a click would bring. */
.theme-toggle { display: inline-grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; transition: color var(--dur-fast), background-color var(--dur-fast); }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--text); background: var(--accent-soft); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle[data-now="dark"] .theme-toggle__moon, .theme-toggle[data-now="light"] .theme-toggle__sun { display: none; }

/* The light/dark switch opens the new theme from the button outwards (theme.js starts the view transition). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 1; }

/* Site footer */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-12) var(--space-16); color: var(--text-subtle); font-size: var(--text-sm); }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* Download rows, rendered by downloads.js into [data-downloads] */
.download-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.download {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: var(--space-5);
  padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.download:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.download img { width: 56px; height: 56px; }
/* A row with several downloads (one per system) stacks their buttons. */
.download__actions { display: grid; gap: var(--space-2); justify-items: stretch; text-align: center; }
.download h3 { font-size: var(--text-lg); }
.download p { color: var(--text-muted); font-size: var(--text-sm); }
.download .meta { margin-block: 0.15rem 0.25rem; color: var(--text-subtle); font: var(--weight-medium) var(--text-xs) / 1.5 var(--font-mono); letter-spacing: 0.02em; }
.download .checksum { margin-top: var(--space-2); color: var(--text-subtle); font: 0.7rem/1.45 var(--font-mono); overflow-wrap: anywhere; user-select: all; }
.download > div { min-width: 0; }
.soon { padding: var(--space-2) var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-pill); color: var(--text-subtle); font-size: var(--text-sm); white-space: nowrap; }
@media (max-width: 560px) {
  .download { grid-template-columns: 48px minmax(0, 1fr); gap: var(--space-4); }
  .download__actions { grid-auto-flow: column; justify-content: start; }
  .download img { width: 48px; height: 48px; }
  .download > :last-child { grid-column: 2; justify-self: start; }
}
