/* =========================================================
   Reset & base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scrollbar-color: #2563eb transparent;
  scrollbar-width: thin; /* thinnest available in Firefox */
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2563eb; border-radius: 999px; }

:root {
  /* ── Neutrals — cool grey, slight blue undertone ── */
  --paper:        #ECEEF5;
  --surface:      #ffffff;
  --ink:          #0c1116;
  --ink-2:        #3a414d;
  --ink-3:        #7a818e;
  --ink-4:        #bdc2cb;
  --line:         #e6e9ef;
  --line-strong:  #d2d6de;

  /* Semantic */
  --bg:           var(--paper);
  --fg:           var(--ink);
  --fg-muted:     var(--ink-2);
  --fg-faint:     var(--ink-3);
  --border:       var(--line);

  /* Legacy aliases — used throughout nav/topbar, kept for compatibility */
  --muted:        var(--ink-3);
  --rule:         var(--line);
  --accent:       var(--ink);

  /* Glass — dark-on-white for default mode */
  --glass-bg:        rgba(12, 17, 22, 0.04);
  --glass-bg-hover:  rgba(12, 17, 22, 0.08);
  --glass-bg-active: rgba(12, 17, 22, 0.12);
  --glass-border:    rgba(12, 17, 22, 0.06);
  --glass-fg:        var(--ink);

  /* Typography */
  --font-display: "Urbanist", system-ui, sans-serif;
  --font-body:    "Outfit",   system-ui, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, monospace;

  /* Legacy aliases */
  --serif: var(--font-display);
  --mono:  var(--font-body);

  /* Radii */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-pill: 999px;

  /* Spacing — 4pt scale */
  --s-1:  4px;   --s-2:  8px;   --s-3:  12px;  --s-4:  16px;
  --s-5:  24px;  --s-6:  32px;  --s-7:  48px;  --s-8:  64px;
  --s-9:  96px;  --s-10: 128px;

  /* Shadows */
  --shadow-1: 0 1px 2px  rgba(12, 17, 22, 0.05);
  --shadow-2: 0 4px 16px rgba(12, 17, 22, 0.07);
  --shadow-3: 0 12px 40px rgba(12, 17, 22, 0.11);

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 180ms;  --dur-2: 320ms;
  --dur-3: 520ms;  --dur-4: 840ms;

  /* Layout */
  --max:    1240px;
  --gutter: clamp(16px, 4vw, 72px);
}

/* ── Project mode — body becomes the project color ── */
[data-mode="project"] {
  --bg:           var(--project, #0c1116);
  --fg:           var(--project-fg, #ffffff);
  --fg-muted:     rgba(255, 255, 255, 0.72);
  --fg-faint:     rgba(255, 255, 255, 0.48);
  --surface:      rgba(255, 255, 255, 0.06);
  --border:       rgba(255, 255, 255, 0.14);
  --muted:        rgba(255, 255, 255, 0.48);
  --rule:         rgba(255, 255, 255, 0.14);
  --glass-bg:        rgba(255, 255, 255, 0.07);
  --glass-bg-hover:  rgba(255, 255, 255, 0.14);
  --glass-bg-active: rgba(255, 255, 255, 0.22);
  --glass-border:    rgba(255, 255, 255, 0.08);
  --glass-fg:        #ffffff;
  --shadow-1: 0 1px 2px  rgba(0, 0, 0, 0.10);
  --shadow-2: 0 4px 24px rgba(0, 0, 0, 0.18);
  --shadow-3: 0 16px 60px rgba(0, 0, 0, 0.28);
}

body {
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background-color var(--dur-3) var(--ease-in-out),
    color            var(--dur-3) var(--ease-in-out);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--fg); color: var(--bg); }

/* =========================================================
   Type scale
   ========================================================= */
.h-display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 4.5vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--fg);
}

h1, .h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: var(--fg);
}

h2, .h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.018em;
  color: var(--fg);
}

h3, .h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.18;
  letter-spacing: -0.012em;
  color: var(--fg);
}

h4, .h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--fg);
}

p, .body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-muted);
}

.body-lg {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.5;
  color: var(--fg-muted);
}

.body-sm {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-muted);
}

.meta,
.eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* =========================================================
   Glass utility
   ========================================================= */
.glass {
  background: var(--glass-bg);
  color: var(--glass-fg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition:
    background-color var(--dur-1) var(--ease-out),
    border-color     var(--dur-1) var(--ease-out),
    transform        var(--dur-1) var(--ease-out);
}
.glass:hover  { background: var(--glass-bg-hover); }
.glass:active { background: var(--glass-bg-active); transform: scale(0.985); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.005em;
  padding: 16px 28px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition:
    opacity var(--dur-1) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}
.btn:hover  { opacity: 0.85; }
.btn:active { transform: scale(0.985); }

.btn-solid {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-radius: 0;
  padding: 16px 0;
  border-bottom: 1px solid currentColor;
}

.btn-glass {
  background: var(--glass-bg);
  color: var(--glass-fg);
  border-color: var(--glass-border);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.btn-glass:hover { background: var(--glass-bg-hover); opacity: 1; }

/* =========================================================
   Top bar — no background bar, pill-only glass
   ========================================================= */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1rem, 2vw, 2rem);
  padding: 1.125rem var(--gutter);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── W3C Luminance-based nav theming — 4 tiers ───────────────────────────
   data-lum is set on both .nav-pill (Layer 1) and .topbar (Layer 2 context).
   Tiers: pure-white (Y≥0.85) | light (Y≥0.45) | dark (Y≥0.15) | pitch-black
   ─────────────────────────────────────────────────────────────────────── */

/* LAYER 1: Pill container background */
.nav-pill[data-lum="pure-white"]  { background: rgba(0, 0, 0, 0.12); box-shadow: none; }
.nav-pill[data-lum="light"]       { background: rgba(0, 0, 0, 0.08); box-shadow: none; }
.nav-pill[data-lum="dark"]        { background: rgba(0, 0, 0, 0.10); box-shadow: none; }
.nav-pill[data-lum="pitch-black"] { background: rgba(0, 0, 0, 0.05);
                                    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }

/* LAYER 2: Inactive text — light states → black */
.topbar[data-lum="pure-white"] #about-btn,
.topbar[data-lum="pure-white"] .nav-pill-wrapper.collapsed #work-btn,
.topbar[data-lum="light"]      #about-btn,
.topbar[data-lum="light"]      .nav-pill-wrapper.collapsed #work-btn {
  color: #1a1a1a; font-weight: 400;
}

/* LAYER 2: Inactive text — dark states → white */
.topbar[data-lum="dark"]        #about-btn,
.topbar[data-lum="dark"]        .nav-pill-wrapper.collapsed #work-btn,
.topbar[data-lum="pitch-black"] #about-btn,
.topbar[data-lum="pitch-black"] .nav-pill-wrapper.collapsed #work-btn {
  color: #ffffff; font-weight: 400;
}

/* Topbar label + intro mark follow the same dark/light split */
.topbar[data-lum="dark"] .topbar-label,
.topbar[data-lum="pitch-black"] .topbar-label { color: #ffffff; }

.topbar[data-lum="dark"] .mark-name,
.topbar[data-lum="pitch-black"] .mark-name { color: #ffffff; }
.topbar[data-lum="dark"] .mark-role,
.topbar[data-lum="pitch-black"] .mark-role { color: rgba(255, 255, 255, 0.65); }

/* Nav indicator */
.topbar[data-lum="dark"] .nav-indicator,
.topbar[data-lum="pitch-black"] .nav-indicator { background: #ffffff; }

/* [data-mode="project"] compat */
[data-mode="project"] .mark-name  { color: #ffffff; }
[data-mode="project"] .mark-role  { color: rgba(255, 255, 255, 0.65); }
[data-mode="project"] .nav-pill   { background: rgba(20, 20, 18, 0.48); }
[data-mode="project"] .nav-indicator { background: #ffffff; }

/* Mark absolute on the left; pill centres on its own as only flex child.
   margin-block: auto centres vertically without any CSS transform — avoids
   conflict with the JS intro transform causing a snap on cleanup. */
.topbar-mark-ghost {
  position: absolute;
  left: var(--gutter);
  top: 0;
  bottom: 0;
  margin-block: auto;
  height: fit-content;
}

/* Separate topbar label — owns "Product Design", no intro connection */
.topbar-label {
  position: absolute;
  left: var(--gutter);
  top: 0;
  bottom: 0;
  margin-block: auto;
  height: fit-content;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--fg);
  opacity: 0;
  white-space: nowrap;
  text-transform: none;
  transition: color 0.5s ease;
}

/* topbar-label dark color handled by [data-lum] rules above */

.nav-pill .mark-name {
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-transform: none;
}

.nav-item--text {
  width: auto;
  overflow: hidden;
  white-space: nowrap;
  font-size: 1.1rem;
  font-family: var(--font-body);
  font-weight: 450;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--fg);
  padding: 0 1rem;
  transition: color 0.4s ease;
}

/* nav-item--text dark color handled by [data-lum] #about-btn rules above */

/* About panel open: dark background, white pill, black Max DeSouza, 64% Work */

.about-open .topbar-label { color: #ffffff; }

.about-open .nav-pill {
  background: rgba(20, 20, 18, 0.48);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#about-btn {
  color: #0c1116;
  background: transparent;
  opacity: 1;
  transition: opacity 0.2s ease 0.15s, background-color 0.2s ease 0.15s, color 0.4s ease;
}

/* LAYER 3 (about-open active state): white pill, always black text.
   Placed after [data-lum] rules — same specificity wins by cascade order. */
.about-open #about-btn {
  background: #ffffff;
  color: #0c1116;
  opacity: 1;
  transition: opacity 0.2s ease 0.15s, background-color 0.2s ease 0.15s;
}

/* Prevent dark luminance tier overriding text when about-btn has its own white pill */
.about-open .topbar[data-lum="dark"] #about-btn,
.about-open .topbar[data-lum="pitch-black"] #about-btn { color: #0c1116; }

/* LAYER 3: Active pill — always 100% white background, 100% black text */
#work-btn {
  background: #ffffff;
  color: #000000;
  opacity: 1;
  transition: opacity 0.2s ease 0.15s, background-color 0.25s ease 0.15s,
              color 0.25s ease 0.15s, font-weight 0.25s ease 0.15s;
}

.about-open #work-btn {
  background: transparent;
  color: #ffffff;
  opacity: 1;
  font-weight: 400;
  transition: opacity 0.2s ease 0.15s, background-color 0.2s ease 0.15s, color 0.2s ease 0.15s;
}

.nav-pill-wrapper.collapsed #work-btn {
  background: transparent;
  font-weight: 400;
  /* color comes from luminance tier rules above */
  transition: background-color 0.25s ease, color 0.25s ease, font-weight 0.25s ease;
}


/* ── Work view toggle icons ──────────────────────────────── */
.work-view-divider {
  display: inline-block;
  width: 1px;
  height: 14px;
  background: rgba(12, 17, 22, 0.18);
  margin: 0 8px 0 10px;
  vertical-align: middle;
  transition: background-color 0.25s ease;
}

.work-view-icons {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
}

.work-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  color: rgba(12, 17, 22, 0.3);
  transition: color 0.2s ease;
}

.work-view-btn.active {
  color: #0c1116;
}

/* Dark pill states (about-open always dark; collapsed dark tiers) */
.about-open .work-view-divider,
.nav-pill-wrapper.collapsed .work-view-divider {
  background: rgba(255, 255, 255, 0.2);
}

.about-open .work-view-btn,
.nav-pill-wrapper.collapsed .work-view-btn {
  color: rgba(255, 255, 255, 0.3);
}

.about-open .work-view-btn.active,
.nav-pill-wrapper.collapsed .work-view-btn.active {
  color: #ffffff;
}

/* Collapsed on light backgrounds — flip to solid dark */
.topbar[data-lum="pure-white"] .nav-pill-wrapper.collapsed #work-btn,
.topbar[data-lum="light"]      .nav-pill-wrapper.collapsed #work-btn {
  color: #000000;
}
.topbar[data-lum="pure-white"] .nav-pill-wrapper.collapsed .work-view-divider,
.topbar[data-lum="light"]      .nav-pill-wrapper.collapsed .work-view-divider {
  background: rgba(0, 0, 0, 0.18);
}
.topbar[data-lum="pure-white"] .nav-pill-wrapper.collapsed .work-view-btn,
.topbar[data-lum="light"]      .nav-pill-wrapper.collapsed .work-view-btn {
  color: rgba(0, 0, 0, 0.3);
}
.topbar[data-lum="pure-white"] .nav-pill-wrapper.collapsed .work-view-btn.active,
.topbar[data-lum="light"]      .nav-pill-wrapper.collapsed .work-view-btn.active {
  color: rgba(0, 0, 0, 0.75);
}

/* ── Grid layout variants ───────────────────────────────── */

/* Single: topbar floats above images */
body.view-single-active .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
}

/* Single: full-bleed images edge to edge, no whitespace */
.projects-grid.view-single {
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}

.projects-grid.view-single .project-card {
  gap: 0;
  height: 100vh;
}

.projects-grid.view-single .project-card:first-child {
  grid-column: span 1;
}

.projects-grid.view-single .project-card:first-child .project-thumb {
  aspect-ratio: unset;
}

.projects-grid.view-single .project-thumb {
  height: 100%;
  aspect-ratio: unset;
  flex: 1 1 0;
}

.projects-grid.view-single .project-meta {
  display: none;
}

/* Grid: equal 2×2, hero card does not span both columns */
.projects-grid.view-grid .project-card:first-child {
  grid-column: span 1;
}

.projects-grid.view-grid .project-card:first-child .project-thumb {
  aspect-ratio: 16 / 9;
}

/* ── About panel ─────────────────────────────────────────── */
.about-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.about-overlay.open {
  opacity: 1;
  pointer-events: auto;
}


.about-bento-wrapper {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  width: min(1100px, 85vw);
  height: auto;
  max-height: none;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s ease;
  overflow: visible;
  padding: 0;
}

.about-bento-wrapper[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.mark {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  text-transform: none;
  width: fit-content;
}
.mark-name {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--fg);
  transition: opacity 0.15s ease, color 0.5s ease;
}
.mark-role {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.2;
  transition: opacity 0.15s ease, color 0.5s ease;
}

/* ── Nav pill ─────────────────────────────────────────── */
.nav-pill-wrapper {
  display: flex;
  align-items: center;
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(205, 206, 212, 0.16);
  border-radius: 999px;
  padding: 3px 3px;
  gap: 2px;
  position: relative;
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  transition: background-color 0.45s ease, box-shadow 0.45s ease;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: opacity 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.nav-indicator { display: none; }
.nav-label     { display: none; }

/* Collapse: width/opacity/padding animated by JS; CSS only disables interaction */
.nav-pill-wrapper.collapsed .nav-item:not(.active) {
  pointer-events: none;
  opacity: 0; /* fallback if JS unavailable */
}

/* ── Portrait (phone & tablet): pill fixed at bottom ──────── */
@media (max-width: 1366px) and (orientation: portrait) {
  /*
   * Centre via static calc: right = 50vw − half of expanded pill width.
   * Expanded pill: 3×44px items + 2×10px gaps + 2×10px padding = 172px → half = 86px.
   * Using a fixed pixel offset avoids the translateX(50%) glitch where the
   * transform re-resolves against the growing element width during transition.
   */
  .nav-pill-wrapper {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: auto;
    right: calc(50% - 86px);
    transform: none;
    z-index: 20;
    transition: right 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  }
  /* Collapsed: fly to bottom-right corner */
  .nav-pill-wrapper.collapsed { right: 20px; }
  /* Squircle + larger size */
  .nav-pill {
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  }
  /* Keep larger padding when collapsed (overrides base 8px) */
  .nav-pill-wrapper.collapsed .nav-pill { padding: 10px; }
  /* Larger touch targets + squircle active highlight */
  .nav-item        { width: 44px; height: 44px; border-radius: 10px; }
  .nav-indicator   { width: 54px; height: 54px; border-radius: 10px; }
  .nav-icon        { width: 20px; height: 20px; }
  .home-icon-wrap  { width: 20px; height: 20px; }
  .icon-scroll,
  .icon-coffee,
  .icon-person     { width: 20px; height: 20px; }
  .nav-label { display: none; }
}

/* ── Landscape (phone & tablet): pill back in topbar ──────── */
@media (max-width: 1366px) and (orientation: landscape) {
  .nav-pill-wrapper {
    position: static;
    bottom: auto;
    left: auto;
    right: auto;
    transform: none;
    transition: none;
  }
}

/* =========================================================
   Page layouts — shared
   ========================================================= */
.page-main {
  min-height: 100vh;
}

/* Inner-page hero header */
.page-header {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-9) var(--gutter) var(--s-9);
  text-align: center;
}

.page-header h1 {
  font-size: clamp(32px, 3.6vw, 52px);
}

.page-header .eyebrow { margin-bottom: var(--s-4); }

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: var(--fg);
  margin: 0;
}

/* Content section — 1/3 head + 2/3 body */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 8vh, 96px) var(--gutter);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(2rem, 6vw, 5rem);
  border-top: 1px solid var(--border);
}

@media (max-width: 760px) {
  .section { grid-template-columns: 1fr; gap: 2rem; }
}

.section.full-width { border-top: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  position: sticky;
  top: 5rem;
  align-self: start;
  height: fit-content;
}
@media (max-width: 760px) { .section-head { position: static; } }

.section-num {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.section-body { max-width: 60ch; }
.section-body p + p { margin-top: 1.25rem; }

/* =========================================================
   Projects grid
   ========================================================= */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  padding: 0;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.project-card:hover { opacity: 1; }

.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--line);
}

/* Home grid: each card row is exactly one viewport height */
.projects-grid:not(.projects-page-grid):not(.view-single) .project-card {
  height: 100vh;
}
.projects-grid:not(.projects-page-grid):not(.view-single) .project-thumb {
  aspect-ratio: unset;
  height: 100%;
  flex: 1 1 0;
}

.project-meta {
  padding: 0 0.25rem;
}

.project-title {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Home: uniform 2×2 grid, no hero card */
.projects-grid:not(.projects-page-grid) .project-card:first-child {
  grid-column: span 1;
}

.projects-grid:not(.projects-page-grid) .project-card:first-child .project-thumb {
  aspect-ratio: 16 / 9;
}

/* Filtered view: uniform 2-per-row, all cards equal */
.projects-grid.filtered .project-card:first-child {
  grid-column: span 1;
}

.projects-grid.filtered .project-card:first-child .project-thumb {
  aspect-ratio: 16 / 9;
}

.projects-grid {
  transition: none;
}

.project-card,
.project-thumb {
  transition: aspect-ratio 0.4s ease;
}

/* =========================================================
   Home — hero
   ========================================================= */
.home-hero {
  display: none; /* intro animation uses topbar mark; section no longer needed */
}

.home-hero .h-display {
  font-family: var(--font-body);
  font-size: clamp(20px, 2.4vw, 32px);
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-weight: 300;
  font-variation-settings: 'wght' 300;
  opacity: 0;
  animation: fadeUp var(--dur-4) var(--ease-out) 0.2s forwards;
}

.home-hero h1.h-display {
  font-size: clamp(16px, 1.9vw, 26px);
}

.home-hero p.h-display {
  font-size: clamp(16px, 1.9vw, 26px);
  animation-name: fadeUpMuted;
  animation-delay: 0.35s;
}

/* Applied after 8s — h1 dims to 64%, p brightens to 100% + wght 450 */
.home-hero.hero-active h1.h-display {
  opacity: 0.64;
  transition: opacity 0.3s ease;
}

.home-hero.hero-active p.h-display {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Hover h1: restore h1 to 100%, revert p to 64% + wght 400 */
.home-hero.hero-active h1.h-display:hover {
  opacity: 1;
}

.home-hero.hero-active:has(h1.h-display:hover) p.h-display {
  opacity: 0.64;
}

.home-hero .eyebrow {
  margin-bottom: var(--s-5);
  font-size: clamp(40px, 5vw, 70px);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--fg);
  opacity: 0;
  animation: fadeUp var(--dur-4) var(--ease-out) 0.05s forwards;
}

.home-hero .h-display {
  margin-bottom: var(--s-6);
  opacity: 0;
  animation: fadeUp var(--dur-4) var(--ease-out) 0.2s forwards;
}

.home-hero .body-lg {
  max-width: 44ch;
  margin-bottom: var(--s-7);
  opacity: 0;
  animation: fadeUp var(--dur-4) var(--ease-out) 0.35s forwards;
}

.home-ctas {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp var(--dur-4) var(--ease-out) 0.5s forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUpMuted {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 0.72; transform: translateY(0); }
}

/* =========================================================
   Projects index — card grid
   ========================================================= */
.projects-page-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
  padding: 0 var(--gutter) var(--s-9);
}

@media (max-width: 640px) {
  .projects-page-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.project-card-meta {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.project-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-xs);
  overflow: hidden;
  transition: filter var(--dur-2) var(--ease-out);
}
.project-card:hover .project-cover { filter: brightness(1.06); }

.project-cover-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s-6);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity    var(--dur-2) var(--ease-out),
    transform  var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.project-card:hover .project-cover-reveal,
.project-cover:focus .project-cover-reveal {
  opacity: 1;
  transform: translateY(0);
}

.project-cover-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 56px);
  letter-spacing: -0.025em;
  line-height: 1;
  color: #fff;
  flex: 1;
  display: flex;
  align-items: center;
}

.project-cover-tagline {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.5;
  max-width: 32ch;
  color: rgba(255, 255, 255, 0.82);
}

/* Legacy project list — kept for any pages still using it */
.project {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.4s ease;
}
.project:first-child { padding-top: 0; }
.project:last-child  { border-bottom: none; }
.project:hover       { padding-left: 0.75rem; }

.project-meta {
  display: flex;
  gap: 1rem;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.5rem;
}

.project-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  line-height: 1.15;
  color: var(--fg);
}

.project-desc {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--fg-muted);
  margin-bottom: 0.9rem;
  max-width: 55ch;
}

.project-link {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: border-color var(--dur-1) var(--ease-out);
}
.project-link:hover { border-color: var(--fg); }

/* =========================================================
   About / Me page
   ========================================================= */
.me-body {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-9) var(--gutter);
}

.me-body .eyebrow { margin-bottom: var(--s-5); }

.me-body h1 {
  margin-bottom: var(--s-7);
}

.me-body .body-lg {
  margin-bottom: var(--s-5);
  color: var(--fg);
}

.me-body .body { color: var(--fg-muted); }

/* Experience + Skills tables */
.me-section { margin-top: var(--s-9); }
.me-section .eyebrow { margin-bottom: var(--s-4); }

.exp-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.exp-row:first-of-type { border-top: 1px solid var(--border); }

.exp-years {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.exp-role {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 17px;
  color: var(--fg);
  margin-bottom: 2px;
}

.exp-org {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-muted);
}

.exp-note {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-muted);
  margin-top: var(--s-2);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-4);
}

.skills-group-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  margin-bottom: var(--s-3);
}

.skills-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skills-group li {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-muted);
}

.contact-link {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: -0.018em;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  display: inline-block;
  transition: border-color var(--dur-1) var(--ease-out);
}
.contact-link:hover { border-color: var(--fg); }

/* =========================================================
   Case study — project mode page
   ========================================================= */
.case-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--s-9) var(--gutter);
  background: var(--ink);
  background-size: cover;
  background-position: center;
  position: relative;
}

.case-back {
  position: absolute;
  top: var(--s-7);
  left: var(--gutter);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  opacity: 0.72;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: opacity var(--dur-1) var(--ease-out);
}
.case-back:hover { opacity: 1; }

.case-eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: var(--s-4);
}

.case-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(64px, 11vw, 160px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: #ffffff;
  margin-bottom: var(--s-5);
}

.case-summary {
  font-family: var(--font-body);
  font-size: clamp(16px, 1.4vw, 20px);
  line-height: 1.5;
  color: #ffffff;
  opacity: 0.78;
  max-width: 48ch;
  margin-bottom: var(--s-7);
}

.case-ctas {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.case-content {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-9) var(--gutter);
}

.case-section {
  border-top: 1px solid var(--border);
  padding: var(--s-7) 0;
}

.case-section .eyebrow { margin-bottom: var(--s-5); }

.case-section h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: -0.018em;
  color: var(--fg);
  margin-bottom: var(--s-5);
}

.case-section p {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg-muted);
  max-width: 60ch;
}
.case-section p + p { margin-top: var(--s-4); }

/* ── Case study: extended layout blocks ───────────── */
.case-media {
  width: 100%;
  overflow: hidden;
  background: var(--ink);
}
.case-media img {
  width: 100%;
  display: block;
  object-fit: cover;
}
.case-media--contained {
  max-width: var(--max);
  margin: 0 auto;
  border-radius: var(--r-xl);
  overflow: hidden;
}

.case-process-item {
  margin-top: var(--s-7);
  padding-top: var(--s-6);
  border-top: 1px solid var(--border);
}
.case-process-item h3 {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin-bottom: var(--s-3);
}
.case-process-item p {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg-muted);
  max-width: 62ch;
}

.case-img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.case-img-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

@media (max-width: 700px) {
  .case-img-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Sprints
   ========================================================= */
.sprint {
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.4s ease;
}
.sprint:first-child { padding-top: 0; }
.sprint:last-child  { border-bottom: none; }
.sprint:hover       { padding-left: 0.75rem; }

.sprint-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.sprint-id {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.sprint-num {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.sprint-dates {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
}

.sprint-status {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid;
  white-space: nowrap;
}

.status-active   { color: #2e7d46; border-color: rgba(46, 125, 70, 0.3); background: rgba(46, 125, 70, 0.06); }
.status-done     { color: var(--fg-faint); border-color: var(--border); }
.status-upcoming { color: var(--fg-faint); border-color: var(--border); background: transparent; }

.sprint-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  color: var(--fg);
}

.sprint-desc {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--fg-muted);
  margin-bottom: 1rem;
  max-width: 58ch;
}

.sprint-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.sprint-tags li {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--fg-faint);
}

/* =========================================================
   Page hero — inner pages (legacy, used by sprints)
   ========================================================= */
.page-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3.5rem, 10vh, 6rem) var(--gutter) clamp(2rem, 5vh, 3.5rem);
  border-bottom: 1px solid var(--border);
}

.page-hero .eyebrow {
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 0.05s forwards;
  margin-bottom: 1rem;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.75rem, 7vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  color: var(--fg);
  opacity: 0;
  animation: fadeUp 0.9s var(--ease-out) 0.15s forwards;
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) var(--s-7);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.footer-mark {
  font-style: italic;
  text-transform: none;
  font-family: var(--font-display);
  letter-spacing: 0;
}


@keyframes pageReveal {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-reveal {
  animation: pageReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* =========================================================
   Bento Grid Layout — Seven boxes in overlay
   ========================================================= */
.bento-grid-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  max-width: 100%;
  width: 100%;
}

.bento-box-1 { grid-column: span 1; grid-row: span 2; }
.bento-box-2 { grid-column: span 1; grid-row: span 2; }
.bento-box-3 { grid-column: span 1; grid-row: span 1; }
.bento-box-4 { grid-column: span 1; grid-row: span 1; }
.bento-box-5 { grid-column: span 1; grid-row: span 1; }
.bento-box-6 { grid-column: span 2; grid-row: span 1; }
.bento-box-7 { grid-column: span 2; grid-row: span 1; }

.bento-box {
  background: rgba(20, 20, 18, 0.48);
  backdrop-filter: blur(12px);
  border: none;
  border-radius: var(--r-lg);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.75rem;
  animation: pageReveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Grid positioning for specific boxes */
.bento-box-1 { grid-column: span 2; grid-row: span 2; }
.bento-box-2 { grid-column: span 2; grid-row: span 2; }
.bento-box-3 { grid-column: span 2; grid-row: span 1; }
.bento-box-4 { grid-column: span 2; grid-row: span 1; }
.bento-box-5 { grid-column: span 2; grid-row: span 1; }
.bento-box-6 { grid-column: span 3; grid-row: span 1; }
.bento-box-7 { grid-column: span 3; grid-row: span 1; }

.bento-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.bento-text {
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  flex-grow: 1;
}

.bento-photo {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--r-md);
  min-height: 300px;
}

.bento-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
}

.bento-list li {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.3;
}

.bento-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.7rem;
}

.bento-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bento-item-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}

.bento-item-meta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bento-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.bento-tool {
  font-family: var(--font-body);
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  background: rgba(20, 20, 18, 0.32);
  border: none;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
}

.bento-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  background: rgba(20, 20, 18, 0.32);
  border: none;
  border-radius: var(--r-md);
}

.bento-link svg {
  width: 16px;
  height: 16px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .bento-layout {
    grid-template-columns: 1fr;
  }
  .bento-large {
    grid-row: span 1;
  }
}

@media (max-width: 640px) {
  .bento-layout {
    grid-template-columns: 1fr;
  }
  .bento-sidebar {
    flex-direction: column;
  }
}

