:root {
  --bg: #100e0c;
  --bg-elev: #181511;
  --ink: #f6f1e8;
  --muted: #b7aea1;
  --line: rgba(246, 241, 232, 0.1);
  --accent: #e85d4c;
  --accent-soft: rgba(232, 93, 76, 0.14);
  --gold: #d4a574;
  --paper: #f3ead8;
  --paper-ink: #2b241c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --header-h: 76px;
  --scroll-experience: min(46vh, 420px);
  --scroll-projects: min(62vh, 680px);
  --scroll-certs: min(58vh, 640px);
}

[data-theme="light"] {
  --bg: #f4efe6;
  --bg-elev: #fffdf8;
  --ink: #1b1713;
  --muted: #6d655a;
  --line: rgba(27, 23, 19, 0.1);
  --accent: #c44536;
  --accent-soft: rgba(196, 69, 54, 0.12);
  --gold: #9a6b3a;
  --shadow: 0 18px 40px rgba(40, 24, 12, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

body.lightbox-open {
  overflow: hidden;
}

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

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  z-index: 80;
  border-radius: 8px;
}

.skip-link:focus {
  top: 12px;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 60;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}

.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.logo {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--muted);
  position: relative;
}

.nav-links a.is-active,
.nav-links a:hover {
  color: var(--ink);
}

.nav-links a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  background: var(--accent);
}

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

.icon-btn,
.nav-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.nav-toggle {
  display: none;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle span::before {
  top: -5px;
}

.nav-toggle span::after {
  top: 5px;
}

.site-header.is-open .nav-toggle span {
  background: transparent;
}

.site-header.is-open .nav-toggle span::before {
  top: 0;
  transform: rotate(45deg);
}

.site-header.is-open .nav-toggle span::after {
  top: 0;
  transform: rotate(-45deg);
}

.hero {
  position: relative;
  padding: 48px 0 88px;
  min-height: calc(100svh - var(--header-h));
  display: grid;
  align-items: center;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 64px;
  align-items: center;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--gold);
  margin: 0 0 18px;
}

.kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold);
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 6.1rem);
  margin: 0 0 18px;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 36rem;
}

.role-line {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 500;
}

#role-rotator {
  display: inline-block;
  color: var(--accent);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#role-rotator.is-out {
  opacity: 0;
  transform: translateY(8px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-ghost:hover {
  border-color: var(--ink);
}

.photo-frame {
  position: relative;
  isolation: isolate;
}

.photo-frame::before,
.photo-frame::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  border: 2px solid var(--gold);
  z-index: 2;
}

.photo-frame::before {
  top: -12px;
  left: -12px;
  border-right: 0;
  border-bottom: 0;
}

.photo-frame::after {
  right: -12px;
  bottom: -12px;
  border-left: 0;
  border-top: 0;
}

.photo-frame img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px;
  position: relative;
  z-index: 1;
}

.photo-glow {
  position: absolute;
  inset: 18% -8% auto;
  height: 55%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  filter: blur(12px);
  z-index: 0;
}

.ghost-name {
  position: absolute;
  right: -4%;
  bottom: -6%;
  font-family: var(--display);
  font-size: clamp(4rem, 10vw, 8rem);
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

section {
  padding: 88px 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 36px;
}

.section-index {
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-head h2 {
  margin: 6px 0 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 34rem;
}

.awards {
  padding-top: 0;
}

.awards-marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 18px 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.awards-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: marquee 32s linear infinite;
}

.awards-marquee:hover .awards-track {
  animation-play-state: paused;
}

.award-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  text-decoration: none;
  font-size: 0.92rem;
}

.award-chip::before {
  content: "★";
  color: var(--gold);
  font-size: 0.78rem;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

.scroll-shell {
  position: relative;
}

.scroll-shell::before,
.scroll-shell::after {
  content: "";
  position: absolute;
  left: 0;
  right: 10px;
  height: 40px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.scroll-shell::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg), transparent);
}

.scroll-shell::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg), transparent);
}

.scroll-shell.has-overflow::after,
.scroll-shell.is-scrolled::before {
  opacity: 1;
}

.scroll-shell.is-end::after {
  opacity: 0;
}

.scroll-panel {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 8px 12px 16px 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--gold) 75%, transparent) transparent;
}

#experience-list.scroll-panel {
  max-height: var(--scroll-experience);
}

#project-grid.scroll-panel {
  max-height: var(--scroll-projects);
}

#cert-grid.scroll-panel {
  max-height: var(--scroll-certs);
}

.scroll-panel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.scroll-panel::-webkit-scrollbar {
  width: 8px;
}

.scroll-panel::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--gold) 70%, transparent);
  border-radius: 99px;
}

.scroll-panel::-webkit-scrollbar-track {
  background: transparent;
}

.exp-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

#experience-list .exp-item:last-child {
  border-bottom: 0;
}

.exp-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.exp-index {
  font-family: var(--display);
  font-size: 1.4rem;
  color: var(--gold);
}

.exp-body h3 {
  margin: 0 0 10px;
  font-size: 1.7rem;
}

.exp-body a {
  text-decoration: none;
}

.exp-body a:hover {
  color: var(--accent);
}

.exp-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.exp-body strong {
  color: var(--ink);
  font-weight: 600;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.filter-chip.is-active,
.filter-chip:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

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

.project-card,
.cert-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.project-card:hover,
.cert-wrap:hover .cert-card,
.cert-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: var(--shadow);
}

.project-media,
.cert-media {
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #1a1714;
}

.project-media img,
.cert-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover img {
  transform: scale(1.06);
}

.project-body,
.cert-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.project-cat,
.cert-issuer,
.cert-year {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.project-body h3,
.cert-body h3 {
  margin: 0;
  font-size: 1.35rem;
}

.project-body p,
.cert-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-cta,
.cert-link {
  margin-top: auto;
  padding-top: 10px;
  font-size: 0.88rem;
  color: var(--accent);
}

.cert-wrap {
  text-decoration: none;
  display: block;
  height: 100%;
}

.cert-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.diploma {
  height: 100%;
  background:
    linear-gradient(180deg, rgba(212, 165, 116, 0.18), transparent 28%),
    var(--paper);
  color: var(--paper-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 18px 18px;
  position: relative;
}

.diploma-ornament {
  width: 54px;
  height: 10px;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  margin-bottom: 10px;
}

.diploma-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a6a43;
}

.diploma-title {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 8px 0 4px;
  line-height: 1.25;
}

.diploma-issuer {
  margin: 0;
  font-size: 0.82rem;
  font-style: italic;
}

.diploma-seal {
  margin-top: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  color: #8a4b32;
  font-family: var(--display);
  font-size: 0.78rem;
  background: radial-gradient(circle at 30% 30%, #f7d9a6, #c9854a);
}

.contact {
  padding-bottom: 40px;
}

.contact-panel {
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: clamp(28px, 5vw, 56px);
  background:
    radial-gradient(800px 200px at 10% 0%, var(--accent-soft), transparent 50%),
    var(--bg-elev);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.contact-panel h2 {
  margin: 8px 0 10px;
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.contact-panel p {
  margin: 0;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 6, 0.82);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 70;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-height: min(80vh, 900px);
  max-width: min(90vw, 1000px);
  border-radius: 16px;
}

.lightbox-caption {
  color: #fff;
  text-align: center;
  margin-top: 12px;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: none;
}

.reveal.in-view {
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 960px) {
  .hero-grid,
  .project-grid,
  .cert-grid,
  .contact-panel,
  .exp-item {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    gap: 36px;
  }

  .photo-frame {
    max-width: 420px;
  }

  .nav-toggle {
    display: grid;
  }

  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    display: none;
    padding: 8px 20px 16px;
  }

  .nav-links a {
    display: block;
    padding: 12px 0;
  }

  .site-header.is-open .nav-links {
    display: flex;
  }

  .section-head {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 680px) {
  :root {
    --scroll-experience: min(42vh, 360px);
    --scroll-projects: min(55vh, 560px);
    --scroll-certs: min(52vh, 520px);
  }

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

  .hero {
    padding-top: 24px;
  }

  .footer,
  .hero-actions,
  .contact-panel {
    flex-direction: column;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .awards-track,
  .reveal,
  .project-media img,
  #role-rotator {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
