/* =====================================================================
   prahladjoshi.com — "Systems of Public Life"
   main.css — tokens, base, typography, layout, header, footer
   ===================================================================== */

:root {
  /* Palette */
  --ocean: #082F3D;
  --petrol: #145564;
  --lime: #C7D94B;
  --yellow: #E6C85C;
  --coral: #D87862;
  --cloud: #F4F7F6;
  --silver: #DDE6E7;
  --slate: #596B70;
  --graphite: #222D30;
  --black: #0A171B;

  /* Derived */
  --ink: var(--graphite);
  --ink-soft: #46575C;
  --line: #C9D5D7;
  --line-dark: rgba(221, 230, 231, .14);
  --white: #FFFFFF;
  --petrol-ink: #0F4654;           /* petrol darkened for AA text on cloud */
  --on-dark: #E9F0F0;
  --on-dark-soft: #A9BDC1;

  /* Type */
  --f-display: "Space Grotesk", "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.1875rem;
  --fs-lg: clamp(1.25rem, 1rem + .8vw, 1.5rem);
  --fs-xl: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem);
  --fs-2xl: clamp(2rem, 1.35rem + 2.3vw, 3.1rem);
  --fs-3xl: clamp(2.35rem, 1.45rem + 3.4vw, 4.25rem);
  --fs-hero: clamp(2.75rem, 1.4rem + 5.4vw, 6rem);

  /* Space */
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1320px;
  --sec-y: clamp(72px, 9vw, 140px);
  --radius: 4px;
  --radius-lg: 10px;

  --header-h: 72px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow: 0 1px 0 rgba(10, 23, 27, .04), 0 18px 40px -24px rgba(8, 47, 61, .35);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--ink);
  background: var(--cloud);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5 { margin: 0; font-family: var(--f-display); font-weight: 600; line-height: 1.08; letter-spacing: -.02em; color: inherit; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
ul[class], ol[class] { list-style: none; }
figure { margin: 0; }
dl, dd { margin: 0; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
::selection { background: var(--lime); color: var(--black); }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 1000;
  background: var(--lime); color: var(--black); padding: 12px 18px;
  font-family: var(--f-mono); font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.on-light :focus-visible, .surface-light :focus-visible { outline-color: var(--petrol); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: calc(var(--maxw) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: calc(880px + var(--gutter) * 2); }
.section { padding-block: var(--sec-y); position: relative; }
.section--tight { padding-block: clamp(56px, 6vw, 96px); }
.surface-dark { background: var(--ocean); color: var(--on-dark); }
.surface-black { background: var(--black); color: var(--on-dark); }
.surface-petrol { background: var(--petrol); color: var(--on-dark); }
.surface-light { background: var(--cloud); color: var(--ink); }
.surface-white { background: var(--white); color: var(--ink); }
.surface-silver { background: var(--silver); color: var(--ink); }

/* Systems grid texture — CSS only */
.grid-texture { position: relative; isolation: isolate; }
.grid-texture::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(221, 230, 231, .06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(221, 230, 231, .06) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at 70% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 20%, transparent 75%);
}
.surface-light.grid-texture::before, .surface-white.grid-texture::before {
  background-image:
    linear-gradient(to right, rgba(20, 85, 100, .07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 85, 100, .07) 1px, transparent 1px);
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  font-family: var(--f-mono); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; line-height: 1.4;
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--lime); box-shadow: 0 0 0 3px rgba(199, 217, 75, .18); flex: none;
}
.surface-light .eyebrow::before, .surface-white .eyebrow::before, .surface-silver .eyebrow::before { background: var(--petrol); box-shadow: 0 0 0 3px rgba(20, 85, 100, .15); }
.eyebrow--plain::before { display: none; }
.lede { font-size: var(--fs-md); line-height: 1.65; max-width: 62ch; }
.surface-dark .lede, .surface-black .lede, .surface-petrol .lede { color: var(--on-dark-soft); }
.muted { color: var(--slate); }
.surface-dark .muted, .surface-black .muted, .surface-petrol .muted { color: var(--on-dark-soft); }
.mono { font-family: var(--f-mono); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.h-xl { font-size: var(--fs-2xl); }
.h-lg { font-size: var(--fs-xl); }
.h-md { font-size: var(--fs-lg); line-height: 1.2; }
.prose { max-width: 68ch; }
.prose p { color: var(--ink-soft); }
.surface-dark .prose p, .surface-black .prose p, .surface-petrol .prose p { color: var(--on-dark-soft); }
.prose h3 { font-size: var(--fs-lg); margin: 1.6em 0 .6em; line-height: 1.25; }
.prose ul { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .45em; color: var(--ink-soft); }
.prose a, .text-link { color: var(--petrol-ink); text-decoration: underline; text-decoration-color: rgba(20, 85, 100, .35); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover, .text-link:hover { text-decoration-color: var(--petrol); }
.surface-dark .prose a, .surface-black .prose a, .surface-petrol .prose a, .surface-dark .text-link, .surface-black .text-link { color: var(--lime); text-decoration-color: rgba(199, 217, 75, .45); }

/* Section heading pattern */
.sec-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-bottom: clamp(36px, 5vw, 64px); max-width: 900px; }
.sec-head__index { font-family: var(--f-mono); font-size: var(--fs-sm); color: var(--slate); display: flex; align-items: center; gap: 14px; }
.sec-head__index b { color: var(--petrol); font-weight: 600; }
.surface-dark .sec-head__index, .surface-black .sec-head__index, .surface-petrol .sec-head__index { color: var(--on-dark-soft); }
.surface-dark .sec-head__index b, .surface-black .sec-head__index b, .surface-petrol .sec-head__index b { color: var(--lime); }
.sec-head__index::after { content: ""; height: 1px; width: 64px; background: currentColor; opacity: .4; }
.sec-head h2 { font-size: var(--fs-2xl); }
.sec-head--split { max-width: none; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: end; column-gap: clamp(24px, 5vw, 80px); }
.sec-head--split .sec-head__index { grid-column: 1 / -1; }

/* ---------- Buttons & links ---------- */
.btn {
  --b-bg: var(--lime); --b-fg: var(--black);
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 1px solid transparent;
  background: var(--b-bg); color: var(--b-fg);
  font-family: var(--f-display); font-weight: 600; font-size: .98rem; letter-spacing: .005em;
  text-decoration: none; line-height: 1.2;
  transition: transform .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn svg { width: 18px; height: 18px; transition: transform .3s var(--ease); }
.btn:hover svg { transform: translateX(4px); }
.btn:hover { background: #D6E66A; }
.btn--ghost { --b-bg: transparent; --b-fg: currentColor; border-color: currentColor; }
.btn--ghost:hover { background: rgba(199, 217, 75, .12); }
.btn--dark { --b-bg: var(--ocean); --b-fg: var(--white); }
.btn--dark:hover { background: var(--petrol); }
.link-arrow {
  display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 600;
  text-decoration: none; color: var(--petrol-ink); padding-block: 6px; background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .35s var(--ease);
}
.link-arrow:hover { background-size: 100% 1px; }
.link-arrow svg { width: 16px; height: 16px; flex: none; transition: transform .3s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }
.surface-dark .link-arrow, .surface-black .link-arrow, .surface-petrol .link-arrow { color: var(--lime); }

/* =====================================================================
   HEADER — sticky
   ===================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8, 47, 61, .94);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  color: var(--on-dark);
  border-bottom: 1px solid var(--line-dark);
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease);
}
.site-header.is-scrolled { background: rgba(10, 23, 27, .96); box-shadow: 0 12px 30px -20px rgba(0, 0, 0, .6); }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--white); min-width: 0; }
.brand__mark { width: 34px; height: 34px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand__name { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; letter-spacing: .08em; white-space: nowrap; }
.brand__sub { font-family: var(--f-mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--on-dark-soft); margin-top: 4px; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav__list { display: flex; align-items: center; gap: 2px; list-style: none; }
.nav__item { position: relative; }
.nav__link, .nav__trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border: 0; background: none; border-radius: 999px;
  font-family: var(--f-display); font-size: .93rem; font-weight: 500; letter-spacing: .01em;
  color: var(--on-dark); text-decoration: none; position: relative;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.nav__link:hover, .nav__trigger:hover, .nav__trigger[aria-expanded="true"] { background: rgba(221, 230, 231, .08); }
.nav__link[aria-current="page"], .nav__trigger.is-active { color: var(--lime); }
.nav__link[aria-current="page"]::after, .nav__trigger.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--lime);
}
.nav__trigger svg { width: 12px; height: 12px; transition: transform .25s var(--ease); }
.nav__trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav__cta { margin-left: 10px; min-height: 42px; padding: 8px 18px; font-size: .9rem; }

/* Mega panel */
.mega {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translate(-50%, 8px);
  width: min(560px, calc(100vw - 32px)); padding: 14px;
  background: var(--black); border: 1px solid var(--line-dark); border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
}
.mega::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; }
.nav__item.is-open .mega { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
.nav__item:last-child .mega { left: auto; right: -12px; transform: translate(0, 8px); }
.nav__item:last-child.is-open .mega { transform: none; }
.nav__item:not(.is-open) .mega { display: none; }
.nav__item.is-open .mega { display: block; animation: megaIn .22s var(--ease); }
@keyframes megaIn { from { opacity: 0; } to { opacity: 1; } }
.mega__label { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--on-dark-soft); padding: 6px 12px 10px; display: flex; justify-content: space-between; }
.mega__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; list-style: none; }
.mega__link { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 4px 10px; padding: 12px; border-radius: 8px; text-decoration: none; color: var(--on-dark); transition: background-color .2s var(--ease); }
.mega__link:hover, .mega__link:focus-visible { background: rgba(20, 85, 100, .45); }
.mega__link[aria-current="page"] { background: rgba(199, 217, 75, .1); }
.mega__num { font-family: var(--f-mono); font-size: .72rem; color: var(--lime); padding-top: 3px; }
.mega__title { font-family: var(--f-display); font-weight: 600; font-size: .95rem; line-height: 1.3; }
.mega__desc { grid-column: 2; font-size: .8rem; line-height: 1.45; color: var(--on-dark-soft); }

/* Burger */
.burger {
  display: none; align-items: center; justify-content: center; gap: 10px; height: 44px; padding: 0 14px 0 16px;
  border: 1px solid var(--line-dark); border-radius: 999px; background: transparent; color: var(--on-dark);
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
}
.burger__icon { width: 18px; height: 12px; position: relative; }
.burger__icon span { position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.burger__icon span:nth-child(1) { top: 0; }
.burger__icon span:nth-child(2) { top: 5px; }
.burger__icon span:nth-child(3) { top: 10px; }
.burger[aria-expanded="true"] .burger__icon span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.burger[aria-expanded="true"] .burger__icon span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] .burger__icon span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* Mobile drawer */
.drawer {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 99;
  background: var(--black); color: var(--on-dark);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px var(--gutter) 40px;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.drawer.is-open { opacity: 1; visibility: visible; transform: none; }
.drawer__group { border-bottom: 1px solid var(--line-dark); }
.drawer__toggle, .drawer__single {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; padding: 8px 0; background: none; border: 0; text-align: left; text-decoration: none;
  font-family: var(--f-display); font-size: 1.3rem; font-weight: 600; color: var(--on-dark);
}
.drawer__single[aria-current="page"] { color: var(--lime); }
.drawer__toggle svg { width: 18px; height: 18px; transition: transform .25s var(--ease); flex: none; }
.drawer__toggle[aria-expanded="true"] svg { transform: rotate(45deg); }
.drawer__toggle .drawer__count { font-family: var(--f-mono); font-size: .72rem; color: var(--on-dark-soft); margin-left: auto; margin-right: 12px; font-weight: 400; }
.drawer__panel { list-style: none; padding: 0 0 16px; display: none; }
.drawer__panel.is-open { display: block; }
.drawer__panel a { display: flex; gap: 14px; align-items: baseline; padding: 11px 0 11px 4px; text-decoration: none; color: var(--on-dark-soft); font-size: 1.02rem; }
.drawer__panel a span { font-family: var(--f-mono); font-size: .72rem; color: var(--lime); width: 24px; flex: none; }
.drawer__panel a[aria-current="page"] { color: var(--lime); }
.drawer__foot { margin-top: 28px; display: grid; gap: 8px; font-size: .95rem; color: var(--on-dark-soft); }
.drawer__foot a { color: var(--on-dark); text-decoration: none; }
body.nav-open { overflow: hidden; }

/* =====================================================================
   BREADCRUMB + PAGE MASTHEAD (shared rhythm, page-specific bodies)
   ===================================================================== */
.crumbs { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .06em; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.crumbs li { display: inline-flex; align-items: center; gap: 10px; }
.crumbs li + li::before { content: "/"; opacity: .5; }
.crumbs a { text-decoration: none; opacity: .8; }
.crumbs a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current] { opacity: 1; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.site-footer { background: var(--black); color: var(--on-dark); position: relative; overflow: hidden; isolation: isolate; }
.site-footer__flow { position: absolute; inset: 0 0 auto 0; height: 100%; z-index: -1; opacity: .5; pointer-events: none; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 96px); padding-block: clamp(64px, 8vw, 112px) 56px; border-bottom: 1px solid var(--line-dark); }
.footer-statement h2 { font-size: var(--fs-xl); max-width: 18ch; margin: 18px 0 20px; }
.footer-statement p { color: var(--on-dark-soft); max-width: 50ch; font-size: .98rem; }
.footer-contact { display: grid; gap: 0; align-content: start; border-top: 1px solid var(--line-dark); }
.footer-contact__row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-dark); align-items: baseline; }
.footer-contact__row dt { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--on-dark-soft); }
.footer-contact__row dd { font-family: var(--f-display); font-size: 1.08rem; font-weight: 500; overflow-wrap: anywhere; }
.footer-contact__row a { text-decoration: none; background-image: linear-gradient(var(--lime), var(--lime)); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s var(--ease); }
.footer-contact__row a:hover { background-size: 100% 1px; color: var(--lime); }
.footer-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; padding-block: 48px; border-bottom: 1px solid var(--line-dark); }
.footer-map h3 { font-family: var(--f-mono); font-size: .7rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--lime); margin-bottom: 16px; display: flex; gap: 10px; align-items: center; }
.footer-map h3 span { color: var(--on-dark-soft); }
.footer-map ul { list-style: none; display: grid; gap: 4px; }
.footer-map a { color: var(--on-dark-soft); text-decoration: none; font-size: .95rem; display: inline-block; padding: 4px 0; transition: color .2s var(--ease), transform .2s var(--ease); }
.footer-map a:hover { color: var(--white); transform: translateX(3px); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; padding-block: 28px 36px; }
.social { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; }
.social a {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-dark); color: var(--on-dark); transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.social a:hover { background: var(--lime); color: var(--black); border-color: var(--lime); }
.social svg { width: 18px; height: 18px; }
.social__static {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line-dark); color: var(--on-dark); cursor: default;
}
.footer-legal { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .04em; color: var(--on-dark-soft); display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-legal a { color: var(--on-dark); text-decoration: underline; text-decoration-color: rgba(199, 217, 75, .5); text-underline-offset: 3px; }
.footer-legal a:hover { color: var(--lime); }
.footer-note { font-size: .78rem; color: var(--on-dark-soft); padding-bottom: 28px; max-width: 90ch; line-height: 1.6; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

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