/* ==========================================================================
   Jeremiah Escubido — Portfolio
   Plain CSS, no framework. Tokens → base → layout → components → sections.
   ========================================================================== */

/* ── Fonts (self-hosted Geist, Latin subset, SIL OFL — see assets/fonts) ── */
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Dark is the default identity; light is defined below. */
  --bg:           #0a0a0b;
  --bg-alt:       #0e0e10;
  --surface:      #131316;
  --surface-2:    #19191d;
  --border:       rgba(255, 255, 255, 0.08);
  --border-strong:rgba(255, 255, 255, 0.14);
  --text:         #ededef;
  --text-muted:   #a1a1aa;
  --text-subtle:  #71717a;
  --accent:       #00d982;
  --accent-text:  #34e3a0;
  --accent-soft:  rgba(0, 217, 130, 0.12);
  --accent-ink:   #03140c;
  --nav-bg:       rgba(10, 10, 11, 0.72);
  --shadow:       0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --grid-line:    rgba(255, 255, 255, 0.045);

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;

  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --section-y: clamp(80px, 11vw, 128px);
  --nav-h: 64px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 200ms;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:           #fafafa;
  --bg-alt:       #f4f4f5;
  --surface:      #ffffff;
  --surface-2:    #f4f4f5;
  --border:       rgba(10, 10, 11, 0.09);
  --border-strong:rgba(10, 10, 11, 0.16);
  --text:         #0a0a0b;
  --text-muted:   #52525b;
  --text-subtle:  #71717a;
  --accent:       #00a866;
  --accent-text:  #007a4a;
  --accent-soft:  rgba(0, 168, 102, 0.1);
  --accent-ink:   #ffffff;
  --nav-bg:       rgba(250, 250, 250, 0.78);
  --shadow:       0 1px 2px rgba(10, 10, 11, 0.04), 0 12px 32px -16px rgba(10, 10, 11, 0.18);
  --grid-line:    rgba(10, 10, 11, 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:           #fafafa;
    --bg-alt:       #f4f4f5;
    --surface:      #ffffff;
    --surface-2:    #f4f4f5;
    --border:       rgba(10, 10, 11, 0.09);
    --border-strong:rgba(10, 10, 11, 0.16);
    --text:         #0a0a0b;
    --text-muted:   #52525b;
    --text-subtle:  #71717a;
    --accent:       #00a866;
    --accent-text:  #007a4a;
    --accent-soft:  rgba(0, 168, 102, 0.1);
    --accent-ink:   #ffffff;
    --nav-bg:       rgba(250, 250, 250, 0.78);
    --shadow:       0 1px 2px rgba(10, 10, 11, 0.04), 0 12px 32px -16px rgba(10, 10, 11, 0.18);
    --grid-line:    rgba(10, 10, 11, 0.05);
    color-scheme: light;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.15; text-wrap: balance; }
p { text-wrap: pretty; }

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

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

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }

.text-muted { color: var(--text-muted); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.875rem;
}
.skip-link:focus { top: 12px; }

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

.section { padding-block: var(--section-y); }
.section-tight { padding-block: clamp(56px, 7vw, 80px); }
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section-head { max-width: 640px; margin-bottom: clamp(40px, 6vw, 64px); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  letter-spacing: -0.03em;
}

.section-desc {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.65;
  max-width: 560px;
}

/* ── Buttons & links ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding-inline: 18px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }

.btn-sm { height: 36px; padding-inline: 14px; font-size: 0.875rem; border-radius: 8px; }

.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--text) 86%, var(--bg)); }
.btn-primary .icon { transition: transform var(--dur) var(--ease); }
.btn-primary:hover .icon[aria-hidden] { transform: translateX(2px); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 30%, transparent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  transition: color var(--dur) var(--ease);
}
.text-link:hover { color: var(--accent-text); }

.status-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0;
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping {
  0%   { transform: scale(0.6); opacity: 0.7; }
  80%, 100% { transform: scale(1.8); opacity: 0; }
}

/* ── Header / nav ───────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background-color 250ms var(--ease), border-color 250ms var(--ease);
}
.site-header.is-scrolled,
.site-header.menu-open {
  background: var(--nav-bg);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
/* Solid while the menu is open so page text doesn't show behind the links */
.site-header.menu-open { background: var(--bg); }

.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0;
}

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="true"] { color: var(--text); background: var(--surface-2); }

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

.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }
}

.menu-toggle { display: none; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }
.menu-toggle[aria-expanded="true"] .icon-menu { display: none; }

.mobile-menu { border-top: 1px solid var(--border); }
.mobile-menu ul { padding-block: 8px 16px; }
.mobile-menu a {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.mobile-menu li:last-child a { border-bottom: 0; }
.mobile-menu a:hover, .mobile-menu a[aria-current="true"] { color: var(--text); }

@media (max-width: 860px) {
  .nav-links, .nav-cta { display: none; }
  .menu-toggle { display: inline-grid; }
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  isolation: isolate;
  padding-top: calc(var(--nav-h) + clamp(56px, 10vw, 120px));
  padding-bottom: clamp(72px, 10vw, 120px);
  overflow: hidden;
}

.hero-grid-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 100%);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent-text);
}

.hero-title {
  font-size: clamp(2.125rem, 4.6vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -0.04em;
  max-width: 19ch;
}

.hero-lede {
  margin-top: 24px;
  max-width: 560px;
  color: var(--text-muted);
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
}
.hero-socials {
  display: inline-flex;
  gap: 4px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--border-strong);
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-subtle);
}
.hero-facts li { display: inline-flex; align-items: center; gap: 10px; }
.hero-facts li + li::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  margin-left: -14px;
}

/* Identity row: avatar + name + availability */
.hero-id {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.hero-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  object-fit: cover;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.hero-id .hero-kicker { margin-bottom: 2px; }
.hero-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* Isometric scene */
.hero-scene { width: 100%; }
.scene-frame {
  position: relative;
  aspect-ratio: 1 / 0.86;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(70% 55% at 50% 58%, var(--accent-soft), transparent 70%),
    var(--surface);
  overflow: hidden;
}
.scene-frame::after {
  /* faint dotted floor so the island reads as sitting in space */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--grid-line) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(60% 50% at 50% 60%, #000, transparent);
  mask-image: radial-gradient(60% 50% at 50% 60%, #000, transparent);
  pointer-events: none;
}
.iso-scene {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: pan-y;
}
.scene-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
}
.scene-hint { color: var(--text-muted); }
.scene-hint-touch { display: none; }
@media (hover: none) {
  .scene-hint-hover { display: none; }
  .scene-hint-touch { display: inline; }
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-scene { max-width: 520px; }
  .scene-frame { aspect-ratio: 1 / 0.8; }
}

@media (max-width: 520px) {
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-socials { width: 100%; padding-left: 0; margin-left: 0; border-left: 0; }
  .hero-socials .icon-btn { border: 1px solid var(--border); }
}

@media (max-width: 520px) {
  .hero { padding-bottom: 56px; }
  .hero-facts { flex-direction: column; gap: 6px; }
  .hero-facts li + li::before { display: none; }
}

/* ── Projects ───────────────────────────────────────────────────────────── */
.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 250ms var(--ease), transform 250ms var(--ease), box-shadow 250ms var(--ease);
}
.project:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding-inline: 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.badge-accent {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent-text);
}

.project-title {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.project-subtitle {
  margin-top: 10px;
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.55;
}
.project-desc {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.project-facts {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.project-facts div { display: grid; grid-template-columns: 104px 1fr; gap: 16px; }
.project-facts dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  padding-top: 2px;
}
.project-facts dd { font-size: 0.875rem; color: var(--text); line-height: 1.55; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.tags li {
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 24px;
}
.doi { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-subtle); overflow-wrap: anywhere; }

.project-media {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}
.project-media img,
.project-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease);
}

/* Work groups */
.work-group + .work-group { margin-top: clamp(56px, 8vw, 88px); }
.group-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Application cards (no screenshots, so the structure carries the card) */
.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.app-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
}
.app-card .project-title { font-size: 1.375rem; }
.app-kind {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: var(--accent-text);
}
.roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
  padding: 12px;
  border-radius: var(--r);
  background: var(--bg);
  border: 1px solid var(--border);
}
.roles::before {
  content: attr(data-label);
  width: 100%;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.roles li {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 0.8125rem;
  line-height: 1.4;
}
.app-card .tags { margin-top: auto; padding-top: 20px; }

.work-more { margin-top: 40px; text-align: center; }

@media (max-width: 1024px) {
  .app-grid { grid-template-columns: 1fr; }
  .app-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; }
  .app-card > * { grid-column: 1; }
  .app-card .roles, .app-card .tags { grid-column: 2; }
  .app-card .roles { grid-row: 1 / span 3; align-self: start; margin-top: 0; }
  .app-card .tags { grid-row: 4 / span 2; align-self: end; }
}
@media (max-width: 640px) {
  .app-grid { gap: 16px; }
  .app-card { display: flex; padding: 20px; }
  .app-card .roles { margin-top: 20px; align-self: stretch; }
  .app-card .tags { align-self: stretch; }
}

/* Featured project */
.project-featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
.project-featured .project-body { padding: clamp(24px, 4vw, 44px); }
.project-featured .project-title { font-size: clamp(1.375rem, 2.4vw, 1.75rem); }
.project-featured .project-media {
  display: flex;
  align-items: center;
  padding: clamp(20px, 3.5vw, 40px);
  border-left: 1px solid var(--border);
  background:
    radial-gradient(120% 80% at 100% 0%, var(--accent-soft), transparent 60%),
    var(--surface-2);
}

.browser {
  width: 100%;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #fff;
  box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.5);
  transition: transform 500ms var(--ease);
}
.project-featured:hover .browser { transform: translateY(-4px); }
.browser-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding-inline: 12px;
  background: #f4f4f5;
  border-bottom: 1px solid #e4e4e7;
}
.browser-bar span { width: 9px; height: 9px; border-radius: 50%; background: #d4d4d8; }
.browser-bar em {
  flex: 1;
  min-width: 0;
  margin-left: 10px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: #71717a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.browser img { height: auto; }

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.project-card { display: flex; flex-direction: column; }
.project-card .project-media {
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--border);
}
.project-card:hover .project-media img,
.project-card:hover .project-media video { transform: scale(1.03); }
.project-card .project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px;
}
.project-card .tags { margin-top: auto; padding-top: 20px; }
.project-card .project-links { margin-top: 16px; }

.media-video video { background: #000; }

.media-toggle,
.media-play {
  position: absolute;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(10, 10, 11, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.media-toggle {
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.media-toggle .icon { width: 14px; height: 14px; }
.media-toggle .icon-play { display: none; }
.media-toggle.is-paused .icon-play { display: block; }
.media-toggle.is-paused .icon-pause { display: none; }

.media-play {
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
}
.media-play .icon { width: 20px; height: 20px; margin-left: 2px; }
.media-play:hover { background: rgba(10, 10, 11, 0.8); transform: scale(1.05); }
.media-video.is-playing .media-play { opacity: 0; pointer-events: none; }

@media (max-width: 1024px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .project-featured { grid-template-columns: 1fr; }
  .project-featured .project-media { order: -1; border-left: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; gap: 16px; }
  .project-facts div { grid-template-columns: 1fr; gap: 2px; }
  .project-card .project-body { padding: 20px; }
}

/* ── About ──────────────────────────────────────────────────────────────── */
.about-portrait {
  width: min(320px, 70%);
  margin-top: 36px;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.about-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.about {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 80px);
}
.about .section-head { margin-bottom: 0; }
.about-body > p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.75;
}
.about-body > p + p { margin-top: 16px; }

.glance {
  margin-top: 36px;
  border-top: 1px solid var(--border);
}
.glance div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding-block: 14px;
  border-bottom: 1px solid var(--border);
}
.glance dt {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-subtle);
}
.glance dd { font-size: 0.9375rem; }

@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .glance div { grid-template-columns: 1fr; gap: 2px; }
}

/* ── Stack ──────────────────────────────────────────────────────────────── */
.stack {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.stack-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  transition: background-color var(--dur) var(--ease);
}
.stack-row:last-child { border-bottom: 0; }
.stack-row:hover { background: var(--surface-2); }
.stack-row dt {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.875rem;
  line-height: 1.3;
  transition: border-color var(--dur) var(--ease);
}
.stack-row:hover .chips li { border-color: var(--border-strong); }

@media (max-width: 640px) {
  .stack-row { grid-template-columns: 1fr; gap: 12px; padding: 18px 20px; }
}

/* ── Journey ────────────────────────────────────────────────────────────── */
.journey {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 80px);
}
.journey .section-head { margin-bottom: 0; }

.timeline { position: relative; }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 24px;
  padding-bottom: 36px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  /* connector line */
  content: "";
  position: absolute;
  left: 104px;
  top: 10px;
  bottom: -2px;
  width: 1px;
  background: var(--border-strong);
}
.timeline-item:last-child::before { display: none; }
.timeline-item::after {
  content: "";
  position: absolute;
  left: 100px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--text-subtle);
}
.timeline-item:first-child::after { background: var(--accent); border-color: var(--accent); }

.timeline-when {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-subtle);
  padding-top: 1px;
}
.timeline-what { padding-left: 16px; }
.timeline-what h3 { font-size: 1.0625rem; letter-spacing: -0.01em; }
.timeline-org { margin-top: 4px; font-size: 0.875rem; color: var(--accent-text); }
.timeline-what p:last-child { margin-top: 8px; color: var(--text-muted); font-size: 0.9375rem; }

@media (max-width: 860px) {
  .journey { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .timeline-item { grid-template-columns: 1fr; gap: 6px; padding-left: 24px; }
  .timeline-item::before { left: 4px; }
  .timeline-item::after { left: 0; }
  .timeline-what { padding-left: 0; }
}

/* ── Now ────────────────────────────────────────────────────────────────── */
.now {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: clamp(24px, 4vw, 36px);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}
.now-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  align-self: start;
  padding-top: 3px;
}
.now-list { display: grid; gap: 12px; color: var(--text-muted); }
.now-list strong { color: var(--text); font-weight: 500; }

@media (max-width: 640px) {
  .now { grid-template-columns: 1fr; }
}

/* ── Gallery ────────────────────────────────────────────────────────────── */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(120px, 15vw, 180px);
  gap: 12px;
}
.gallery li:first-child { grid-column: span 2; grid-row: span 2; }
.gallery button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease), filter 300ms var(--ease);
  filter: saturate(0.9);
}
.gallery button:hover img { transform: scale(1.04); filter: saturate(1); }

@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 130px; gap: 8px; }
}

/* Lightbox */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.lightbox::backdrop {
  background: rgba(5, 5, 6, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 72px 72px 24px;
  max-width: 100%;
}
.lightbox img {
  max-width: min(1200px, 100%);
  max-height: calc(100dvh - 150px);
  width: auto;
  border-radius: var(--r);
  animation: lb-in 300ms var(--ease);
}
.lightbox figcaption {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}
.lightbox .icon-btn {
  position: fixed;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.lightbox .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }
.lb-close { top: 16px; right: 16px; }
.lb-prev, .lb-next { top: 50%; translate: 0 -50%; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
@keyframes lb-in { from { opacity: 0; transform: scale(0.98); } }

@media (max-width: 640px) {
  .lightbox figure { padding: 64px 12px 88px; }
  .lb-prev, .lb-next { top: auto; bottom: 20px; translate: none; }
  .lb-prev { left: calc(50% - 52px); }
  .lb-next { right: calc(50% - 52px); }
}

/* ── Contact ────────────────────────────────────────────────────────────── */
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(40px, 6vw, 80px);
  align-items: end;
}
.contact-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.copy-email .icon-check { display: none; color: var(--accent-text); }
.copy-email.is-copied .icon-check { display: block; }
.copy-email.is-copied .icon-copy { display: none; }

.contact-links { border-top: 1px solid var(--border); }
.contact-links a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--dur) var(--ease);
}
.contact-links a > span { display: grid; flex: 1; min-width: 0; }
.cl-label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-subtle); }
.cl-value { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.cl-arrow { transition: transform var(--dur) var(--ease); }
.contact-links a:hover { color: var(--text); }
.contact-links a:hover .cl-arrow { transform: translate(2px, -2px); color: var(--accent-text); }
.cl-arrow-down { rotate: 90deg; }
.contact-links a:hover .cl-arrow-down { transform: translate(2px, 0); }

@media (max-width: 860px) {
  .contact-inner { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .contact-actions .btn { flex: 1 1 auto; }
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 28px;
  font-size: 0.875rem;
  color: var(--text-subtle);
}
.footer-inner .text-link { font-size: 0.875rem; color: var(--text-muted); }

/* ── Motion ─────────────────────────────────────────────────────────────── */
/* 3D tilt + glare (driven by --rx/--ry/--gx/--gy from main.js) */
.tilt {
  position: relative;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition:
    transform 500ms var(--ease),
    border-color 250ms var(--ease),
    box-shadow 250ms var(--ease);
  will-change: transform;
}
.tilt.is-tilting { transition-duration: 120ms, 250ms, 250ms; }
.tilt::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%),
              color-mix(in srgb, var(--text) 9%, transparent), transparent 60%);
  opacity: 0;
  transition: opacity 300ms var(--ease);
  pointer-events: none;
}
.tilt.is-tilting::after { opacity: 1; }
.tilt.is-tilting { box-shadow: var(--shadow); }

/* Lists that reveal item by item (--i set in main.js) */
.js .reveal.stagger { opacity: 1; transform: none; }
.js .reveal.stagger > * {
  opacity: 0;
  transform: translateY(10px);
}
.js .reveal.stagger.is-visible > * {
  opacity: 1;
  transform: none;
  transition:
    opacity 600ms var(--ease) calc(var(--i, 0) * 60ms + 80ms),
    transform 600ms var(--ease) calc(var(--i, 0) * 60ms + 80ms),
    background-color var(--dur) var(--ease);
}

/* Timeline connector draws downward as items appear */
.js .timeline.reveal .timeline-item::before {
  transform: scaleY(0);
  transform-origin: top;
}
.js .timeline.reveal.is-visible .timeline-item::before {
  transform: scaleY(1);
  transition: transform 700ms var(--ease) calc(var(--i, 0) * 60ms + 300ms);
}
/* Content is only hidden when JS is available to reveal it again. */
.js .enter {
  opacity: 0;
  transform: translateY(12px);
  animation: enter 700ms var(--ease) forwards;
  animation-delay: calc(var(--d, 0) * 80ms + 60ms);
}
@keyframes enter { to { opacity: 1; transform: none; } }

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@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;
  }
  .js .enter, .js .reveal, .js .reveal.stagger > * { opacity: 1; transform: none; animation: none; }
  .js .timeline.reveal .timeline-item::before { transform: none; }
  .tilt { transform: none; }
  .status-dot::after { display: none; }
}

