/* DankProxies V2 — dark glass design system.
 *
 * Ported from the reference-site mechanics (glass surfaces, ambient mesh,
 * tinted depth) onto the DankProxies identity: near-black ground, brand red,
 * tight radii. Everything here is CSP-safe. `default-src 'self'` means
 * font-src is 'self' too, so the display face is a system stack until a woff2
 * is self-hosted — swap --font-display in one place when it is.
 */

/* Space Grotesk, self-hosted. SIL OFL 1.1 — see fonts/OFL.txt, which ships
 * beside the files as the licence requires.
 *
 * Self-hosted rather than linked because `default-src 'self'` covers font-src:
 * a Google Fonts <link> does not load slowly here, it does not load at all.
 *
 * The src path is RELATIVE on purpose. This block is byte-copied into
 * site/v2/v2-site.css, and the two stylesheets sit at different depths on
 * different origins — /static/v2/tokens.css and /v2/v2-site.css — so an
 * absolute path could only ever be right for one of them. `fonts/…` resolves
 * correctly from both, given each origin carries its own copy of the files.
 *
 * One variable face covers 300-700, so weight changes cost no extra request.
 * font-display:swap: the system stack renders immediately and is replaced when
 * the 22 KB latin subset lands. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/space-grotesk-latin.woff2") format("woff2");
  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: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
                 U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
                 U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
                 U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;

  /* ---- ground ------------------------------------------------------- */
  --bg:            #08080a;
  --bg-raise:      #0d0d11;   /* rails and wells: anything *under* glass */
  --bg-sink:       #050506;   /* code panels, telemetry, inset surfaces */

  /* ---- glass -------------------------------------------------------- */
  /* One recipe, three weights. The inset white top-edge is what makes it read
     as glass rather than as a flat grey box — do not drop it. */
  --glass:         linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  --glass-hi:      linear-gradient(160deg, rgba(255,255,255,.085), rgba(255,255,255,.030));
  --glass-lo:      linear-gradient(160deg, rgba(255,255,255,.032), rgba(255,255,255,.012));
  --glass-blur:    blur(22px) saturate(1.35);
  --glass-edge:    inset 0 1px 0 rgba(255,255,255,.075);

  /* ---- lines -------------------------------------------------------- */
  --line:          rgba(255,255,255,.075);   /* hairline: table rows, dividers */
  --line-2:        rgba(255,255,255,.13);    /* chrome: inputs, ghost buttons */
  --line-hot:      rgba(217,26,34,.34);      /* accent-tinted edge */

  /* ---- ink ---------------------------------------------------------- */
  /* Contrast against --bg, measured: text 17.9:1, muted 7.9:1, dim 4.9:1.
     --dim carries the small uppercase labels (table headers, tile labels,
     placeholders), so it has to clear 4.5:1 — the obvious #6e6e7a lands at
     3.98 and quietly fails every one of them. */
  --text:          #f2f2f5;
  --muted:         #a2a2ae;
  --dim:           #7d7d8a;

  /* ---- brand -------------------------------------------------------- */
  --accent:        #d91a22;
  --accent-hi:     #ff3b45;
  --accent-deep:   #8f0f16;
  --accent-soft:   rgba(217,26,34,.13);
  --accent-glow:   rgba(217,26,34,.42);
  /* The fill gradient stops short of --accent-hi on purpose: white on #ff3b45
     is 3.5:1, so a button label sitting on the light end would fail AA. This
     ramp keeps white at 4.8:1 or better across the whole sweep, and the vivid
     stop still appears in the glow and the hover sheen. */
  --accent-grad:   linear-gradient(135deg, #e01f28, #d91a22 45%, #a5121a);

  /* ---- data / status ------------------------------------------------ */
  /* Carried over from the Order IQ palette so that workspace stops being a
     separate design system and starts being this one. */
  --ok:            #2fe1a7;
  --warn:          #f5a524;
  --info:          #32c8ff;
  --violet:        #9f8cff;
  --ok-soft:       rgba(47,225,167,.12);
  --warn-soft:     rgba(245,165,36,.12);
  --info-soft:     rgba(50,200,255,.12);
  --violet-soft:   rgba(159,140,255,.12);

  /* ---- depth -------------------------------------------------------- */
  /* Shadows are red-tinted, never neutral. That single choice is most of why
     the surface reads as lit by the brand rather than as a grey card. */
  --shadow:        0 30px 70px -34px rgba(217,26,34,.40), 0 2px 10px -4px rgba(0,0,0,.65);
  --shadow-sm:     0 14px 34px -20px rgba(217,26,34,.34), 0 1px 4px -2px rgba(0,0,0,.55);
  --shadow-lg:     0 48px 110px -40px rgba(217,26,34,.46), 0 4px 18px -6px rgba(0,0,0,.70);
  --ring:          0 0 0 3px rgba(217,26,34,.28);

  /* ---- geometry ----------------------------------------------------- */
  --r:             14px;   /* cards, panels */
  --r-sm:          9px;    /* inputs, buttons, chips */
  --r-xs:          6px;    /* pills, tiny badges */
  --r-pill:        999px;
  --maxw:          1320px;
  --maxw-narrow:   980px;
  --gutter:        clamp(16px, 3vw, 32px);
  --sidebar-w:     244px;
  --sidebar-w-min: 68px;
  --topbar-h:      60px;

  /* ---- motion ------------------------------------------------------- */
  --t-fast:        120ms cubic-bezier(.4,0,.2,1);
  --t:             200ms cubic-bezier(.4,0,.2,1);
  --t-slow:        420ms cubic-bezier(.22,1,.36,1);
  --t-spring:      520ms cubic-bezier(.2,1.5,.4,1);

  /* ---- type --------------------------------------------------------- */
  /* Space Grotesk carries the display voice: headings, prices, stat values,
     the wordmark's neighbours. The fallbacks matter — font-display:swap means
     they are what renders for the first paint — so they are metric-adjacent
     grotesques rather than a bare `sans-serif`.
     Body text stays on the system UI stack: Space Grotesk is a display face
     and gets tiring at 13px across a dense table. */
  --font-display: "Space Grotesk", "Segoe UI Variable Display", "SF Pro Display",
                  Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ui:      "Segoe UI Variable Text", "SF Pro Text", Inter,
                  system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "Cascadia Mono", "JetBrains Mono",
                  Consolas, "Liberation Mono", monospace;

  /* A real scale, not 46 hand-tuned rem values. */
  --fs-3xl: clamp(2.4rem, 5.2vw, 3.9rem);
  --fs-2xl: clamp(1.85rem, 3.4vw, 2.6rem);
  --fs-xl:  clamp(1.35rem, 2.1vw, 1.72rem);
  --fs-lg:  1.15rem;
  --fs-md:  1rem;
  --fs:     .875rem;
  --fs-sm:  .8125rem;
  --fs-xs:  .75rem;
  --fs-2xs: .6875rem;
}

/* ------------------------------------------------------------------ reset */

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

html { -webkit-text-size-adjust: 100%; }

body.v2 {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs)/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Ambient mesh: five radial stops at low alpha, fixed to the viewport so it
   behaves like light in the room rather than a background that scrolls away. */
body.v2::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58vw 42vw at 12% -8%,  rgba(217,26,34,.16),   transparent 62%),
    radial-gradient(46vw 38vw at 92% 4%,   rgba(255,59,69,.10),   transparent 60%),
    radial-gradient(52vw 44vw at 78% 88%,  rgba(159,140,255,.055),transparent 64%),
    radial-gradient(40vw 36vw at 8% 96%,   rgba(50,200,255,.045), transparent 62%),
    radial-gradient(90vw 70vw at 50% 42%,  rgba(217,26,34,.035),  transparent 70%);
}

/* Film grain: one inline SVG, no image request, kills the gradient banding
   that large dark washes produce on 8-bit panels. */
body.v2::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.34'/></svg>");
}

/* The ambient layers sit at negative z-index rather than lifting every content
   element to z-index 1. The obvious `body.v2 > * { position: relative }` looks
   equivalent and is not: at (0,1,1) it outranks both `.v2-orbs` and
   `.skip-link` at (0,1,0), stripping their positioning, dropping them into
   flow, and shoving the whole app 22px down the page.
   body's own background still paints behind all of this, because with no
   background on <html> it is propagated to the canvas. */

/* Three orbs, blurred hard, drifting slowly. They are what stops a dark page
   from reading as a dead rectangle when nothing else is animating. */
.v2-orbs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.v2-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(78px);
  opacity: .5;
  will-change: transform;
  animation: orbDrift 22s ease-in-out infinite;
}
.v2-orb.a { width: 460px; height: 460px; top: -14%; left: -6%;
            background: radial-gradient(circle, rgba(217,26,34,.55), transparent 68%); }
.v2-orb.b { width: 380px; height: 380px; top: 34%; right: -8%; animation-delay: -7s;
            background: radial-gradient(circle, rgba(255,59,69,.34), transparent 68%); }
.v2-orb.c { width: 520px; height: 520px; bottom: -18%; left: 32%; animation-delay: -14s;
            background: radial-gradient(circle, rgba(159,140,255,.22), transparent 70%); }

@keyframes orbDrift {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  33%      { transform: translate3d(38px,-30px,0) scale(1.09); }
  66%      { transform: translate3d(-26px,26px,0) scale(.94); }
}

/* ------------------------------------------------------------- typography */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.022em;
  line-height: 1.14;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); letter-spacing: -.030em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); letter-spacing: -.015em; }
h4 { font-size: var(--fs-md); letter-spacing: -.010em; }
p  { margin: 0; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-hi); }

.mono, code, kbd, pre, .tabular {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}
.tnum { font-variant-numeric: tabular-nums; }

.display { font-family: var(--font-display); }
.hero-type {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 800;
  letter-spacing: -.038em;
  line-height: 1.02;
}

.muted { color: var(--muted); }
.dim   { color: var(--dim); }
.lead  { color: var(--muted); font-size: var(--fs-md); line-height: 1.62; text-wrap: pretty; }

/* --accent on --bg is 4.1:1 — fine for large text, short of AA for the small
   accent labels that appear everywhere, so emphasis text uses the light stop. */
.accent { color: var(--accent-hi); }

/* background-clip:text needs the explicit -webkit-text-fill-color or Safari
   paints the solid colour straight over the gradient. */
.grad {
  background: linear-gradient(96deg, #ff5d66, #d91a22 46%, #ff3b45);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Hand-underline, drawn rather than typed, scaling with the word. */
.ul { position: relative; white-space: nowrap; }
.ul::after {
  content: "";
  position: absolute;
  left: -.04em; right: -.04em; bottom: -.06em;
  height: .10em;
  border-radius: var(--r-pill);
  background: var(--accent-grad);
  transform: scaleX(var(--ul-scale, 1));
  transform-origin: left;
}

/* ------------------------------------------------------------------ focus */

:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.skip-link {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: var(--r-sm); z-index: 999;
}
.skip-link:focus { left: 12px; top: 12px; }

::selection { background: rgba(217,26,34,.35); color: #fff; }

/* --------------------------------------------------------- scroll reveal */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--t-slow), transform var(--t-slow);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* -------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  /* Anything whose only job is to move is removed, not merely frozen. */
  .v2-orbs, body.v2::after { display: none; }
}

/* ------------------------------------------------------------- utilities */

.stack      { display: flex; flex-direction: column; }
.row        { display: flex; align-items: center; }
.row-between{ display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap       { flex-wrap: wrap; }
.g-4  { gap: 4px; }  .g-6  { gap: 6px; }  .g-8  { gap: 8px; }
.g-10 { gap: 10px; } .g-12 { gap: 12px; } .g-16 { gap: 16px; }
.g-20 { gap: 20px; } .g-24 { gap: 24px; } .g-32 { gap: 32px; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
