/* ═══════════════════════════════════════════════════════
   BRAIN IQ — DESIGN SYSTEM
   A refined, premium aesthetic built on purple + gold + cream
═══════════════════════════════════════════════════════ */

:root {
  /* Surfaces — clean almost-white with the faintest hint of warmth */
  --bg:        #fafcfa;          /* near-white, only a whisper of green */
  --bg-2:      #f0f4ee;          /* subtle sage for contrast */
  --white:     #ffffff;
  --paper:     #fbfdf8;          /* parchment for certificates */

  /* Primary green — DVLA / GOV.UK institutional teal-green */
  --g-50:      #e8f3ee;
  --g-100:     #c4e0d2;
  --g-200:     #8fc6ad;
  --g-300:     #5ba98a;
  --g-400:     #2f8f6f;
  --g-500:     #0e7a5e;          /* primary — slightly lighter than #016853 */
  --g-600:     #066850;
  --g-700:     #054d3b;
  --g-800:     #033529;
  --g-900:     #021f17;

  /* Map green to legacy purple variable names so existing components work */
  --p-50:      var(--g-50);
  --p-100:     var(--g-100);
  --p-200:     var(--g-200);
  --p-300:     var(--g-300);
  --p-400:     var(--g-400);
  --p-500:     var(--g-500);
  --p-600:     var(--g-600);
  --p-700:     var(--g-700);
  --p-800:     var(--g-800);
  --p-900:     var(--g-900);

  --purple:    var(--g-500);
  --purple-l:  var(--g-300);
  --purple-d:  var(--g-700);
  --purple-xl: var(--g-50);

  /* Gold — kept for certificate accents only */
  --gold:      #b8924a;
  --gold-l:    #d9b56e;
  --gold-d:    #876a2d;
  --gold-soft: #f0e2c0;
  --gold-deep: #6b5223;

  /* Navy & deep forest for dark accent sections */
  --navy:      #0e2a52;
  --navy-d:    #061a36;
  --forest-d:  #054d3b;
  --forest-x:  #033529;

  /* Ink — deep forest near-black */
  --ink:       #0e2418;
  --ink-2:     #1f3a28;
  --ink-3:     #3d5746;
  --muted:     #6b7d70;
  --muted-2:   #99a89e;

  /* Borders — neutral with warm cast */
  --border:    #dde6d2;
  --border-2:  #c5d2b8;
  --border-p:  #cce0c0;

  /* Shadows — layered & soft */
  --sh-1:      0 1px 2px rgba(28,18,60,.04), 0 2px 8px rgba(28,18,60,.04);
  --sh-2:      0 2px 4px rgba(28,18,60,.05), 0 8px 24px rgba(28,18,60,.08);
  --sh-3:      0 4px 8px rgba(28,18,60,.06), 0 16px 48px rgba(28,18,60,.12);
  --sh-4:      0 8px 16px rgba(28,18,60,.08), 0 32px 80px rgba(28,18,60,.18);
  --sh-purple: 0 12px 32px rgba(111,71,176,.28);
  --sh-gold:   0 12px 32px rgba(199,154,58,.32);

  /* Radii */
  --r-xs:      6px;
  --r-sm:      10px;
  --r:         14px;
  --r-lg:      20px;
  --r-xl:      28px;

  /* Transitions */
  --t-fast:    .15s cubic-bezier(.4,0,.2,1);
  --t:         .25s cubic-bezier(.4,0,.2,1);
  --t-slow:    .45s cubic-bezier(.4,0,.2,1);

  /* Type */
  --serif:     'Cormorant Garamond', 'Times New Roman', serif;
  --sans:      'DM Sans', system-ui, -apple-system, sans-serif;
  --mono:      'DM Mono', 'SF Mono', Menlo, monospace;
}

/* ─────── Reset ─────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
::selection { background: var(--p-200); color: var(--ink); }

/* Subtle paper grain — gives the cream a tactile feel */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 1;
  pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px;
}

/* ─────── Layout ─────── */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px; position: relative; z-index: 2; }
.container-narrow { max-width: 880px; }

/* ─────── Pills & tags ─────── */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--purple-d);
  background: var(--p-50);
  border: 1px solid var(--p-100);
  border-radius: 999px; padding: 6px 14px;
  transition: transform var(--t), background var(--t);
}
.pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple); flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--p-100);
}
.pill-gold { background: rgba(199,154,58,.12); border-color: rgba(199,154,58,.3); color: var(--gold-d); }
.pill-gold::before { background: var(--gold); box-shadow: 0 0 0 3px rgba(199,154,58,.18); }
.pill-light { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: rgba(255,255,255,.85); }
.pill-light::before { background: var(--gold-l); box-shadow: 0 0 0 3px rgba(230,194,105,.2); }

/* ─────── Buttons ─────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: none; border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--sans); font-weight: 500; letter-spacing: .01em;
  transition: transform var(--t), box-shadow var(--t), background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap; padding: 14px 28px; font-size: .92rem;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.2) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform .6s ease;
}
.btn:hover::after { transform: translateX(100%); }

.btn-primary {
  background: linear-gradient(135deg, var(--p-600), var(--p-500));
  color: #fff; box-shadow: 0 4px 14px rgba(111,71,176,.32);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(111,71,176,.42); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent; color: var(--purple-d);
  border: 1.5px solid var(--p-200); font-weight: 500;
}
.btn-outline:hover { background: var(--p-50); border-color: var(--purple); color: var(--purple-d); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--p-50); color: var(--purple-d); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-l));
  color: #2a1f00; font-weight: 600;
  box-shadow: 0 4px 14px rgba(199,154,58,.35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(199,154,58,.5); }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--p-800); transform: translateY(-1px); }

.btn-xl { padding: 18px 40px; font-size: 1rem; border-radius: var(--r); }
.btn-lg { padding: 16px 34px; font-size: .98rem; }
.btn-sm { padding: 10px 18px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ─────── Typography ─────── */
.eyebrow {
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
}
.h-display {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 1.02; letter-spacing: -.025em; color: var(--ink);
}
.h-display em { font-style: italic; color: var(--purple); }
.h-title {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.08; letter-spacing: -.02em; color: var(--ink);
}
.h-title em { font-style: italic; color: var(--purple); }
.h-sub {
  font-size: 1.05rem; color: var(--ink-3);
  line-height: 1.72; max-width: 540px;
}
.h-sub-lg { font-size: 1.12rem; line-height: 1.7; }

.section-header { text-align: center; margin: 0 auto 64px; max-width: 720px; }
.section-header .eyebrow,
.section-header .pill { margin-bottom: 18px; }
.section-header .h-title { margin-bottom: 16px; }
.section-header .h-sub { margin: 0 auto; }

/* ─────── Reveal animations ─────── */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal.from-l { transform: translateX(-28px) translateY(0); }
.reveal.from-r { transform: translateX(28px) translateY(0); }
.reveal.from-l.visible, .reveal.from-r.visible { transform: translateX(0); }
.d1 { transition-delay: .08s; } .d2 { transition-delay: .16s; }
.d3 { transition-delay: .24s; } .d4 { transition-delay: .32s; }
.d5 { transition-delay: .40s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ─────── Nav (shared) ─────── */
.site-nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(246,244,238,.82);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid rgba(230,224,210,.6);
  transition: padding var(--t), background var(--t);
}
.site-nav.scrolled { background: rgba(246,244,238,.94); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; gap: 28px; }
.nav-logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.55rem; font-weight: 700;
  color: var(--ink); letter-spacing: -.01em;
}
.nav-logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--p-600), var(--p-400));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .9rem; box-shadow: 0 4px 12px rgba(111,71,176,.32);
  position: relative; overflow: hidden;
}
.nav-logo-mark::after {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,.4) 0%, transparent 50%);
  animation: shimmer 4s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { transform: translate(-30%,-30%); } 50% { transform: translate(30%,30%); } }
.nav-logo span { color: var(--purple); }
.nav-links { display: flex; align-items: center; gap: 36px; list-style: none; }
.nav-links a { font-size: .9rem; color: var(--ink-3); transition: color var(--t-fast); position: relative; }
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: -4px; width: 0; height: 2px;
  background: var(--purple); transition: width var(--t);
}
.nav-links a:hover, .nav-links a.active { color: var(--purple-d); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-right { display: flex; align-items: center; gap: 14px; }

.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 8px; cursor: pointer;
}
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform var(--t), opacity var(--t); }
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile {
  display: none; position: fixed; inset: 70px 0 0 0; z-index: 199;
  background: var(--bg);
  flex-direction: column; padding: 36px 28px 28px; gap: 4px;
  animation: navSlide .3s cubic-bezier(.16,1,.3,1);
}
@keyframes navSlide { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
.nav-mobile.open { display: flex; }
.nav-mobile a {
  font-size: 1.15rem; font-family: var(--serif); font-weight: 600;
  color: var(--ink); padding: 18px 4px; border-bottom: 1px solid var(--border);
}
.nav-mobile a:last-of-type { border: none; }
.nav-mobile .btn { margin-top: 20px; }

/* ─────── Footer (shared) ─────── */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,.5);
  padding: 72px 0 28px; position: relative; overflow: hidden;
}
.site-footer::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent);
  opacity: .3;
}
.footer-top {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 56px; margin-bottom: 52px;
}
.footer-brand { max-width: 280px; }
.footer-brand .nav-logo { color: #fff; margin-bottom: 16px; }
.footer-brand .nav-logo span { color: var(--p-300); }
.footer-desc { font-size: .86rem; line-height: 1.7; color: rgba(255,255,255,.5); }
.footer-col h4 {
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold-l); margin-bottom: 18px; font-weight: 500;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.footer-col a { font-size: .88rem; color: rgba(255,255,255,.55); transition: color var(--t-fast); }
.footer-col a:hover { color: var(--p-300); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px; padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem; color: rgba(255,255,255,.35);
}

/* ─────── Cards (shared) ─────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px;
  box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--p-100); }

/* ─────── Mobile shared ─────── */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-right .btn-primary { display: none; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 36px; }
}
@media (max-width: 560px) {
  .container { padding: 0 20px; }
  .footer-top { grid-template-columns: 1fr; }
  .btn-xl { padding: 15px 28px; font-size: .94rem; }
}
