/* =========================================================================
   Ashar S. Ahmed — Portfolio
   Design system: document cream, Old Glory navy ink, one sharp red accent.
   Type: Libre Franklin (display) · Public Sans (body) · Geist Mono (labels)
   ========================================================================= */

:root {
  /* --- palette: quiet US-federal — Old Glory navy + red on document cream --- */
  --paper:      oklch(0.962 0.007 88);   /* document cream */
  --paper-2:    oklch(0.942 0.009 86);   /* slightly deeper card */
  --paper-3:    oklch(0.922 0.011 84);   /* hairline fills */
  --ink:        oklch(0.255 0.055 262);  /* Old Glory navy (text) */
  --ink-2:      oklch(0.43 0.045 262);   /* secondary text */
  --ink-3:      oklch(0.57 0.030 264);   /* tertiary / captions */
  --line:       oklch(0.86 0.012 80);    /* hairlines */
  --line-2:     oklch(0.80 0.016 78);
  --navy:       oklch(0.205 0.052 262);  /* dark sections / footer */

  /* accent — overridden by Tweaks; default Old Glory red */
  --accent:     oklch(0.485 0.165 18);
  --accent-ink: color-mix(in oklab, var(--accent) 78%, var(--ink)); /* adapts to theme */
  --accent-soft: color-mix(in oklab, var(--accent) 11%, transparent);
  --on-accent:  oklch(0.98 0.006 85);

  /* --- type: institutional American sans + government Public Sans --- */
  --display: "Libre Franklin", system-ui, sans-serif;
  --body:    "Public Sans", system-ui, sans-serif;
  --mono:    "Geist Mono", ui-monospace, monospace;
  --display-weight: 800;

  /* --- metrics --- */
  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 6px;
  --radius-sm: 4px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================================
   Reset / base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--on-accent); }

/* =========================================================================
   Dark theme — set [data-theme="dark"] on <html>
   ========================================================================= */
:root[data-theme="dark"] {
  --paper:      oklch(0.205 0.045 262);  /* deep navy field */
  --paper-2:    oklch(0.240 0.045 262);
  --paper-3:    oklch(0.275 0.042 262);
  --ink:        oklch(0.930 0.010 88);   /* cream text */
  --ink-2:      oklch(0.740 0.022 264);
  --ink-3:      oklch(0.600 0.026 264);
  --line:       oklch(0.330 0.038 262);
  --line-2:     oklch(0.400 0.042 262);
  --navy:       oklch(0.155 0.045 262);  /* footer / dossier, darker than field */
}
:root[data-theme="dark"] body::before {
  background-image: radial-gradient(oklch(0.85 0.02 262 / 0.035) 1px, transparent 1px);
}

/* subtle paper grain via layered radial dots */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image: radial-gradient(oklch(0.3 0.04 262 / 0.022) 1px, transparent 1px);
  background-size: 5px 5px;
}

/* =========================================================================
   Layout primitives
   ========================================================================= */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}
section { position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 500;
}
.eyebrow::before {
  content: "";
  width: 18px; height: 1.5px;
  background: var(--accent);
  display: inline-block;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 40px;
  flex-wrap: wrap;
  margin-bottom: clamp(40px, 5vw, 64px);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(30px, 4.4vw, 52px);
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.section-head .note {
  font-size: 15px;
  color: var(--ink-3);
  line-height: 1.45;
  padding-bottom: 0.35em;
  text-align: right;
}
@media (max-width: 680px) {
  .section-head { align-items: flex-start; }
  .section-head .note { text-align: left; }
  .section-head .note br { display: none; }
}

.section-pad { padding-block: clamp(72px, 10vw, 140px); }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 15px 24px;
  border-radius: 2px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* =========================================================================
   Nav
   ========================================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in oklab, var(--paper) 80%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--line);
}
.nav-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: 18px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand .dot {
  width: 10px; height: 10px;
  background: var(--accent);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  list-style: none;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  position: relative;
  padding: 4px 0;
  transition: color 0.25s;
}
.nav-links a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 0; height: 1.5px; background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }
.nav-cta { display: flex; align-items: center; gap: 14px; }

/* theme toggle (sun → crescent) */
.theme-toggle {
  width: 52px; height: 28px; flex: none;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--paper-2);
  position: relative; cursor: pointer; padding: 0;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .knob {
  position: absolute; top: 50%; left: 3px; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent);
  transition: left 0.32s var(--ease), background 0.32s var(--ease), box-shadow 0.32s var(--ease);
}
:root[data-theme="dark"] .theme-toggle .knob {
  left: 27px;
  background: transparent;
  box-shadow: inset -5px -2px 0 0 oklch(0.93 0.01 88);
}
.nav-burger { display: none; }
@media (max-width: 820px) {
  .nav-links { display: none; }
}

/* =========================================================================
   HERO
   ========================================================================= */
.hero { padding-top: 132px; padding-bottom: clamp(60px, 9vw, 120px); overflow: hidden; }
.hero .status {
  display: inline-flex; align-items: center; gap: 13px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2);
  margin-bottom: 34px;
}
.status .live {
  width: 7px; height: 7px;
  background: var(--accent); flex: none;
}
.status .sep {
  width: 1px; height: 12px; flex: none;
  background: var(--line-2); display: inline-block;
}
.status .st { white-space: nowrap; }
.status b { color: var(--ink); font-weight: 500; }

.hero h1 {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(48px, 9.5vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.035em;
}
.hero h1 .accent { color: var(--accent); }
.hero .lede {
  font-size: clamp(17px, 2vw, 21px);
  color: var(--ink-2);
  max-width: 56ch;
  margin-top: 28px;
  text-wrap: pretty;
}
.hero .role {
  font-family: var(--mono);
  font-size: clamp(13px, 1.5vw, 15px);
  letter-spacing: 0.05em;
  color: var(--ink);
  margin-top: 18px;
}
.hero .role b { color: var(--accent-ink); font-weight: 600; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 40px; }

/* stat row */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: clamp(48px, 7vw, 84px);
}
.hero-stats .stat { background: var(--paper); padding: 24px clamp(16px, 2vw, 28px); }
.hero-stats .stat .n {
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: clamp(28px, 3.6vw, 44px); letter-spacing: -0.02em;
  line-height: 1;
}
.hero-stats .stat .n .u { color: var(--accent); }
.hero-stats .stat .l {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-3); text-transform: uppercase; margin-top: 10px;
}
@media (max-width: 680px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } }

.hero-grid { max-width: 18ch; }

/* =========================================================================
   About
   ========================================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(36px, 6vw, 90px);
  align-items: start;
}
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; gap: 36px; } }
.about-grid .big {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.22;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}
.about-grid .big em { font-style: normal; color: var(--accent-ink); }
.about-grid .body p { color: var(--ink-2); margin-bottom: 18px; max-width: 60ch; }
.about-meta {
  margin-top: 30px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 28px;
}
.about-meta .row .k { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.about-meta .row .v { font-size: 15.5px; margin-top: 4px; }

/* =========================================================================
   Expertise / skills
   ========================================================================= */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 880px) { .exp-grid { grid-template-columns: 1fr; } }
.exp-card {
  background: var(--paper);
  padding: clamp(26px, 3vw, 38px);
  transition: background 0.35s var(--ease);
}
.exp-card:hover { background: var(--paper-2); }
.exp-card h3 {
  font-family: var(--display); font-weight: 700;
  font-size: 22px; letter-spacing: -0.01em; margin: 0 0 12px;
}
.exp-card p { color: var(--ink-2); font-size: 15px; }

/* datasheet key list (replaces tag chips) */
.card-foot { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.micro {
  display: block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 11px;
}
.keyline { font-size: 15px; line-height: 1.85; color: var(--ink-2); }
.keyline span { white-space: nowrap; }

/* capability ledger (replaces the skill matrix) */
.spec { margin-top: clamp(40px, 5vw, 68px); border-top: 1.5px solid var(--ink); }
.spec-cap { padding: 14px 2px 2px; }
.spec-row {
  display: grid; grid-template-columns: 46px 210px 1fr; gap: 24px;
  padding: 20px 2px; border-top: 1px solid var(--line);
  align-items: baseline;
}
.spec-row .ix { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); letter-spacing: 0.04em; }
.spec-row .k { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); }
@media (max-width: 720px) {
  .spec-row { grid-template-columns: 1fr; gap: 8px; }
  .spec-row .ix { display: none; }
}

/* =========================================================================
   Experience timeline
   ========================================================================= */
.timeline { border-top: 1px solid var(--line); }
.job {
  display: grid;
  grid-template-columns: 0.5fr 1.5fr;
  gap: clamp(20px, 4vw, 56px);
  padding: clamp(28px, 4vw, 44px) 0;
  border-bottom: 1px solid var(--line);
  position: relative;
  transition: background 0.4s var(--ease);
}
.job:hover { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }
@media (max-width: 760px) { .job { grid-template-columns: 1fr; gap: 14px; } }
.job .when { font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.02em; }
.job .when .now { color: var(--accent-ink); }
.job h3 { font-family: var(--display); font-weight: 700; font-size: clamp(21px, 2.6vw, 28px); letter-spacing: -0.01em; }
.job .org { color: var(--ink-2); font-size: 15.5px; margin-top: 4px; margin-bottom: 18px; }
.job .org b { color: var(--ink); font-weight: 600; }
.job ul { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.job ul li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: 15.5px; max-width: 64ch; }
.job ul li::before {
  content: ""; position: absolute; left: 0; top: 10px;
  width: 7px; height: 7px; background: var(--accent); border-radius: 1px; transform: rotate(45deg);
}
.job ul li b { color: var(--ink); font-weight: 600; }

/* =========================================================================
   Projects
   ========================================================================= */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 760px) { .proj-grid { grid-template-columns: 1fr; } }
.proj {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(26px, 3vw, 36px);
  background: var(--paper);
  display: flex; flex-direction: column;
  min-height: 260px;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.proj:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: 0 24px 50px -28px oklch(0.2 0.02 60 / 0.35); }
.proj .top { display: flex; align-items: center; justify-content: space-between; }
.proj .kind { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.proj .link { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; transition: color 0.25s; }
.proj:hover .link { color: var(--ink); }
.proj h3 { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: -0.015em; margin: 22px 0 10px; }
.proj p { color: var(--ink-2); font-size: 15px; }
.proj .foot { margin-top: auto; padding-top: 22px; border-top: 1px solid var(--line); }

/* =========================================================================
   Credentials  (certs + education)
   ========================================================================= */
.cred-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(28px, 5vw, 64px); }
@media (max-width: 820px) { .cred-grid { grid-template-columns: 1fr; gap: 40px; } }
.cred-list { display: flex; flex-direction: column; }
.cred {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 22px 0; border-top: 1px solid var(--line);
}
.cred:last-child { border-bottom: 1px solid var(--line); }
.cred .name { font-family: var(--display); font-weight: 600; font-size: clamp(17px, 2vw, 21px); letter-spacing: -0.01em; }
.cred .sub { font-size: 14px; color: var(--ink-3); margin-top: 3px; }
.cred .yr { font-family: var(--mono); font-size: 13px; color: var(--accent-ink); white-space: nowrap; }

/* =========================================================================
   Contact / footer
   ========================================================================= */
.contact { background: var(--navy); color: oklch(0.94 0.008 88); }
.contact .eyebrow { color: oklch(0.78 0.16 30); }
.contact .eyebrow::before { background: var(--accent); }
.contact h2 {
  font-family: var(--display); font-weight: var(--display-weight);
  font-size: clamp(40px, 8vw, 104px); line-height: 0.95; letter-spacing: -0.035em;
  margin: 24px 0 8px;
}
.contact a.mail { color: oklch(0.94 0.006 85); border-bottom: 2px solid var(--accent); transition: color 0.25s; }
.contact a.mail:hover { color: var(--accent); }
.contact-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }
.contact .btn { background: oklch(0.95 0.008 88); color: oklch(0.205 0.052 262); border-color: oklch(0.95 0.008 88); }
.contact .btn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.contact .btn.ghost { background: transparent; color: oklch(0.94 0.006 85); border-color: oklch(0.42 0.012 62); }
.contact .btn.ghost:hover { background: oklch(0.94 0.006 85); color: var(--ink); border-color: oklch(0.94 0.006 85); }
.foot-bar {
  border-top: 1px solid oklch(0.32 0.012 60);
  margin-top: clamp(60px, 9vw, 110px);
  padding: 26px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: oklch(0.62 0.01 70); letter-spacing: 0.03em;
}

/* =========================================================================
   Scroll reveal + motion
   ========================================================================= */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: 0.07s; }
.reveal[data-d="2"] { transition-delay: 0.14s; }
.reveal[data-d="3"] { transition-delay: 0.21s; }
.reveal[data-d="4"] { transition-delay: 0.28s; }

/* clip-unmask for marquee headings */
.reveal[data-reveal="mask"] {
  opacity: 1; transform: none;
  clip-path: inset(0 0 108% 0);
  transition: clip-path 1.05s var(--ease);
  will-change: clip-path;
}
.reveal[data-reveal="mask"].in { clip-path: inset(0 0 -18% 0); }
.reveal[data-reveal="mask"][data-d="1"] { transition-delay: 0.08s; }

/* thin scroll-progress line */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  z-index: 200; pointer-events: none; background: transparent;
}
.scroll-progress span {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: left;
  background: var(--accent);
}

/* scroll-spy active nav link */
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { width: 100%; }

/* Lenis inertial scroll */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .reveal[data-reveal="mask"] { clip-path: none; transition: none; }
  html { scroll-behavior: auto; }
}
