/* =========================================================
   Raghav Khullar — personal site
   Modern minimal, dark-first, no framework
   Dual-lens: [data-lens="sdet"] | [data-lens="pm"]
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --bg:            #0b0d10;
  --bg-elev:       #111419;
  --surface:       #14181e;
  --surface-2:     #1a1f27;
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text:          #e9ecf1;
  --text-muted:    #9aa3af;
  --text-faint:    #6b7280;

  /* SDET lens — warm */
  --accent:        #ff6a3d;
  --accent-2:      #ff9d3d;
  --accent-soft:   rgba(255, 106, 61, 0.14);
  --accent-glow:   rgba(255, 106, 61, 0.35);
  --accent-rgb:    255, 106, 61;

  --ok:            #33d17a;

  --radius:        14px;
  --radius-lg:     22px;
  --maxw:          1080px;

  --shadow:        0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --ring:          0 0 0 3px var(--accent-soft);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  color-scheme: dark;
}

/* PM lens — cool. Switching lens shifts the whole palette. */
:root[data-lens="pm"] {
  --accent:        #7b8cff;
  --accent-2:      #b06bff;
  --accent-soft:   rgba(123, 140, 255, 0.16);
  --accent-glow:   rgba(123, 140, 255, 0.38);
  --accent-rgb:    123, 140, 255;
}

:root[data-theme="light"] {
  --bg:            #f7f8fa;
  --bg-elev:       #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f1f3f6;
  --border:        rgba(10, 12, 16, 0.10);
  --border-strong: rgba(10, 12, 16, 0.18);

  --text:          #16191f;
  --text-muted:    #4b5563;
  --text-faint:    #8b93a1;

  --accent-soft:   rgba(255, 106, 61, 0.12);
  --shadow:        0 12px 40px -16px rgba(20, 24, 40, 0.25);

  color-scheme: light;
}
:root[data-theme="light"][data-lens="pm"] {
  --accent:        #5566e8;
  --accent-2:      #8c46e0;
  --accent-soft:   rgba(85, 102, 232, 0.12);
  --accent-glow:   rgba(85, 102, 232, 0.32);
  --accent-rgb:    85, 102, 232;
}

/* Palette changes are animated so the lens switch feels physical */
:root { transition: none; }
body, .btn, .icon-btn, .tag, .fact, .skill-card, .project, .timeline__card, .chip {
  transition-property: background, border-color, color, box-shadow, transform;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(720px 480px at 15% -5%, var(--accent-soft), transparent 60%),
    radial-gradient(680px 520px at 100% 0%, rgba(90, 130, 255, 0.10), transparent 55%);
  pointer-events: none;
  transition: background 0.4s ease;
}
:root[data-theme="light"] body::before { opacity: 0.7; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
}

::selection { background: var(--accent); color: #fff; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Lens visibility ---------- */
:root[data-lens="sdet"] [data-lens-only="pm"],
:root[data-lens="pm"]   [data-lens-only="sdet"] { display: none; }

/* Content fades in when the lens flips */
.lens-anim [data-lens-only] { animation: lensIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes lensIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Coverage meter (scroll progress) ---------- */
.coverage {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 60;
  background: transparent;
  pointer-events: none;
}
.coverage__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: background 0.3s ease;
}
.coverage.is-full .coverage__bar {
  background: linear-gradient(90deg, var(--ok), var(--ok));
  box-shadow: 0 0 14px rgba(51, 209, 122, 0.5);
}
.coverage__readout {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  white-space: nowrap;
  user-select: none;
}
.coverage__readout b { color: var(--text-muted); font-weight: 500; }
.coverage__readout.is-full b { color: var(--ok); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.72em 1.35em;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn--primary {
  --btn-bg: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px -8px var(--accent-glow);
}
.btn--primary:hover { box-shadow: 0 14px 34px -8px var(--accent-glow); border-color: transparent; }

.btn svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  vertical-align: middle;
}
.chip--live {
  border-color: transparent;
  background: rgba(51, 209, 122, 0.14);
  color: var(--ok);
}
.chip--soft {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Navbar ---------- */
.nav {
  position: fixed;
  top: 3px; left: 0; right: 0;
  z-index: 50;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--border);
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  white-space: nowrap;
}
.nav__brand .dot { color: var(--accent); }
.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav__links a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav__links a:hover,
.nav__links a.active { color: var(--text); background: var(--surface-2); }

.nav__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }

.nav__burger { display: none; }

/* ---------- Lens switch ---------- */
.lens-switch {
  display: inline-flex;
  position: relative;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.lens-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.lens-switch__btn svg { width: 14px; height: 14px; }
.lens-switch__btn:hover { color: var(--text-muted); }
.lens-switch__btn[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 14px -5px var(--accent-glow);
}
.lens-switch__btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* Nudge first-time visitors to try the switch */
.lens-switch.is-hinting::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  animation: hintRing 2.4s ease-out 3;
  pointer-events: none;
}
@keyframes hintRing {
  0%   { opacity: 0.8; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.12); }
  100% { opacity: 0;   transform: scale(1.12); }
}

/* ---------- ⌘K hint ---------- */
.cmdk-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.cmdk-hint:hover { border-color: var(--accent); }
.cmdk-hint:focus-visible { outline: none; box-shadow: var(--ring); }
kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.5;
}

/* ---------- Sections ---------- */
section { padding: 96px 0; }
.section-head { max-width: 680px; margin-bottom: 48px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 0.6em;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent);
  display: inline-block;
}
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.section-head p { color: var(--text-muted); margin: 14px 0 0; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 128px;
  padding-bottom: 48px;
}
.hero__grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 56px;
  align-items: center;
  width: 100%;
}
.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  margin-bottom: 24px;
}
.hero__status .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(51, 209, 122, 0.6);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(51, 209, 122, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(51, 209, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(51, 209, 122, 0); }
}
.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.2rem);
  margin-bottom: 6px;
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  color: var(--text-muted);
  margin: 8px 0 0;
  line-height: 1.25;
}
.hero__tagline em {
  font-style: normal;
  color: var(--accent);
}
.hero__lead {
  color: var(--text-muted);
  max-width: 52ch;
  margin: 22px 0 0;
  font-size: 1rem;
}
.hero__lead strong { color: var(--text); font-weight: 600; }
.hero__lead em { color: var(--text); font-style: italic; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.hero__side { justify-self: center; }
.hero__portrait {
  position: relative;
  width: min(300px, 80vw);
  aspect-ratio: 1;
}
.hero__portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 30px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
}
.hero__portrait::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 40px;
  background: conic-gradient(from 120deg, var(--accent), transparent 40%, var(--accent-2), transparent 80%, var(--accent));
  filter: blur(28px);
  opacity: 0.4;
  z-index: -1;
  transition: background 0.4s ease;
}
.hero__badge {
  position: absolute;
  bottom: -14px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.hero__badge b { color: var(--text); font-weight: 600; }

/* ---------- Terminal console ---------- */
.console {
  margin-top: 56px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.console__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.console__dots { display: inline-flex; gap: 6px; }
.console__dots i {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
}
.console__dots i:first-child { background: #ff5f57; }
.console__dots i:nth-child(2) { background: #febc2e; }
.console__dots i:nth-child(3) { background: #28c840; }
.console__title {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-faint);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.console__badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.console__badge--pass { background: rgba(51, 209, 122, 0.14); color: var(--ok); }

.console__body {
  margin: 0;
  padding: 20px 22px 24px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.85;
  color: var(--text-muted);
  min-height: 17em;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
.console__out .c-cmd    { color: var(--text); font-weight: 500; }
.console__out .c-suite  { color: var(--accent); }
.console__out .c-pass   { color: var(--ok); }
.console__out .c-dim    { color: var(--text-faint); }
.console__out .c-time   { color: var(--text-faint); font-size: 0.92em; }
.console__out .c-sum    { color: var(--ok); font-weight: 500; }
.console__caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}
.console.is-done .console__caret { animation: none; opacity: 0.35; }
@keyframes blink { 50% { opacity: 0; } }

/* Screen-reader / no-JS description of the console */
.console__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Impact stats ---------- */
.impact { padding-top: 0; padding-bottom: 72px; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(700px 160px at 50% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}
.stat { text-align: center; padding: 6px 8px; }
.stat__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.4vw, 2.7rem);
  line-height: 1;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
}

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 56px;
  align-items: start;
}
.about__body p { color: var(--text-muted); margin: 0 0 18px; }
.about__body p strong { color: var(--text); font-weight: 600; }
.about__body p em { color: var(--text); font-style: italic; }
.facts { display: grid; gap: 14px; }
.fact {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.fact svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.fact .k { font-size: 0.78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.fact .v { font-weight: 600; line-height: 1.4; }

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 22px;
}
.timeline__item {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 26px;
  position: relative;
}
.timeline__when {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  padding-top: 22px;
  text-align: right;
  position: relative;
}
/* Rail + node */
.timeline__when::after {
  content: "";
  position: absolute;
  right: -14px; top: 28px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline__item.is-current .timeline__when::after {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg), 0 0 12px var(--accent-glow);
}
.timeline__item::before {
  content: "";
  position: absolute;
  left: 145px; top: 40px; bottom: -30px;
  width: 1px;
  background: var(--border);
}
.timeline__item:last-child::before { display: none; }
.timeline__item--dashed::before,
.timeline__item--dashed + .timeline__item::before { background: none; }

.timeline__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}
.timeline__card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.timeline__item--dashed .timeline__card {
  background: transparent;
  border-style: dashed;
  border-color: var(--border-strong);
}
.timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.timeline__card h3 { font-size: 1.2rem; }
.timeline__org {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin: 6px 0 14px;
}
.timeline__card ul {
  margin: 0 0 16px;
  padding-left: 1.1em;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.timeline__card li { margin-bottom: 8px; }
.timeline__card li::marker { color: var(--accent); }
.timeline__card b { color: var(--text); font-weight: 600; }
.timeline__link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}
.timeline__link svg { width: 16px; height: 16px; transition: transform 0.18s ease; }
.timeline__link:hover svg { transform: translateX(3px); }

/* ---------- Skills ---------- */
/* 5 cards over 3 columns (3 + 2) reads better than a 4 + 1 orphan */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.skill-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.skill-card__icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 18px;
}
.skill-card__icon svg { width: 24px; height: 24px; }
.skill-card h3 {
  font-size: 1.15rem;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* PM lens promotes the product card to the front; SDET lens sends it last */
:root[data-lens="pm"] .skill-card[data-order-pm="1"] { order: 1; }
:root[data-lens="pm"] .skill-card[data-order-pm="2"] { order: 2; }
:root[data-lens="pm"] .skill-card[data-order-pm="3"] { order: 3; }
:root[data-lens="pm"] .skill-card[data-order-pm="4"] { order: 4; }
:root[data-lens="pm"] .skill-card[data-order-pm="5"] { order: 5; }
:root[data-lens="sdet"] .skill-card[data-order-pm="1"] { order: 5; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* ---------- Projects ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
}
.project:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.project__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.project__folder { color: var(--accent); }
.project__folder svg { width: 30px; height: 30px; }
.project__links { display: flex; gap: 6px; color: var(--text-faint); }
.project__links a { transition: color 0.15s ease, transform 0.15s ease; }
.project__links a:hover { color: var(--text); transform: translateY(-2px); }
.project__links svg { width: 20px; height: 20px; }
.project h3 { font-size: 1.2rem; margin-bottom: 10px; }
.project > p { color: var(--text-muted); font-size: 0.95rem; margin: 0 0 20px; flex: 1; }

/* Product-lens case framing */
.project__case { flex: 1; margin-bottom: 20px; }
.project__case p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 10px;
  padding-left: 0;
}
.project__case p:last-child { margin-bottom: 0; }
.project__case b {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1px;
}

.project__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.project__lang { display: inline-flex; align-items: center; gap: 0.5em; }
.project__lang .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Product track ---------- */
.pm__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.pm__col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.pm__col-title {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 1.05rem;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.pm__col-title svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.pm__list { margin: 0; padding-left: 1.1em; }
.pm__list li {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
}
.pm__list li:last-child { margin-bottom: 0; }
.pm__list li::marker { color: var(--accent); }
.pm__list b { color: var(--text); font-weight: 600; }

.pm__next {
  margin-top: 24px;
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.pm__next-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.pm__next-head h3 { font-size: 1.05rem; }
.pm__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.pm__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.pm__card-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.pm__card h4 { font-size: 1rem; margin: 8px 0 8px; }
.pm__card p { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 14px; line-height: 1.6; }
.pm__card-state {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.pm__card-state::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.pm__note {
  margin: 22px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.pm__note a { color: var(--accent); font-weight: 600; border-bottom: 1px solid transparent; }
.pm__note a:hover { border-bottom-color: var(--accent); }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact__card {
  background:
    radial-gradient(600px 200px at 50% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 64px 32px;
}
.contact__card h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 16px; }
.contact__card p { color: var(--text-muted); max-width: 54ch; margin: 0 auto 32px; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Footer ---------- */
.footer {
  padding: 40px 0 56px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.9rem;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }
.footer .heart { color: var(--accent); }
.footer__socials { display: flex; gap: 8px; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- Command palette ---------- */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
}
.cmdk[hidden] { display: none; }
.cmdk__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease both;
}
:root[data-theme="light"] .cmdk__backdrop { background: rgba(20, 24, 40, 0.35); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.cmdk__panel {
  position: relative;
  width: min(560px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: cmdkIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cmdkIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.cmdk__field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk__field svg { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }
.cmdk__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  outline: none;
}
.cmdk__input::placeholder { color: var(--text-faint); }
.cmdk__esc { flex-shrink: 0; }

.cmdk__list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: min(52vh, 360px);
  overflow-y: auto;
}
.cmdk__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.94rem;
  color: var(--text-muted);
}
.cmdk__item svg { width: 17px; height: 17px; color: var(--text-faint); flex-shrink: 0; }
.cmdk__item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--text);
}
.cmdk__item[aria-selected="true"] svg { color: var(--accent); }
.cmdk__item-kind {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.cmdk__empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
}
.cmdk__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.76rem;
  color: var(--text-faint);
}
.cmdk__foot span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  z-index: 110;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .coverage__readout { display: none; }
}

@media (max-width: 940px) {
  .nav__links a { padding: 8px 10px; font-size: 0.85rem; }
  .cmdk-hint { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 22px 12px; }
  .pm__grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .hero { padding-top: 116px; }
  .hero__grid { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .hero__cta { justify-content: center; }
  .hero__status { margin-inline: auto; }
  .hero__lead { margin-inline: auto; }
  .hero__side { order: -1; }
  .hero__portrait { width: min(220px, 60vw); }
  .about__grid { grid-template-columns: 1fr; gap: 36px; }
  .console { margin-top: 44px; text-align: left; }

  .timeline__item { grid-template-columns: 1fr; gap: 10px; }
  .timeline__when { text-align: left; padding-top: 0; padding-left: 2px; }
  .timeline__when::after { display: none; }
  .timeline__item::before { display: none; }

  .nav__links {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(78vw, 320px);
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    background: var(--bg-elev);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    /* hidden, not merely off-screen — keeps the links out of the tab order */
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
  }
  .nav__links.open { transform: translateX(0); visibility: visible; }
  .nav__links a { padding: 14px 18px; font-size: 1.05rem; }
  .nav__burger {
    display: inline-grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    z-index: 60;
  }
  .nav__burger svg { width: 22px; height: 22px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  section { padding: 72px 0; }
  .impact { padding-top: 0; padding-bottom: 56px; }
  .contact__card { padding: 44px 22px; }
  .nav__inner { padding: 12px 16px; gap: 8px; }
  .container { padding: 0 18px; }
  .lens-switch__btn { padding: 6px 10px; font-size: 0.7rem; }
  .lens-switch__btn span { display: none; }
  .lens-switch__btn[aria-pressed="true"] span { display: inline; }
  .console__body { font-size: 0.76rem; padding: 16px 16px 20px; min-height: 19em; }
  .stats { padding: 22px 14px; }
  .pm__col, .pm__next { padding: 22px 20px; }
}
