/* ==========================================================================
   global.css - design system
   Tokens taken from design-reference/DESIGN.md (Stitch "Cyber Rank Protocol").

   Three rules that must not be broken when editing:
   1. Teal (--teal) is an accent only: eyebrow labels, active state, links,
      one leading rule. Filling a block with it kills its signal value.
   2. Mono labels are set in uppercase with wide tracking - but only for
      short taxonomy labels, never for a sentence.
   3. The strengths/limitations pair is the signature of this design. They get
      identical width and identical type treatment; only the leading rule
      colour differs. Making limitations smaller turns an editorial ranking
      back into a vendor page.
   ========================================================================== */

/* -- 1. Tokens ---------------------------------------------------------- */

:root {
  /* Canvas and container tiers (level 0 -> 5) */
  --bg: #051424;
  --s0: #010f1f;
  --s1: #0d1c2d;
  --s2: #122131;
  --s3: #1c2b3c;
  --s4: #273647;

  /* Text */
  --text: #d4e4fa;
  --text-dim: #c3c5d9;
  --text-muted: #8d90a2;
  --heading: #ffffff;

  /* Lines */
  --outline: #434656;
  --outline-faint: rgba(255, 255, 255, 0.07);
  --rule: #1c2b3c;

  /* Accents. Sparingly. */
  --primary: #b6c4ff;
  --action: #0055ff;
  --action-hi: #2a6cff;
  --teal: #00e3fd;
  --teal-dim: #00b8cf;
  --teal-wash: rgba(0, 227, 253, 0.08);
  --teal-line: rgba(0, 227, 253, 0.32);

  /* Status */
  --warn: #ffb4ab;
  --warn-wash: rgba(255, 180, 171, 0.07);
  --warn-line: rgba(255, 180, 171, 0.3);

  /* Type */
  --font-sans: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  /* Shape */
  --r: 4px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* Rhythm: 8px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --pad-page: 20px;
  --section: 80px;
  --max-width: 1280px;
  --measure: 68ch;
  --header-h: 64px;

  /* Motion */
  --speed: 140ms;
  --ease: cubic-bezier(0.2, 0.6, 0.3, 1);
}

/* -- 2. Reset ----------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0; padding: 0; }
figure, blockquote { margin: 0; }

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

/* -- 3. Typography ------------------------------------------------------ */

h1, h2, h3 {
  color: var(--heading);
  font-weight: 800;
  letter-spacing: -0.022em;
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.15rem, 1.35rem + 3.4vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 1.06rem + 0.6vw, 1.5rem); font-weight: 700; letter-spacing: -0.015em; }

p { margin: 0; }

a { color: var(--teal); text-decoration: none; }
a:hover { color: #6df1ff; text-decoration: underline; text-underline-offset: 3px; }

strong, b { color: var(--heading); font-weight: 600; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: var(--r);
}

/* The lede does a specific job: it is the one-paragraph answer under a
   heading, so it is set larger and lighter than body copy. */
.lede {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.22rem);
  line-height: 1.6;
  color: var(--text-dim);
  max-width: var(--measure);
}

.note {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: var(--measure);
}

/* Mono taxonomy label. Short labels only - never a sentence. */
.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--teal);
  display: block;
}

.label--muted { color: var(--text-muted); }

.tabular { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* -- 4. Layout ---------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--pad-page);
}

.section { padding-block: var(--section); }
.section + .section { padding-top: 0; }
.section--tight { padding-block: calc(var(--section) * 0.6); }

.section__head { margin-bottom: var(--s-6); }
.section__head .label { margin-bottom: var(--s-3); }
.section__head h2 { max-width: 22ch; }
.section__head .lede { margin-top: var(--s-4); }
.section__head .note { margin-top: var(--s-4); }

/* A hairline that carries the accent without flooding the page with it. */
.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  background: var(--teal);
  color: #00232b;
  font-weight: 700;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r);
  transition: top var(--speed) var(--ease);
}
.skip-link:focus { top: var(--s-3); text-decoration: none; }

/* -- 5. Header ---------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(1, 15, 31, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--outline-faint);
}

.site-header .container {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--heading);
  margin-right: auto;
  padding-block: var(--s-3);
}
.site-logo:hover { text-decoration: none; }
.site-logo__mark { flex: none; }
.site-logo__text { display: flex; flex-direction: column; line-height: 1.15; }
.site-logo__name {
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.site-logo__tagline {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* CSS-only mobile menu. The checkbox stays in the layer but off-screen so it
   remains keyboard focusable; display:none would remove it from tab order. */
.nav-check {
  position: absolute;
  opacity: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  right: var(--pad-page);
  top: 10px;
  z-index: 2;
  cursor: pointer;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--outline);
  border-radius: var(--r);
  cursor: pointer;
  color: var(--text);
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  content: "";
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { position: absolute; top: -6px; }
.nav-toggle__bars::after { position: absolute; top: 6px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
}

.site-nav a {
  color: var(--text-dim);
  font-size: 0.93rem;
  font-weight: 500;
  padding-block: var(--s-2);
  transition: color var(--speed) var(--ease);
}
.site-nav a:hover { color: var(--heading); text-decoration: none; }

/* Active item: the body carries the page slug, the link carries its own.
   No build-time substitution, so depth never matters. */
body[data-nav="home"]        .site-nav a[data-nav="home"],
body[data-nav="methodology"] .site-nav a[data-nav="methodology"],
body[data-nav="about"]       .site-nav a[data-nav="about"],
body[data-nav="editorial"]   .site-nav a[data-nav="editorial"],
body[data-nav="submit"]      .site-nav a[data-nav="submit"] {
  color: var(--teal);
}

.nav-cta { margin-left: var(--s-2); }

@media (max-width: 900px) {
  .nav-toggle { display: grid; margin-left: auto; }
  .nav-check { display: block; }
  .site-logo { margin-right: 0; }

  .site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: var(--s-4);
  }
  .nav-check:checked ~ .site-nav { display: flex; }
  .nav-check:focus-visible + .nav-toggle {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
  }

  .site-nav a {
    padding: var(--s-3) 0;
    border-top: 1px solid var(--outline-faint);
    font-size: 1rem;
  }
  .nav-cta {
    margin: var(--s-4) 0 0;
    text-align: center;
    border-top: 0;
  }
}

/* -- 6. Buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.btn:hover { text-decoration: none; }

.btn--solid {
  background: var(--action);
  border-color: var(--action);
  color: #ffffff;
}
.btn--solid:hover { background: var(--action-hi); border-color: var(--action-hi); color: #ffffff; }

.btn--ghost {
  background: transparent;
  border-color: var(--outline);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-wash); }

/* -- 7. Callout --------------------------------------------------------- */

.callout {
  border: 1px solid var(--outline);
  border-left: 3px solid var(--outline);
  border-radius: var(--r-lg);
  background: var(--s1);
  padding: var(--s-4) var(--s-5);
  display: grid;
  gap: var(--s-2);
  max-width: var(--measure);
}
.callout__title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--heading);
}
.callout p { font-size: 0.96rem; line-height: 1.6; color: var(--text-dim); }

.callout--note { border-left-color: var(--teal); background: var(--teal-wash); }
.callout--note .callout__title { color: var(--teal); }

.callout--warn { border-left-color: var(--warn); background: var(--warn-wash); }
.callout--warn .callout__title { color: var(--warn); }

/* -- 8. Prose ----------------------------------------------------------- */
/* Used by the eight text subpages. Content there is authored verbatim, so the
   styling has to hold up for long stretches of running text. */

.prose { max-width: var(--measure); display: grid; gap: var(--s-4); }
.prose > h2 { margin-top: var(--s-6); }
.prose > h3 { margin-top: var(--s-5); }
.prose > :first-child { margin-top: 0; }
.prose p { color: var(--text-dim); }
.prose ul, .prose ol { display: grid; gap: var(--s-3); padding-left: 0; list-style: none; }

.prose ul > li,
.prose ol > li {
  position: relative;
  padding-left: var(--s-6);
  color: var(--text-dim);
}
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  background: var(--teal);
  border-radius: 1px;
}
.prose ol { counter-reset: prose-count; }
.prose ol > li { counter-increment: prose-count; }
.prose ol > li::before {
  content: counter(prose-count);
  position: absolute;
  left: 0;
  top: 0.05em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal);
}

/* -- 9. Footer ---------------------------------------------------------- */

.site-footer {
  margin-top: var(--section);
  background: var(--s0);
  border-top: 1px solid var(--outline-faint);
  padding-block: var(--s-8) var(--s-6);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s-7);
  padding-bottom: var(--s-7);
  border-bottom: 1px solid var(--rule);
}

.footer-col h2 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s-4);
}
.footer-col ul { list-style: none; display: grid; gap: var(--s-3); }
.footer-col a { color: var(--text-dim); font-size: 0.94rem; }
.footer-col a:hover { color: var(--teal); }

.footer-bottom { padding-top: var(--s-6); display: grid; gap: var(--s-4); }
.footer-bottom > p {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.footer-notes { list-style: none; display: grid; gap: var(--s-3); max-width: 92ch; }
.footer-notes li { font-size: 0.85rem; line-height: 1.6; color: var(--text-muted); }
.footer-notes a { color: var(--text-dim); text-decoration: underline; text-underline-offset: 2px; }
.footer-notes a:hover { color: var(--teal); }

@media (max-width: 700px) {
  :root { --pad-page: 16px; --section: 56px; }
  body { font-size: 16px; }
}

/* Separates a trailing note or callout from the block above it. A class rather
   than an inline style, so the spacing scale stays in one place. */
.stack-above { margin-top: var(--s-5); }
