/* ============================================================
   lithos — UI surface styles

   Adapted from the Brainwave design system used on ianlarson.design.
   Full original kept unpublished at ../reference/brainwave/ .

   SCOPE, ON PURPOSE:
   This styles the UI *around* the worlds. The world chrome (wordmark,
   number, prev/next) deliberately does NOT use any of it. That chrome
   uses mix-blend-mode: difference so it stays legible over any world
   without per-world tuning, and tokenised colors would break that.

   So: buttons, panels, inputs, and typography here. Nothing that
   floats over a canvas.

   TRIMMED: dropped the enterprise palette (category accents, billing
   mauve, status colors, the light theme, the full type scale). Lithos
   is one dark surface and a handful of controls. Token names match the
   original so the two systems stay recognisably related.
   ============================================================ */

/* Inter, self-hosted. One 48KB variable file covers the whole 400-600 range
   for the latin subset, so there is no third-party round trip on first paint.
   That matters: lithos's prev/next ritual dies if worlds are slow to appear.
   Inter is SIL Open Font License 1.1, so self-hosting is explicitly allowed.
   font-display:swap paints immediately in the fallback and reflows once,
   rather than holding text invisible while the font loads. */
@font-face{
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;          /* variable range */
  font-display: swap;
  src: url("fonts/inter-latin-var.woff2") format("woff2-variations");
  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{
  /* --- Type ---------------------------------------------------- */
  --font-display: "Inter", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --base1-size: 1rem;      --base1-line: 1.5rem;   --base1-spacing: -0.03em;
  --base2-size: 0.875rem;  --base2-line: 1.5rem;   --base2-spacing: -0.02em;
  --caption1-size: 0.75rem;--caption1-line: 1.25rem;--caption1-spacing: -0.03em;

  /* --- Neutrals (Brainwave n-1 .. n-7) -------------------------- */
  --n-1: #FEFEFE;
  --n-4: #6C7275;
  --n-5: #343839;
  --n-6: #232627;
  --n-7: #141718;

  --primary-1: #0084FF;

  /* lithos runs darker than Brainwave's shell. The worlds are near
     black, so panels sit just above them rather than on n-6/n-7. */
  --bg-world: #08090a;
  --surface-panel: rgba(20, 23, 24, 0.92);
  --surface-hover: rgba(254, 254, 254, 0.10);

  --border-subtle: var(--n-5);
  --border-strong: var(--n-4);

  --text-primary: var(--n-1);
  --text-secondary: var(--n-4);

  /* --- Controls ------------------------------------------------- */
  --control-h: 3rem;
  --control-h-medium: 2.5rem;
  --control-h-small: 2.25rem;

  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-5-5: 1.375rem;

  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  --border-control: 0.125rem;

  --shadow-button: 0 0.125rem 0.25rem rgba(0,0,0,0.15);
  --shadow-float: 0 0 1rem 0.25rem rgba(0,0,0,0.04),
                  0 2rem 1.5rem -1rem rgba(0,0,0,0.12);
  --ring-inset-dark: inset 0 0 0 0.0625rem #343839;

  --dur: 160ms;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-colors: color var(--dur) var(--ease-default),
                       background-color var(--dur) var(--ease-default),
                       border-color var(--dur) var(--ease-default);
}

/* ============================================================
   Buttons — Brainwave .bw-btn, carried over as-is
   ============================================================ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
  height:var(--control-h); padding:0 var(--space-5-5);
  border:var(--border-control) solid transparent; border-radius:var(--radius-lg);
  font-family:var(--font-display); font-size:var(--base2-size);
  line-height:var(--base2-line); font-weight:var(--fw-semibold);
  letter-spacing:var(--base2-spacing);
  cursor:pointer; white-space:nowrap; transition:var(--transition-colors);
  -webkit-tap-highlight-color:transparent; user-select:none;
}
.btn:disabled{ opacity:.2; pointer-events:none; }
.btn:active{ transform:translateY(.5px); }
.btn svg{ flex-shrink:0; }

.btn--medium{ height:var(--control-h-medium); }
.btn--small{
  height:var(--control-h-small); padding:0 var(--space-4);
  border-width:1px; border-radius:var(--radius-md);
}

.btn--primary{ background:var(--primary-1); border-color:var(--primary-1); color:var(--n-1); }
.btn--primary:hover{ background:rgba(0,132,255,.9); border-color:transparent; }

.btn--secondary{ background:var(--n-7); border-color:rgba(254,254,254,.1); color:var(--n-1); }
.btn--secondary:hover{ background:rgba(254,254,254,.1); }

.btn--stroke{ background:transparent; border-color:var(--border-subtle); color:var(--text-primary); }
.btn--stroke:hover{ background:var(--surface-hover); border-color:var(--border-strong); }

.btn--contrast{ background:var(--n-1); border-color:var(--n-1); color:var(--n-7); }
.btn--contrast:hover{ color:var(--primary-1); }

.btn:focus-visible{ outline:2px solid var(--primary-1); outline-offset:2px; }

/* ============================================================
   Panels — the Brainwave float: soft shadow + inset hairline
   ============================================================ */
.panel{
  background:var(--surface-panel);
  border-radius:var(--radius-2xl);
  box-shadow:var(--shadow-float), var(--ring-inset-dark);
  backdrop-filter:blur(12px);
  color:var(--text-primary);
  font-family:var(--font-display);
}

/* ============================================================
   Text
   ============================================================ */
.t-base1{ font-family:var(--font-display); font-size:var(--base1-size); line-height:var(--base1-line); letter-spacing:var(--base1-spacing); font-weight:var(--fw-medium); }
.t-base2{ font-family:var(--font-display); font-size:var(--base2-size); line-height:var(--base2-line); letter-spacing:var(--base2-spacing); font-weight:var(--fw-medium); }
.t-caption{ font-family:var(--font-display); font-size:var(--caption1-size); line-height:var(--caption1-line); letter-spacing:var(--caption1-spacing); font-weight:var(--fw-medium); }
.t-muted{ color:var(--text-secondary); }
.t-num{ font-variant-numeric:tabular-nums; }
