/* ============================================================
   Jad Bader — Portfolio
   Monochrome / editorial / grotesk + mono
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* dark (default) */
  --bg: #0c0c0d;
  --bg-soft: #141416;
  --bg-elev: #161618;
  --fg: #eceae3;
  --fg-dim: #9a9a93;
  --fg-faint: #6a6a64;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #eceae3;            /* mono by default */
  --accent-ink: #0c0c0d;        /* text on accent fills */
  --grain-opacity: 0.045;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);

  --maxw: 1440px;
  --pad: clamp(20px, 5vw, 76px);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f1f0ea;
  --bg-soft: #e9e8e1;
  --bg-elev: #fbfaf6;
  --fg: #17171a;
  --fg-dim: #5c5c57;
  --fg-faint: #8d8d86;
  --line: rgba(0, 0, 0, 0.13);
  --line-strong: rgba(0, 0, 0, 0.26);
  --accent: #17171a;
  --accent-ink: #f1f0ea;
  --grain-opacity: 0.03;
  --shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.28);
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
::selection { background: var(--fg); color: var(--bg); }

/* ---------- Grain ---------- */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9000;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
:root[data-theme='light'] .grain { mix-blend-mode: multiply; }

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--fg);
  pointer-events: none;
  z-index: 9500;
  transform: translate3d(-100px, -100px, 0) translate(-50%, -50%);
  transition: width 0.3s var(--ease), height 0.3s var(--ease),
              background 0.3s var(--ease), opacity 0.3s var(--ease);
  mix-blend-mode: difference;
  opacity: 0;
}
.cursor.is-visible { opacity: 1; }
.cursor.is-lg { width: 70px; height: 70px; }
.cursor.is-hover { width: 44px; height: 44px; }
@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}
/* On precise pointers the circle replaces the system cursor entirely. */
@media (hover: hover) and (pointer: fine) {
  *, *::before, *::after { cursor: none !important; }
}

/* ---------- Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.section {
  padding-block: clamp(80px, 12vh, 160px);
  position: relative;
}
/* full-bleed hairline so each section reads as a distinct space */
.section::before,
.contact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 1px;
  background: var(--line);
}
/* subtle alternating band for extra separation between spaces */
.section[data-band]::after,
.contact[data-band]::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background: var(--bg-soft);
  opacity: 0.6;
  z-index: -1;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--line-strong);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: clamp(40px, 6vh, 72px);
}
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.section-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--fg-faint);
}

/* ---------- Reveal ----------
   Transform-only (opacity stays 1) so the resting state is always painted —
   transitions can freeze at their start value in backgrounded iframes / print /
   PDF export, and a faded-out element would vanish. A small slide can't hide it. */
.reveal {
  transform: translateY(20px);
  transition: transform 0.6s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: transform;
}
.reveal.in { transform: none; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--pad);
  transition: padding 0.4s var(--ease), background 0.4s var(--ease),
              border-color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  padding-block: 11px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--line);
}
.nav-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.nav-name:hover { opacity: 0.7; }
/* availability status, lives in the menu bar */
.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  white-space: nowrap;
}
.nav-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: pulse 2.6s infinite;
  flex: none;
}
:root[data-theme='light'] .nav-status-dot { background: #16a34a; }
@media (max-width: 560px) { .nav-status-text { display: none; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}
.nav-right {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 34px);
}
.nav-links {
  display: flex;
  gap: clamp(14px, 2vw, 30px);
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  position: relative;
  padding-block: 4px;
  transition: color 0.25s var(--ease);
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav-links a:hover { color: var(--fg); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.active { color: var(--fg); }
.nav-links a.active::after { transform: scaleX(1); }
@media (max-width: 720px) { .nav-links { display: none; } }

.theme-toggle {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.4s var(--ease);
}
.theme-toggle:hover { color: var(--fg); border-color: var(--line-strong); transform: rotate(18deg); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme='light'] .theme-toggle .sun { display: none; }
:root[data-theme='light'] .theme-toggle .moon { display: block; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 90px;
  position: relative;
}
.hero-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: clamp(28px, 5vh, 50px);
}
.hero-meta .eyebrow::before { width: 32px; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(3.4rem, 13vw, 11.5rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
}
.hero-title .line { display: block; }
.hero-title .line > span { display: block; }
.hero-title.reveal { transform: translateY(34px); }
.hero-title.reveal { transition-duration: 0.9s; }

.hero-statement {
  margin-top: clamp(30px, 5vh, 54px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  flex-wrap: wrap;
}
.hero-statement p {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.45;
  max-width: 30ch;
  color: var(--fg);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.hero-statement p .dim { color: var(--fg-dim); }
.hero-scroll {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.hero-scroll .bar {
  position: relative;
  width: 1px; height: 38px;
  background: var(--line);
  overflow: hidden;
}
.hero-scroll .bar::after {
  content: '';
  position: absolute;
  top: -50%; left: 0;
  width: 100%; height: 50%;
  background: var(--fg);
  animation: scrolldown 2.2s var(--ease) infinite;
}
@keyframes scrolldown {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(300%); }
}

/* ============================================================
   WORK
   ============================================================ */
.work-list { display: flex; flex-direction: column; }

/* shared card bits */
.proj-index {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
}
.proj-title {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.02;
  transition: transform 0.4s var(--ease);
}
.proj-desc { color: var(--fg-dim); line-height: 1.5; }
.proj-role {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 11px;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.proj:hover .tag { border-color: var(--line-strong); }

/* brand-colored chips (Python, AWS, etc.) */
.brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--brand, var(--fg-faint));
  transition: transform 0.3s var(--ease);
}
.tag.is-brand, .skill.is-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tag.is-brand:hover, .skill.is-brand:hover {
  color: var(--brand-ink, var(--fg));
  border-color: color-mix(in srgb, var(--brand, var(--line-strong)) 55%, var(--line));
  background: color-mix(in srgb, var(--brand, transparent) 9%, transparent);
}
.tag.is-brand:hover .brand-dot, .skill.is-brand:hover .brand-dot { transform: scale(1.25); }
.proj-arrow {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--fg-dim);
  flex: none;
  transition: transform 0.45s var(--ease), background 0.35s var(--ease),
              color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.proj-arrow svg { width: 17px; height: 17px; }
.proj:hover .proj-arrow {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  transform: rotate(-45deg);
}
.proj-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.thumb-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, monospace);
  font-size: clamp(28px, 6vw, 64px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: color-mix(in oklab, var(--fg) 12%, transparent);
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in oklab, var(--fg) 6%, transparent), transparent 60%),
    var(--bg-soft);
}

/* ---- Layout A: stacked editorial rows (default) ---- */
[data-work-layout='stack'] .work-list .proj {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(28px, 5vw, 88px);
  align-items: start;
  padding-block: clamp(34px, 5vh, 54px);
  border-top: 1px solid var(--line);
  position: relative;
}
[data-work-layout='stack'] .work-list .proj:last-child { border-bottom: 1px solid var(--line); }
[data-work-layout='stack'] .proj-thumb {
  display: none;
}
/* index reads as a spaced badge, set off from the content block */
[data-work-layout='stack'] .proj-index {
  align-self: start;
  margin-top: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--fg-dim);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
[data-work-layout='stack'] .proj:hover .proj-index { border-color: var(--line-strong); color: var(--fg); }
[data-work-layout='stack'] .proj-main { display: flex; flex-direction: column; gap: 14px; }
[data-work-layout='stack'] .proj-title { font-size: clamp(1.6rem, 4vw, 2.9rem); }
[data-work-layout='stack'] .proj-desc { max-width: 52ch; font-size: 1rem; }
/* year sits at the top, arrow drops to the bottom — clear vertical breathing room */
[data-work-layout='stack'] .proj-side {
  display: flex; flex-direction: column; align-self: stretch;
  align-items: flex-end; justify-content: space-between; gap: 18px; text-align: right;
}
[data-work-layout='stack'] .proj-side .proj-role {
  margin-top: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--fg-dim);
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
[data-work-layout='stack'] .proj:hover .proj-side .proj-role { border-color: var(--line-strong); color: var(--fg); }
[data-work-layout='stack'] .proj:hover .proj-title { transform: translateX(12px); }
[data-work-layout='stack'] .proj::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-soft);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.4s var(--ease);
}
[data-work-layout='stack'] .proj:hover::after { opacity: 0.55; }
@media (max-width: 760px) {
  [data-work-layout='stack'] .work-list .proj {
    grid-template-columns: auto 1fr;
    gap: 16px 20px;
  }
  [data-work-layout='stack'] .proj-side {
    grid-column: 1 / -1;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    text-align: left;
    justify-content: space-between;
  }
  [data-work-layout='stack'] .proj-arrow { display: none; }
}

/* ---- Layout B: two-column grid of cards ---- */
[data-work-layout='grid'] .work-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(24px, 3.5vw, 48px);
}
[data-work-layout='grid'] .proj {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--bg-soft);
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
}
[data-work-layout='grid'] .proj:hover { border-color: var(--line-strong); transform: translateY(-4px); }
[data-work-layout='grid'] .proj-thumb { display: block; }
[data-work-layout='grid'] .proj-main { display: flex; flex-direction: column; gap: 12px; padding: 0 6px 6px; }
[data-work-layout='grid'] .proj-title { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
[data-work-layout='grid'] .proj-topline { display: flex; justify-content: space-between; align-items: center; }
[data-work-layout='grid'] .proj-desc { font-size: 0.96rem; }
[data-work-layout='grid'] .proj-side { display: flex; flex-direction: column; gap: 14px; }
[data-work-layout='grid'] .proj-meta-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
@media (max-width: 760px) {
  [data-work-layout='grid'] .work-list { grid-template-columns: 1fr; }
}

/* ---- Layout C: alternating big blocks ---- */
[data-work-layout='alt'] .work-list { gap: clamp(48px, 8vh, 110px); }
[data-work-layout='alt'] .proj {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
}
[data-work-layout='alt'] .proj:nth-child(even) .proj-thumb { order: 2; }
[data-work-layout='alt'] .proj-thumb { display: block; aspect-ratio: 4 / 3; transition: transform 0.5s var(--ease); }
[data-work-layout='alt'] .proj:hover .proj-thumb { transform: scale(1.012); }
[data-work-layout='alt'] .proj-main { display: flex; flex-direction: column; gap: 18px; }
[data-work-layout='alt'] .proj-title { font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
[data-work-layout='alt'] .proj-desc { max-width: 42ch; }
[data-work-layout='alt'] .proj-side { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
[data-work-layout='alt'] .proj-topline { display: flex; align-items: center; gap: 16px; }
@media (max-width: 760px) {
  [data-work-layout='alt'] .proj { grid-template-columns: 1fr; gap: 22px; }
  [data-work-layout='alt'] .proj:nth-child(even) .proj-thumb { order: 0; }
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(40px, 7vw, 110px);
  align-items: start;
}
@media (max-width: 880px) { .about-grid { grid-template-columns: 1fr; gap: 48px; } }
.about-lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.28;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}
.about-lead .muted { color: var(--fg-faint); }
.about-body { margin-top: 28px; color: var(--fg-dim); max-width: 56ch; font-size: 1.02rem; }
.about-body p + p { margin-top: 16px; }

.about-side { display: flex; flex-direction: column; gap: 36px; }
.side-block .side-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  display: block;
}
.skill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.skill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.skill:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-soft); }
.looking-list { list-style: none; display: flex; flex-direction: column; gap: 13px; }
.looking-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--fg);
  font-size: 1rem;
}
.looking-list li::before {
  content: '↳';
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ============================================================
   TIMELINE / ACCOMPLISHMENTS
   ============================================================ */
.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: clamp(16px, 4vw, 48px);
  padding-block: clamp(22px, 3.4vh, 34px);
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.tl-item:last-child { border-bottom: 1px solid var(--line); }
.tl-year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
}
.tl-body h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  letter-spacing: -0.02em;
}
.tl-body p { color: var(--fg-dim); margin-top: 6px; font-size: 0.98rem; max-width: 54ch; }
.tl-kind {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .tl-item { grid-template-columns: 1fr; gap: 8px; }
  .tl-kind { order: -1; }
}

.certs {
  margin-top: clamp(40px, 6vh, 72px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cert {
  background: var(--bg);
  padding: 24px clamp(20px, 3vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.3s var(--ease);
}
.cert:hover { background: var(--bg-soft); }
.cert .cert-name { font-size: 1rem; letter-spacing: -0.01em; line-height: 1.3; }
.cert .cert-status {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.cert .cert-status.live { color: #4ade80; }
:root[data-theme='light'] .cert .cert-status.live { color: #16a34a; }

/* ============================================================
   CONTACT / FOOTER
   ============================================================ */
.contact { padding-block: clamp(90px, 14vh, 180px); position: relative; }
.contact-head {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 9vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}
.contact-mail {
  display: inline-flex;
  align-items: center;
  gap: 0.12em;
  position: relative;
}
.contact-mail .ul {
  background-image: linear-gradient(var(--fg), var(--fg));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.45s var(--ease);
  padding-bottom: 0.04em;
}
.contact-mail:hover .ul { background-size: 100% 2px; }
.contact-sub {
  margin-top: clamp(30px, 5vh, 54px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
}
.contact-links { display: flex; gap: 10px; flex-wrap: wrap; }
.clink {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 10px 18px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease), background 0.3s var(--ease);
}
.clink svg { width: 15px; height: 15px; }
.clink:hover { color: var(--fg); border-color: var(--line-strong); transform: translateY(-2px); background: var(--bg-soft); }
.contact-note {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--fg-faint);
  text-align: right;
  line-height: 1.7;
}

.footer {
  border-top: 1px solid var(--line);
  padding-block: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.footer span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
}
.footer .to-top {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color 0.25s var(--ease);
}
.footer .to-top:hover { color: var(--fg); }

/* ============================================================
   SUBPAGES — projects index + project detail
   ============================================================ */
.page {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
  padding-top: clamp(120px, 18vh, 210px);
  padding-bottom: clamp(72px, 11vh, 130px);
  min-height: 100svh;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
  margin-bottom: clamp(34px, 6vh, 60px);
}
.back-link:hover { color: var(--fg); gap: 14px; }
.back-link svg { width: 15px; height: 15px; }

.page-head { margin-bottom: clamp(40px, 7vh, 80px); }
.page-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-top: 22px;
}
.page-intro {
  margin-top: 26px;
  max-width: 58ch;
  color: var(--fg-dim);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.5;
  text-wrap: pretty;
}

/* categorized listing */
.proj-category { margin-top: clamp(46px, 7vh, 88px); }
.cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
}
.cat-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.3rem, 2.6vw, 1.95rem);
  letter-spacing: -0.025em;
}
.cat-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  white-space: nowrap;
}
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: clamp(18px, 2vw, 28px);
}
.pcard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(22px, 2.4vw, 30px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--bg-soft);
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
}
.pcard:hover { border-color: var(--line-strong); transform: translateY(-4px); }
.pcard-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.pcard-year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
}
.pcard-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.pcard-desc { color: var(--fg-dim); font-size: 0.96rem; line-height: 1.5; flex: 1; }
.pcard-arrow {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--fg-dim);
  flex: none;
  transition: transform 0.45s var(--ease), background 0.35s var(--ease),
              color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.pcard-arrow svg { width: 16px; height: 16px; }
.pcard:hover .pcard-arrow {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  transform: rotate(-45deg);
}

/* project detail */
.proj-hero { max-width: 62ch; }
.proj-hero .eyebrow { margin-bottom: 26px; }
.proj-hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6.5vw, 5rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.proj-lead {
  margin-top: 28px;
  color: var(--fg-dim);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.45;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}
.proj-detail {
  margin-top: clamp(48px, 8vh, 90px);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
@media (max-width: 880px) { .proj-detail { grid-template-columns: 1fr; gap: 44px; } }
.detail-block + .detail-block { margin-top: 42px; }
.detail-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  display: block;
}
.detail-body p { color: var(--fg-dim); line-height: 1.62; }
.detail-body p + p { margin-top: 14px; }
.detail-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.detail-list li { display: flex; gap: 13px; align-items: baseline; color: var(--fg); line-height: 1.5; }
.detail-list li::before {
  content: '↳';
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 0.85em;
  flex: none;
}
.detail-side { display: flex; flex-direction: column; gap: 30px; }
.meta-row { display: flex; flex-direction: column; gap: 6px; }
.meta-k {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.meta-v { color: var(--fg); font-size: 1rem; }
.detail-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ============================================================
   CHAT WIDGET (recruiter assistant)
   ============================================================ */
.chat { position: fixed; right: clamp(16px, 3vw, 32px); bottom: clamp(16px, 3vw, 32px); z-index: 1200; }
/* keep normal cursors inside the chat so typing/clicking feels native */
.chat, .chat * { cursor: auto !important; }
.chat button, .chat .chat-chip { cursor: pointer !important; }
.chat .chat-input { cursor: text !important; }

.chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 100px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s var(--ease), opacity 0.25s var(--ease);
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab svg { width: 18px; height: 18px; }
.chat-open .chat-fab { opacity: 0; pointer-events: none; transform: scale(0.9); }
@media (max-width: 460px) { .chat-fab-text { display: none; } .chat-fab { padding: 14px; } }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100svh - 110px));
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.26s var(--ease), transform 0.26s var(--ease);
}
.chat-open .chat-panel { opacity: 1; transform: none; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.chat-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}
.chat-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; flex: none;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: pulse 2.6s infinite;
}
:root[data-theme='light'] .chat-dot { background: #16a34a; }
.chat-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg-dim);
  border: 1px solid transparent;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.chat-close:hover { color: var(--fg); border-color: var(--line); }
.chat-close svg { width: 15px; height: 15px; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg--bot {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--fg);
  border-bottom-left-radius: 5px;
}
.chat-msg--user {
  align-self: flex-end;
  background: var(--fg);
  color: var(--bg);
  border-bottom-right-radius: 5px;
}
.chat-typing { display: inline-flex; gap: 5px; align-items: center; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg-faint);
  animation: chatBounce 1.2s var(--ease) infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 4px; }
.chat-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 11px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.chat-chip:hover { color: var(--fg); border-color: var(--line-strong); background: var(--bg-soft); }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  flex: none;
}
.chat-input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 10px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color 0.25s var(--ease);
}
.chat-input::placeholder { color: var(--fg-faint); }
.chat-input:focus { outline: none; border-color: var(--line-strong); }
.chat-send {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  display: grid; place-items: center;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.chat-send:hover { transform: scale(1.06); }
.chat-send:disabled { opacity: 0.4; }
.chat-send svg { width: 17px; height: 17px; }
.chat-foot {
  padding: 0 16px 12px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: center;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { transform: none; }
  .hero-title .line > span { transform: none !important; }
  .cursor { display: none; }
}
