/* ============================================================
   Kimpor Kang — Portfolio
   Token names follow the DESIGN.md system.
   ============================================================ */

:root {
  --surface-canvas: #fbfbfa;
  --surface-card: #ffffff;
  --surface-subtle: #f0efea;
  --surface-container-low: #f4f4f2;
  --surface-container: #eeeeec;
  --surface-container-high: #e8e8e6;

  --text-primary: #111418;
  --text-secondary: #575d66;
  --text-tertiary: #8a8f98;
  --primary-container: #1e232a;
  --on-primary: #ffffff;
  --on-primary-container: #858a93;

  --accent: #c85028;
  --accent-deep: #a83912;
  --accent-soft: #ffdbd0;

  --status-ongoing: #d97706;
  --status-ongoing-bg: #fef3c7;
  --status-ongoing-ink: #92400e;
  --status-done: #166534;

  --border-subtle: #e6e6e3;
  --border-strong: #cfceca;

  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 1140px;
  --margin: 3rem;
  --margin-mobile: 1.25rem;
  --gutter: 1.5rem;
  --radius-sm: 0.125rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-pill: 9999px;
  --shadow-hover: 0 8px 24px -4px rgba(17, 20, 24, 0.06);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --topbar-h: 4.5rem;
}

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

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

body {
  margin: 0;
  background: var(--surface-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(200, 80, 40, 0.12);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

section[id] { scroll-margin-top: calc(var(--topbar-h) + 1.5rem); }

.skip-link {
  position: absolute;
  left: var(--margin-mobile);
  top: 0.75rem;
  z-index: 120;
  padding: 0.75rem 1rem;
  background: var(--primary-container);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius-md);
  transform: translateY(-180%);
  transition: transform 0.18s var(--ease);
}
.skip-link:focus { transform: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--margin-mobile);
}

@media (min-width: 1024px) {
  .wrap { padding: 0 var(--margin); }
}

.ico { width: 18px; height: 18px; flex: none; }
.ico-accent { color: var(--accent); }

/* ---------- Editorial metadata type ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.mono-note {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.mono-ok { color: var(--status-done); }
.mono-warn { color: var(--status-ongoing); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0.01em;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  touch-action: manipulation;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), transform 0.16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 13px; line-height: 16px; }

.btn-primary { background: var(--primary-container); border-color: var(--primary-container); color: var(--on-primary); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-secondary { background: var(--surface-card); border-color: var(--border-subtle); color: var(--primary-container); }
.btn-secondary:hover { background: var(--surface-container-low); border-color: var(--border-strong); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-primary); }
.btn-ghost:hover { background: var(--surface-card); border-color: var(--primary-container); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--text-secondary); padding-left: 0.6rem; padding-right: 0.6rem; }
.btn-quiet:hover { color: var(--primary-container); background: var(--surface-subtle); }

/* ---------- Badges, pills and beacons ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

.pill-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.beacon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
}
.status-ongoing { background: var(--status-ongoing-bg); border-color: rgba(217, 119, 6, 0.28); color: var(--status-ongoing-ink); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.card-pad { padding: 1.5rem; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.card-head h3 { display: flex; align-items: center; gap: 0.5rem; }

.card-title {
  font-size: 20px;
  line-height: 28px;
  letter-spacing: -0.01em;
  margin: 0;
}
.card-title-sm {
  font-size: 17px;
  line-height: 24px;
  letter-spacing: -0.005em;
  margin: 0;
}
.card-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}
.card-desc {
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
  margin: 0;
}

/* ---------- Sticky top navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 251, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
}

.brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.brand-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.nav { display: none; gap: 1.15rem; }
.nav-link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.nav-cta { display: none; }

.burger {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}
.burger:hover { border-color: var(--border-strong); background: var(--surface-container-low); }
.burger span {
  width: 16px;
  height: 1px;
  background: var(--text-primary);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (min-width: 720px) {
  .nav-cta { display: inline-flex; }
}
@media (max-width: 479px) {
  .brand-tag { display: none; }
}
@media (min-width: 1240px) {
  .nav { display: flex; }
  .burger { display: none; }
}

/* ---------- Mobile drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(17, 20, 24, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
body.menu-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
body.menu-open { overflow: hidden; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(360px, 88vw);
  height: 100vh;
  height: 100dvh;
  padding: 1.5rem;
  background: var(--primary-container);
  color: #ffffff;
  transform: translateX(100%);
  transition: transform 0.28s var(--ease);
  overscroll-behavior: contain;
}
.drawer.is-open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.drawer-brand {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.drawer-close {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: inherit;
  cursor: pointer;
  transition: background-color 0.16s var(--ease);
}
.drawer-close:hover { background: rgba(255, 255, 255, 0.1); }

.drawer-links { display: flex; flex-direction: column; margin-top: 1rem; }
.drawer-link {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.85rem 0.25rem;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transition: color 0.16s var(--ease), padding-left 0.16s var(--ease);
}
.drawer-link:hover,
.drawer-link.is-active { color: #ffffff; padding-left: 0.5rem; }
.drawer-num { font-family: var(--font-mono); font-size: 11px; color: var(--accent-soft); }

.drawer-foot {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.6);
}
.drawer-strong { color: #ffffff; font-weight: 600; }
.drawer-foot a { color: var(--accent-soft); }
.drawer-foot p { margin: 0; }

/* ---------- Hero ---------- */
.hero { padding: 1.25rem 0 3rem; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: var(--gutter);
  padding-top: 1.5rem;
}

.hero-title {
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.hero-portrait { margin-top: 1.5rem; }
.hero-portrait .portrait-frame { max-width: 11rem; margin-inline: auto; }
@media (min-width: 900px) {
  .hero-portrait {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: stretch;
    margin-top: 0;
    display: grid;
  }
  .hero-portrait .portrait-frame { max-width: none; margin-inline: 0; }
  .hero-portrait .portrait-frame img {
    position: absolute;
    inset: 0.75rem;
    width: calc(100% - 1.5rem);
    height: calc(100% - 1.5rem);
    object-fit: cover;
    object-position: center top;
  }
}

.hero-sub {
  max-width: 64ch;
  margin: 1.75rem 0 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.hero-sub strong { color: var(--text-primary); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 2fr 1fr; align-items: start; }
  .hero-lead, .hero-sub, .hero-actions { grid-column: 1; }
}
@media (min-width: 1024px) {
  .hero { padding: 1.75rem 0 4rem; }
}

/* ---------- Edge-to-edge feature band ---------- */
.band { margin: 0; }
.band-img {
  width: 100%;
  height: clamp(200px, 32vw, 440px);
  object-fit: cover;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  filter: saturate(0.94) contrast(0.98);
}
.band-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

/* ---------- Section scaffolding ---------- */
.section { padding: 4rem 0; border-top: 1px solid var(--border-subtle); }
/* the band already closes with a hairline, so the next section must not double it */
.band + .section { border-top: none; }
.section-alt { background: var(--surface-container-low); }
.section-contrast { background: var(--surface-container-high); }

.section-head { max-width: 44rem; margin-bottom: 2.5rem; }
.section-title {
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-lede {
  margin: 0.85rem 0 0;
  font-size: 15px;
  line-height: 24px;
  color: var(--text-secondary);
}
.section-head-row {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gutter);
}
.section-head-row > div:first-child { max-width: 40rem; }

/* ---------- Structural grid ---------- */
.grid-12 { display: grid; grid-template-columns: 1fr; gap: var(--gutter); align-items: start; }

@media (min-width: 1024px) {
  .grid-12 { grid-template-columns: repeat(12, 1fr); }
  .col-6 { grid-column: span 6; }
  .col-12 { grid-column: span 12; }
}

.spec-sheet { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.25rem; }
.spec-sheet > div {
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
}
.spec-sheet dt {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.3rem;
}
.spec-sheet dd { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-primary); }

.spec-sheet-compact { gap: 0; margin-bottom: 0; }
.spec-sheet-compact > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  background: none;
  border-radius: 0;
  padding: 0.45rem 0;
  border-bottom: 1px dotted var(--border-strong);
}
.spec-sheet-compact > div:last-child { border-bottom: none; }
.spec-sheet-compact dt { margin: 0; }
.spec-sheet-compact dd { text-align: right; color: var(--text-secondary); }

/* ---------- Portrait frame ---------- */
.portrait-frame {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.portrait-frame img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  position: relative;
  z-index: 1;
}
.portrait-tile {
  display: none;
  position: absolute;
  inset: 0.75rem;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface-container);
  border-radius: var(--radius-md);
}
.portrait-frame.is-empty .portrait-tile { display: grid; }

/* ---------- 01 Experience & education ---------- */
.timeline-col { display: flex; flex-direction: column; gap: 0.85rem; }
.timeline-label { margin: 0; }

.timeline { display: flex; flex-direction: column; gap: var(--gutter); flex: 1; }
.timeline .entry { display: flex; flex-direction: column; flex: 1; height: 100%; }
.entry-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.85rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}
.entry-list { display: flex; flex-direction: column; gap: 0.55rem; }
.entry-list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
}
.entry-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--accent);
}

@media (min-width: 1024px) {
  .timeline-col { align-self: stretch; height: 100%; }
  /* reserve two lines for the note so the Work and Study rules line up */
  .timeline-col .entry-head { min-height: 4.75rem; }
}

/* the "Tools I Built" entry closes the section as a full-width row */
@media (min-width: 900px) {
  .entry-wide .entry-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 1.75rem;
  }
}

/* ---------- 02 Field projects ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease);
}
.filter-btn em { font-style: normal; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.filter-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.filter-btn.is-active { background: var(--primary-container); border-color: var(--primary-container); color: #ffffff; }
.filter-btn.is-active em { color: var(--accent-soft); }

.projects-grid { display: grid; grid-template-columns: 1fr; gap: var(--gutter); }

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.project-card:hover,
.project-card:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.project-card.is-hidden { display: none; }

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0;
}
.project-card-head .card-title {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.project-card-head .status-pill {
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 2px;
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-container);
  border-bottom: 1px solid var(--border-subtle);
  touch-action: pan-y;
}
.card-media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.gallery-track {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img {
  position: static;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  filter: saturate(0.92) contrast(0.98);
  cursor: zoom-in;
}

.media-index {
  position: absolute;
  bottom: 0.7rem;
  right: 0.7rem;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: rgba(17, 20, 24, 0.82);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
}

.gal-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: rgba(17, 20, 24, 0.82);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s var(--ease), background-color 0.16s var(--ease);
}
.gal-btn .ico { width: 16px; height: 16px; }
.gal-btn:hover { background: var(--accent); }
.card-media:hover .gal-btn,
.card-media:focus-within .gal-btn { opacity: 1; }
.gal-prev { left: 0.6rem; }
.gal-next { right: 0.6rem; }

.gal-count {
  position: absolute;
  bottom: 0.7rem;
  left: 0.7rem;
  z-index: 3;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  color: #ffffff;
  background: rgba(17, 20, 24, 0.82);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
  transition: background-color 0.16s var(--ease);
}
.gal-count:hover { background: var(--accent); }

@media (hover: none) {
  .gal-btn { opacity: 1; }
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.5rem;
}

.card-meta {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}
.card-meta > div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px dotted var(--border-strong);
}
.card-meta > div:last-child { border-bottom: none; padding-bottom: 0; }
.card-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.card-meta dd { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-secondary); }

@media (min-width: 700px) {
  .projects-grid { grid-template-columns: 1fr 1fr; }
  .project-card-head { min-height: 3.5rem; }
  .project-card .card-kicker { min-height: 1.15rem; }
  .project-card .card-desc { min-height: 5.25rem; }
  .project-card .card-meta > div { min-height: 2.35rem; align-items: baseline; }
}
@media (min-width: 1024px) {
  .projects-grid { grid-template-columns: repeat(3, 1fr); }
  .project-card-head { min-height: 3.65rem; }
  .project-card .card-desc { min-height: 5.65rem; }
  .project-card .card-meta > div { min-height: 2.5rem; }
}

/* ---------- 03 Site utilities ---------- */
.util-grid { display: grid; grid-template-columns: 1fr; gap: var(--gutter); }
/* min-width:0 lets the card shrink so the nowrap terminal lines scroll inside it */
.util-card { display: flex; flex-direction: column; gap: 0.85rem; min-width: 0; }

.util-media { margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.util-media img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.5rem;
}

.compare { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
.compare-cell {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}
.compare-cell p { margin: 0 0 0.35rem; }
.compare-cell p:last-child { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-secondary); }

.terminal {
  background: var(--primary-container);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  overflow-x: auto;
}
.terminal-line {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 18px;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
}
.terminal-dim { color: var(--on-primary-container); }
.terminal-ok { color: #8fd6a4; }

@media (min-width: 560px) {
  .compare { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .util-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .util-card { height: 100%; }
  .util-card .pill-list { margin-top: auto; }
}

/* ---------- 04 Contact ---------- */
/* left-aligned with the section head, on the same 44rem measure */
.contact-card { max-width: 44rem; }
.channel-list { display: flex; flex-direction: column; margin-bottom: 1.25rem; }
.channel-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dotted var(--border-strong);
}
.channel-row:last-child { border-bottom: none; }
.channel-row dt {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
/* long values (the email address) must break rather than widen the row on small phones */
.channel-row dd { margin: 0; font-size: 13px; line-height: 20px; color: var(--text-primary); overflow-wrap: anywhere; }
.channel-row a {
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.channel-row a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Footer ---------- */
.footer {
  padding: 3rem 0 2rem;
  background: var(--surface-container-low);
  border-top: 1px solid var(--border-subtle);
}
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-bottom: 2rem; }
.footer-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}
.footer-copy { max-width: 36ch; font-size: 13px; line-height: 20px; color: var(--text-secondary); }
.footer-links { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.75rem; }
.footer-links a { font-size: 13px; line-height: 20px; color: var(--text-secondary); transition: color 0.16s var(--ease); }
.footer-links a:hover { color: var(--accent); }
.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}
.footer-base a:hover { color: var(--accent); }
.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: color 0.16s var(--ease);
}
.back-to-top:hover { color: var(--accent); }

@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 1.6fr 1fr 1.2fr; gap: 2.5rem; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  background: rgba(9, 10, 12, 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox-img { max-width: 92vw; max-height: 84vh; object-fit: contain; border: 1px solid rgba(255, 255, 255, 0.14); }
.lightbox-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.lightbox-btn:hover { background: var(--accent); border-color: var(--accent); }
.lb-close { top: 1.15rem; right: 1.15rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-count {
  position: absolute;
  top: 1.4rem;
  left: 1.4rem;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
  font-variant-numeric: tabular-nums;
}
body.lb-open { overflow: hidden; }

/* ---------- Motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero .hero-lead,
  .hero .hero-portrait,
  .hero .hero-sub,
  .hero .hero-actions { animation: rise 0.7s var(--ease) both; }

  .hero .hero-lead { animation-delay: 0.06s; }
  .hero .hero-portrait { animation-delay: 0.12s; }
  .hero .hero-sub { animation-delay: 0.18s; }
  .hero .hero-actions { animation-delay: 0.24s; }
}

/* Scroll-linked reveals, only where view timelines are supported.
   Everywhere else the content simply renders in place. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-head,
    .project-card,
    .util-card,
    .entry {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 26%;
    }
  }
}

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