:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #1f2523;
  --muted: #626b66;
  --line: rgba(31, 37, 35, 0.12);
  --rose: #85464c;
  --sage: #64796d;
  --gold: #775b29;
  --deep: #14211d;
  --shadow: 0 24px 70px rgba(31, 37, 35, 0.12);
}

[data-theme="dark"] {
  --bg: #111713;
  --surface: #17211c;
  --surface-strong: #1d2923;
  --ink: #f6efe5;
  --muted: #b9c1ba;
  --line: rgba(246, 239, 229, 0.14);
  --rose: #e4a1a3;
  --sage: #9bb1a3;
  --gold: #d7b76d;
  --deep: #0f1713;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 64px);
  color: #fffaf3;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.site-header.scrolled {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(31, 37, 35, 0.08);
  backdrop-filter: blur(18px);
}

.brand,
.nav-links,
.language-switcher {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: "Playfair Display", serif;
}

.nav-links a {
  font-size: 0.92rem;
  font-weight: 700;
  opacity: 0.88;
}

.theme-toggle,
.lang-option,
.dialog-close {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.language-switcher {
  gap: 6px;
  padding: 4px;
  border: 1px solid currentColor;
  border-radius: 999px;
}

.lang-option {
  width: 34px;
  height: 34px;
  border-color: transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  opacity: 0.72;
}

.lang-option.active {
  background: #fffaf3;
  border-color: #fffaf3;
  color: #14211d;
  opacity: 1;
}

.site-header.scrolled .lang-option.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.hero {
  position: relative;
  min-height: 92svh;
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: 130px clamp(20px, 5vw, 64px) 76px;
  color: #fffaf3;
}

.hero-media,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(19, 28, 24, 0.92) 0%, rgba(19, 28, 24, 0.72) 44%, rgba(19, 28, 24, 0.14) 100%),
    linear-gradient(0deg, rgba(19, 28, 24, 0.5), transparent 42%);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(220px, 360px);
  align-items: center;
  justify-content: space-between;
  gap: clamp(28px, 6vw, 92px);
  width: 100%;
}

.hero-content {
  max-width: 760px;
}

.hero-portrait {
  width: min(30vw, 360px);
  min-width: 240px;
  margin: 0;
  justify-self: end;
}

.hero-portrait img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(255, 250, 243, 0.32);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.36);
}

.hero-portrait::after {
  content: "";
  display: block;
  width: 72%;
  height: 8px;
  margin: 18px auto 0;
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.24);
  filter: blur(10px);
}

.eyebrow,
.section-kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1,
.section-heading h2,
.intro-section h2,
.contact-copy h2 {
  font-family: "Playfair Display", Georgia, serif;
  line-height: 0.98;
}

.hero h1 {
  margin: 0;
  font-size: 6rem;
}

.hero-lede {
  max-width: 690px;
  margin: 24px 0 0;
  font-size: 1.25rem;
  color: rgba(255, 250, 243, 0.9);
}

.hero-actions,
.hero-facts,
.project-controls,
.project-stack,
.fit-tags,
.interest-marquee {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 34px;
}

.button,
.chip,
.text-button {
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
}

.button.primary {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}

[data-theme="dark"] .button.primary {
  color: #211719;
}

.hero .eyebrow { color: #e6bd81; }
.contact-section .section-kicker { color: #e6bd81; }

.button.secondary {
  background: rgba(255, 250, 243, 0.08);
  border-color: rgba(255, 250, 243, 0.42);
  color: #fffaf3;
}

.button.full {
  width: 100%;
}

.hero-facts {
  margin-top: 34px;
  color: rgba(255, 250, 243, 0.78);
  font-size: 0.92rem;
}

.hero-facts span {
  padding: 8px 12px;
  border: 1px solid rgba(255, 250, 243, 0.2);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.08);
}

.section-shell,
.intro-section,
.fit-band,
.contact-section {
  padding: 96px clamp(20px, 5vw, 64px);
}

.section-grid,
.two-column,
.contact-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(36px, 6vw, 96px);
}

.intro-section h2,
.section-heading h2,
.contact-copy h2 {
  margin: 0;
  font-size: 3rem;
}

.intro-copy > p,
.section-heading > p,
.contact-copy p,
.thesis-card p,
.project-card p {
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.metrics article,
.project-card,
.skill-board article,
.thesis-card,
.contact-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 20px;
}

.metrics strong {
  display: block;
  color: var(--rose);
  font-size: 1.1rem;
}

.metrics span {
  color: var(--muted);
  font-size: 0.92rem;
}

.fit-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  background: var(--deep);
  color: #fffaf3;
}

.fit-copy {
  max-width: 760px;
}

.fit-copy p {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.65rem, 3vw, 3rem);
  line-height: 1.12;
}

.fit-tags span,
.project-stack span,
.interest-marquee span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.fit-band .fit-tags span {
  background: rgba(255, 250, 243, 0.08);
  border-color: rgba(255, 250, 243, 0.2);
  color: rgba(255, 250, 243, 0.84);
}

.section-heading {
  max-width: 890px;
  margin-bottom: 34px;
}

.project-controls {
  margin-bottom: 24px;
}

.chip {
  padding: 9px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
}

.chip.active {
  background: var(--ink);
  color: var(--bg);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.project-card {
  display: flex;
  min-height: 390px;
  flex-direction: column;
  padding: 26px;
  transition: transform 180ms ease, opacity 180ms ease;
}

.project-card.flagship {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--rose) 13%, var(--surface)));
}

.project-card:hover {
  transform: translateY(-4px);
}

.project-card.is-hidden {
  display: none;
}

.project-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.project-card h3,
.skill-board h3,
.thesis-card h3,
.project-dialog h2 {
  margin: 22px 0 10px;
  font-size: 1.4rem;
  line-height: 1.12;
}

.project-stack {
  margin-top: auto;
  padding-top: 22px;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.text-button {
  align-self: flex-start;
  margin-top: 22px;
  padding: 10px 0;
  border-width: 0 0 1px;
  background: transparent;
  color: var(--rose);
}

.github-proof {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--deep);
  color: #fffaf3;
}

.github-proof h3 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.15;
}

.github-stats {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 10px;
}

.github-stats span {
  padding: 8px 12px;
  border: 1px solid rgba(255, 250, 243, 0.2);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.08);
  color: rgba(255, 250, 243, 0.84);
  font-size: 0.9rem;
  font-weight: 800;
}

.sticky-heading {
  position: sticky;
  top: 110px;
  align-self: start;
}

.skill-board {
  display: grid;
  gap: 16px;
}

.skill-board article {
  padding: 26px;
}

.education-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.thesis-card {
  padding: 34px;
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--sage) 13%, var(--surface)));
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.timeline-item span {
  color: var(--rose);
  font-weight: 800;
}

.timeline-item small {
  grid-column: 2;
  color: var(--muted);
}

.timeline-item.active {
  border-color: var(--rose);
  box-shadow: 0 12px 34px rgba(184, 111, 114, 0.14);
}

.compact {
  padding-top: 36px;
}

.interest-marquee {
  padding-bottom: 6px;
}

.contact-section {
  background: var(--deep);
  color: #fffaf3;
}

.contact-copy p {
  color: rgba(255, 250, 243, 0.78);
}

.contact-panel {
  display: grid;
  gap: 12px;
  padding: 26px;
  background: rgba(255, 250, 243, 0.08);
  border-color: rgba(255, 250, 243, 0.2);
  box-shadow: none;
}

.contact-panel a {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 250, 243, 0.18);
  color: rgba(255, 250, 243, 0.9);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.cv-downloads {
  display: grid;
  grid-template-columns: 1fr repeat(3, auto);
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 250, 243, 0.18);
  border-bottom: 1px solid rgba(255, 250, 243, 0.18);
}

.cv-downloads strong {
  color: #fffaf3;
}

.contact-panel .cv-downloads a {
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 250, 243, 0.28);
  border-radius: 6px;
  text-align: center;
}

.contact-panel .button {
  border-bottom: 1px solid var(--rose);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px clamp(20px, 5vw, 64px);
  color: var(--muted);
}

.project-dialog {
  width: min(760px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 34px;
}

[hidden] { display: none !important; }
.project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-card { min-width: 0; }
.project-preview { width: calc(100% + 52px); margin: -26px -26px 24px; height: auto; aspect-ratio: 8 / 5; object-fit: cover; object-position: top; border-radius: 7px 7px 0 0; border-bottom: 1px solid var(--line); }
.project-preview-link { display: block; width: calc(100% + 52px); margin: -26px -26px 24px; padding: 0; border: 0; background: var(--surface-strong); border-radius: 7px 7px 0 0; cursor: zoom-in; }
.project-preview-link .project-preview { display: block; width: 100%; margin: 0; object-fit: contain; object-position: center; }
.case-study-preview { margin: 24px 0; }
.case-study-preview img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.case-study-preview .text-button { display: inline-block; margin-top: 8px; }
.project-card h3, .qualification-entry h3, .experience-entry h3 { overflow-wrap: anywhere; }
.project-dialog { max-height: calc(100svh - 40px); overflow-y: auto; }
.project-dialog h2 { padding-right: 42px; }
.project-dialog h3 { font-size: 1rem; color: var(--rose); margin-bottom: 6px; }
.project-dialog p { color: var(--muted); }
.experience-entry { border-left: 2px solid var(--rose); padding: 0 0 0 28px; max-width: 800px; }
.experience-entry ul { color: var(--muted); padding-left: 20px; }
.experience-entry + .experience-entry { margin-top: 34px; }
.qualification-entry { border-top: 1px solid var(--line); padding: 22px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 36px; }
.qualification-entry h3 { margin: 0; font-size: 1.2rem; }
.qualification-entry p { margin: 0; color: var(--muted); }
.qualification-entry p:last-child { grid-column: 2; }
.qualification-meta { color: var(--rose) !important; }
.design-section { background: var(--surface); border-block: 1px solid var(--line); }
.design-section h2 { font-family: "Playfair Display", Georgia, serif; font-size: 2rem; margin: 0; }
.cv-mode { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cv-mode label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: .9rem; }
.cv-mode input { margin-top: 6px; accent-color: #e4a1a3; flex-shrink: 0; }
.cv-downloads { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cv-downloads a { min-width: 0 !important; padding: 10px 4px !important; }
.hero-portrait::after { display: none; }
.hero-portrait img { height: auto; }
.hero-facts span { border-radius: 6px; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 40; padding: 12px 20px; background: var(--surface); color: var(--ink); }
.skip-link:focus { top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid #397aa4; outline-offset: 4px; }
section[id] { scroll-margin-top: 100px; }
.site-header { gap: 16px; }
.nav-links { gap: 14px; }
.nav-links a { font-size: .85rem; }
.contact-panel .button.primary { color: #fff; }
[data-theme="dark"] .contact-panel .button.primary { color: #211719; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
@media (max-width: 1100px) { .hero h1 { font-size: 4.5rem; } .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .nav-links { display: none; } }
@media (max-width: 900px) { .project-grid { grid-template-columns: 1fr; } .qualification-entry { grid-template-columns: 1fr; } .qualification-entry p:last-child { grid-column: 1; } .intro-section h2, .section-heading h2, .contact-copy h2 { font-size: 2.3rem; } }
@media (max-width: 520px) { .hero h1 { font-size: 3.5rem !important; } .hero-lede { font-size: 1.05rem; } .cv-mode { grid-template-columns: 1fr; } .contact-panel { padding: 20px; } }

.project-dialog::backdrop {
  background: rgba(17, 23, 19, 0.62);
  backdrop-filter: blur(6px);
}

.dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  color: var(--ink);
}

.architecture {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 26px 0;
}

.architecture div {
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 800;
}

@media (max-width: 900px) {
  .site-header {
    padding: 14px 18px;
  }

  .nav-links {
    display: none;
  }

  .site-header {
    gap: 10px;
  }

  .language-switcher {
    gap: 3px;
    padding: 3px;
    margin-left: auto;
  }

  .lang-option {
    width: 31px;
    height: 31px;
    font-size: 0.66rem;
  }

  .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .hero {
    min-height: 88svh;
    padding-top: 112px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero-portrait {
    width: min(48vw, 230px);
    min-width: 160px;
    justify-self: start;
  }

  .hero-overlay {
    background:
      linear-gradient(90deg, rgba(19, 28, 24, 0.92), rgba(19, 28, 24, 0.54)),
      linear-gradient(0deg, rgba(19, 28, 24, 0.6), transparent 45%);
  }

  .section-grid,
  .two-column,
  .contact-section,
  .education-layout {
    grid-template-columns: 1fr;
  }

  .metrics,
  .project-grid,
  .architecture {
    grid-template-columns: 1fr;
  }

  .project-card.flagship {
    grid-column: auto;
  }

  .github-proof {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: auto;
  }

  .fit-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .sticky-heading {
    position: static;
  }

  footer {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .brand span:last-child {
    display: none;
  }

  .lang-option {
    width: 28px;
    height: 28px;
    font-size: 0.62rem;
  }

  .hero h1 {
    font-size: 4.1rem;
  }

  .hero-portrait {
    width: min(58vw, 190px);
  }

  .button {
    width: 100%;
  }

  .cv-downloads {
    grid-template-columns: 1fr;
  }

  .contact-panel .cv-downloads a {
    width: 100%;
  }

  .section-shell,
  .intro-section,
  .fit-band,
  .contact-section {
    padding-block: 72px;
  }
}

@media print {
  .site-header,
  .hero-media,
  .hero-overlay,
  .hero-actions,
  .project-controls,
  .text-button,
  .theme-toggle,
  .dialog-close,
  footer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .hero,
  .contact-section,
  .fit-band {
    min-height: auto;
    padding: 28px 0;
    background: #fff;
    color: #111;
  }

  .section-shell,
  .intro-section {
    padding: 28px 0;
  }

  .project-card,
  .skill-board article,
  .thesis-card,
  .contact-panel,
  .metrics article {
    box-shadow: none;
    break-inside: avoid;
  }
}

@media (max-width: 520px) {
  .hero { min-height: auto; padding: 100px 20px 48px; }
  .hero h1 { font-size: 3rem !important; padding-right: 118px; line-height: 1.05; }
  .hero-portrait { position: absolute; top: 76px; right: 0; width: 108px; min-width: 0; }
  .hero-actions { margin-top: 22px; gap: 10px; }
  .hero-actions .button { width: auto; flex: 1; padding: 8px 12px; font-size: .9rem; text-align: center; }
  .hero-facts { margin-top: 22px; gap: 8px; font-size: .82rem; }
  .hero-lede { margin-top: 20px; }
}
