/* Shared by every page: colours, fonts, the WebGL background and the cursor.
   The colours below are the default theme, taken from the logo: its black,
   its ring (--accent) and its card (--text). theme.js overrides them when
   another colour is picked, so use the variables, not raw colours. */
:root {
  color-scheme: dark;

  --bg: #04070b;
  --bg-rgb: 4 7 11;
  --surface: #0a1118;
  --surface-rgb: 10 17 24;
  --panel: #0d171e;
  --panel-rgb: 13 23 30;
  --border: #1c2931;
  --border-strong: #2c3b43;

  --text: #f3f7f4;
  --text-soft: #ecf1ed;
  --text-soft-rgb: 236 241 237;
  --text-2: #c1d3cd;
  --copy: #b1c4be;
  --copy-rgb: 177 196 190;
  --muted: #88a09a;
  --muted-rgb: 136 160 154;
  --faint: #708a85;
  --ghost: #5c746e;
  --line: rgb(var(--copy-rgb) / 0.14);
  --line-strong: rgb(var(--text-soft-rgb) / 0.2);

  --accent-deep: #10998b;
  --accent: #1cb9a9;
  --accent-rgb: 28 185 169;
  --accent-light: #87e2d7;
  --accent-light-rgb: 135 226 215;
  --accent-pale: #9fefdf;
  --accent-soft: #bff6e6;
  --live: #98f6da;
  --live-rgb: 152 246 218;
  --warm: #e8b376;
  --warm-rgb: 232 179 118;
  --cool: #9fc9e8;
  --danger: #ff8c9b;
  --danger-rgb: 255 140 155;
  --theme-light: #f3f7f4;

  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --gutter: clamp(1.25rem, 3.3vw, 3.75rem);
  --header-height: 5.5rem;
}

* { box-sizing: border-box; }

/* The logo: drawn once at the top of index.html (scripts/brand-assets.js), then
   <svg class="mark"><use …>. The card takes the text colour, the ring the accent. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.mark { flex: none; width: 1.6em; height: 1.6em; color: var(--text); overflow: visible; }
.mark__orbit { color: var(--accent); }

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: auto;
  scroll-padding-top: var(--header-height);
  scrollbar-color: rgb(var(--accent-light-rgb) / 0.42) var(--bg);
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 300ms ease;
}
html:not([data-route='home']) body {
  background: radial-gradient(ellipse at 77% 3%, rgb(var(--accent-rgb) / 0.1), transparent 36rem), var(--bg);
}

::selection { color: var(--bg); background: var(--accent-soft); }
a { color: inherit; text-decoration: none; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 5px; }
.hidden { display: none !important; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* The landing only exists on "/", the app only on the other routes.
   The stars and the cursor stay everywhere. */
html[data-route='home'] .app-shell { display: none; }
html:not([data-route='home']) #landing-page,
html:not([data-route='home']) .site-header,
html:not([data-route='home']) .scroll-meter,
html:not([data-route='home']) .palette,
html:not([data-route='home']) .loader,
html:not([data-route='home']) .vignette { display: none; }

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  color: var(--bg);
  background: var(--text);
  transform: translateY(-180%);
  transition: transform 180ms ease-out;
}
.skip-link:focus { transform: translateY(0); }

.sky {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 350ms ease;
}
.sky.is-lost { opacity: 0.22; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgb(var(--bg-rgb) / 0.4), transparent 24%, transparent 78%, rgb(var(--bg-rgb) / 0.28)),
    radial-gradient(circle at 50% 47%, transparent 46%, rgb(var(--bg-rgb) / 0.58) 118%);
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: -0.85rem 0 0 -0.85rem;
  border: 1px solid rgb(var(--accent-light-rgb) / 0.5);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: width 220ms ease, height 220ms ease, margin 220ms ease, border-color 220ms ease, opacity 160ms ease;
  will-change: transform;
}
.cursor span { width: 2px; height: 2px; border-radius: 50%; background: var(--text); }
.cursor.is-visible { opacity: 1; }
.cursor.is-hovering {
  width: 2.8rem;
  height: 2.8rem;
  margin: -1.4rem 0 0 -1.4rem;
  border-color: rgb(var(--warm-rgb) / 0.75);
}
.cursor.is-down { width: 1.25rem; height: 1.25rem; margin: -0.625rem 0 0 -0.625rem; }

/* Colour swatches, used by the landing picker and in the settings */
.swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.swatches button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  transition: border-color 180ms ease;
}
.swatches button::before {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  content: '';
  background: linear-gradient(135deg, var(--swatch-light) 0 46%, var(--swatch-accent) 54% 100%);
  box-shadow: 0 0 0 4px rgb(255 255 255 / 0.04);
}
.swatches button:hover { border-color: var(--line-strong); }
.swatches button[aria-pressed='true'] { border-color: var(--text-soft); }

.color-field {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
  cursor: pointer;
}
.color-field input {
  grid-row: 1 / 3;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.color-field input::-webkit-color-swatch-wrapper { padding: 3px; }
.color-field input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color-field input::-moz-color-swatch { border: 0; border-radius: 50%; }
.color-field span { align-self: end; color: var(--text-soft); font-size: 0.75rem; font-weight: 600; line-height: 1.2; }
.color-field output { align-self: start; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.05em; }

@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
