/* Design tokens for CypherMonkey Labs.
   Space Grotesk (Florian Karsten) and Atkinson Hyperlegible (Braille Institute)
   are self-hosted under the SIL Open Font License. See css/fonts/OFL-*.txt. */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-display: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  --text-scale: 1;
  --fs-100: calc(clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem) * var(--text-scale));
  --fs-200: calc(clamp(1.0625rem, 1rem + 0.2vw, 1.125rem) * var(--text-scale));
  --fs-300: calc(clamp(1.25rem, 1.15rem + 0.35vw, 1.375rem) * var(--text-scale));
  --fs-400: calc(clamp(1.5rem, 1.35rem + 0.6vw, 1.75rem) * var(--text-scale));
  --fs-500: calc(clamp(1.875rem, 1.6rem + 1vw, 2.375rem) * var(--text-scale));
  --fs-600: calc(clamp(2.25rem, 1.8rem + 1.6vw, 3.25rem) * var(--text-scale));
  --fs-700: calc(clamp(2.75rem, 2rem + 2.4vw, 4.5rem) * var(--text-scale));
  --fs-800: calc(clamp(3.25rem, 2rem + 5vw, 6.5rem) * var(--text-scale));
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
  --radius-1: 8px;
  --radius-2: 14px;
  --radius-3: 22px;
  --radius-4: 32px;
  --radius-pill: 999px;
  --dur-instant: 80ms;
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-moderate: 320ms;
  --dur-slow: 480ms;
  --dur-scenic: 900ms;
  --dur-epic: 1400ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-decel: cubic-bezier(0.05, 0.7, 0.1, 1);
  --ease-accel: cubic-bezier(0.3, 0, 0.8, 0.15);
  --ease-spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1);
  --content-max: 1680px;
  --content: min(100% - 2 * clamp(16px, 4vw, 64px), var(--content-max));
  --grid-cols: 4;
  --cm-header-h: 56px;
  --cm-rail: 0px;
  --focus-halo: var(--bg);
  color-scheme: light;
}

@supports not (animation-timing-function: linear(0, 1)) {
  :root { --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); }
}

@media (min-width: 768px) {
  :root { --cm-header-h: 64px; --grid-cols: 8; }
}

@media (min-width: 1024px) {
  :root { --cm-header-h: 72px; --grid-cols: 12; }
}

@media (min-width: 1600px) {
  :root { --grid-cols: 16; }
}

@media (min-width: 2200px) {
  html { font-size: 18px; }
  :root { --content-max: 2000px; }
}

:root,
html[data-theme="dawn"] {
  --bg: #FBF7FF;
  --surface: #FFFFFF;
  --surface-2: #F3EEFF;
  --ink: #1E1B3A;
  --ink-muted: #4A4670;
  --primary: #5B4BD6;
  --on-primary: #FFFFFF;
  --primary-container: #E6E0FF;
  --focus: #5B4BD6;
  --peach: #FFB4A2;
  --sky: #A7D8FF;
  --mint: #9EE6CF;
  --lavender: #C9B8FF;
  --butter: #FFE8A3;
  --pink: #FFC6E0;
  --disclaimer-bg: #FFF4CC;
  --danger: #B3261E;
  --success: #1E6B4F;
  --line: #D9D3EA;
  --shadow: 0 1px 2px rgb(30 27 58 / 0.06), 0 8px 24px rgb(91 75 214 / 0.12);
  --glass: 78%;
  color-scheme: light;
}

html[data-theme="starlight"] {
  --bg: #0F1030;
  --surface: #1A1B45;
  --surface-2: #24255A;
  --ink: #F4F1FF;
  --ink-muted: #C9C4F0;
  --primary: #B9AEFF;
  --on-primary: #14123A;
  --primary-container: #3A3380;
  --focus: #FFE08A;
  --peach: #FFB4A2;
  --sky: #A7D8FF;
  --mint: #9EE6CF;
  --lavender: #C9B8FF;
  --butter: #FFE8A3;
  --pink: #FFC6E0;
  --disclaimer-bg: #2A2550;
  --danger: #FFB4AB;
  --success: #8FE3BF;
  --line: #3C3E78;
  --shadow: 0 0 0 1px rgb(185 174 255 / 0.18), 0 12px 32px rgb(0 0 0 / 0.35);
  --glass: 70%;
  color-scheme: dark;
}

html[data-theme="contrast"] {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F2F2F2;
  --ink: #000000;
  --ink-muted: #1A1A1A;
  --primary: #0000CC;
  --on-primary: #FFFFFF;
  --primary-container: #DDDDFF;
  --focus: #000000;
  --focus-halo: #FFFF00;
  --peach: #FFB4A2;
  --sky: #A7D8FF;
  --mint: #9EE6CF;
  --lavender: #C9B8FF;
  --butter: #FFE8A3;
  --pink: #FFC6E0;
  --disclaimer-bg: #FFFFFF;
  --danger: #B00020;
  --success: #006400;
  --line: #000000;
  --shadow: 0 0 0 2px #000000;
  --glass: 100%;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--cm-header-h) + 16px);
  scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  color: var(--ink);
}

@media (min-width: 768px) {
  html { scroll-padding-bottom: 32px; }
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-200);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  font-weight: 700;
}

h1, h2 { letter-spacing: -0.02em; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--focus-halo, var(--bg));
}

html[data-theme="contrast"] :focus-visible {
  outline: 3px solid #000000;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #FFFF00;
}

::selection {
  background: var(--primary-container);
  color: var(--ink);
}

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid CanvasText;
    box-shadow: 0 0 0 6px Canvas;
  }
}
