/* ─── Light theme (default) ─── */
:root {
  --bg: #ffffff;
  --bg-card: #fafafa;
  --bg-card-hover: #f4f4f6;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --accent: #CC0033;
  --accent-solid: #CC0033;
  --accent-hover: #a30029;
  --accent-glow: rgba(204, 0, 51, 0.18);
  --accent-soft: rgba(204, 0, 51, 0.08);
  --accent-soft-border: rgba(204, 0, 51, 0.18);
  --accent-2: #6b7280;
  --success: #0f8a4d;
  --text: #23272f;
  --text-dim: #5b6270;
  --text-bright: #0b0d12;
  --border: rgba(15, 20, 30, 0.12);
  --border-hover: rgba(204, 0, 51, 0.35);
  --grid-line: rgba(204, 0, 51, 0.04);
  --star-opacity: 0;
  --radius: 12px;
  --mono: 'DM Mono', monospace;
  --sans: 'Outfit', sans-serif;
}

/* ─── Dark theme (white → black) ─── */
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-card: #0d0d10;
  --bg-card-hover: #17171c;
  --nav-bg: rgba(0, 0, 0, 0.85);
  --accent: #ff4d6d;
  --accent-solid: #CC0033;
  --accent-hover: #e00039;
  --accent-glow: rgba(204, 0, 51, 0.35);
  --accent-soft: rgba(255, 77, 109, 0.1);
  --accent-soft-border: rgba(255, 77, 109, 0.2);
  --accent-2: #94a3b8;
  --success: #34d399;
  --text: #cfcfd8;
  --text-dim: #9b9ba5;
  --text-bright: #e8e8ee;
  --border: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 77, 109, 0.4);
  --grid-line: rgba(255, 255, 255, 0.03);
  --star-opacity: 1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ─── Starfield Background (dark mode only) ─── */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: var(--star-opacity);
  transition: opacity 0.4s ease;
}
.stars::before, .stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 10%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 15% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 15%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 90%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 65% 35%, rgba(255,77,109,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 25% 45%, rgba(255,255,255,0.15) 0%, transparent 100%);
  animation: drift 80s linear infinite;
}
.stars::after {
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 20%, rgba(255,77,109,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 90%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 55% 55%, rgba(255,255,255,0.3) 0%, transparent 100%);
  animation: drift 120s linear infinite reverse;
}
@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-30px); }
}

/* ─── Grid Overlay ─── */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ─── Content Wrapper ─── */
.content { position: relative; z-index: 1; }

/* ─── Navigation ─── */
/* Scoped to the top bar: the prev/next block on a project page is also a
   <nav>, and a bare `nav` selector pinned it to the top of the viewport. */
.content > nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s ease, border-color 0.4s ease;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links { display: flex; gap: 32px; }
.nav-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: color 0.3s;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

/* ─── Theme Toggle ─── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.3s;
}
.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  transform: translateY(-2px);
}
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* ─── Hero ─── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 60px 80px;
  max-width: 1300px;
  margin: 0 auto;
  gap: 80px;
}
.hero-text { flex: 1; }
.hero-tag {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.2s;
}
.hero h1 {
  font-size: clamp(48px, 6vw, 80px);
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.4s;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--accent-solid), #ff5c7a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 520px;
  line-height: 1.8;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.6s;
}
.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.8s;
}
.btn {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 14px 28px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.3s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--accent-solid);
  color: #fff;
  box-shadow: 0 4px 24px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 36px var(--accent-glow);
  transform: translateY(-2px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* Hero graphic */
.hero-graphic {
  flex: 0 0 360px;
  height: 360px;
  position: relative;
  opacity: 0;
  animation: fadeIn 1.2s ease forwards 0.6s;
}
.orbit-ring {
  position: absolute;
  border: 1px solid var(--accent-soft-border);
  border-radius: 50%;
  animation: spin 20s linear infinite;
}
.orbit-ring:nth-child(1) { inset: 0; }
.orbit-ring:nth-child(2) { inset: 40px; animation-duration: 15s; animation-direction: reverse; border-color: var(--border); }
.orbit-ring:nth-child(3) { inset: 80px; animation-duration: 25s; }
.orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--accent-solid);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-glow);
  top: -4px;
  left: 50%;
  margin-left: -4px;
}
.orbit-ring:nth-child(2) .orbit-dot { background: var(--accent-2); box-shadow: none; }
.orbit-center {
  position: absolute;
  inset: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.orbit-center-inner {
  width: 20px;
  height: 20px;
  background: var(--accent-solid);
  border-radius: 50%;
  box-shadow: 0 0 40px var(--accent-glow);
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ─── Section Layout ─── */
section {
  padding: 100px 60px;
  max-width: 1300px;
  margin: 0 auto;
}
.section-header {
  margin-bottom: 60px;
}
.section-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -1px;
}

/* ─── About ─── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
}
.about-text p {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 20px;
  line-height: 1.85;
}
.about-text p strong { color: var(--text); font-weight: 500; }
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.3s;
}
.stat-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}
.stat-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 8px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ─── Projects ─── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
  transition: all 0.4s;
  position: relative;
  overflow: hidden;
  /* The whole card is a link on the home page. */
  color: inherit;
  text-decoration: none;
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--accent-solid), transparent);
  transition: height 0.4s;
}
.project-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}
.project-card:hover::before { height: 100%; }
.project-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.project-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 12px;
}
.project-desc {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 20px;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-soft-border);
  letter-spacing: 0.5px;
}
.project-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.project-term {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}
.project-status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
}
.project-status.active {
  color: var(--success);
  border-color: var(--success);
  background: transparent;
}
/* "View details →" affordance on a clickable card */
.project-more {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.75;
  transition: opacity 0.3s, gap 0.3s;
}
.project-card:hover .project-more { opacity: 1; gap: 13px; }

/* ─── Skills ─── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  transition: all 0.3s;
}
.skill-group:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
}
.skill-group-icon {
  font-size: 28px;
  margin-bottom: 16px;
}
.skill-group-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 16px;
}
.skill-list {
  list-style: none;
}
.skill-list li {
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-list li:last-child { border-bottom: none; }
.skill-list li::before {
  content: '›';
  color: var(--accent);
  font-weight: 700;
}

/* ─── Experience ─── */
.timeline {
  position: relative;
  padding-left: 40px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent-solid), var(--border));
}
.timeline-item {
  position: relative;
  margin-bottom: 48px;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -44px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-solid);
  box-shadow: 0 0 16px var(--accent-glow);
}
.timeline-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.timeline-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.timeline-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.timeline-desc {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.8;
}

/* ─── Windows (LinkedIn + Resume) ─── */
.window-solo { max-width: 820px; margin: 0 auto; }
.window-solo.narrow { max-width: 600px; }
.window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s, transform 0.3s;
}
.window:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-hover);
  flex: 0 0 auto;
}
.window-dots { display: flex; gap: 6px; }
.window-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
  display: block;
}
.window-dots i:first-child { background: var(--accent-solid); }
.window-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.window-body {
  position: relative;
  height: 620px;
  background: #fff;
  flex: 1 1 auto;
}
.window-body iframe,
.window-body object {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.window-body.pdf-viewer {
  height: auto;
  min-height: 320px;
  overflow: visible;
  background: var(--bg-card-hover);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pdf-page {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}
.pdf-loading {
  margin: auto;
  padding: 60px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.window-body.pdf-viewer > iframe {
  width: 100%;
  height: 900px;
  border: 0;
  border-radius: 4px;
  background: #fff;
}

/* Natively rendered LinkedIn post — theme-aware, never blocked */
.window-body.post-card {
  height: auto;
  background: var(--bg-card);
  overflow: visible;
  display: block;
}
.post-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px 0;
}
.post-avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-solid);
  color: #fff;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-who { flex: 1 1 auto; min-width: 0; }
.post-author {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.35;
}
.post-headline {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.45;
}
.post-mark { flex: 0 0 auto; width: 22px; height: 22px; color: var(--accent); }
.post-body { padding: 18px 24px 24px; }
.post-body p {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 14px;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.post-tag { font-size: 13.5px; color: var(--accent); }

.window-fallback {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px;
  text-align: center;
  background: var(--bg-card);
}
.window-fallback svg { width: 34px; height: 34px; color: var(--accent); }
.window-fallback p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
  max-width: 300px;
}
.window-foot {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
}
.window-foot .btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Contact ─── */
.contact-section {
  text-align: center;
  padding: 120px 60px;
}
.contact-section .section-header { margin-bottom: 40px; }
.contact-desc {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto 48px;
  line-height: 1.8;
}
.contact-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 36px;
  text-decoration: none;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 14px;
}
.contact-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  background: var(--bg-card-hover);
}
.contact-card svg { width: 20px; height: 20px; color: var(--accent); }
.contact-card-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.contact-card-value {
  font-size: 15px;
  color: var(--text-bright);
}

/* ─── Footer ─── */
footer {
  text-align: center;
  padding: 40px 60px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ══════════════════════════════════════════════════════════════════
   Project detail pages
   ══════════════════════════════════════════════════════════════════ */
/* ─── Work-in-progress gate ───
   Covers a project page entirely while it is still being written. The page
   content stays in the DOM (this is a visual cover, not access control). */
.wip-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 60px 24px;
  text-align: center;
  background: var(--bg);
}
.wip-overlay::before, .wip-overlay::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background: repeating-linear-gradient(
    45deg, var(--accent) 0 16px, transparent 16px 32px);
  opacity: 0.75;
}
.wip-overlay::before { top: 0; }
.wip-overlay::after { bottom: 0; }
.wip-overlay svg {
  width: clamp(44px, 8vw, 70px);
  height: clamp(44px, 8vw, 70px);
  stroke: var(--accent);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wip-title {
  font-family: var(--mono);
  font-size: clamp(28px, 8vw, 84px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: clamp(1px, 0.5vw, 6px);
  text-transform: uppercase;
  color: var(--accent);
}
.wip-project {
  font-family: var(--mono);
  font-size: clamp(11px, 2vw, 14px);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.wip-sub {
  max-width: 520px;
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.6;
  color: var(--text-dim);
}
.wip-back {
  margin-top: 10px;
  padding: 13px 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-bright);
  font-size: 15px;
  text-decoration: none;
  transition: border-color 0.3s, background 0.3s;
}
.wip-back:hover, .wip-back:focus-visible {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.project-hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: 160px 60px 40px;
}
.back-link {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  transition: color 0.3s, gap 0.3s;
}
.back-link:hover { color: var(--accent); gap: 15px; }
.project-hero h1 {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 20px;
}
.project-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.project-summary {
  font-size: 18px;
  color: var(--text-dim);
  line-height: 1.85;
  max-width: 720px;
}

.project-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 50px 60px;
}
.project-section h2 {
  font-size: 13px;
  font-family: var(--mono);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}
.project-section p {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.85;
  margin-bottom: 18px;
  max-width: 780px;
}
.project-section p strong { color: var(--text); font-weight: 500; }
.bullet-list { list-style: none; max-width: 780px; }
.bullet-list li {
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.8;
  padding: 10px 0 10px 22px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.bullet-list li:last-child { border-bottom: none; }
.bullet-list li::before {
  content: '›';
  color: var(--accent);
  font-weight: 700;
  position: absolute;
  left: 0;
}

/* Media gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s;
  display: flex;
  flex-direction: column;
}
.gallery-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
}
.gallery-item.wide { grid-column: 1 / -1; }
.gallery-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-card-hover);
  overflow: hidden;
}
.gallery-frame img,
.gallery-frame video,
.gallery-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  display: block;
}
.gallery-frame video { object-fit: contain; background: #000; }
.gallery-item button.gallery-frame {
  padding: 0;
  cursor: zoom-in;
  border: 0;
  font: inherit;
  color: inherit;
}
.gallery-caption {
  padding: 14px 18px 18px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
/* Placeholder shown when a media file is missing or not set yet */
.gallery-missing {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--bg-card-hover);
}
.gallery-missing svg { width: 26px; height: 26px; color: var(--accent); opacity: 0.6; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s;
}
.lightbox-close:hover { border-color: var(--accent); color: var(--accent); }

/* Next/prev project nav at the foot of a detail page */
.project-nav {
  position: static;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 60px 100px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.project-nav a {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 26px;
  text-decoration: none;
  flex: 1 1 260px;
  transition: all 0.3s;
}
.project-nav a:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}
.project-nav .dir {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.project-nav .name { color: var(--text-bright); font-size: 16px; font-weight: 500; }
.project-nav a.next { text-align: right; }

/* Compact "next project" button that rides along the right edge of the
   viewport. Collapsed it is just an arrow; hovering/focusing reveals the
   project name. It hides itself once the footer nav is on screen. */
.project-fab {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
  max-width: 50px;
  padding: 13px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: max-width 0.35s ease, opacity 0.3s ease, visibility 0.3s ease,
              border-color 0.3s ease, background 0.3s ease;
}
.project-fab:hover, .project-fab:focus-visible {
  max-width: 320px;
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.project-fab svg {
  width: 22px;
  height: 22px;
  flex: none;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.project-fab .fab-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 22px;
}
.project-fab .fab-dir {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.project-fab .fab-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-bright);
}
.project-fab.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ─── Animations ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .content > nav { padding: 14px 24px; }
  .nav-right { gap: 20px; }
  .nav-links { gap: 20px; }
  .hero { flex-direction: column; padding: 120px 28px 60px; gap: 40px; }
  .hero-graphic { flex: 0 0 260px; width: 260px; height: 260px; }
  .orbit-center { inset: 80px; }
  section { padding: 80px 28px; }
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .project-card { grid-template-columns: 1fr; }
  .project-meta { align-items: flex-start; }
  .contact-links { flex-direction: column; align-items: center; }
  .window-body { height: 520px; }
  .window-body.pdf-viewer { height: auto; padding: 14px; gap: 14px; }
  .window-body.pdf-viewer > iframe { height: 70vh; }
  .project-hero { padding: 130px 28px 30px; }
  .project-section { padding: 40px 28px; }
  .project-nav { padding: 30px 28px 80px; }
  .lightbox { padding: 20px; }
}
@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav-logo { font-size: 12px; letter-spacing: 1px; }
  .hero h1 { letter-spacing: -1px; }
  .stats-grid { grid-template-columns: 1fr; }
  .window-body { height: 440px; }
  .window-body.pdf-viewer { height: auto; }
  .gallery { grid-template-columns: 1fr; }
  .project-nav a.next { text-align: left; }
  .project-fab { right: 14px; padding: 11px; max-width: 44px; }
  .project-fab svg { width: 20px; height: 20px; }
  .project-fab:hover, .project-fab:focus-visible { max-width: calc(100vw - 28px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
