/* ============================================================
   TRACELINE — base layer: reset, type, layout, atmosphere
   ============================================================ */
@import url('fonts.css');
@import url('tokens.css');

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font-family: var(--ff-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* atmosphere: gradient mesh + restrained grain ------------------ */
.mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(880px 620px at 78% -8%, rgba(110, 75, 255, 0.30), transparent 62%),
    radial-gradient(720px 520px at 96% 16%, rgba(45, 226, 230, 0.16), transparent 60%),
    radial-gradient(680px 480px at 4% 8%, rgba(198, 242, 78, 0.10), transparent 58%),
    radial-gradient(900px 700px at 50% 108%, rgba(255, 46, 107, 0.10), transparent 62%);
}
.mesh::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.42;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
}
[data-theme="light"] .mesh {
  background:
    radial-gradient(880px 620px at 80% -10%, rgba(110, 75, 255, 0.16), transparent 62%),
    radial-gradient(700px 520px at 98% 12%, rgba(45, 226, 230, 0.16), transparent 60%),
    radial-gradient(640px 460px at 2% 6%, rgba(198, 242, 78, 0.20), transparent 58%);
}
[data-theme="light"] .mesh::after { opacity: 0.2; }

.page { position: relative; z-index: 1; }

/* ---- typography ---- */
h1, h2, h3, h4, h5 { font-family: var(--ff-display); margin: 0; font-weight: 700; color: var(--text); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.display-1 { font-family: var(--ff-display); font-weight: 800; font-size: var(--fs-d1); line-height: var(--lh-d1); letter-spacing: var(--tr-d1); }
.display-2 { font-family: var(--ff-display); font-weight: 800; font-size: var(--fs-d2); line-height: var(--lh-d2); letter-spacing: var(--tr-d2); }
.h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--tr-h1); font-weight: 700; }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--tr-h2); font-weight: 700; }
.h3 { font-family: var(--ff-display); font-size: var(--fs-h3); line-height: var(--lh-h3); letter-spacing: var(--tr-h3); font-weight: 600; }
.h4 { font-family: var(--ff-display); font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: 600; }
.lead { font-size: var(--fs-lead); line-height: var(--lh-lead); color: var(--text-2); }
.body-lg { font-size: 17px; line-height: 1.62; color: var(--text-2); }
.small { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); }
.xs { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.label {
  font-size: var(--fs-label); line-height: 1.2; letter-spacing: var(--tr-label);
  text-transform: uppercase; font-weight: 600; color: var(--text-2);
}
.mono { font-family: var(--ff-mono); font-size: var(--fs-mono); letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "lnum" 1; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---- layout ---- */
.container { width: 100%; max-width: var(--w-max); margin-inline: auto; padding-inline: var(--gutter); }
.section { position: relative; padding-block: var(--sp-13); }
.section--tight { padding-block: var(--sp-11); }
.section-head { max-width: 780px; }
.section-head .eyebrow { margin-bottom: var(--sp-4); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-label); letter-spacing: var(--tr-label); text-transform: uppercase;
  font-weight: 700; color: var(--text-3);
}
.eyebrow::before {
  content: ""; width: 18px; height: 1px; background: var(--grad); border-radius: 2px;
}
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-3 { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-4 { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-6 { display: flex; flex-direction: column; gap: var(--sp-6); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-2 { display: flex; align-items: center; gap: var(--sp-2); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.grid { display: grid; gap: var(--sp-6); }

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.hair { height: 1px; background: linear-gradient(90deg, transparent, var(--border-luminous), transparent); }

/* skip link */
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 400;
  background: var(--text); color: var(--text-inverse); padding: 10px 16px; border-radius: var(--r-2);
  font-weight: 600; font-size: var(--fs-sm);
}
.skip:focus { left: 16px; }

/* ---- focus ---- */
:where(a, button, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-2);
}
::selection { background: rgba(198, 242, 78, 0.3); color: var(--text); }

/* ---- scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--base-deep); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid var(--base-deep); }

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

/* ---- responsive frame rules: 1440 / 768 / 390 ---- */
@media (max-width: 1340px) {
  .hero { padding-top: 24px; }
}
@media (max-width: 1280px) {
  :root { --w-max: 1120px; --gutter: 28px; --fs-d1: 54px; }
  :root { --fs-d1: 56px; --fs-d2: 42px; }
}
@media (max-width: 900px) {
  :root {
    --w-max: 100%; --gutter: 32px; --header-h: 64px;
    --fs-d1: 46px; --fs-d2: 36px; --fs-h1: 32px; --fs-h2: 26px;
    --fs-lead: 17px; --fs-score: 112px;
  }
  .section { padding-block: var(--sp-11); }
  .section--tight { padding-block: var(--sp-9); }
}
@media (max-width: 560px) {
  :root {
    --gutter: 20px; --header-h: 60px;
    --fs-d1: 34px; --fs-d2: 29px; --fs-h1: 27px; --fs-h2: 23px;
    --fs-h3: 18px; --fs-lead: 16px; --fs-body: 15px; --fs-score: 84px;
  }
  .section { padding-block: var(--sp-9); }
}
