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

:root {
  --color-bg: #fafafa;
  --color-text: #111;
  --color-muted: #636363;
  --color-border: #e5e5e3;
  --color-accent: #111;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --max-width: 1100px;
  --nav-height: 64px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* NAV */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  box-shadow: none;
  transform: translateY(0);
  transition:
    top    0.55s cubic-bezier(0.16, 1, 0.3, 1),
    left   0.55s cubic-bezier(0.16, 1, 0.3, 1),
    right  0.55s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    transform     0.55s cubic-bezier(0.16, 1, 0.3, 1),
    background    0.4s ease,
    box-shadow    0.4s ease,
    border-color  0.4s ease,
    backdrop-filter          0.4s ease,
    -webkit-backdrop-filter  0.4s ease;
  z-index: 100;
}

.nav-row {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  flex-shrink: 0;
}

/* Instant jump above viewport — no transition */
.nav.nav-jump {
  transform: translateY(-100%);
  transition: none !important;
}

/* Floating pill state after slide-in */
.nav.is-scrolled {
  top: 12px;
  left: calc(50% - 486px);
  right: calc(50% - 486px);
  border-radius: 20px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(250, 250, 249, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.08);
}

/* Inline L2 row — expands pill when Work/Experiments is opened while scrolled */
.nav-l2,
.nav-l2-exp {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  max-height: 0;
  overflow: hidden;
  border-top: 1px solid transparent;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, border-color 0.2s ease, padding 0.25s ease;
}

.nav.is-scrolled.work-is-open .nav-l2,
.nav.is-scrolled.exp-is-open .nav-l2-exp {
  max-height: 44px;
  padding: 8px 2rem 12px;
  opacity: 1;
  border-top-color: var(--color-border);
}

.nav-l2-link {
  font-size: 16px;
  font-weight: 400;
  color: var(--color-muted);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.15s;
}

.nav-l2-link:hover {
  color: var(--color-text);
}

/* Suppress the separate dropdowns when the pill is handling L2 */
.nav.is-scrolled ~ .work-dropdown,
.nav.is-scrolled ~ .exp-dropdown {
  display: none !important;
}

.nav-logo {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  font-size: 16px;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-work-btn,
.nav-exp-btn {
  font-size: 16px;
  font-family: var(--font);
  color: var(--color-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}

.nav-work-btn:hover,
.nav-work-btn[aria-expanded="true"],
.nav-exp-btn:hover,
.nav-exp-btn[aria-expanded="true"] {
  color: var(--color-text);
}

/* WORK + EXPERIMENTS DROPDOWNS */
.work-dropdown,
.exp-dropdown {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: rgba(250, 250, 249, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.work-dropdown.is-open,
.exp-dropdown.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.work-dropdown-inner,
.exp-dropdown-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  gap: 2rem;
  height: 44px;
  align-items: center;
  justify-content: center;
}

.work-dropdown-link,
.exp-dropdown-link {
  font-size: 16px;
  font-weight: 400;
  color: var(--color-muted);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.15s;
}

.work-dropdown-link:hover,
.exp-dropdown-link:hover {
  color: var(--color-text);
}

/* Desktop only */
@media (max-width: 768px) {
  .work-dropdown,
  .exp-dropdown { display: none; }
}

/* Hide work L2 when experiments is open and vice versa */
.nav.is-scrolled.exp-is-open .nav-l2 { display: none; }
.nav.is-scrolled.work-is-open .nav-l2-exp { display: none; }


/* IMAGE PLACEHOLDERS */
.img-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #eeede9;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.img-placeholder--square {
  aspect-ratio: 1 / 1;
}

/* HERO */
.hero {
  padding-top: calc(var(--nav-height) + 6rem);
  padding-bottom: 6rem;
  padding-left: 2rem;
  padding-right: 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-label {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: 1.5rem;
  transition: none;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0ms both;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--color-text);
  max-width: 800px;
  margin-bottom: 1.5rem;
  transition: none;
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 80ms both;
}

.hero-sub {
  font-size: 15px;
  color: var(--color-muted);
  transition: none;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 180ms both;
}

/* SECTIONS */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem;
  border-top: 1px solid var(--color-border);
}

.section-header {
  margin-bottom: 2.5rem;
}

/* EXPERIMENTS SECTION */
.exp-section {
  max-width: 824px;
  padding: 40px 0 64px;
  border-top: 1px solid var(--color-border);
}
.exp-header {
  margin-bottom: 40px;
}
.exp-label {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}
.exp-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.exp-img {
  width: 507px;
  height: 239px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--color-border);
}
.exp-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.exp-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: #333;
  margin: 0;
  line-height: 1.3;
}
.exp-meta {
  font-size: 16px;
  color: var(--color-muted);
  margin: 0;
}
.exp-desc {
  font-size: 16px;
  color: #636363;
  margin: 0;
  line-height: 1.65;
}
.exp-view {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  width: fit-content;
  transition: opacity 0.15s ease;
}
.exp-view:hover {
  opacity: 0.5;
}
@media (max-width: 768px) {
  .exp-card {
    flex-direction: column;
  }
  .exp-img {
    width: 100%;
    height: auto;
    aspect-ratio: 507 / 239;
  }
}

.section-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #636363;
}

/* PROJECTS GRID */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--color-bg);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background 0.15s;
}

.project-card:hover {
  background: #f0efed;
}

.projects-grid--small {
  grid-template-columns: 1fr;
}

.project-card--small {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.project-card--small-text {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  flex: 0 0 40%;
}

.project-card--small-img {
  flex: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  min-width: 0;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-tag {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  background: var(--color-border);
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
}

.project-year {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.project-body {
  flex: 1;
}

.project-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.6;
}

.project-arrow {
  font-size: 1.1rem;
  color: var(--color-muted);
  align-self: flex-end;
  transition: transform 0.15s, color 0.15s;
}

.project-card:hover .project-arrow {
  color: var(--color-text);
  transform: translate(2px, -2px);
}

/* ABOUT */
.section--about .about-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4rem;
  align-items: start;
}

.about-text {
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  max-width: 560px;
}

.about-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
}

.about-links a {
  font-size: 0.875rem;
  color: var(--color-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.about-links a:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

/* NAV THEME TOGGLE */
.nav-divider {
  color: var(--color-border);
  font-size: 0.875rem;
  user-select: none;
}

.nav-theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  outline: none;
}

.theme-track {
  display: flex;
  align-items: center;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: #e8e8e8;
  border: 1px solid #d0d0d0;
  position: relative;
  transition: background 0.35s ease, border-color 0.35s ease;
  flex-shrink: 0;
}

html.dark .theme-track {
  background: #3a3a38;
  border-color: #555553;
}

.theme-thumb {
  position: absolute;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.35s ease;
}

html.dark .theme-thumb {
  transform: translateX(16px);
  background: #2a2a28;
}

.theme-icon {
  width: 9px;
  height: 9px;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

.theme-icon--sun {
  opacity: 1;
  color: #636363;
  transform: scale(1) rotate(0deg);
}

.theme-icon--moon {
  opacity: 0;
  color: #edede9;
  transform: scale(0.6) rotate(-30deg);
}

html.dark .theme-icon--sun {
  opacity: 0;
  transform: scale(0.6) rotate(30deg);
}

html.dark .theme-icon--moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Suppress all transitions while the theme view-transition is running */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

/* DARK MODE */
html.dark {
  --color-bg: #111110;
  --color-text: #edede9;
  --color-muted: #a0a0a0;
  --color-border: #3a3a38;
  --color-accent: #edede9;
}

/* ── Nav / Megamenu ── */
html.dark .nav.is-scrolled {
  background: rgba(17, 17, 16, 0.88);
  box-shadow: inset 0 0 0 0.5px #b0b0ac, 0 4px 32px rgba(0, 0, 0, 0.08);
}
html.dark .work-dropdown,
html.dark .exp-dropdown {
  background: rgba(17, 17, 16, 0.97);
}

/* ── Homepage project cards ── */
html.dark .project-card:hover {
  background: #1c1c1a;
}
html.dark .project-tag {
  background: var(--color-border);
}

/* ── Image placeholders ── */
html.dark .img-placeholder {
  background: #222220;
}

/* ── Stack card placeholders ── */
html.dark .sp-card-front { background: #2f2f2f; }
html.dark .sp-card-mid   { background: #3a3a3a; }
html.dark .sp-card-back  { background: #404040; }

/* ── Stack section bar ── */
html.dark .sp-section-label { color: #e0e0dc; }
html.dark .sp-view-toggle   { background: #2a2a2a; }
html.dark .sp-toggle-btn.is-active {
  background: #3a3a38;
  color: #edede9;
}

/* ── Stack info panel text ── */
html.dark .sp-info-title  { color: #c8c8c4; }
html.dark .sp-info-label  { color: #c8c8c4; }

/* ── Stack impact pills ── */
html.dark .sp-pill      { background: #0d2b1a; outline-color: #1a3d14; }
html.dark .sp-pill-stat { color: #6ed52a; }
html.dark .sp-pill-desc { color: #c8c8c4; }

/* ── Stack detail highlight section ── */
html.dark .spd-section--highlight { background: #1a1a18; }

/* ── Grid card thumbnails ── */
html.dark .sp-grid-card { background: #2f2f2f; }

/* ── Coverflow footer ── */
html.dark .cf-footer        { background: #1a1a18; border-color: #3a3a38; }
html.dark .cf-title         { color: #edede9; }
html.dark .cf-sub           { color: #636363; }
html.dark .cf-nav-btn       { background: rgba(255,255,255,0.06); color: #636363; }
html.dark .cf-nav-btn:hover { background: rgba(255,255,255,0.1);  color: #edede9; }

/* ── Skeleton loaders ── */
html.dark .is-skeleton {
  background: linear-gradient(90deg, #2c2c2e 25%, #3c3c3e 50%, #2c2c2e 75%);
  background-size: 200% 100%;
}

/* ── Case study body text ── */
html.dark body                 { color: #b0b0ac; }

html.dark .auc-title,
html.dark .auc-subtitle,
html.dark .auc-section-title,
html.dark .auc-lbl-heading,
html.dark .auc-lbl-bold,
html.dark .auc-sub-heading,
html.dark .auc-block-heading   { color: #e0e0dc !important; }

html.dark .auc-body,
html.dark .auc-block-body,
html.dark .auc-sub-body,
html.dark .auc-lbl-sub,
html.dark .auc-impact-label    { color: #b0b0ac; }

/* ── Case study impact pills ── */
html.dark .auc-pill      { background: #0d2b1a; outline-color: #1a3d14; }
html.dark .auc-pill-stat { color: #6ed52a; }
html.dark .auc-pill-desc { color: #c8c8c4; }

/* ── Case study surface tones ── */
html.dark .auc-hero-img-wrap img,
html.dark .auc-launch-wide-img { opacity: 0.88; }
html.dark .auc-row-img          { opacity: 0.88; }

/* ── Case study dark sections ── */
html.dark .auc-dark { background: #393939; }

/* ── Stack hero background ── */
html.dark .sp-hero { background: #111110; }

/* ── Hero text ── */
html.dark .hero-label,
html.dark .hero-title,
html.dark .hero-sub { color: #edede9; }

/* ── Nav text ── */
html.dark .nav-logo,
html.dark .nav-theme-btn { color: #edede9; }

html.dark .nav-links a,
html.dark .nav-work-btn,
html.dark .nav-exp-btn { color: #a0a0a0; }

html.dark .nav-links a:hover,
html.dark .nav-work-btn:hover,
html.dark .nav-exp-btn:hover { color: #eeeeee; }

html.dark .nav-l2-link { color: #b0b0ac; }
html.dark .nav-l2-link:hover { color: #eeeeee; }

/* ── Stack expanded overview copy ── */
html.dark .spd-condensed-overview { color: #b0b0ac; }

/* ── Experiments section ── */
html.dark .exp-title { color: #edede9; }
html.dark .exp-desc  { color: #b0b0ac; }

/* FOOTER */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* REVEAL ANIMATION */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes revealIn {
  from { opacity: 0; transform: scale(0.98) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.reveal {
  opacity: 0;
}

.reveal.revealed {
  animation: revealIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  /* ── NAV ── */
  .nav {
    padding: 0 1.25rem;
  }

  .nav.is-scrolled {
    left: 12px;
    right: 12px;
  }

  .nav-links {
    gap: 1.25rem;
  }

  /* ── HERO (standard section, not stack hero) ── */
  .hero {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-top: calc(var(--nav-height) + 3rem);
    padding-bottom: 3rem;
  }

  /* ── SECTIONS ── */
  .section {
    padding: 3rem 1.25rem;
  }

  /* ── PROJECTS GRID ── */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-card--small {
    flex-direction: column;
  }

  .project-card--small-text {
    flex: none;
  }

  .project-card--small-img {
    height: 200px;
  }

  /* ── ABOUT ── */
  .section--about .about-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* ── FOOTER ── */
  .footer {
    padding: 1.5rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

  /* Tighten hero text on tiny screens */
  .hero {
    padding-top: calc(var(--nav-height) + 2rem);
    padding-bottom: 2rem;
  }
}
