/* ============================================
   Design tokens
   ============================================ */
:root {
  /* Color — monochrome editorial palette */
  --color-bg: #ffffff;
  --color-bg-mobile-bar: #ffffff;
  --color-card: #ffffff;
  --color-card-hover: #fafaf8;
  --color-border: #e5e2dd;
  --color-border-strong: #cfc9c0;

  --color-text-primary: #333333;
  --color-text-body: #333333;
  --color-text-muted: #848484;

  --color-accent: #333333;
  --color-accent-hover: #000000;
  --color-on-accent: #ffffff;

  --color-focus-ring: #333333;

  /* Type */
  --font-heading: "Nunito Sans", -apple-system, "system-ui", "Segoe UI", Roboto, sans-serif;
  --font-body: "Nunito Sans", -apple-system, "system-ui", "Segoe UI", Roboto, sans-serif;

  --fs-xs: 0.8125rem;   /* 13px */
  --fs-sm: 0.9375rem;   /* 15px */
  --fs-base: 1.0625rem; /* 17px */
  --fs-md: 1.125rem;    /* 18px */
  --fs-lg: 1.375rem;    /* 22px */
  --fs-xl: 1.75rem;     /* 28px */
  --fs-2xl: 2.25rem;    /* 36px */
  --fs-3xl: 2.75rem;    /* 44px */

  /* Space (4/8 rhythm) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  --content-max-width: 40rem;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --duration-fast: 150ms;
  --duration-base: 250ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   Reset
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-family: var(--font-heading); font-weight: 300; color: var(--color-text-primary); }
p { margin: 0 0 var(--space-4); }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
}

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-text-primary);
  color: var(--color-on-accent);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-weight: 500;
  z-index: 100;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus {
  top: var(--space-4);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html {
  scroll-behavior: smooth;
}

/* ============================================
   Top bar (scrolls with the page, all breakpoints)
   ============================================ */
.topbar {
  /* relative (not static) so z-index still applies — otherwise the
     mobile menu overlay (a positioned element) paints above the nav
     links and swallows taps meant for them. */
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-mobile-bar);
  border-bottom: 1px solid var(--color-border);
}

.topbar__name {
  order: 1;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--color-text-primary);
  transition: color var(--duration-fast) var(--ease-out);
}
.topbar__name:hover { color: var(--color-text-muted); }

.menu-toggle {
  order: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.menu-toggle__icon {
  width: 22px;
  height: 16px;
  position: relative;
  display: block;
}
.menu-toggle__icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 2px;
  transition: transform var(--duration-base) var(--ease-out), opacity var(--duration-fast) var(--ease-out), top var(--duration-base) var(--ease-out);
}
.menu-toggle__icon span:nth-child(1) { top: 0; }
.menu-toggle__icon span:nth-child(2) { top: 7px; }
.menu-toggle__icon span:nth-child(3) { top: 14px; }

.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__icon span:nth-child(3) {
  top: 7px;
  transform: rotate(-45deg);
}

/* Collapsible on mobile (dropdown below the bar); inline columns on desktop. */
.topbar__nav,
.topbar__socials {
  flex-basis: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height var(--duration-base) var(--ease-out), opacity var(--duration-base) var(--ease-out);
}
.topbar__nav { order: 3; }
.topbar__socials { order: 4; justify-content: center; }

.topbar.is-open .topbar__nav,
.topbar.is-open .topbar__socials {
  max-height: 300px;
  opacity: 1;
  overflow-y: auto;
  pointer-events: auto;
  margin-top: var(--space-6);
}

.topbar__nav ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.topbar__nav a {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-size: var(--fs-sm);
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  padding: var(--space-2) 0;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out);
}

.topbar__nav a .nav-line {
  width: 100%;
  height: 1px;
  background: transparent;
  transition: background var(--duration-base) var(--ease-out);
}

.topbar__nav a:hover,
.topbar__nav a:focus-visible {
  color: var(--color-text-primary);
}
.topbar__nav a:hover .nav-line,
.topbar__nav a:focus-visible .nav-line {
  background: var(--color-border-strong);
}

.topbar__nav a.is-active {
  color: var(--color-text-primary);
  font-weight: 500;
}
.topbar__nav a.is-active .nav-line {
  background: var(--color-text-primary);
}

@media (min-width: 1024px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: var(--space-5) var(--space-8);
  }

  .menu-toggle { display: none; }

  .topbar__name {
    order: initial;
    justify-self: center;
    font-size: var(--fs-xl);
  }

  .topbar__nav,
  .topbar__socials {
    order: initial;
    flex-basis: auto;
    max-height: none;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    margin-top: 0;
  }

  .topbar__nav {
    justify-self: start;
  }
  .topbar__nav ul {
    flex-direction: row;
    gap: var(--space-5);
  }
  .topbar__nav a {
    align-items: center;
  }

  .topbar__socials {
    justify-self: end;
    justify-content: flex-end;
    gap: var(--space-4);
  }
}

@media (min-width: 1440px) {
  .topbar {
    padding-left: var(--space-9);
    padding-right: var(--space-9);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.4);
  z-index: 35;
}
.overlay[hidden] { display: none; }

@media (min-width: 1024px) {
  .overlay { display: none !important; }
}

.social-list {
  display: flex;
  gap: var(--space-5);
}
.social-list a,
.social-list .lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 calc(var(--space-3) * -1);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.social-list a:hover,
.social-list a:focus-visible,
.social-list .lang-toggle:hover,
.social-list .lang-toggle:focus-visible {
  color: var(--color-text-primary);
  transform: translateY(-2px);
}

.lang-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---- Content ---- */
.content {
  padding: 0 var(--space-5) var(--space-9);
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* Wider content column for text-dense pages (e.g. Experience) so role/date
   pairs and bullets wrap less, reading shorter without changing wording. */
@media (min-width: 1024px) {
  .content--wide {
    max-width: 48rem;
  }
}

/* ============================================
   Hero
   ============================================ */
.hero {
  padding-top: var(--space-8);
  padding-bottom: var(--space-6);
  scroll-margin-top: var(--space-6);
}

.hero__name {
  font-size: var(--fs-3xl);
  font-weight: 300;
  letter-spacing: -0.01em;
}

.hero__tagline {
  margin: var(--space-4) 0 0;
  max-width: 30rem;
  color: var(--color-text-muted);
}

@media (min-width: 1024px) {
  .hero { padding-top: var(--space-9); }
}

/* Full-bleed video hero (About page only).
   Aspect-ratio driven (not vh) so the crop stays true to the footage's own
   wide framing instead of being stretched/zoomed to fill a viewport fraction. */
.hero--video {
  position: relative;
  overflow: hidden;
  padding: 0;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 220px;
  max-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
}

@media (min-width: 640px) {
  .hero--video { aspect-ratio: 2 / 1; }
}

@media (min-width: 1024px) {
  .hero--video { aspect-ratio: 5 / 2; max-height: 420px; }
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  transition: opacity 600ms linear;
}
.hero__video.is-active {
  opacity: 1;
}

/* Static photo hero (Projects page) — same positioning as .hero__video
   but always visible, no crossfade/toggle machinery needed. */
.hero__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero__video-toggle {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 3;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.hero__video-toggle:hover,
.hero__video-toggle:focus-visible {
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(-1px);
}
.hero__video-toggle svg {
  display: block;
  width: 16px;
  height: 16px;
}
.hero__video-toggle .icon-play,
.hero__video-toggle .icon-pause,
.hero__video-toggle .icon-replay {
  display: none;
}
.hero__video-toggle[data-state="play"] .icon-play { display: block; }
.hero__video-toggle[data-state="pause"] .icon-pause { display: block; }
.hero__video-toggle[data-state="replay"] .icon-replay { display: block; }

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 8, 4, 0.5) 0%, rgba(10, 8, 4, 0.72) 100%);
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 34rem;
  padding: var(--space-8) var(--space-5);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.hero--video .hero__name { color: #ffffff; }
.hero--video .hero__tagline {
  font-size: var(--fs-md);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.9);
  margin-left: auto;
  margin-right: auto;
}

.section {
  padding-top: var(--space-8);
  scroll-margin-top: var(--space-6);
}

.section--compact {
  padding-top: var(--space-6);
}

@media (min-width: 1024px) {
  .section:first-of-type { padding-top: var(--space-9); }
}

.page-title {
  font-size: var(--fs-2xl);
  font-weight: 300;
  margin-bottom: var(--space-6);
}

.page-title--tight {
  margin-bottom: var(--space-4);
}

/* Standing WIP note — dashed border marks it as an aside, not core content. */
.todo-note {
  margin-bottom: var(--space-6);
  padding: var(--space-3) var(--space-4);
  max-width: 60ch;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.page-subtitle {
  max-width: 42ch;
  margin-top: calc(-1 * var(--space-4));
  margin-bottom: var(--space-6);
  font-size: var(--fs-base);
  color: var(--color-text-muted);
}

/* Reveal-on-scroll (progressive enhancement, JS toggles .is-visible) */
.reveal {
  opacity: 1;
  transform: none;
}
.js-reveal-ready .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
}
.js-reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================
   About
   ============================================ */
.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.about__text strong { color: var(--color-text-primary); font-weight: 500; }

.about__portrait {
  display: block;
  order: -1;
  max-width: 200px;
  margin: 0 auto;
}
.portrait-frame {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.portrait-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 640px) {
  .about__grid {
    grid-template-columns: 1fr 220px;
    align-items: start;
  }
  .about__portrait {
    order: initial;
    max-width: none;
    margin: 0;
  }
}

/* ============================================
   Experience / timeline
   ============================================ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.timeline--compact {
  gap: var(--space-4);
}
.timeline--compact .timeline__header {
  margin-bottom: var(--space-2);
}
.timeline--compact .timeline__list {
  gap: var(--space-1);
}

.timeline__item {
  padding-left: var(--space-5);
  border-left: 1px solid var(--color-border);
  position: relative;
}
.timeline__item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-text-muted);
}

.timeline__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}

.timeline__role {
  flex: 1 1 220px;
  font-size: var(--fs-md);
  font-weight: 500;
}

.timeline__date {
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  font-family: var(--font-heading);
}

.timeline__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.timeline__list li {
  position: relative;
  padding-left: var(--space-5);
}
.timeline__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

/* ============================================
   Projects
   ============================================ */
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .project-grid { grid-template-columns: repeat(3, 1fr); }
}

.project-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  transition: transform var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out), background var(--duration-base) var(--ease-out);
}
.project-card:hover,
.project-card:focus-within {
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
  background: var(--color-card-hover);
}

.project-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

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

.project-card__links {
  display: flex;
  gap: var(--space-1);
}
.project-card__links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}
.project-card__links a:hover,
.project-card__links a:focus-visible {
  color: var(--color-text-primary);
}

.project-card__title {
  font-size: var(--fs-md);
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.project-card__desc {
  color: var(--color-text-body);
  font-size: var(--fs-sm);
  flex: 1;
}

.project-grid__status {
  grid-column: 1 / -1;
  padding: var(--space-5);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.project-grid__status a { color: var(--color-text-primary); }

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
}
.tag-list li {
  font-size: var(--fs-xs);
  font-family: var(--font-heading);
  color: var(--color-text-muted);
}

.tag-list--skills {
  gap: var(--space-3);
}
.tag-list--skills li {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  font-size: var(--fs-sm);
}

.tag-list--skills li.tag--core {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 600;
}

/* ============================================
   Skills
   ============================================ */
.skills__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .skills__grid { grid-template-columns: repeat(2, 1fr); }
}

.skills__group-title {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

