/* ==========================================================================
   Alybeck — Design System
   Aesthetic: "STEM sticker book" — cutout cards, hard offset shadows,
   dashed graph-paper grid, per-subject colour coding.
   Bright mode : white + purple
   Dark mode   : black + multicolour
   ========================================================================== */

/* ----------------------------------------------------------- design tokens */
:root {
  /* Subject accents — shared by both themes. These vivid values are for LARGE
     fills only (badge backgrounds, big blocks) where they carry white text.
     Never use them for small text or thin borders: several are only ~2:1
     against white. Use the --c-*-ink pair below for anything text-sized. */
  --c-math:     #7c3aed;
  --c-science:  #0ea5e9;
  --c-coding:   #10b981;
  --c-robotics: #f59e0b;
  --c-drone:    #ef4444;
  --c-speaking: #ec4899;
  --c-english:  #8b5cf6;
  --c-social:   #14b8a6;
  --c-stem:     #f97316;
  --c-ai:       #6366f1;

  /* typography */
  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;

  /* rhythm */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;

  --gutter: clamp(1.15rem, 4vw, 3.5rem);
  --maxw: 1240px;

  --t-fast: 160ms cubic-bezier(.4, 0, .2, 1);
  --t-med: 320ms cubic-bezier(.34, 1.4, .64, 1);
  --t-slow: 620ms cubic-bezier(.22, 1, .36, 1);
}

/* ------------------------------------------------------------ BRIGHT MODE */
:root,
[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f7f4ff;
  --bg-sunk: #efe9ff;
  --surface: #ffffff;
  --surface-2: #faf8ff;

  --ink: #17102b;
  --ink-2: #4b4066;
  --ink-3: #6b6080;        /* AA (4.9:1+) on bg, bg-alt and bg-sunk */

  --brand: #6d28d9;
  --brand-2: #9333ea;
  --brand-soft: #ede4ff;
  --brand-ink: #ffffff;

  --line: #e3d9f7;
  --line-hard: #17102b;

  --star: #c2620a;         /* darker amber so stars clear 3:1 as graphics */
  --ok: #047857;           /* AA as body text on light surfaces */

  /* text-safe accents: AA (4.5:1) on every light surface, and white text
     stays readable on top of them */
  --c-math-ink:     #7c3aed;
  --c-science-ink:  #096e9c;
  --c-coding-ink:   #0a7652;
  --c-robotics-ink: #905d06;
  --c-drone-ink:    #bf3636;
  --c-speaking-ink: #b53775;
  --c-english-ink:  #764ed1;
  --c-social-ink:   #0c756a;
  --c-stem-ink:     #a94e0e;
  --c-ai-ink:       #5759d4;

  --shadow-hard: 5px 5px 0 var(--line-hard);
  --shadow-hard-sm: 3px 3px 0 var(--line-hard);
  --shadow-soft: 0 18px 40px -22px rgba(45, 20, 90, .38);
  --shadow-lift: 0 26px 55px -26px rgba(45, 20, 90, .45);

  --grid-line: rgba(109, 40, 217, .09);
  --glow: rgba(147, 51, 234, .16);
  --scrim: rgba(255, 255, 255, .72);
  --hero-veil: linear-gradient(100deg, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .8) 42%, rgba(255, 255, 255, .12) 74%, transparent 100%);
  color-scheme: light;
}

/* -------------------------------------------------------------- DARK MODE */
[data-theme="dark"] {
  --bg: #07070b;
  --bg-alt: #0d0d14;
  --bg-sunk: #101019;
  --surface: #12121c;
  --surface-2: #181824;

  --ink: #f6f4ff;
  --ink-2: #b9b3d4;
  --ink-3: #837da3;

  --brand: #a78bfa;
  --brand-2: #22d3ee;
  --brand-soft: #1d1730;
  --brand-ink: #07070b;

  --line: #272736;
  --line-hard: #000000;

  --star: #fbbf24;
  --ok: #34d399;

  /* text-safe accents, lightened where needed for AA on dark surfaces */
  --c-math-ink:     #9a67f1;
  --c-science-ink:  #0ea5e9;
  --c-coding-ink:   #10b981;
  --c-robotics-ink: #f59e0b;
  --c-drone-ink:    #ef4444;
  --c-speaking-ink: #ec4899;
  --c-english-ink:  #9367f6;
  --c-social-ink:   #14b8a6;
  --c-stem-ink:     #f97316;
  --c-ai-ink:       #7275f2;

  --shadow-hard: 5px 5px 0 rgba(0, 0, 0, .85);
  --shadow-hard-sm: 3px 3px 0 rgba(0, 0, 0, .85);
  --shadow-soft: 0 20px 44px -24px rgba(0, 0, 0, .9);
  --shadow-lift: 0 30px 60px -26px rgba(0, 0, 0, .95);

  --grid-line: rgba(167, 139, 250, .10);
  --glow: rgba(167, 139, 250, .2);
  --scrim: rgba(7, 7, 11, .74);
  --hero-veil: linear-gradient(100deg, rgba(7, 7, 11, .97) 0%, rgba(7, 7, 11, .84) 42%, rgba(7, 7, 11, .2) 74%, transparent 100%);
  color-scheme: dark;
}

/* dark mode multicolour brightening for chips/cards */
[data-theme="dark"] .card,
[data-theme="dark"] .prog-card { border-color: var(--line); }

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, .32vw + .93rem, 1.06rem);
  line-height: 1.68;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  transition: background var(--t-fast), color var(--t-fast);
}

/* graph-paper texture across the whole site */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 0%, #000 10%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 10%, transparent 78%);
}
body > * { position: relative; z-index: 1; }

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -.028em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.35rem, 6.4vw, 4.6rem); }
h2 { font-size: clamp(1.85rem, 4.1vw, 3.05rem); }
h3 { font-size: clamp(1.2rem, 1.7vw, 1.5rem); }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: var(--brand-ink);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--r-sm) 0; font-weight: 700;
}
.skip:focus { left: 0; }

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

/* ------------------------------------------------------------- primitives */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(3.4rem, 8vw, 6.6rem); }
.section--alt { background: var(--bg-alt); }
.section--sunk { background: var(--bg-sunk); }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }
.measure { max-width: 62ch; }
.stack > * + * { margin-top: 1rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-display); font-size: .78rem; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; color: var(--brand);
  background: var(--brand-soft);
  border: 2px solid var(--line-hard);
  border-radius: var(--r-pill);
  padding: .34rem .9rem;
  box-shadow: var(--shadow-hard-sm);
  margin-bottom: 1.1rem;
}
[data-theme="dark"] .eyebrow { border-color: var(--brand); box-shadow: none; }

.lede { font-size: clamp(1.04rem, .5vw + .95rem, 1.24rem); color: var(--ink-2); }

.sec-head { max-width: 66ch; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.sec-head.center { margin-inline: auto; }

/* squiggle underline for headings */
.squiggle { position: relative; display: inline-block; }
.squiggle::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.16em; height: .34em;
  background: var(--brand); opacity: .28; border-radius: var(--r-pill);
  transform: skewX(-12deg);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-family: var(--font-display); font-weight: 800; font-size: 1rem;
  letter-spacing: -.01em;
  padding: .82rem 1.5rem;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 2.5px solid var(--line-hard); border-radius: var(--r-pill);
  box-shadow: var(--shadow-hard);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  text-align: center;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--line-hard); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line-hard); }
[data-theme="dark"] .btn { border-color: transparent; }
[data-theme="dark"] .btn:hover { box-shadow: 7px 7px 0 rgba(0, 0, 0, .85); }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); }
[data-theme="dark"] .btn--ghost { border-color: var(--line); }
/* --brand-2 is deep purple in light mode but bright cyan in dark, so the
   readable foreground flips: white on purple, near-black on cyan */
.btn--alt { --btn-bg: var(--brand-2); --btn-fg: #ffffff; }
[data-theme="dark"] .btn--alt { --btn-fg: #07070b; }
.btn--lg { font-size: 1.08rem; padding: 1rem 1.85rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-hard-sm) !important; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 2.5px solid var(--line-hard);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-hard);
  padding: clamp(1.3rem, 2.4vw, 1.9rem);
  transition: transform var(--t-med), box-shadow var(--t-med);
}
.card:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--line-hard); }
[data-theme="dark"] .card { border-color: var(--line); box-shadow: var(--shadow-soft); }
[data-theme="dark"] .card:hover { box-shadow: var(--shadow-lift); border-color: var(--brand); }

.grid { display: grid; gap: clamp(1.1rem, 2vw, 1.7rem); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); }

/* accent chips */
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .76rem; font-weight: 800; font-family: var(--font-display);
  letter-spacing: .04em; text-transform: uppercase;
  padding: .28rem .7rem; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand);
  border: 1.5px solid currentColor;
}

/* ------------------------------------------------------------------ stars */
.stars { display: inline-flex; gap: 2px; color: var(--star); line-height: 1; }
.stars svg { width: 1em; height: 1em; fill: currentColor; }
.stars--half svg:last-child { opacity: .45; }

/* ------------------------------------------------------------ animations */
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.9) rotate(-2deg); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-13px); } }
@keyframes spinslow { to { transform: rotate(360deg); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes shimmer { 0% { background-position: -180% 0; } 100% { background-position: 180% 0; } }

.reveal { opacity: 0; }
.reveal.in { animation: rise var(--t-slow) both; }
.reveal.in.pop { animation-name: pop; }

.float { animation: floaty 6.5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1 !important; animation: none !important; }
  .float, .spin { animation: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ----------------------------------------------------------------- header */
.hdr {
  position: sticky; top: 0; z-index: 90;
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  background: var(--scrim);
  border-bottom: 2.5px solid var(--line-hard);
}
[data-theme="dark"] .hdr { border-bottom-color: var(--line); }

.hdr__in { display: flex; align-items: center; gap: 1rem; min-height: 72px; }

.brand {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.05rem, 1.5vw, 1.28rem); letter-spacing: -.035em;
  display: inline-flex; align-items: baseline; gap: .04em; margin-right: auto;
  white-space: nowrap;
}
.brand b { color: var(--brand); }
.brand i { font-style: normal; color: var(--ink-3); font-weight: 700; }

.nav { display: flex; align-items: center; gap: .3rem; }
.nav a {
  padding: .5rem .8rem; border-radius: var(--r-pill);
  font-weight: 700; font-size: .95rem; color: var(--ink-2);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav a:hover { color: var(--brand); background: var(--brand-soft); }
.nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }

.hdr__act { display: flex; align-items: center; gap: .6rem; }

.tgl {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 2.5px solid var(--line-hard);
  box-shadow: var(--shadow-hard-sm);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast);
}
.tgl:hover { transform: rotate(-14deg) scale(1.06); }
[data-theme="dark"] .tgl { border-color: var(--line); box-shadow: none; }
.tgl svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.tgl .i-sun { display: none; }
[data-theme="dark"] .tgl .i-sun { display: block; }
[data-theme="dark"] .tgl .i-moon { display: none; }

.burger { display: none; }

@media (max-width: 940px) {
  .burger {
    display: grid; place-items: center; width: 44px; height: 44px;
    border-radius: var(--r-pill); background: var(--surface-2);
    border: 2.5px solid var(--line-hard); box-shadow: var(--shadow-hard-sm); cursor: pointer;
  }
  [data-theme="dark"] .burger { border-color: var(--line); box-shadow: none; }
  .burger span { display: block; width: 19px; height: 2.4px; background: currentColor; border-radius: 2px; }
  .burger span + span { margin-top: 4px; }

  .nav {
    position: fixed; inset: 72px 0 auto; z-index: 89;
    flex-direction: column; align-items: stretch; gap: .2rem;
    background: var(--bg); border-bottom: 2.5px solid var(--line-hard);
    padding: 1rem var(--gutter) 1.5rem;
    box-shadow: var(--shadow-soft);
    transform: translateY(-135%);
    transition: transform var(--t-med);
  }
  .nav[data-open="true"] { transform: none; }
  .nav a { padding: .82rem 1rem; font-size: 1.05rem; }
  .nav .btn { margin-top: .5rem; }
}
@media (min-width: 941px) { .nav .btn { display: none; } }

/* ----------------------------------------------------------------- footer */
.ftr {
  background: var(--bg-alt);
  border-top: 2.5px solid var(--line-hard);
  padding-block: clamp(2.6rem, 5vw, 4rem) 1.6rem;
}
[data-theme="dark"] .ftr { border-top-color: var(--line); }
.ftr__grid {
  display: grid; gap: 2.2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr));
  margin-bottom: 2.2rem;
}
.ftr h4 {
  font-size: .82rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 1rem;
}
.ftr li + li { margin-top: .55rem; }
.ftr li a { color: var(--ink-2); font-weight: 600; font-size: .95rem; }
.ftr li a:hover { color: var(--brand); }
.ftr__base {
  border-top: 1.5px solid var(--line); padding-top: 1.4rem;
  display: flex; flex-wrap: wrap; gap: .8rem 1.5rem; justify-content: space-between;
  color: var(--ink-3); font-size: .88rem;
}

/* --------------------------------------------------------------- marquee */
.mq {
  overflow: hidden; border-block: 2.5px solid var(--line-hard);
  background: var(--brand); color: var(--brand-ink);
  padding-block: .7rem;
}
[data-theme="dark"] .mq { border-color: var(--line); }
.mq__track { display: flex; width: max-content; animation: marquee 34s linear infinite; }
.mq__track:hover { animation-play-state: paused; }
.mq span {
  font-family: var(--font-display); font-weight: 800; font-size: .95rem;
  letter-spacing: .03em; padding-inline: 1.5rem; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 1.5rem;
}
.mq span::after { content: "✦"; opacity: .6; }
