/* ============================================================
   Case Study Pages — work/work.css
   ============================================================ */

/* Override base section rule for case study pages */
.cs-page section {
  border-top: none;
  padding: 0;
  scroll-margin-top: 0;
}

/* Work-page nav back link */
.work-nav-back {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
}

.work-nav-back:hover {
  color: var(--text);
}

/* ─── HERO ──────────────────────────────────────────────────── */

.cs-hero {
  min-height: 60svh;
  padding-top: 130px;
  padding-right: var(--pad);
  padding-bottom: clamp(60px, 8vw, 100px);
  padding-left: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-bottom: 1px solid var(--dim);
}

.cs-category {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  align-self: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 6px 14px;
  margin-bottom: 36px;
}

.cs-title {
  font-family: 'Clash Display', 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(52px, 10vw, 148px);
  line-height: 0.88;
  letter-spacing: -0.04em;
  word-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 36px;
  text-wrap: balance;
}

.cs-meta {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.cs-client {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.cs-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--label);
  letter-spacing: 0.08em;
}

.cs-meta-sep {
  color: var(--dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.cs-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.cs-link:hover { border-bottom-color: var(--accent); }

.cs-note {
  color: var(--label);
  font-style: italic;
}

/* ─── CONTENT SECTIONS ──────────────────────────────────────── */

.cs-section {
  padding: clamp(72px, 8vw, 120px) var(--pad);
  border-top: 1px solid var(--dim);
}

.cs-eyebrow {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 40px;
}

.cs-body {
  max-width: 680px;
  font-size: clamp(15px, 1.55vw, 18px);
  line-height: 1.82;
  color: var(--muted);
}

.cs-body p + p {
  margin-top: 22px;
}

.cs-body strong {
  color: var(--text);
  font-weight: 500;
}

.cs-body-wide {
  max-width: 860px;
}

/* Sub-heading inside a section */
.cs-sub {
  font-family: 'Syne', sans-serif;
  font-size: clamp(17px, 1.9vw, 22px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 14px;
}

/* ─── STEP LIST ─────────────────────────────────────────────── */

.cs-steps {
  list-style: none;
  counter-reset: step;
  max-width: 860px;
  border-top: 1px solid var(--dim);
}

.cs-steps li {
  counter-increment: step;
  position: relative;
  border-bottom: 1px solid var(--dim);
  padding: 22px 0 22px 74px;
  font-size: clamp(14px, 1.45vw, 16px);
  line-height: 1.75;
  color: var(--muted);
  transition: color 0.25s, background 0.25s;
}

.cs-steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.cs-steps li:hover { color: var(--text); }

.cs-steps strong {
  color: var(--text);
  font-weight: 500;
}

/* ─── BULLET LIST ───────────────────────────────────────────── */

.cs-list {
  list-style: none;
  max-width: 760px;
  margin-top: 22px;
}

.cs-list li {
  position: relative;
  padding-left: 26px;
  font-size: clamp(14px, 1.45vw, 16px);
  line-height: 1.8;
  color: var(--muted);
}

.cs-list li + li { margin-top: 10px; }

.cs-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

.cs-list strong {
  color: var(--text);
  font-weight: 500;
}

/* ─── CALLOUT ───────────────────────────────────────────────── */

.cs-callout {
  max-width: 860px;
  margin-top: 48px;
  border-left: 2px solid var(--accent);
  background: linear-gradient(90deg, rgba(91, 78, 255, 0.075), transparent 70%);
  padding: 26px 30px;
}

.cs-callout-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.cs-callout p {
  font-size: clamp(15px, 1.6vw, 19px);
  line-height: 1.65;
  color: var(--text);
  font-weight: 300;
}

/* ─── CODE BLOCK ────────────────────────────────────────────── */

.cs-code {
  max-width: 860px;
  margin-top: 44px;
  border: 1px solid var(--dim);
  background: #0c0c10;
  overflow: hidden;
}

.cs-code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--dim);
  padding: 11px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}

.cs-code-head::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.cs-code pre {
  margin: 0;
  padding: 22px 18px;
  overflow-x: auto;
}

.cs-code code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.85;
  color: #b9b9c4;
  white-space: pre;
}

.cs-code .k { color: #8b7fff; }
.cs-code .s { color: #6fb98f; }
.cs-code .c { color: #4a4a55; font-style: italic; }
.cs-code .f { color: #d4d4de; }

/* ─── DIAGRAM FIGURE ────────────────────────────────────────── */

.cs-diagram {
  margin: 0;
  border: 1px solid var(--dim);
  background: #0a0a0d;
}

.cs-diagram img {
  width: 100%;
  display: block;
}

.cs-diagram figcaption {
  border-top: 1px solid var(--dim);
  padding: 14px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
}

/* ─── FEATURE GRID ──────────────────────────────────────────── */

.cs-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--dim);
  border: 1px solid var(--dim);
  margin-top: 44px;
}

.cs-feature {
  background: var(--bg);
  padding: 30px 26px;
  transition: background 0.3s;
  min-width: 0;
}

.cs-feature:hover { background: #0d0d12; }

.cs-feature-num {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 16px;
}

.cs-feature h4 {
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}

.cs-feature p {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ─── STAT ROW ──────────────────────────────────────────────── */

.cs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--dim);
  border-bottom: 1px solid var(--dim);
}

.cs-stat {
  padding: 28px var(--pad);
  border-left: 1px solid var(--dim);
  /* Grid items default to min-width: auto, which lets a long stat value or
     label force the column past its minmax(140px, 1fr) floor and overflow
     the viewport on mobile. min-width: 0 lets it actually wrap instead. */
  min-width: 0;
}

.cs-stat:first-child {
  border-left: none;
}

.cs-stat-value {
  display: block;
  font-family: 'Clash Display', 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 2.6vw, 34px);
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  overflow-wrap: break-word;
}

.cs-stat-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
}

/* ─── VISUAL / GALLERY ──────────────────────────────────────── */

.cs-visual-block {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-visual-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.18);
}

.cs-gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 28px);
}

.cs-gallery-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}

@media (max-width: 720px) {
  .cs-gallery-row { grid-template-columns: 1fr; }
}

.cs-gallery img {
  width: 100%;
  display: block;
  background: var(--dim);
}

.cs-gallery-row .cs-gallery-wide img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
}

.cs-gallery-row .cs-gallery-narrow img {
  aspect-ratio: 9 / 16;
  object-fit: cover;
  object-position: top center;
}

/* Desktop + mobile pair, matched height.
   The legacy .cs-gallery-row assumes landscape device mockups; this variant
   handles real portrait screenshots without leaving a gap under the wide one. */

.cs-gallery-pair {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: clamp(16px, 2vw, 28px);
  align-items: stretch;
}

.cs-gallery-pair .g-main { aspect-ratio: 16 / 9; }
.cs-gallery-pair .g-side { position: relative; }

.cs-gallery-pair .g-main img,
.cs-gallery-pair .g-side img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  background: var(--dim);
  border: 1px solid var(--dim);
}

.cs-gallery-pair .g-side img {
  position: absolute;
  inset: 0;
}

@media (max-width: 720px) {
  .cs-gallery-pair { grid-template-columns: 1fr; }
  .cs-gallery-pair .g-side { position: static; aspect-ratio: 16 / 10; }
  .cs-gallery-pair .g-side img { position: static; }
}

/* ─── MOCKUP GALLERY ────────────────────────────────────────── */
/* For agency presentation mockups, which arrive at a consistent 3:2-ish
   ratio. Two up, with an optional full-width lead image. */

.cs-mockups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(14px, 1.8vw, 24px);
}

.cs-mockups img {
  width: 100%;
  aspect-ratio: 1800 / 1252;
  object-fit: cover;
  display: block;
  background: var(--dim);
  border: 1px solid var(--dim);
  transition: transform 0.6s var(--ease);
}

/* full-width mockups keep their natural ratio — nothing worth cropping out */
.cs-mockups .wide { grid-column: 1 / -1; }
.cs-mockups .wide img { aspect-ratio: auto; height: auto; }

.cs-mockups .tall img {
  aspect-ratio: 1650 / 1800;
  object-position: top center;
}

@media (max-width: 680px) {
  .cs-mockups { grid-template-columns: 1fr; }
  .cs-mockups .tall img { aspect-ratio: 1800 / 1252; }
}

/* lead visual directly under a case study hero */
.cs-lead {
  border-bottom: 1px solid var(--dim);
}

.cs-lead img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top center;
  background: var(--dim);
}

@media (max-width: 680px) {
  .cs-lead img { aspect-ratio: 4 / 3; }
}

/* ─── TOOLS ─────────────────────────────────────────────────── */

.cs-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 52px;
}

.cs-tool {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--dim);
  padding: 7px 14px;
}

/* ─── CASE STUDY INDEX (parent hub) ─────────────────────────── */

.cs-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 44px;
}

.cs-index-group {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 28px;
}

.cs-index-group:first-child { margin-top: 0; }

.cs-index-group span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.cs-index-group::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--dim);
}

.cs-index-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--dim);
  background: var(--bg-raised);
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease);
  min-width: 0;
}

.cs-index-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
}

.cs-index-visual {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 1px solid var(--dim);
}

.cs-index-body { padding: 18px 20px 22px; }

.cs-index-tag {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--label);
  margin-bottom: 10px;
}

.cs-index-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 8px;
}

.cs-index-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

/* ─── TIMELINE ──────────────────────────────────────────────── */

.cs-timeline {
  margin-top: 40px;
  border-top: 1px solid var(--dim);
}

.cs-timeline-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--dim);
}

@media (max-width: 620px) {
  .cs-timeline-row { grid-template-columns: 1fr; gap: 8px; }
}

.cs-timeline-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding-top: 2px;
}

.cs-timeline-body {
  font-size: 15px;
  line-height: 1.72;
  color: var(--muted);
}

.cs-timeline-body strong {
  color: var(--text);
  font-weight: 500;
}

/* ─── QUOTES ────────────────────────────────────────────────── */

.cs-quotes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 40px;
}

.cs-quote {
  border: 1px solid var(--dim);
  border-left: 2px solid var(--accent-line);
  background: var(--bg-raised);
  padding: 24px 26px;
}

.cs-quote p {
  font-size: 15.5px;
  line-height: 1.66;
  color: var(--text);
  margin: 0 0 14px;
}

.cs-quote cite {
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
}

/* ─── PROTECTED GATE ────────────────────────────────────────── */

.cs-gate {
  border-top: 1px solid var(--dim);
  padding: clamp(72px, 9vw, 128px) var(--pad);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(91, 78, 255, 0.09), transparent 62%),
    var(--bg);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.cs-gate.is-unlocked {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.cs-gate.is-checking { opacity: 0.45; }

.cs-gate.is-shaking .cs-gate-inner { animation: gate-shake 0.42s ease; }

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.cs-gate-inner {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
}

.cs-gate-lock {
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 26px;
  color: var(--accent);
}

.cs-gate-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.cs-gate-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 18px;
}

.cs-gate-text {
  font-size: clamp(14px, 1.5vw, 16px);
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 34px;
}

.cs-gate-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.cs-gate-form input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text);
  background: #101014;
  border: 1px solid var(--dim-2);
  padding: 13px 18px;
  width: min(280px, 100%);
  transition: border-color 0.2s;
}

.cs-gate-form input::placeholder { color: #555; letter-spacing: 0.1em; }
.cs-gate-form input:focus { outline: none; border-color: var(--accent); }

.cs-gate-form button {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  padding: 13px 26px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.3s, opacity 0.2s;
}

.cs-gate-form button:hover:not(:disabled) {
  background: #6d61ff;
  box-shadow: 0 0 26px rgba(91, 78, 255, 0.36);
}

.cs-gate-form button:disabled { opacity: 0.55; cursor: default; }

.cs-gate-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  color: #ff6b6b;
  margin-bottom: 18px;
}

.cs-gate-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--label);
}

.cs-gate-divider::before,
.cs-gate-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--dim);
}

.cs-gate-cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--dim-2);
  padding: 13px 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s, gap 0.2s;
}

.cs-gate-cta:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  gap: 16px;
}

.cs-gate-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.8;
  color: var(--label);
  margin-top: 26px;
}

/* teaser section above the gate */
.cs-preview-fade .cs-body {
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 45%, transparent 100%);
}

#csProtected[hidden] { display: none; }

/* ─── FOOTER NAV ────────────────────────────────────────────── */

/* the global `nav` rule is position:fixed with a gradient scrim — neither
   applies to the prev/next nav, which belongs in the normal flow */
.cs-footer-nav::after { display: none; }

.cs-footer-nav {
  position: static;
  border-top: 1px solid var(--dim);
  padding: clamp(40px, 5vw, 64px) var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.cs-footer-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s, gap 0.2s;
}

.cs-footer-link:hover {
  color: var(--text);
  gap: 14px;
}

/* ─── PAGE FOOTER ───────────────────────────────────────────── */

.cs-page-footer {
  border-top: 1px solid var(--dim);
  padding: 32px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.cs-page-footer .footer-copy,
.cs-page-footer .footer-built {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--label);
  letter-spacing: 0.04em;
}

.cs-page-footer .footer-built em {
  font-style: normal;
  color: var(--accent);
}
