/* ==========================================================================
   PRIME Academy — design tokens, reset and shared components
   Brand V2: flush-left ruled grid, zero radius, hard offset shadows.
   Navy carries structure, purple is reserved for CTAs, marks, links and
   emphasis figures. Mauve is the supporting neutral — never an accent.
   ========================================================================== */

:root {
  /* --- Brand constants ------------------------------------------------- */
  --navy:        #273473;
  --purple:      #6965C8;
  --mauve:       #A7999F;
  --white:       #fff;     /* text on accent/band fills only, never a surface */

  /* --- Dark theme ------------------------------------------------------
     Portfolite's background treatment (near-black base, a subtly raised
     panel one step up, hairline rules, grain) rendered in PRIME's palette:
     the base carries navy's hue at very low lightness instead of neutral
     black, so the brand still reads. Zero radius and no gradients — those
     parts of the reference are overridden by the V2 guide. */
  --bg:          #07080F;  /* page base — near-black, navy cast */
  --surface:     #0E1020;  /* cards, header, ruled cells */
  --surface-2:   #151831;  /* hover, notes, raised panels */
  --band:        #273473;  /* navy bands — now a raised brand block */

  /* Ink */
  --ink:         #EDEEF5;  /* headings and primary text */
  --ink-dim:     rgba(237, 238, 245, .68);  /* body copy */
  --ink-faint:   rgba(237, 238, 245, .14);  /* the un-revealed state of a wipe-in heading */

  /* Accent — #6965C8 is the fill colour, but too dark for small text on
     near-black, so links and marks use a lifted tint. */
  --accent:      #6965C8;
  --accent-text: #9C98EC;

  /* Washes */
  --lilac:       rgba(105, 101, 200, .20);  /* badge / highlight wash */
  --stripe:      #1C2140;  /* image placeholder + inactive bars */
  --tint:        var(--surface-2);
  --shell:       var(--surface);

  /* Rules — cool light tint, mirroring the reference's rgba(99,99,99,.3) */
  --rule:        rgba(164, 172, 214, .18);
  --rule-soft:   rgba(164, 172, 214, .11);
  --rule-strong: rgba(164, 172, 214, .32);
  --rule-hard:   rgba(237, 238, 245, .55);  /* the 2px section underline */

  --shadow-hard: 10px 10px 0 rgba(105, 101, 200, .22);

  /* Grain — a tiled SVG turbulence field, so there is no binary asset and
     nothing to fetch. Matches the reference's 40px tile at 10% opacity. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='40' height='40' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-opacity: .085;

  --slot-label: #8792B8;   /* mono caption inside image placeholders */

  /* Warp field colours, read by warp-bg.js. Declared here rather than in the
     script so the animated background follows the theme with everything else. */
  --warp-1: #07080F;
  --warp-2: #6965C8;
  --warp-3: #273473;

  /* Type */
  --sans: Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Rhythm */
  --gut:  48px;  /* horizontal page gutter, desktop */
  --page: 1280px;
}


/* ==========================================================================
   Light theme
   ==========================================================================
   Only the semantic tokens are re-declared — nothing else in the stylesheets
   needs to know a theme exists. The one category that deliberately does NOT
   flip is the navy and accent bands (footer, announcement bar, mock-test
   panel, hero stat card, intro cover): those stay dark in both themes, which
   is why the ~15 hardcoded rgba(255,255,255,…) values sitting on them remain
   correct here rather than needing light variants.

   `[data-theme="dark"]` is spelled out as well as :root so an explicit choice
   of dark still wins over a light system preference. */

:root[data-theme="light"] {
  --bg:          #FFFFFF;
  --surface:     #FFFFFF;
  --surface-2:   #F4F5F9;
  --shell:       #F1ECEE;  /* warm band behind the closing CTA */

  --ink:         #14161F;
  --ink-dim:     rgba(20, 22, 31, .74);
  --ink-faint:   rgba(20, 22, 31, .12);  /* the un-revealed state of a wipe-in heading */

  /* #6965C8 on white is only ~4.0:1 — under AA for body-size text. Links and
     small accent text get a darker step; fills keep the brand purple. */
  --accent:      #6965C8;
  --accent-text: #514DB5;

  /* The dark theme's flat #A7999F reads fine as a mid-tone against near-
     black (~7.3:1) but drops to ~2.7:1 on white — both are "light-ish"
     colours, so the pairing has almost no contrast. Same hue, darkened,
     restores it to ~5.2:1. --mauve is a pure text/label token everywhere
     except two decorative fills (a muted badge, a select-arrow icon), so
     overriding it here is safe. */
  --mauve:       #746B6F;

  --lilac:       #EDECFA;
  --stripe:      #E7E9F2;
  --tint:        var(--surface-2);

  --rule:        rgba(39, 52, 115, .16);
  --rule-soft:   rgba(39, 52, 115, .10);
  --rule-strong: rgba(39, 52, 115, .24);
  --rule-hard:   var(--navy);   /* the 2px section underline, as originally drawn */

  --shadow-hard: 10px 10px 0 rgba(105, 101, 200, .16);

  /* Dark noise over white reads as dirt rather than texture, so it is much
     lighter here than the same grain over near-black. */
  --grain-opacity: .03;

  --slot-label:  #5A6180;

  --warp-1: #FFFFFF;
  --warp-2: #CFCCF5;
  --warp-3: #E7E9F6;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

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

::selection { background: var(--accent); color: var(--white); }

/* Focus — the design has no focus states, so we add one that stays on-brand.
   Visible for keyboard users only. */
:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

/* Grain — the reference's 40px tile at 10%, laid over the whole page.
   Fixed and pointer-events:none so it never affects layout or hit testing.
   Sits under the transition curtain in the stacking order. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 40px 40px;
  background-repeat: repeat;
  opacity: var(--grain-opacity);
}

@media (prefers-reduced-motion: reduce) {
  body::after { opacity: calc(var(--grain-opacity) * .6); }
}

.skip-link {
  position: absolute;
  left: 0;
  top: -100%;
  z-index: 100;
  background: var(--navy);
  color: var(--white);
  padding: 14px 20px;
  font: 700 12px/1 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.skip-link:focus {
  top: 0;
  color: var(--white);
}

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


/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
  max-width: var(--page);
  margin-inline: auto;
}

.section-pad { padding-inline: var(--gut); }

/* Ruled section heading: 01 — Title ————————— link */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--rule-hard);
}

.section-num {
  font: 600 11px/1 var(--sans);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent-text);
  flex: none;
}

.section-head h2 {
  font: 800 32px/1 var(--sans);
  letter-spacing: -.02em;
  color: var(--ink);
}

.section-head .spacer { flex: 1; }

.eyebrow {
  font: 600 11px/1 var(--sans);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--mauve);
}

.mono {
  font: 500 12px/1.5 var(--mono);
  color: var(--mauve);
}


/* --------------------------------------------------------------------------
   Logo mark — three ascending bars, the tallest in purple
   -------------------------------------------------------------------------- */

.mark {
  width: 27px;
  height: 29px;
  flex: none;
  color: var(--ink);          /* the two short bars */
}
.mark .mark__peak { fill: var(--accent-text); }
.mark .mark__bar  { fill: currentColor; }

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.logo:hover { color: var(--ink); }

.logo__name {
  display: block;
  font: 800 19px/1 var(--sans);
  letter-spacing: -.02em;
  color: inherit;
}
.logo__sub {
  display: block;
  font: 600 8.5px/1 var(--sans);
  letter-spacing: .34em;
  color: inherit;
  margin-top: 4px;
}

.logo__name--footer { margin-top: 16px; }
.logo__sub--footer  { color: rgba(255, 255, 255, .7); }


/* --------------------------------------------------------------------------
   Buttons — square, uppercase, letter-spaced
   -------------------------------------------------------------------------- */

.btn {
  display: inline-block;
  border: 1px solid transparent;
  font: 700 13px/1 var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 18px 26px;
  cursor: pointer;
  text-align: center;
  transition: background-color .12s linear, color .12s linear, border-color .12s linear;
}

.btn--primary {
  background: var(--accent);
  color: var(--white);
}
.btn--primary:hover { background: var(--accent-text); color: #14161F; }

.btn--navy {
  background: var(--navy);
  color: var(--white);
}
.btn--navy:hover { background: var(--accent); color: var(--white); }

.btn--outline {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--ink);
}
.btn--outline:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* On navy panels the primary button inverts to white on hover */
.on-navy .btn--primary:hover { background: var(--white); color: var(--navy); }

.btn--sm {
  font-size: 12px;
  padding: 14px 20px;
}

/* Ruled-heading link — "All 9 courses →" */
.link-caps {
  font: 600 12px/1 var(--sans);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* Affordance inside a card that is itself the link — "View course →" */
.card-link {
  font: 600 12px/1 var(--sans);
  color: var(--accent-text);
}


/* --------------------------------------------------------------------------
   Image placeholders — striped slots mark where real photography goes.
   Swap the whole element for an <img> at content stage.
   -------------------------------------------------------------------------- */

.img-slot {
  background: repeating-linear-gradient(
    45deg,
    var(--tint), var(--tint) 9px,
    var(--stripe) 9px, var(--stripe) 18px
  );
  display: flex;
  align-items: flex-end;
  padding: 14px;
}

.img-slot__label {
  font: 500 10px/1 var(--mono);
  color: var(--slot-label);
  background: var(--surface);
  padding: 6px 8px;
}


/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 34px;
  height: 74px;
  padding-inline: 40px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  height: 100%;
  padding-right: 26px;
  border-right: 1px solid var(--rule);
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav a {
  display: inline-block;
  font: 600 13px/1 var(--sans);
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--accent-text); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent-text); }

.site-header__spacer { flex: 1; }

/* Wrapping these two in a div for the mobile menu took them out of
   .site-header__inner's flex row, so they lost its gap and sat flush against
   each other. They need their own. */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

/* Theme toggle — square like everything else, sized to sit level with the
   login link rather than shouting. Shows a sun in dark mode (what you get if
   you press it) and a moon in light. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s linear, color .12s linear;
}
.theme-toggle:hover {
  border-color: var(--accent-text);
  color: var(--accent-text);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Only one icon is ever rendered — the other is removed from the box entirely
   so the button never reserves space for both. */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.site-header__login {
  font: 600 13px/1 var(--sans);
  color: var(--ink);
  white-space: nowrap;
}

/* Hamburger — hidden until the nav collapses */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: 0;
  padding: 8px 0;
  margin-left: auto;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
}
.nav-toggle span:last-child { width: 15px; background: var(--accent); }


/* --------------------------------------------------------------------------
   Site footer
   -------------------------------------------------------------------------- */

.site-footer {
  background: var(--navy);
  color: var(--white);
}

.site-footer__inner {
  padding: 44px var(--gut);
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
}

.site-footer .mark { color: var(--white); }

.site-footer__blurb {
  font: 400 13px/1.6 var(--sans);
  color: rgba(255, 255, 255, .6);
  margin-top: 20px;
  max-width: 30ch;
}

.footer-col { display: flex; flex-direction: column; gap: 11px; }

.footer-col h3 {
  font: 600 10px/1 var(--sans);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mauve);
  margin-bottom: 5px;
}

.footer-col a,
.footer-col p {
  font: 400 13px/1.5 var(--sans);
  color: rgba(255, 255, 255, .82);
}
.footer-col a:hover { color: var(--white); }

.site-footer__legal {
  padding: 20px var(--gut) 34px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font: 500 11px/1.6 var(--mono);
  color: rgba(255, 255, 255, .55);
}
.site-footer__legal a { color: rgba(255, 255, 255, .55); }
.site-footer__legal a:hover { color: var(--white); }


/* --------------------------------------------------------------------------
   Responsive — the design collapses to a single ruled column.
   Reference: the 402 × 874 mobile frame in the source mockup.
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  :root { --gut: 32px; }

  /* The logo and toggle each hold a fixed 66px row height, so opening the
     menu grows the header downwards without moving the toggle. */
  .site-header__inner {
    padding-inline: 20px;
    height: auto;
    gap: 0 16px;
    flex-wrap: wrap;
    align-items: center;
  }

  .site-header__brand {
    border-right: 0;
    padding-right: 0;
    height: 66px;
  }

  /* The spacer would sit on row one while the menu is closed and leave it
     once the nav wraps, jerking the toggle across the header. Drop it and let
     margin-left:auto own the free space in both states. */
  .site-header__spacer { display: none; }

  .nav-toggle {
    display: flex;
    justify-content: center;
    height: 66px;
  }

  .site-nav,
  .site-header__actions {
    display: none;
    flex-basis: 100%;
  }

  .site-header[data-nav-open="true"] .site-nav,
  .site-header[data-nav-open="true"] .site-header__actions {
    display: block;
  }

  .site-header[data-nav-open="true"] .site-header__inner {
    padding-bottom: 20px;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .site-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--rule-soft);
    border-top: 0;
    font-size: 15px;
  }
  .site-nav a:hover { border-bottom-color: var(--rule-soft); color: var(--accent-text); }

  .site-header__actions {
    display: none;
    padding-top: 16px;
  }
  .site-header[data-nav-open="true"] .site-header__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .site-header__login { padding: 4px 0; }
  .site-header__actions .btn { display: block; }

  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
  }
}

@media (max-width: 599px) {
  :root { --gut: 20px; }

  .section-head { gap: 12px; flex-wrap: wrap; }
  .section-head h2 { font-size: 22px; }

  .site-footer__inner { grid-template-columns: 1fr; gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
