/* ==========================================================================
   Jung Mo Kang — Portfolio
   Static HTML + one stylesheet. Dark-only (OLED). 8pt spacing grid.
   ========================================================================== */

:root {
  --bg: #0F1116;          /* page background (warm graphite, off pure slate) */
  --surface: #171A21;     /* cards */
  --surface-2: #1F232C;   /* hover / muted surface */
  --border: #2B303B;      /* card & divider borders */
  --text: #F2F1ED;        /* primary text (warm near-white) */
  --text-2: #B4A695;      /* secondary text (warm desaturated sand, same temp axis as accent) */
  --accent: #E8A33D;      /* signal amber accent */
  --accent-hover: #F2B75C;   /* brighter accent for button hover */
  --accent-dim: rgba(232, 163, 61, 0.12);  /* chip/badge fills */
  --accent-30: rgba(232, 163, 61, 0.30);   /* chip borders */
  --accent-40: rgba(232, 163, 61, 0.44);   /* card hover border */
  --on-accent: #241806;   /* near-black text on amber buttons */

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Zilla Slab', 'Hanken Grotesk', Georgia, serif;

  --container: 1080px;
  --gutter: 24px;
  --radius: 14px;
  --section-y: 96px;
}

/* ----- Reset / base --------------------------------------------------------*/
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

@media (min-width: 1024px) {
  body { font-size: 17px; }
}

img, svg { max-width: 100%; }

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

p { margin: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul { margin: 0; padding: 0; list-style: none; }

/* ----- Focus / a11y --------------------------------------------------------*/
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 1000;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: top 150ms ease-out;
}
.skip-link:focus { top: 8px; text-decoration: none; }

/* ----- Layout helpers ------------------------------------------------------*/
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }

/* Rhythm variation — a subtly recessed full-bleed band breaks the uniform
   background so sections read as distinct landmarks, not one stamped column. */
.section--band {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
/* Tighter opening for the writing section so spacing is not a constant. */
.section--tight { padding-block: 72px; }

/* Asymmetric two-column: a lead statement sits beside its card grid. */
@media (min-width: 900px) {
  .how-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 56px;
    align-items: start;
  }
  .how-layout .section-head {
    margin-bottom: 0;
    position: sticky;
    top: 96px;
  }
  .how-layout .grid-how { grid-template-columns: repeat(2, 1fr); }
}

.section-head { margin-bottom: 44px; max-width: 62ch; }

.section-title {
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.08;
  margin-bottom: 16px;
  text-wrap: balance;
}

.section-intro {
  color: var(--text-2);
  font-size: 18px;
  line-height: 1.6;
  max-width: 60ch;
}

/* ----- Chips ---------------------------------------------------------------*/
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.chip {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
}

/* ----- Buttons -------------------------------------------------------------*/
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  padding: 13px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 180ms ease-out, border-color 180ms ease-out,
              transform 180ms ease-out, color 180ms ease-out;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { transform: translateY(-2px); background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--accent-40);
  color: var(--text);
}

.btn svg { width: 18px; height: 18px; flex: none; }

/* ----- Header --------------------------------------------------------------*/
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background: rgba(15, 17, 22, 0.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  flex: none;
}
.logo:hover { text-decoration: none; color: var(--accent); }

.primary-nav {
  margin-left: auto;
  min-width: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-list a {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 150ms ease-out, background-color 150ms ease-out;
}
.nav-list a:hover { color: var(--text); text-decoration: none; }
.nav-list a[aria-current="true"] { color: var(--accent); }

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  color: var(--text-2);
  border-radius: 8px;
  flex: none;
}
.nav-icon:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-icon svg { width: 20px; height: 20px; }

/* Hamburger toggle — hidden on desktop, the nav mechanism on mobile. */
.nav-toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent-40); }
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 767px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed;
    left: 0; right: 0;
    top: 64px;
    background: rgba(15, 17, 22, 0.96);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 8px var(--gutter) 16px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 160ms ease-out, transform 160ms ease-out, visibility 160ms;
  }
  .primary-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .nav-list li { width: 100%; }
  .nav-list a {
    display: block;
    font-size: 16px;
    padding: 12px 12px;
    border-radius: 8px;
  }
  .nav-list .nav-icon { width: auto; height: auto; padding: 12px; justify-content: flex-start; gap: 10px; }
  .nav-list .nav-icon::after { content: "GitHub"; font-size: 16px; font-weight: 500; }
}

/* ----- Hero ----------------------------------------------------------------*/
.hero {
  position: relative;
  padding-block: 88px 72px;
  overflow: hidden;
}

.hero::before {
  /* dotted grid — neutral, not accent-tinted */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(166, 167, 174, 0.28) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.3;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
  z-index: 0;
  pointer-events: none;
}

.hero .container { position: relative; z-index: 1; }

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 20px;
}

.hero h1 {
  /* Oversized editorial display — caps at 5.5rem on desktop (below the 6rem
     ceiling); letter-spacing held at -0.03em (looser than the -0.04em floor). */
  font-size: clamp(38px, 9vw, 5.5rem);
  line-height: 1.03;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.hero .role {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 20px;
}
.hero .role .role-sep { color: var(--border); margin: 0 4px; }
.hero .role .role-years { color: var(--accent); }

/* Seeking-intent / availability line */
.hero-available {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 24px;
  max-width: 60ch;
  line-height: 1.5;
}
.hero-available .dot {
  position: relative;
  top: -2px;
  flex: none;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.hero .lead {
  font-size: 19px;
  color: var(--text);
  max-width: 54ch;
  line-height: 1.6;
  margin-bottom: 28px;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

/* Proof strip — project names visible before any scroll */
.proof-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--text-2);
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.proof-strip .proof-label {
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
}
.proof-strip a {
  color: var(--text);
  padding: 1px 2px;
  border-radius: 4px;
  transition: color 150ms ease-out;
}
.proof-strip a:hover { color: var(--accent); text-decoration: none; }
.proof-strip .proof-sep { color: var(--border); }

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
}
.hero-links a:hover { color: var(--accent); text-decoration: none; }
.hero-links svg { width: 18px; height: 18px; }
/* Email as the emphasized contact action in the hero */
.hero-links a.hero-email { color: var(--accent); font-weight: 600; }
.hero-links a.hero-email:hover { color: var(--accent-hover); }

/* ----- Figures ribbon ------------------------------------------------------
   A compact inline credential band, not a big-number stat template: the
   figures read as one line of provenance, each numeral flagged in mono. */
.stats {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stats .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 32px;
  padding-block: 22px;
}
.stat {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.stat .num {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
  letter-spacing: -0.01em;
  flex: none;
}
.stat .label {
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.35;
}

@media (min-width: 768px) {
  .stats .container { gap: 12px 44px; }
}

/* ----- Card grids ----------------------------------------------------------*/
.grid { display: grid; gap: 20px; }

.grid-os { grid-template-columns: 1fr; }
.grid-field { grid-template-columns: 1fr; }
.grid-how { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid-os { grid-template-columns: repeat(2, 1fr); }
  .grid-field { grid-template-columns: repeat(2, 1fr); }
  .grid-how { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-os { grid-template-columns: repeat(3, 1fr); }
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 200ms ease-out, transform 200ms ease-out,
              background-color 200ms ease-out;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Open-source card is a whole link (stretched-link) */
.card-link:hover {
  border-color: var(--accent-40);
  transform: translateY(-2px);
  background: var(--surface-2);
}
.card-link:focus-within {
  border-color: var(--accent-40);
}
.card-link .stretched {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

/* Field-work and how-i-work cards do not navigate — no hover lift/glow,
   so motion-on-hover stays reserved for genuinely clickable cards. */
.card-link .stretched:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.card-name {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.card-link:hover .card-name { color: var(--accent); }

/* Case-study card — has its own explicit links, so no stretched-link. */
.card-study { border-color: var(--accent-30); }
.card-badge {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: -4px;
}
.card-study .card-chips { margin-top: 0; }
.card-actions {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: auto;
  padding-top: 4px;
}
.card-action-primary {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.card-action-secondary {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
}
.card-action-secondary:hover { color: var(--text); text-decoration: none; }

.card-desc {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}

.card-chips { margin-top: auto; }

/* Field-work card */
.entry .entry-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.entry .entry-role {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.entry .bullets {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.entry .bullets li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
}
.entry .bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.7;
}

/* How-I-Work — a principle spec-list, not a grid of identical cards.
   Rows are separated by hairlines and read as an engineering datasheet. */
.grid-how { gap: 0 44px; }
.how-item {
  padding: 22px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.how-item .how-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
}
.how-item .how-body {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.6;
}

.how-footer { margin-top: 28px; }
.how-footer a, .os-footer a {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.os-footer { margin-top: 28px; }

/* ----- Writing featured card ----------------------------------------------*/
.writing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 768px) {
  .writing-grid { grid-template-columns: repeat(2, 1fr); }
}
.featured {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 200ms ease-out;
}
.featured:hover { border-color: var(--accent-40); }
.featured .featured-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.featured .featured-title {
  font-size: 24px;
  color: var(--text);
  max-width: 24ch;
}
.featured .featured-dek {
  font-size: 17px;
  color: var(--text-2);
  max-width: 60ch;
}
.featured .featured-cta {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  align-self: flex-start;
}

/* ----- About ---------------------------------------------------------------*/
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
@media (min-width: 768px) {
  .about-grid { grid-template-columns: 1.4fr 1fr; gap: 56px; }
}
.about-bio p {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 20px;
}
.about-bio p:last-child { margin-bottom: 0; }

.about-block { margin-bottom: 28px; }
.about-block:last-child { margin-bottom: 0; }
.about-block h3 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.about-langs {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.7;
}

/* ----- Contact / footer ----------------------------------------------------*/
.contact {
  border-top: 1px solid var(--border);
  position: relative;   /* anchor for the decorative wave layer */
  overflow: hidden;     /* the wave layer never adds scroll or shifts layout */
}
/* Topographic wave band at the very bottom of the footer. Decorative only:
   a CSS background so a failed load degrades to nothing (no broken-image),
   aria-hidden + pointer-events:none in markup, painted behind content. The
   asset's own #0F1116 fill matches --bg, so the crest reads as depth with no
   seam above it. */
.contact-waves {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 360px;
  max-height: 66%;
  z-index: 0;
  pointer-events: none;
  background: url("waves.svg") no-repeat center bottom;
  background-size: cover;
  opacity: 0.6;
}
.contact .container { position: relative; z-index: 1; }
.contact h2 {
  font-size: 44px;
  line-height: 1.1;
  margin-bottom: 16px;
}
.contact .contact-line {
  font-size: 18px;
  color: var(--text-2);
  max-width: 56ch;
  margin-bottom: 32px;
}
.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 56px;
}
.smallprint {
  font-size: 14px;
  color: var(--text-2);
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.smallprint a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.smallprint a:hover { color: var(--accent); }

/* ----- Article page --------------------------------------------------------*/
.article-wrap { padding-block: 40px 96px; }

.backlink {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 40px;
}
.backlink:hover { color: var(--accent); text-decoration: none; }

.article {
  max-width: 68ch;
  margin-inline: auto;
}
.article h1 {
  font-size: 34px;
  line-height: 1.2;
  margin-bottom: 16px;
}
.article .dek {
  font-size: 19px;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 24px;
}
.article .byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.04em;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.article .byline .byline-meta { color: var(--text-2); }
.article .byline .byline-sep { color: var(--border); }

/* Article footer: back-to-writing / continue link row */
.article-nav {
  max-width: 68ch;
  margin: 48px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.article-nav a {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  display: inline-block;
}
.article-nav a + br + a {
  color: var(--text-2);
  font-weight: 400;
  margin-top: 12px;
}
.article-nav a + br + a:hover { color: var(--accent); }
.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: 40px;
}
.article h2 {
  font-size: 24px;
  line-height: 1.25;
  margin-top: 48px;
  margin-bottom: 16px;
}
.article h2 .h2-num {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-right: 10px;
}
.article p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}
.article ul.article-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.article ul.article-list > li {
  position: relative;
  padding-left: 20px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
}
.article ul.article-list > li::before {
  content: "";
  position: absolute;
  left: 0; top: 12px;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--accent);
}
.article strong { color: var(--text); font-weight: 700; }

/* Bolded-lesson callouts — full-bordered tinted panel, no side stripe. */
.lesson {
  background: var(--accent-dim);
  border: 1px solid var(--accent-30);
  padding: 18px 22px;
  border-radius: 12px;
  margin-block: 28px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
}
.lesson strong { color: var(--accent-hover); }

.article .article-footnote {
  font-size: 15px;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.7;
}

.article-footer { border-top: 1px solid var(--border); margin-top: 64px; }

/* ----- Reveal animation ----------------------------------------------------
   Content is visible by default. The entrance only applies when JS is present
   AND motion is allowed; a headless/hidden-tab render (no `.js`, or the JS
   failsafe) always shows the fully-composed page. The transition never gates
   whether the content can be seen. */
.reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 550ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 550ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
  /* Intra-grid stagger: cards resolve in sequence, not as one slab. */
  .js .grid .reveal:nth-child(2) { transition-delay: 60ms; }
  .js .grid .reveal:nth-child(3) { transition-delay: 120ms; }
  .js .grid .reveal:nth-child(4) { transition-delay: 180ms; }
  .js .grid .reveal:nth-child(5) { transition-delay: 240ms; }
  .js .grid .reveal:nth-child(6) { transition-delay: 300ms; }
}

/* ----- Responsive tweaks ---------------------------------------------------*/
@media (max-width: 767px) {
  :root { --gutter: 16px; --section-y: 64px; }
  .hero { padding-block: 40px 44px; }
  .hero .role { font-size: 19px; }
  .hero .lead { font-size: 17px; }
  .contact h2 { font-size: 34px; }
  .section-title { font-size: 27px; }
  .section--tight { padding-block: 56px; }
}

/* ----- Card figures (v5 visuals) -------------------------------------------
   A thumbnail at the head of each open-source card. Consistent 16/10 frame,
   1px hairline border, radius from the card family, no layout shift (the
   aspect-ratio box reserves space before the image decodes). Dark renders and
   UI shots fill the frame (cover). White-canvas research plots instead sit on
   a subtle light tile and are shown whole (contain) so axes and labels are not
   cropped — the tile is a neutral mount, the plot itself is never recoloured. */
.card-figure {
  position: relative;
  order: -1;                 /* image leads the card, above badge/title */
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  line-height: 0;
}
.card-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-figure--tile { background: #ECE9E3; }
.card-figure--tile img { object-fit: contain; padding: 8px; }

/* A card figure that carries its own visible caption (the amr_stack demo is
   labelled a simulation render in-frame, not only in alt text). */
.card-fig-wrap {
  order: -1;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-fig-wrap .card-figure { order: 0; }
.card-fig-cap {
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.5;
}

/* ----- Article figures (v5 visuals) ----------------------------------------*/
.article figure {
  margin: 32px 0;
}
.article figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.article figure.figure--tile img {
  background: #ECE9E3;
  padding: 12px;
}
.article figcaption {
  font-size: 14px;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.6;
  margin-top: 10px;
}

/* ----- 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 { opacity: 1; transform: none; }
  .btn:hover, .card-link:hover { transform: none; }
}
