/* ── Page variables ── */
:root {
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --subnav-bg: rgba(249, 249, 247, 0.88);
  --cs-radius: 20px;
}
[data-theme="dark"] {
  --subnav-bg: rgba(2, 6, 16, 0.92);
}

/* ── Scroll progress bar ── */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--color-dark);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ── Back link ── */
.back-row { padding: 40px 0 0; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gray-medium);
  transition: color 0.2s ease;
  text-decoration: none;
}
.back-link:hover { color: var(--color-dark); }
.back-link svg { width: 14px; height: 14px; }

/* ── Hero ── */
.cs-hero { padding: 44px 0 56px; }
.cs-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.cs-title {
  font-family: var(--font-heading);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--color-dark);
  max-width: 14ch;
}
.cs-lede {
  margin-top: 28px;
  max-width: 600px;
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.55;
  color: var(--color-gray-medium);
  font-weight: 300;
}

/* ── Meta strip ── */
.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-top: 48px;
  border-top: 1px solid var(--color-gray-light);
  padding-top: 28px;
}
[data-theme="dark"] .cs-meta { border-top-color: rgba(255, 255, 255, 0.1); }
.cs-meta .meta-k {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gray-medium);
  margin-bottom: 10px;
}
.cs-meta .meta-v {
  font-size: 15px;
  color: var(--color-dark);
  line-height: 1.55;
}

/* ── Cover ── */
.cs-cover { margin-top: 56px; }
.cover-frame {
  aspect-ratio: 16 / 8;
  border-radius: var(--cs-radius);
  border: 1px solid var(--color-gray-light);
  overflow: hidden;
  background: var(--color-bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 48px;
}
[data-theme="dark"] .cover-frame { border-color: rgba(255, 255, 255, 0.08); }
.cover-frame .cover-img {
  height: 100%;
  width: auto;
  max-width: calc(33.33% - 11px);
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* ── Sticky subnav ── */
.cs-subnav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--subnav-bg);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--color-gray-light);
  margin-top: 72px;
}
[data-theme="dark"] .cs-subnav { border-bottom-color: rgba(255, 255, 255, 0.1); }
.cs-subnav-inner {
  display: flex;
  gap: 28px;
  height: 56px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.cs-subnav-inner::-webkit-scrollbar { display: none; }
.cs-subnav a {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--color-gray-medium);
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.cs-subnav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -17px;
  height: 2px;
  background: var(--color-dark);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cs-subnav a:hover { color: var(--color-dark); }
.cs-subnav a.active { color: var(--color-dark); font-weight: 500; }
.cs-subnav a.active::after { transform: scaleX(1); }

/* ── Content blocks ── */
.block { padding: 80px 0; border-bottom: 1px solid var(--color-gray-light); }
[data-theme="dark"] .block { border-bottom-color: rgba(255, 255, 255, 0.08); }
.block:last-of-type { border-bottom: none; }

/* Two-column block layout */
.block-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
}
.block-num {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gray-medium);
  padding-top: 4px;
}
.block-content {}
.block-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--color-dark);
  max-width: 16ch;
}

/* Prose */
.prose { max-width: 620px; }
.prose p {
  font-size: 17px;
  line-height: 1.72;
  color: var(--color-gray-medium);
  margin-top: 20px;
}
.prose p:first-child { margin-top: 0; }
.prose p.lead {
  font-size: 20px;
  color: var(--section-header-color);
  line-height: 1.6;
  font-weight: 400;
}

/* ── Steps list ── */
.steps { display: flex; flex-direction: column; margin-top: 0; }
.step {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 20px;
  padding: 28px 0;
  border-top: 1px solid var(--color-gray-light);
}
[data-theme="dark"] .step { border-top-color: rgba(255, 255, 255, 0.08); }
.step:last-child { border-bottom: 1px solid var(--color-gray-light); }
[data-theme="dark"] .step:last-child { border-bottom-color: rgba(255, 255, 255, 0.08); }
.step-num {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--color-gray-medium);
  padding-top: 4px;
  letter-spacing: 0.04em;
}
.step h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-dark);
}
.step p {
  margin-top: 6px;
  color: var(--color-gray-medium);
  font-size: 15.5px;
  line-height: 1.6;
  max-width: 540px;
}

/* ── Figure ── */
.figure { margin-top: 48px; }
.figure-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--cs-radius);
  border: 1px solid var(--color-gray-light);
  overflow: hidden;
  background: var(--color-bg-card);
  object-fit: cover;
}
[data-theme="dark"] .figure-img { border-color: rgba(255, 255, 255, 0.08); }
.figure-ph {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--cs-radius);
  border: 1px solid var(--color-gray-light);
  background: var(--color-bg-card);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(2, 6, 23, 0.025) 0px, rgba(2, 6, 23, 0.025) 1px,
    transparent 1px, transparent 11px
  );
  display: grid;
  place-items: center;
}
[data-theme="dark"] .figure-ph {
  border-color: rgba(255, 255, 255, 0.08);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px,
    transparent 1px, transparent 11px
  );
}
.figure-ph span {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--color-gray-medium);
  background: var(--color-bg-card);
  border: 1px solid var(--color-gray-light);
  padding: 5px 12px;
  border-radius: 999px;
}
[data-theme="dark"] .figure-ph span { border-color: rgba(255, 255, 255, 0.08); }
figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--color-gray-medium);
  letter-spacing: 0.03em;
}

/* Two figures side by side */
.figure-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 48px;
}
.figure-duo .figure-ph { aspect-ratio: 4 / 3; }

/* ── Gallery ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 0;
}
.gallery-img {
  aspect-ratio: 3 / 5;
  border-radius: 14px;
  border: 1px solid var(--color-gray-light);
  overflow: hidden;
  background: var(--color-bg-card);
  object-fit: cover;
  object-position: top center;
  width: 100%;
}
[data-theme="dark"] .gallery-img { border-color: rgba(255, 255, 255, 0.08); }

/* ── Pull stats ── */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 52px;
}
.stat { border-top: 2px solid var(--color-dark); padding-top: 20px; }
.stat-big {
  font-family: var(--font-heading);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-dark);
}
.stat-big .stat-unit {
  font-size: 0.5em;
  font-weight: 600;
}
.stat-lbl {
  margin-top: 12px;
  font-size: 15px;
  color: var(--color-gray-medium);
  line-height: 1.5;
}

/* ── Quote ── */
.cs-quote { padding: 72px 0; }
.cs-quote blockquote {
  font-family: var(--font-heading);
  font-size: clamp(24px, 3.4vw, 42px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 18ch;
  color: var(--color-dark);
}
.cs-quote .quote-by {
  margin-top: 24px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--color-gray-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Next project ── */
.cs-next { border-top: 1px solid var(--color-gray-light); padding: 60px 0 0; }
[data-theme="dark"] .cs-next { border-top-color: rgba(255, 255, 255, 0.1); }
.next-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 44px 0;
  text-decoration: none;
  color: inherit;
}
.next-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gray-medium);
  margin-bottom: 12px;
}
.next-title {
  font-family: var(--font-heading);
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-dark);
  transition: opacity 0.25s ease;
}
.next-link:hover .next-title { opacity: 0.5; }
.next-arrow {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1px solid var(--color-gray-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--color-dark);
  transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
[data-theme="dark"] .next-arrow { border-color: rgba(255, 255, 255, 0.1); }
.next-link:hover .next-arrow {
  background: var(--color-dark);
  color: var(--color-bg);
  transform: translateX(6px);
  border-color: var(--color-dark);
}
.next-arrow svg { width: 22px; height: 22px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .block-layout { grid-template-columns: 1fr; gap: 20px; }
  .cs-meta { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .figure-duo, .stats, .gallery { grid-template-columns: 1fr; }
  .gallery-img { aspect-ratio: 16 / 10; }
  .cover-frame { padding: 20px 24px; gap: 10px; }
}
@media (max-width: 600px) {
  .cs-title { font-size: clamp(40px, 10vw, 64px); }
  .cs-hero { padding: 36px 0 44px; }
  .block { padding: 56px 0; }
  .cs-subnav-inner { gap: 20px; }
}
