/* ============================================================
   Maddy Raff — Portfolio v2 (Every.to dark, Newsreader serif)
   Every.to: bg #020202, white text, Signifier serif headers,
   Switzer sans body. We use Newsreader + Inter as free subs.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,600;0,6..72,700;1,6..72,400;1,6..72,600&family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700&display=swap');

:root {
  /* Dark canvas — every.to uses rgb(2,2,2) */
  --color-canvas:        #020202;
  --color-canvas-warm:   #0c0c0a;
  --color-canvas-card:   #111110;
  --color-canvas-raised: #1c1c1a;

  /* Text */
  --color-ink:           #ffffff;
  --color-body:          rgba(255,255,255,0.72);
  --color-muted:         rgba(255,255,255,0.48);
  --color-muted-soft:    rgba(255,255,255,0.32);

  /* Borders */
  --color-hairline:      rgba(255,255,255,0.1);
  --color-hairline-soft: rgba(255,255,255,0.06);

  /* Surfaces */
  --color-surface:       rgba(255,255,255,0.05);
  --color-surface-hover: rgba(255,255,255,0.09);

  /* Accent — electric blue */
  --color-orange:        #38BFFF;
  --color-orange-hover:  #1AAAE8;
  --color-orange-dim:    rgba(56,191,255,0.18);

  /* Typography */
  --font-serif: "Newsreader", "Hoefler Text", "Baskerville Old Face", Georgia, serif;
  --font-sans:  "Inter", -apple-system, "Helvetica Neue", sans-serif;

  --text-hero:     clamp(38px, 5vw, 60px);
  --text-display:  clamp(26px, 3.5vw, 44px);
  --text-headline: 22px;
  --text-body:     16px;
  --text-ui:       15px;
  --text-caption:  13px;
  --text-micro:    11px;

  /* Spacing */
  --space-section: 96px;
  --space-xl:      56px;
  --space-lg:      40px;
  --space-md:      24px;
  --space-sm:      16px; /* also used for card/contact grid gaps */
  --space-xs:      8px;

  /* Layout */
  --content-max:    1200px;
  --content-narrow:  760px;
  --gutter:           40px;
  --gutter-mobile:    20px;

  /* Shape */
  --radius-sm:    6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-card: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card:  0 0 0 1px rgba(255,255,255,0.07), 0 8px 16px rgba(0,0,0,0.5), 0 24px 48px rgba(0,0,0,0.6);
  --shadow-lift:  0 0 0 1px rgba(255,255,255,0.12), 0 16px 32px rgba(0,0,0,0.6), 0 40px 80px rgba(0,0,0,0.7);
}

/* ============================================================
   Light mode overrides
   ============================================================ */

[data-theme="light"] {
  --color-canvas:        #f5f4f0;
  --color-canvas-warm:   #eeede9;
  --color-canvas-card:   #ffffff;
  --color-canvas-raised: #e8e7e3;

  --color-ink:           #0a0a0a;
  --color-body:          rgba(10,10,10,0.72);
  --color-muted:         rgba(10,10,10,0.48);
  --color-muted-soft:    rgba(10,10,10,0.32);

  --color-hairline:      rgba(10,10,10,0.1);
  --color-hairline-soft: rgba(10,10,10,0.06);

  --color-surface:       rgba(10,10,10,0.04);
  --color-surface-hover: rgba(10,10,10,0.08);

  --color-orange:        #0077cc;
  --color-orange-hover:  #0066b3;
  --color-orange-dim:    rgba(0,119,204,0.12);

  --shadow-card: 0 0 0 1px rgba(0,0,0,0.07), 0 8px 16px rgba(0,0,0,0.08), 0 24px 48px rgba(0,0,0,0.1);
  --shadow-lift: 0 0 0 1px rgba(0,0,0,0.1),  0 16px 32px rgba(0,0,0,0.12), 0 40px 80px rgba(0,0,0,0.15);
}

/* Nav CTA inverts in light mode */
[data-theme="light"] .nav-cta {
  background: #0a0a0a !important;
  color: #ffffff !important;
}
[data-theme="light"] .nav-cta:hover {
  background: #222222 !important;
}

/* ============================================================
   Reset & base
   ============================================================ */

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

body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-serif); font-weight: 400; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* ============================================================
   Layout
   ============================================================ */

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

.container-narrow {
  max-width: calc(var(--content-narrow) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ============================================================
   Navigation
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-canvas);
  height: 64px;
  display: flex;
  align-items: center;
  transition: border-color 0.2s ease;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  border-bottom-color: var(--color-hairline);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links a {
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-body);
  border-radius: var(--radius-full);
  transition: color 0.15s;
}

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

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

.nav-cta {
  background: #ffffff !important;
  color: #0a0a0a !important;
  padding: 7px 16px !important;
  border-radius: var(--radius-full) !important;
  font-weight: 600 !important;
  transition: background 0.15s !important;
}

.nav-cta:hover { background: #e8e8e8 !important; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-body);
  transition: color 0.15s, background 0.15s;
}
.theme-toggle:hover {
  color: var(--color-ink);
  background: var(--color-surface);
}

/* ============================================================
   Hero — single column: text block → card stack
   ============================================================ */

.hero {
  background: var(--color-canvas);
  padding: var(--space-section) 0 0;
}

.hero-text {
  padding-bottom: var(--space-section);
}

.hero-eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 14px;
}

.hero-headline {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  margin: 0;
  text-align: center;
  animation: headline-blur-in 1.4s ease-out forwards;
  animation-delay: 0.2s;
  filter: blur(18px);
}

@keyframes headline-blur-in {
  from { filter: blur(18px); }
  to   { filter: blur(0px); }
}

/* Per-character spans for mouse trail */
.hero-headline .word {
  display: inline-block; /* wraps only at word boundaries */
  white-space: nowrap;
}
.hero-headline .char {
  display: inline;
  transition: filter 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}


.hero-sub {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-body);
  margin: var(--space-md) 0 0;
  text-align: center;
}

.hero-links {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-top: 4px;
}

.hero-link {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-orange);
  transition: color 0.15s;
}

.hero-link:hover { color: var(--color-orange-hover); }

/* ============================================================
   Card Stack — overlapping flex row, every.to mechanics
   ============================================================ */

.card-stack-wrap {
  width: 100%;
  padding: 8px 0 var(--space-xl);
  overflow: visible;
}

.card-stack {
  display: flex;
  align-items: flex-end;
  padding: 24px 0 36px; /* vertical room for spring lift + shadow */
}

.stack-card {
  flex: 1;
  min-width: 0;
  /* no max-width — cards span full container width */
  /* negative margin creates every.to-style overlap */
  margin-right: -32px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: var(--color-canvas-card);
  /* rotation set per-card via --rot custom property */
  transform: rotate(var(--rot, 0deg)) translateY(0px);
  /* return-to-rest: spring/bounce */
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
  /* z-index set inline per card (ascending — last card on top) */
  position: relative;
  /* isolate each card's compositing layer — prevents neighbor repaint on hover */
  will-change: transform;
  isolation: isolate;
  /* load animation */
  opacity: 0;
  animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.stack-card:last-child {
  margin-right: 0;
}

.stack-card:nth-child(1) { animation-delay: 0ms; }
.stack-card:nth-child(2) { animation-delay: 80ms; }
.stack-card:nth-child(3) { animation-delay: 160ms; }
.stack-card:nth-child(4) { animation-delay: 240ms; }

@keyframes cardIn {
  from {
    opacity: 0;
    transform: rotate(var(--rot, 0deg)) translateY(32px);
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) translateY(0px);
  }
}

.stack-card:hover {
  transform: rotate(var(--rot, 0deg)) translateY(-14px) !important;
  box-shadow: var(--shadow-lift) !important;
  animation: none !important;
  opacity: 1 !important;
  transition: transform 0.35s cubic-bezier(0.0, 0.0, 0.2, 1),
              box-shadow 0.3s ease !important;
}

/* Image wrap — full-bleed screenshot, top rounded corners */
.stack-card-img-wrap {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  position: relative;
  flex-shrink: 0;
}

/* Default image */
.stack-card-img-default {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
}

/* Bottom info section — editorial style */
/* Right padding accounts for the -32px card overlap so text stays visible */
.stack-card-body {
  padding: 16px 52px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-canvas-card);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  border-top: 1px solid var(--color-hairline-soft);
}

.stack-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stack-card-company {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  white-space: nowrap;
}

.stack-card-title {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--color-ink);
  margin: 0;
}

/* ============================================================
   Work section
   ============================================================ */

.section {
  padding: var(--space-section) 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) 0 var(--space-md);
  border-top: 1px solid var(--color-hairline);
  margin-bottom: var(--space-md);
}

.section-label {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.section-count {
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  color: var(--color-muted-soft);
}

/* Category tag */
.card-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-orange);
  background: var(--color-orange-dim);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* ---- Featured card (full-width horizontal) ---- */
.work-card-featured {
  display: grid;
  grid-template-columns: 1fr 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-canvas-card);
  border: 1px solid var(--color-hairline);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color: var(--color-ink);
}

.work-card-featured:hover {
  border-color: var(--color-hairline-soft);
  box-shadow: var(--shadow-lift);
}

.work-card-featured .card-info {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-xs);
  border-right: 1px solid var(--color-hairline);
}

.work-card-featured .card-headline {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-ink);
  margin: var(--space-xs) 0;
  transition: opacity 0.15s;
}

.work-card-featured:hover .card-headline { opacity: 0.85; text-decoration: underline; text-underline-offset: 3px; }

.work-card-featured .card-desc {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-body);
}

.work-card-featured .card-cta {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-orange);
  margin-top: var(--space-xs);
}

.work-card-featured .card-photo {
  overflow: hidden;
}

.work-card-featured .card-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform 0.5s ease;
}

.work-card-featured:hover .card-photo img { transform: scale(1.03); }

/* Work grid wrapper */
.work-grid { display: grid; gap: var(--space-md); }

/* ---- Standard 3-up cards ---- */
.work-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.work-card-std {
  display: flex;
  flex-direction: column;
  color: var(--color-ink);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-hairline);
  background: var(--color-canvas-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.work-card-std:hover {
  border-color: rgba(255,255,255,0.16);
  box-shadow: var(--shadow-lift);
}

.work-card-std .card-photo {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.work-card-std .card-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform 0.5s ease;
  filter: brightness(0.9);
}

.work-card-std:hover .card-photo img {
  transform: scale(1.03);
  filter: brightness(1);
}

.work-card-std .card-info {
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--color-hairline);
}

.work-card-std .card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.work-card-std .card-company {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted-soft);
}

.work-card-std .card-headline {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--color-ink);
}

.work-card-std:hover .card-headline {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   About
   ============================================================ */

.about {
  padding: var(--space-section) 0;
  border-top: 1px solid var(--color-hairline);
}

.about-inner {
  display: block;
}

.about-eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 14px;
}

.about-headline {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-ink);
  margin-bottom: var(--space-sm);
}

.about-body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-body);
}

.about-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-hairline);
}

.about-meta-item .meta-label {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.about-meta-item .meta-value {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ink);
  line-height: 1.4;
}

.about-portrait {
  border-radius: var(--radius-card);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--color-canvas-card);
  border: 1px solid var(--color-hairline);
}

.about-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(15%);
}

/* ============================================================
   Dark contact band
   ============================================================ */

.contact-band {
  border-top: 1px solid var(--color-hairline);
  padding: var(--space-xl) 0;
  background: var(--color-canvas-warm);
}

.contact-band-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.contact-eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 14px;
}

.contact-headline {
  font-family: var(--font-serif);
  font-size: clamp(26px, 3.5vw, 42px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-ink);
  margin-bottom: var(--space-lg);
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  width: 100%;
}

.contact-card:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-hairline);
}

.contact-card-info { display: flex; flex-direction: column; gap: 2px; }

.contact-card-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.contact-card-name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ink);
}

.contact-card-arrow {
  color: var(--color-muted);
  font-size: 14px;
  flex-shrink: 0;
  margin-left: 12px;
}

.contact-card.copied .contact-card-arrow {
  color: var(--color-orange);
  font-size: 11px;
  font-weight: 700;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-hairline);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer-brand {
  font-family: var(--font-sans);
  font-size: var(--text-caption);
  color: var(--color-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-md);
}

.footer-links a {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-muted);
  transition: color 0.15s;
}

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

/* ============================================================
   Case study pages — article layout
   ============================================================ */

.project-hero {
  padding: var(--space-lg) 0 var(--space-md);
  border-bottom: 1px solid var(--color-hairline);
}

.project-back {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
  transition: color 0.15s;
}

.project-back:hover { color: var(--color-orange); }

.project-tag { margin-bottom: var(--space-sm); }

.project-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-ink);
  margin-bottom: var(--space-md);
}

.project-meta {
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--color-hairline);
  flex-wrap: wrap;
}

.project-meta-item .meta-label {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 5px;
}

.project-meta-item .meta-value {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ink);
}

/* Article sections */
.project-section {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-hairline);
}

.project-section:first-of-type { border-top: 0; }

.project-section-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.project-section-num {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-top: 10px;
  position: sticky;
  top: 80px;
}

.project-section-content h3 {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--color-ink);
  margin-bottom: var(--space-sm);
}

.project-section-content p {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.72;
  color: var(--color-body);
  margin-bottom: var(--space-xs);
}

.project-section-content strong { color: var(--color-ink); font-weight: 600; }
.project-section-content em { font-style: italic; color: var(--color-ink); }

/* Principle list */
.principle-list {
  list-style: none;
  padding: 0;
  margin: var(--space-sm) 0 0;
  display: grid;
  gap: 10px;
}

.principle-list li {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--color-body);
  padding-left: var(--space-sm);
  border-left: 2px solid var(--color-orange);
}

.principle-list strong { color: var(--color-ink); font-weight: 600; }

/* Figma embed */
.figma-embed {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-canvas-card);
  aspect-ratio: 16 / 10;
  width: 100%;
  border: 1px solid var(--color-hairline);
}

.figma-embed iframe {
  border: 0;
  width: 100%; height: 100%;
  display: block;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  margin-left: auto;
  margin-right: auto;
  padding-top: var(--space-lg);
  max-width: fit-content;
}

.stat-item { text-align: center; }

.stat-value {
  font-family: var(--font-serif);
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-ink);
  margin-bottom: 8px;
}

.stat-value em {
  font-style: normal;
  color: var(--color-orange);
  font-size: 0.7em;
}

.stat-label {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.4;
}

.stat-callout {
  margin-top: var(--space-lg);
  padding: var(--space-lg) 0 0;
  text-align: center;
}

.stat-callout .stat-value {
  font-size: clamp(56px, 8vw, 96px);
  margin-bottom: var(--space-xs);
}

.stat-callout .stat-label {
  font-size: 15px;
}

/* Before/After compare slider */
.compare-shell {
  position: relative;
  background: var(--color-canvas-card);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-lg);
  padding: 72px 88px;
  overflow: hidden;
  cursor: col-resize;
  margin-top: var(--space-sm);
}

.compare-slider {
  --pos: 50%;
  position: relative;
  width: 100%;
  aspect-ratio: 13 / 10;
  user-select: none;
  touch-action: pan-y;
}

.compare-slider .compare-img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.5));
}

.compare-img-before { clip-path: inset(0 calc(100% - var(--pos) + 2px) 0 0 round 10px); }
.compare-img-after  { clip-path: inset(0 0 0 calc(var(--pos) + 2px) round 10px); }

.compare-label {
  position: absolute;
  top: 20px;
  z-index: 3;
  background: rgba(255,255,255,0.12);
  color: #fff;
  padding: 5px 12px;
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  backdrop-filter: blur(8px);
  transition: opacity 0.15s;
}

.compare-label-before { left: 20px; }
.compare-label-after  { right: 20px; }
.compare-shell.is-all-after  .compare-label-before { opacity: 0; }
.compare-shell.is-all-before .compare-label-after  { opacity: 0; }

/* Next project card */
.next-project {
  padding: var(--space-lg) 0 var(--space-section);
  border-top: 1px solid var(--color-hairline);
}

/* Stack cards reused in next-project context */
.next-card-wrap {
  display: flex;
  align-items: flex-end;
}
.next-card-wrap .stack-card {
  flex: 1;
  min-width: 0;
  opacity: 1;
  animation: none;
  margin-right: -32px;
}
.next-card-wrap .stack-card:last-child {
  margin-right: 0;
}

.next-eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
}

.next-card {
  display: grid;
  grid-template-columns: 1fr 380px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-canvas-card);
  border: 1px solid var(--color-hairline);
  color: var(--color-ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.next-card:hover {
  border-color: rgba(255,255,255,0.16);
  box-shadow: var(--shadow-lift);
}

.next-card-info {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  border-right: 1px solid var(--color-hairline);
}

.next-card-headline {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--color-ink);
  margin: 6px 0 4px;
}

.next-card:hover .next-card-headline {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.next-card-desc {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-body);
  line-height: 1.55;
}

.next-card-cta {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-orange);
  margin-top: 4px;
}

.next-card-photo {
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.next-card-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform 0.5s ease;
  filter: brightness(0.9);
}

.next-card:hover .next-card-photo img {
  transform: scale(1.03);
  filter: brightness(1);
}

/* ============================================================
   Scroll reveal
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .stack-card { opacity: 1 !important; animation: none !important; transform: rotate(var(--rot, 0deg)) !important; transition: none !important; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1100px) {
  :root { --gutter: 28px; }
  .work-card-featured { grid-template-columns: 1fr 340px; }
  .next-card { grid-template-columns: 1fr 300px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .project-section-grid { grid-template-columns: 140px 1fr; }
  .project-section-num { position: static; }
  .stack-card { margin-right: -24px; }
}

/* Card stack wraps to 2×2 grid well before other mobile breakpoints */
@media (max-width: 900px) {
  .card-stack, .next-card-wrap {
    flex-wrap: wrap;
    padding: 16px 0 24px;
    gap: var(--space-sm);
  }
  .stack-card {
    flex: 1 1 calc(50% - 8px);
    margin-right: 0 !important;
    transform: none !important;
    animation: none !important;
    opacity: 1 !important;
  }
  .stack-card:hover {
    transform: translateY(-8px) !important;
  }
}

@media (max-width: 860px) {
  .work-card-featured { grid-template-columns: 1fr; }
  .work-card-featured .card-info { border-right: 0; border-bottom: 1px solid var(--color-hairline); }
  .work-card-featured .card-photo { aspect-ratio: 16/9; }

  .work-grid-3 { grid-template-columns: 1fr 1fr; }

  .about-inner { grid-template-columns: 1fr; }
  .about-portrait { width: 140px; height: 175px; }
  .about-meta { grid-template-columns: repeat(3,1fr); }

  .contact-cards { grid-template-columns: 1fr 1fr; max-width: none; }

  .next-card { grid-template-columns: 1fr; }
  .next-card-info { border-right: 0; border-bottom: 1px solid var(--color-hairline); }

  .project-section-grid { grid-template-columns: 1fr; gap: var(--space-sm); }
  .project-section-num { position: static; padding-top: 0; }

  .compare-shell { padding: 48px 56px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }

  .stack-card { margin-right: -20px; }
}

@media (max-width: 520px) {
  .stack-card {
    flex: 1 1 100% !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 620px) {
  :root {
    --gutter: var(--gutter-mobile);
    --space-section: 64px;
  }

  .nav { height: 56px; }
  .nav-links a:not(.nav-cta) { display: none; }

  .hero { padding: var(--space-section) 0 0; }
  .hero-headline { font-size: 34px; }
  .hero-text { padding-bottom: var(--space-md); }

  .stack-card-title { font-size: 14px; }
  .stack-card-company { display: none; }

  .work-grid-3 { grid-template-columns: 1fr; }

  .about-meta { grid-template-columns: 1fr; gap: var(--space-xs); }
  .contact-cards { grid-template-columns: 1fr; }

  .project-title { font-size: 24px; }
  .project-meta { gap: var(--space-md); }

  .compare-shell { padding: 24px; }
  .compare-label { font-size: 10px; padding: 4px 10px; top: 12px; }
  .compare-label-before { left: 12px; }
  .compare-label-after { right: 12px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 38px; }

  .footer-inner { flex-direction: column; gap: var(--space-xs); }
}
