:root {
  --bg: #0e0c0a;
  --bg-elev: #181513;
  --text: #d8cfc2;
  --text-muted: #8a8278;
  --text-dim: #5b554d;
  --heading: #f4ede0;
  --accent: #e25d29;
  --accent-soft: #f4a261;
  --border: #2a2521;
  --rule: #211d1a;

  --max-width: 1180px;
  --radius: 10px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 7rem;
  --space-8: 10rem;

  --font-serif: "Fraunces", "Times New Roman", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg-elev);
}

/* WebKit / Blink (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-elev);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border: 2px solid var(--bg-elev);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-soft);
}

::-webkit-scrollbar-corner {
  background: var(--bg-elev);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

ul {
  list-style: none;
}

img,
video {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.15;
}

em {
  font-style: italic;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ───────── Reveal-on-scroll ───────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
  will-change: opacity, transform;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ───────── Section rhythm ───────── */
.section {
  padding-top: var(--space-7);
  padding-bottom: var(--space-7);
}

@media (min-width: 768px) {
  .section {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }
}

.section-head {
  margin-bottom: var(--space-6);
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.section-title {
  font-family: var(--font-serif);
  font-weight: 350;
  font-size: clamp(1.9rem, 5vw, 3rem);
  letter-spacing: -0.025em;
  color: var(--heading);
  font-variation-settings:
    "opsz" 100,
    "SOFT" 40,
    "WONK" 0;
}

/* ───────── Buttons ───────── */
.btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.btn-primary {
  color: var(--bg);
  background: var(--accent);
}

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

.btn-ghost {
  color: var(--accent);
  background: transparent;
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: rgba(226, 93, 41, 0.08);
}

/* ───────── Hero ───────── */
.hero {
  min-height: clamp(80vh, 90vh, 100vh);
  display: flex;
  align-items: center;
  padding-top: var(--space-7);
  padding-bottom: var(--space-7);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -10%;
  /* Glow scales with the viewport so it fills the box on every screen size
     instead of being clipped into a thin sliver on narrow / tall mobiles. */
  width: max(60%, 22rem);
  height: max(80%, 22rem);
  background: radial-gradient(
    ellipse at center,
    rgba(226, 93, 41, 0.14),
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

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

.hero-main {
  max-width: 56ch;
}

/* Stats are a desktop-only flourish; hidden on smaller screens where the
   hero copy already carries the same numbers. */
.hero-stats {
  display: none;
}

@media (min-width: 900px) {
  .hero-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-7);
  }

  /* Name + lead are the primary element: let them take the lion's share. */
  .hero-main {
    flex: 1 1 auto;
  }

  /* Stats are a slim secondary column pinned to the right, intentionally
     narrow so they never compete with the name/lead for attention. */
  .hero-stats {
    display: block;
    flex: 0 0 auto;
    width: max-content;
    align-self: center;
    border-left: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    padding-left: var(--space-4);
    opacity: 0.85;
  }

  .hero-stats-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .hero-stat {
    margin: 0;
  }

  .hero-stat-num {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--accent);
  }

  .hero-stat-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin: 2px 0 0;
    max-width: 14ch;
  }
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.hero-name {
  font-family: var(--font-serif);
  font-weight: 350;
  font-variation-settings:
    "opsz" 144,
    "SOFT" 40,
    "WONK" 0;
  font-size: clamp(3rem, 13vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--heading);
  margin: 0 0 var(--space-5);
}

.name-line {
  display: block;
}

.name-italic {
  font-style: italic;
  font-weight: 350;
  color: var(--accent);
  font-variation-settings:
    "opsz" 144,
    "SOFT" 60,
    "WONK" 1;
}

.hero-lead {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.7;
  color: var(--text);
  max-width: 52ch;
  margin: 0 0 var(--space-6);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ───────── Skills ───────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.skill-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.skill-card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--accent-soft);
  margin-bottom: var(--space-3);
  font-variation-settings:
    "opsz" 40,
    "SOFT" 40,
    "WONK" 0;
}

.skill-card p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: var(--space-4);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.skill-tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* ───────── Projects ───────── */
.project {
  padding-top: var(--space-7);
  padding-bottom: var(--space-7);
  border-top: 1px solid var(--rule);
}

.project:first-of-type {
  border-top: none;
}

.project-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (min-width: 900px) {
  .project-inner {
    grid-template-columns: 1.05fr 1fr;
    gap: var(--space-7);
    align-items: start;
  }
  .project-reverse .project-media {
    order: 2;
  }
  /* anchor the video to the top of its slot on desktop */
  .project-media {
    align-self: start;
  }
  .project-video {
    object-position: top;
  }
}

/* video / preview slot */
.project-media {
  position: sticky;
  top: 6rem;
}

@media (max-width: 899px) {
  .project-media {
    position: static;
  }
}

.project-media-placeholder,
.project-video {
  width: 100%;
  /* Default to 16:9; each video overrides this below to match its own
     cropped content ratio so it fills the slot with no black bars. */
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* The source recordings had black borders baked into the 1280x720 frame.
   The WebMs are cropped to their real content, so each has its own ratio:
   cars-3d is 1016x560 and media-monitor is 1110x624. Match each exactly. */
#project-cars-3d .project-video,
#project-cars-3d .project-media-placeholder {
  aspect-ratio: 1016 / 560;
}

#project-media-monitor .project-video,
#project-media-monitor .project-media-placeholder {
  aspect-ratio: 1110 / 624;
}

.project-media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background:
    radial-gradient(circle at 30% 30%, rgba(226, 93, 41, 0.14), transparent 60%),
    linear-gradient(135deg, var(--bg-elev) 0%, var(--bg) 100%);
}

/* When a video is present, it owns the slot; the placeholder is only a
   graceful fallback that the video's onerror handler reveals if the file
   is missing or fails to load. */
.project-video + .project-media-placeholder {
  display: none;
}

.placeholder-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.placeholder-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.project-video {
  object-fit: cover;
  background: var(--bg-elev);
}

/* project text column */
.project-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-2);
}

.project-title {
  font-family: var(--font-serif);
  font-weight: 350;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  letter-spacing: -0.025em;
  color: var(--heading);
  margin-bottom: var(--space-3);
  font-variation-settings:
    "opsz" 100,
    "SOFT" 40,
    "WONK" 0;
}

.project-tagline {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.5em;
  letter-spacing: 0.01em;
  color: var(--accent);
  white-space: nowrap;
}

.project-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  margin-bottom: var(--space-5);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.project-live:hover {
  color: var(--accent-soft);
  border-bottom-color: var(--accent-soft);
}

.project-block {
  margin-bottom: var(--space-5);
}

.project-block:last-child {
  margin-bottom: 0;
}

.project-block h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.project-block > p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  max-width: 56ch;
}

.project-do,
.project-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.project-do li,
.project-features li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

.project-do li::before,
.project-features li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.project-tech li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--accent-soft);
  border: 1px solid var(--border);
  background: rgba(226, 93, 41, 0.06);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

.project-code {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.project-code:hover {
  color: var(--accent-soft);
  border-bottom-color: var(--accent-soft);
}

/* ───────── Experience / timeline ───────── */
.timeline {
  display: grid;
  gap: var(--space-4);
}

.timeline-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.timeline-item:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-2);
}

.timeline-role {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.3rem;
  color: var(--accent-soft);
  font-variation-settings:
    "opsz" 40,
    "SOFT" 40,
    "WONK" 0;
}

.timeline-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  white-space: nowrap;
}

.timeline-org {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.timeline-summary {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  max-width: 64ch;
  margin-bottom: var(--space-3);
}

.timeline-points {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.timeline-points li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  max-width: 64ch;
}

.timeline-points li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
}

.timeline-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.timeline-tech li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--accent-soft);
  border: 1px solid var(--border);
  background: rgba(226, 93, 41, 0.06);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

/* ───────── Education ───────── */
.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.education-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.education-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.education-card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--heading);
  margin-bottom: var(--space-3);
  font-variation-settings:
    "opsz" 40,
    "SOFT" 40,
    "WONK" 0;
}

.education-org {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-soft);
  margin-bottom: var(--space-1);
}

.education-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.education-meta a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.education-meta a:hover {
  color: var(--accent-soft);
  border-bottom-color: var(--accent-soft);
}

/* ───────── Personal tools ───────── */
.section-lead {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 56ch;
  margin-top: var(--space-4);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.tool-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--space-2);
}

.tool-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--heading);
  margin-bottom: var(--space-2);
  font-variation-settings:
    "opsz" 40,
    "SOFT" 40,
    "WONK" 0;
}

.tool-tagline {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.tool-body {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: var(--space-4);
}

.tool-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  flex-grow: 1;
}

.tool-features li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

.tool-features li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
}

.tool-card .project-code {
  margin-top: auto;
  align-self: flex-start;
}

/* ───────── About ───────── */
.about-inner {
  max-width: 760px;
}

.about-body p {
  font-family: var(--font-serif);
  font-weight: 350;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  line-height: 1.6;
  color: var(--text);
  margin-bottom: var(--space-4);
  font-variation-settings:
    "opsz" 32,
    "SOFT" 30,
    "WONK" 0;
}

.about-body p:last-child {
  margin-bottom: 0;
}

.about-body em {
  font-style: italic;
  color: var(--accent);
  font-variation-settings:
    "opsz" 32,
    "SOFT" 60,
    "WONK" 1;
}

/* ───────── Contact ───────── */
.contact-inner {
  max-width: 760px;
}

.contact-title {
  font-family: var(--font-serif);
  font-weight: 350;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: -0.03em;
  color: var(--heading);
  margin: var(--space-3) 0 var(--space-4);
  font-variation-settings:
    "opsz" 120,
    "SOFT" 40,
    "WONK" 0;
}

.contact-lead {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 48ch;
  margin-bottom: var(--space-6);
}

.contact-links {
  display: grid;
  gap: var(--space-3);
}

.contact-links a {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.contact-links a:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.contact-link-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  min-width: 5rem;
}

.contact-link-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--heading);
}

.contact-links a:hover .contact-link-value {
  color: var(--accent);
}

/* ───────── Footer ───────── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.footer-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent);
  font-variation-settings:
    "opsz" 40,
    "SOFT" 60,
    "WONK" 1;
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.footer-year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}
