/* ==========================================================================
   GOVU DESIGN TOKENS — canonical source for Rahul's own projects

   ONE SWITCH. Two themes, four colours.
     light  →  white + blue,   third colour ORANGE
     dark   →  black + yellow, third colour GREEN

   Set data-theme="light" | "dark" on <html>. That's the whole API.

   Token NAMES never change — only values. Build against names and both
   themes come free.

   Palette philosophy: warm neutrals rather than cold greys, one dominant
   accent per surface, generous type. Warm whites read as considered;
   cold #f8fafc greys read as unfinished bootstrap.
   ========================================================================== */

/* ------------------- Shared: type, space, radius, motion ------------------ */
:root {
  /* Space Grotesk gives headings a modern, geometric character that reads
     young without reading unserious. Inter keeps body copy boringly legible,
     which is body copy's entire job. */
  --font-heading: 'Space Grotesk', 'Outfit', system-ui, sans-serif;
  --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, Menlo, monospace;

  /* Fluid scale — headings need no media queries */
  --text-xs:   0.78rem;
  --text-sm:   0.88rem;
  --text-base: 1rem;
  --text-lg:   1.13rem;
  --text-xl:   clamp(1.25rem, 2vw, 1.5rem);
  --text-2xl:  clamp(1.6rem, 3.2vw, 2.1rem);
  --text-3xl:  clamp(2.1rem, 5.5vw, 3.4rem);
  --text-4xl:  clamp(2.6rem, 8vw, 4.6rem);

  --tracking-tight: -0.03em;   /* large headings need negative tracking */
  --tracking-snug:  -0.015em;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --container-max: 1400px;
  --container-narrow: 1080px;
  --navbar-height: 64px;

  --space-1: 4px;  --space-2: 8px;   --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px;  --space-7: 32px; --space-8: 40px;
  --space-9: 56px; --space-10: 80px; --space-11: 112px;
}

/* ==================== LIGHT — white + blue + orange ====================== */
:root,
:root[data-theme="light"] {
  --bg-primary: #fbfbf9;          /* warm white, not cold grey */
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-inset: #f3f4f1;
  --border-color: #e5e5e0;
  --border-strong: #cfcfc7;

  --text-primary: #14161c;
  --text-secondary: #555a66;
  --text-muted: #8a8f9c;

  --primary-color: #2563eb;       /* blue leads */
  --primary-hover: #1d4ed8;
  --primary-light: #e8eeff;
  --primary-contrast: #ffffff;

  --accent-color: #ea6a1f;        /* orange — the warm third */
  --accent-hover: #d15a13;
  --accent-light: #fff1e7;
  --accent-contrast: #ffffff;

  --highlight: #2563eb;
  --glow: rgba(37, 99, 235, 0.18);

  --success: #15803d; --success-light: #eefaf1;
  --warning: #b45309; --warning-light: #fef7ec;
  --danger:  #c2261d; --danger-light:  #fdf0ee;

  --shadow-sm:    0 1px 2px rgba(20,22,28,.05);
  --card-shadow:  0 2px 4px rgba(20,22,28,.03), 0 12px 32px rgba(20,22,28,.05);
  --hover-shadow: 0 4px 8px rgba(37,99,235,.08), 0 18px 44px rgba(37,99,235,.13);
  --modal-shadow: 0 24px 64px rgba(20,22,28,.16);
  --focus-ring:   0 0 0 3px rgba(37,99,235,.30);
}

/* ==================== DARK — black + yellow + green ====================== */
:root[data-theme="dark"] {
  --bg-primary: #08080a;          /* near-black */
  --bg-secondary: #121215;
  --bg-card: rgba(18, 18, 21, 0.76);
  --bg-inset: #0d0d10;
  --border-color: #26262c;
  --border-strong: #3f3f48;

  --text-primary: #f7f7f2;
  --text-secondary: #a8a89e;
  --text-muted: #70706a;

  --primary-color: #ffd60a;       /* yellow leads on black */
  --primary-hover: #ffe14d;
  --primary-light: #2b2405;
  --primary-contrast: #08080a;    /* black text on yellow buttons */

  --accent-color: #4ade80;        /* green — far enough from yellow to signal */
  --accent-hover: #6ee79b;
  --accent-light: #0d2e1a;
  --accent-contrast: #06140c;

  --highlight: #ffd60a;
  --glow: rgba(255, 214, 10, 0.28);

  --success: #4ade80; --success-light: #0d2e1a;
  --warning: #ffd60a; --warning-light: #2b2405;
  --danger:  #ff6b6b; --danger-light:  #3a1414;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.5);
  --card-shadow:  0 2px 6px rgba(0,0,0,.5), 0 16px 40px rgba(0,0,0,.6);
  --hover-shadow: 0 4px 10px rgba(0,0,0,.5), 0 22px 52px rgba(255,214,10,.16);
  --modal-shadow: 0 28px 70px rgba(0,0,0,.75);
  --focus-ring:   0 0 0 3px rgba(255,214,10,.45);
}

/* ------------------------------ Base ------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.08;
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-snug); }
h3 { font-size: var(--text-lg); letter-spacing: var(--tracking-snug); }
p  { text-wrap: pretty; }

a { color: var(--accent-color); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
::selection { background: var(--highlight); color: var(--primary-contrast); }

/* --------------------------- Layout helpers ----------------------------- */
.container { max-width: var(--container-max); margin: 0 auto; padding: var(--space-9) var(--space-6); }
.container-narrow { max-width: var(--container-narrow); }
.grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stack > * + * { margin-top: var(--space-4); }

/* ---------------------------- Components -------------------------------- */
.glass, .card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
}

.card {
  padding: var(--space-6);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
/* Colour bar wipes in on hover — cheap motion, high perceived polish */
.card::after {
  content: ''; position: absolute; left: 0; bottom: 0;
  height: 3px; width: 100%;
  background: var(--highlight);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease-spring);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--hover-shadow); border-color: var(--border-strong); }
.card:hover::after { transform: scaleX(1); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-primary);
  font-weight: 650; font-size: var(--text-sm);
  border: 1px solid transparent;
  cursor: pointer; transition: var(--transition); text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary-color); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 8px 24px var(--glow); }
.btn-accent { background: var(--accent-color); color: var(--accent-contrast); }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--text-primary); }
.btn-secondary:hover { background: var(--primary-light); border-color: var(--primary-color); color: var(--primary-color); }

.tag {
  display: inline-flex; align-items: center;
  padding: 0.3rem 0.85rem; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 650; letter-spacing: .02em;
  background: var(--primary-light); color: var(--primary-color);
  border: 1px solid var(--border-color);
}
.tag-accent { background: var(--accent-light); color: var(--accent-color); }

/* Marker-pen highlight behind text */
.mark { background: linear-gradient(transparent 62%, var(--glow) 62%); padding: 0 .1em; }

/* ------------------- Selectable items & nav active state ----------------- */
.selectable {
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.selectable:hover { border-color: var(--primary-color); background: var(--primary-light); }
.selectable.is-selected {
  border-color: var(--primary-color);
  background: var(--primary-light);
  box-shadow: inset 3px 0 0 var(--primary-color);
}

.nav-link {
  display: inline-flex; align-items: center;
  color: var(--text-secondary); font-weight: 600; font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}
.nav-link:hover { color: var(--primary-color); background: var(--primary-light); text-decoration: none; }
.nav-link.active { color: var(--primary-color); background: var(--primary-light); }

/* ------------------------- Theme toggle button --------------------------- */
.theme-toggle {
  --toggle-w: 52px; --toggle-h: 28px;
  position: relative;
  width: var(--toggle-w); height: var(--toggle-h);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-inset);
  padding: 3px;
  cursor: pointer;
  transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--primary-color); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.theme-toggle::before {
  content: '';
  display: block;
  width: calc(var(--toggle-h) - 8px); height: calc(var(--toggle-h) - 8px);
  border-radius: var(--radius-full);
  background: var(--primary-color);
  box-shadow: 0 2px 6px var(--glow);
  transform: translateX(0);
  transition: transform 0.3s var(--ease-spring), background 0.3s ease;
}
:root[data-theme="dark"] .theme-toggle::before {
  transform: translateX(calc(var(--toggle-w) - var(--toggle-h)));
}

/* ---------------------------- Timeline ---------------------------------- */
.timeline { position: relative; padding-left: var(--space-7); }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border-color);
}
.timeline-item { position: relative; padding-bottom: var(--space-8); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute; left: calc(-1 * var(--space-7) + 1px); top: 7px;
  width: 10px; height: 10px; border-radius: var(--radius-full);
  background: var(--bg-primary); border: 2px solid var(--primary-color);
}
.timeline-item.current::before { background: var(--primary-color); box-shadow: 0 0 0 4px var(--glow); }

/* ------------------------------ Images ---------------------------------- */
/* Reserve the box before pixels arrive: aspect-ratio prevents the layout
   shift that makes a page feel cheap on a slow connection. */
.media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--bg-inset);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.media img, .media video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.5s ease;
}
/* Hover works standalone, and also when a parent .card is hovered */
.media:hover, .card:hover .media { border-color: var(--primary-color); }
.media:hover img, .card:hover .media img { transform: scale(1.04); }
.media-square { aspect-ratio: 1 / 1; }
.media-portrait { aspect-ratio: 3 / 4; }
.media-wide { aspect-ratio: 21 / 9; }
.media-placeholder {
  display: grid; place-items: center;
  font-family: var(--font-heading); font-size: var(--text-2xl); color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-inset), var(--primary-light));
}

.avatar {
  width: 128px; height: 128px; border-radius: var(--radius-full);
  object-fit: cover; border: 3px solid var(--primary-color);
  box-shadow: 0 8px 28px var(--glow);
}
/* Monogram fallback for when no photo file exists yet */
.avatar-fallback {
  width: 128px; height: 128px; border-radius: var(--radius-full);
  display: grid; place-items: center;
  font-family: var(--font-heading); font-size: 2.6rem; font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--primary-contrast); background: var(--primary-color);
  border: 3px solid var(--primary-color); box-shadow: 0 8px 28px var(--glow);
}

img { max-width: 100%; height: auto; }

/* ------------------------------ Motion ---------------------------------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s var(--ease-spring); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 768px) {
  .container { padding: var(--space-7) var(--space-4); }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}
