:root {
  --cream: #f6ecd6;
  --dawn-hi: #fbf3e2;
  --dawn-lo: #ecd1ab;
  --peach: #e0a487;
  --ink: #16121c;
  --teal: #2f8f86;
  --teal-ink: #176058;
  --gold: #c1923c;
  --navy: #16213a;
  --chrome: #c9ced6;
  --link: #176058;
  --case-accent: #2f8f86;
  --case-accent-2: #c1923c;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pad: clamp(1.25rem, 5vw, 5rem);
  --ease: cubic-bezier(0.22, 0.7, 0.27, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  scrollbar-width: thin;
  scrollbar-color: var(--peach) transparent;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(125% 80% at 80% 6%, color-mix(in srgb, var(--gold), transparent 78%), transparent 48%),
    linear-gradient(180deg, var(--dawn-hi) 0%, var(--cream) 44%, var(--dawn-lo) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--peach);
  border: 3px solid var(--cream);
  border-radius: 99px;
}

a {
  color: inherit;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.95'/%3E%3C/svg%3E");
}

.cs-nav {
  position: fixed;
  left: max(var(--pad), env(safe-area-inset-left));
  right: max(var(--pad), env(safe-area-inset-right));
  top: max(1.9rem, env(safe-area-inset-top));
  z-index: 60;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.cs-logo {
  position: relative;
  width: 64px;
  height: 48px;
  pointer-events: auto;
}

.cs-logo span {
  position: absolute;
  bottom: 0;
  display: block;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(150deg, #e9eaee 0%, #9aa0a6 52%, #6b7176 100%);
  mix-blend-mode: multiply;
}

.cs-logo span:nth-child(1) { left: 0; width: 32px; height: 48px; }
.cs-logo span:nth-child(2) { left: 17px; width: 26px; height: 32px; opacity: 0.76; }
.cs-logo span:nth-child(3) { right: 0; width: 31px; height: 37px; }

.cs-nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  pointer-events: auto;
}

.cs-nav__links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 6px 4px;
  text-decoration: none;
  color: #09070d;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: clamp(1rem, 1.7vw, 1.4rem);
}

.cs-logo:focus-visible,
.cs-nav__links a:focus-visible,
.meta-link:focus-visible,
.next-project a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 3px;
}

.nav-icon {
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-icon--works {
  border-radius: 0;
  border: 0;
  background:
    linear-gradient(45deg, transparent 38%, currentColor 39% 61%, transparent 62%),
    linear-gradient(-45deg, transparent 38%, currentColor 39% 61%, transparent 62%);
}

.case-hero {
  min-height: 100vh;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.92fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 5rem);
  padding: 8rem var(--pad) 5rem;
}

.case-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal-ink);
  margin: 0 0 1.3rem;
}

.case-title {
  font-size: clamp(3.2rem, 7.4vw, 7rem);
  line-height: 0.9;
  font-weight: 300;
  letter-spacing: -0.07em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.case-subtitle {
  margin-top: 1.8rem;
  max-width: 22ch;
  font-size: clamp(1.6rem, 3.1vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-weight: 300;
  color: color-mix(in srgb, var(--ink), transparent 12%);
}

.case-hero__visual {
  position: relative;
  width: 100%;
  height: min(54vh, 500px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* the per-case SVG draws its own field; data-mode sets a matching fallback so no meet-gaps show */
.case-hero__visual[data-mode="dark"] { background: #0e1626; }
.case-hero__visual[data-mode="light"] { background: #f3e7cb; }

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.case-main {
  padding: 0 var(--pad) 6rem;
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 31vw);
  gap: clamp(3rem, 8vw, 8rem);
  max-width: 1180px;
  margin: 0 auto clamp(7rem, 12vw, 11rem);
  scroll-margin-top: 8rem;
}

.story-copy {
  font-size: clamp(1.7rem, 3vw, 3.1rem);
  line-height: 1.25;
  letter-spacing: -0.055em;
}

.story-copy p + p {
  margin-top: 2.2rem;
}

.case-meta {
  padding-top: 0.7rem;
  font-size: 1.05rem;
  line-height: 1.4;
}

.meta-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1.2rem;
  padding: 1.25rem 0;
  border-top: 1px solid color-mix(in srgb, var(--ink), transparent 80%);
}

.meta-row:last-child {
  border-bottom: 1px solid color-mix(in srgb, var(--ink), transparent 80%);
}

.meta-row dt {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  padding-top: 0.2rem;
  color: color-mix(in srgb, var(--ink), transparent 28%);
}

.meta-link {
  color: var(--link);
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
}

.meta-link:hover { text-decoration: underline; }

/* status badge under the hero title */
.case-status {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-ink);
  border: 1px solid color-mix(in srgb, var(--teal-ink), transparent 62%);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
}

/* results-at-a-glance metrics band */
.case-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(1.5rem, 4vw, 3.5rem);
  max-width: 1180px;
  margin: 0 auto clamp(6rem, 11vw, 10rem);
  padding-top: 1.6rem;
  border-top: 1px solid color-mix(in srgb, var(--ink), transparent 82%);
  scroll-margin-top: 8rem;
}

.case-metric__v {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--teal-ink);
}

.case-metric__l {
  margin-top: 0.8rem;
  font-size: 1rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--ink), transparent 20%);
  max-width: 26ch;
}

/* real-UI showcase slot (drop screenshots into the `shots` array in case.js) */
.case-shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  max-width: 1180px;
  margin: 0 auto;
}

.case-shots img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.32);
}

/* shared small kicker label */
.case-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal-ink);
  margin: 0 0 2.2rem;
}

/* process band */
.case-process { max-width: 1180px; margin: 0 auto clamp(6rem, 11vw, 10rem); scroll-margin-top: 8rem; }
.process-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 3.5vw, 3rem); position: relative; }
.process-row::before { content: ""; position: absolute; top: 26px; left: 5%; right: 5%; height: 2px; background: color-mix(in srgb, var(--ink), transparent 86%); z-index: 0; }
.process-step { position: relative; z-index: 1; }
.process-step__n { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: var(--cream); border: 2px solid var(--teal-ink); color: var(--teal-ink); font-weight: 300; font-size: 1.4rem; margin-bottom: 1.4rem; }
.process-step h3 { font-size: clamp(1.45rem, 2.4vw, 2rem); font-weight: 300; letter-spacing: -0.03em; margin: 0 0 0.8rem; }
.process-step p { font-size: 1.02rem; line-height: 1.5; color: color-mix(in srgb, var(--ink), transparent 18%); max-width: 34ch; }

/* design-system palette */
.case-system { position: relative; max-width: 1180px; margin: 0 auto clamp(6rem, 11vw, 10rem); scroll-margin-top: 8rem; }
.case-system__ghost { position: absolute; top: -4rem; right: -1rem; font-size: clamp(13rem, 26vw, 24rem); line-height: 0.78; font-weight: 300; color: color-mix(in srgb, var(--teal), transparent 90%); pointer-events: none; z-index: 0; user-select: none; }
.case-system__body { position: relative; z-index: 1; }
.palette { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: clamp(1rem, 2vw, 1.6rem); }
.swatch { display: flex; flex-direction: column; gap: 0.55rem; }
.swatch__chip { display: block; height: 88px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }
.swatch__hex { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92rem; }
.swatch__name { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: color-mix(in srgb, var(--ink), transparent 35%); }

/* reflection pull-quote */
.case-reflection { max-width: 1180px; margin: 0 auto clamp(6rem, 11vw, 9rem); scroll-margin-top: 8rem; }
.case-reflection__q { font-size: clamp(1.6rem, 3.4vw, 2.8rem); font-weight: 300; line-height: 1.28; letter-spacing: -0.03em; max-width: 26ch; border-left: 3px solid var(--teal-ink); padding-left: clamp(1.2rem, 3vw, 2.2rem); color: color-mix(in srgb, var(--ink), transparent 6%); }

/* staggered child reveals (metrics / process / palette) */
.reveal.in-view .case-metric,
.reveal.in-view .process-step,
.reveal.in-view .swatch { animation: caseRise 0.6s var(--ease) both; }
.reveal.in-view .case-metric:nth-child(2),
.reveal.in-view .process-step:nth-child(2),
.reveal.in-view .swatch:nth-child(2) { animation-delay: 0.09s; }
.reveal.in-view .case-metric:nth-child(3),
.reveal.in-view .process-step:nth-child(3),
.reveal.in-view .swatch:nth-child(3) { animation-delay: 0.18s; }
.reveal.in-view .swatch:nth-child(4) { animation-delay: 0.27s; }
.reveal.in-view .swatch:nth-child(5) { animation-delay: 0.36s; }
@keyframes caseRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.chapter {
  max-width: 1180px;
  margin: 0 auto clamp(7rem, 12vw, 11rem);
  scroll-margin-top: 8rem;
}

.chapter h2 {
  margin-bottom: 2rem;
  font-size: clamp(3.6rem, 9vw, 8.8rem);
  line-height: 0.86;
  font-weight: 300;
  letter-spacing: -0.08em;
  text-transform: uppercase;
}

.chapter p {
  max-width: 780px;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.55;
}

.dark-showcase {
  margin-inline: calc(var(--pad) * -1);
  padding: clamp(4rem, 9vw, 8rem) var(--pad);
  color: #fff;
  background:
    radial-gradient(circle at 28% 30%, color-mix(in srgb, var(--case-accent), transparent 18%), transparent 32%),
    #08080b;
  scroll-margin-top: 0;
}

.showcase-lab {
  max-width: 1180px;
  margin: 0 auto 2.2rem;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

.mockup-stack {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: clamp(2rem, 5vw, 4rem);
  max-width: 1180px;
  margin: 0 auto;
  align-items: stretch;
}

.mockup {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  padding-top: 36px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, var(--case-accent), var(--case-accent-2));
  background-size: 120px 120px, 120px 120px, auto;
  box-shadow: 0 42px 90px rgba(0, 0, 0, 0.32);
}

/* faux product UI inside the showcase mockups (was empty boxes) */
.mk-body { flex: 1; display: flex; flex-direction: column; gap: 11px; padding: 20px; }
.mk-row { display: grid; grid-template-columns: 18px 1fr 56px; gap: 10px; align-items: center; height: 30px; padding: 0 10px; border-radius: 7px; background: rgba(255, 255, 255, 0.12); }
.mk-row i { width: 14px; height: 14px; border-radius: 4px; background: rgba(255, 255, 255, 0.6); }
.mk-row b { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.45); }
.mk-row u { height: 16px; border-radius: 8px; background: color-mix(in srgb, var(--case-accent-2), white 34%); }
.mk-chart { margin-top: auto; display: flex; align-items: flex-end; gap: 9px; height: 92px; padding: 0 4px; }
.mk-chart s { flex: 1; border-radius: 5px 5px 0 0; background: rgba(255, 255, 255, 0.42); }
.mk-chart s:nth-child(1){height:46%} .mk-chart s:nth-child(2){height:72%} .mk-chart s:nth-child(3){height:38%} .mk-chart s:nth-child(4){height:90%} .mk-chart s:nth-child(5){height:58%} .mk-chart s:nth-child(6){height:78%}
.mk-pbody { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.mk-card { height: 104px; border-radius: 14px; background: rgba(255, 255, 255, 0.16); }
.mk-card:first-child { background: color-mix(in srgb, var(--case-accent-2), white 18%); opacity: 0.9; }
.mk-pill { margin-top: auto; height: 42px; border-radius: 21px; background: rgba(255, 255, 255, 0.55); }

.mockup::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 36px;
  background: rgba(0, 0, 0, 0.26);
}

.mockup::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 13.5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 16px 0 rgba(255, 255, 255, 0.42), 32px 0 rgba(255, 255, 255, 0.42);
}

.mockup--phone {
  min-height: 460px;
  border-radius: 34px;
}

.next-project {
  padding: clamp(4rem, 8vw, 7rem) var(--pad);
  background: radial-gradient(circle at 76% 22%, color-mix(in srgb, var(--teal), transparent 66%), transparent 42%), var(--ink);
  color: var(--cream);
}

.next-project p {
  margin: 0 0 1rem;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.7;
}

.next-project a {
  display: inline-block;
  max-width: 12ch;
  color: var(--cream);
  text-decoration: none;
  font-size: clamp(4rem, 10vw, 9rem);
  line-height: 0.86;
  letter-spacing: -0.08em;
  font-weight: 300;
  transition: color 0.3s var(--ease);
}

.next-project a:hover { color: var(--gold); }

body[data-preview-section] .case-hero,
body[data-preview-section] .next-project {
  display: none;
}

body[data-preview-section] .case-main {
  min-height: 100vh;
  padding-top: 7.5rem;
}

body[data-preview-section] .case-main > section {
  display: none;
  opacity: 1;
  transform: none;
}

body[data-preview-section="story"] #story,
body[data-preview-section="context"] #context,
body[data-preview-section="started"] #started,
body[data-preview-section="showcase"] #showcase {
  display: grid;
}

body[data-preview-section="context"] #context,
body[data-preview-section="started"] #started {
  display: block;
}

body[data-preview-section="showcase"] #showcase {
  margin-top: 0;
}

.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .cs-nav {
    left: 1.2rem;
    right: 1.2rem;
    top: 1rem;
  }

  .cs-logo {
    width: 58px;
    height: 44px;
  }

  .cs-nav__links {
    gap: 0.85rem;
  }

  .case-hero {
    grid-template-columns: 1fr;
    padding-top: 7rem;
    align-items: start;
  }

  .case-hero__visual {
    position: relative;
    inset: auto;
    width: 100%;
    height: min(42vh, 360px);
    margin-top: 2.5rem;
  }

  .case-title {
    font-size: clamp(2.6rem, 12.5vw, 5rem);
    max-width: none;
    overflow-wrap: break-word;
  }

  .case-subtitle { font-size: clamp(1.8rem, 6.4vw, 3rem); }

  .next-project a { font-size: clamp(2.6rem, 12vw, 5rem); overflow-wrap: break-word; }

  .chapter h2 { overflow-wrap: break-word; }

  .story-grid,
  .mockup-stack {
    grid-template-columns: 1fr;
  }

  .story-copy {
    font-size: 1.65rem;
  }

  .process-row { grid-template-columns: 1fr; gap: 2rem; }
  .process-row::before { display: none; }
  .case-system__ghost { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .reveal.in-view .case-metric,
  .reveal.in-view .process-step,
  .reveal.in-view .swatch { animation: none; }
}
