/* ─────────────────────────────────────────────
   Case-study pages. Requires site.css (tokens, reset, focus).
   Normal-size text uses --ink or --mute only; --brand is reserved for
   large display text and decoration (see contrast notes in site.css).
───────────────────────────────────────────── */
.maxw { max-width: 880px; margin: 0 auto; }

/* ── Top bar ── */
.cs-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem var(--gut);
  background: rgba(243, 228, 201, 0.95); border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) {
  .cs-nav { background: rgba(243, 228, 201, 0.88); backdrop-filter: blur(12px) saturate(1.2); }
}
.cs-brand { display: inline-flex; align-items: center; gap: 0.55rem; font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 0.9rem; letter-spacing: 0.06em; color: var(--ink); }
.cs-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.cs-back { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 40px; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; color: var(--ink); border-bottom: 1px solid var(--line); transition: border-color .2s; }
.cs-back:hover { border-bottom-color: var(--ink); }
.cs-back svg { width: 15px; height: 15px; }

/* ── Hero ── */
.cs-hero { padding-block: clamp(3rem, 8vw, 5.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.cs-kicker { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; margin-bottom: 1.25rem; }
.cs-tag { display: inline-flex; align-items: center; gap: 0.4rem; font-family: 'IBM Plex Mono', monospace; font-size: 0.76rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink); background: var(--bone); border: 1px solid var(--line); padding: 0.22rem 0.6rem; }
.cs-tag.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #2F6B3A; }
.cs-title { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: clamp(2.3rem, 6vw, 3.9rem); line-height: 1.02; letter-spacing: -0.03em; color: var(--ink); }
.cs-title .accent { color: var(--brand); }
.cs-summary { font-size: clamp(1.1rem, 1.8vw, 1.3rem); line-height: 1.6; color: var(--ink); max-width: 60ch; margin-top: 1.25rem; }
.cs-stack { font-family: 'IBM Plex Mono', monospace; font-size: 0.88rem; color: var(--mute); margin-top: 1.25rem; }

/* meta strip */
.cs-meta { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 2rem; }
.cs-meta .cell { padding: 1rem 1rem 1rem 0; border-right: 1px solid var(--line); }
.cs-meta .cell + .cell { padding-left: 1rem; }
.cs-meta .cell:last-child { border-right: none; }
.cs-meta .k { font-family: 'IBM Plex Mono', monospace; font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); margin-bottom: 0.3rem; }
.cs-meta .v { font-size: 1rem; font-weight: 500; color: var(--ink); line-height: 1.4; }

/* ── Body ── */
.cs-body { padding-bottom: clamp(3rem, 8vw, 5rem); }
.cs-section { padding-top: clamp(2.25rem, 5vw, 3.25rem); }
.cs-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); margin-bottom: 0.7rem; }
.cs-h2 { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.18; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 1rem; }
.cs-body p { font-size: 1.06rem; line-height: 1.75; color: var(--ink); margin-bottom: 1rem; max-width: 68ch; }
.cs-body p strong, .cs-list li strong { font-weight: 600; }
.cs-body a:not([class]) { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--mute); }
.cs-body a:not([class]):hover { text-decoration-color: var(--ink); }
.cs-list { list-style: none; max-width: 68ch; margin-bottom: 1rem; }
.cs-list li { position: relative; padding-left: 1.5rem; font-size: 1.04rem; line-height: 1.7; color: var(--ink); margin-bottom: 0.6rem; }
.cs-list li::before { content: ''; position: absolute; left: 0.2rem; top: 0.72em; width: 6px; height: 6px; background: var(--brand); }
.cs-note { font-size: 0.98rem !important; color: var(--mute) !important; border-left: 3px solid var(--line); padding-left: 1rem; }

/* My-contribution / scope box */
.cs-own { border: 1px solid var(--line); background: var(--bone); padding: 1.4rem 1.5rem; margin-top: 1.25rem; }
.cs-own h3 { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); margin-bottom: 0.75rem; }
.cs-own .cs-list { margin-bottom: 0; }
.cs-own .cs-list li:last-child { margin-bottom: 0; }

/* highlight cards */
.cs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 1.25rem; }
.cs-card { background: var(--paper); padding: 1.4rem; }
.cs-card .h { font-family: 'IBM Plex Mono', monospace; font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); margin-bottom: 0.5rem; }
.cs-card .t { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 1.15rem; color: var(--ink); margin-bottom: 0.35rem; line-height: 1.25; }
.cs-card p { font-size: 0.98rem; line-height: 1.6; margin: 0; }

/* Flow diagram (ordered list of stages) */
.cs-flow { list-style: none; display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.5rem; margin-top: 1.25rem; counter-reset: step; }
.cs-flow li { flex: 1 1 140px; position: relative; border: 1px solid var(--line); background: var(--paper); padding: 0.9rem 1rem; counter-increment: step; }
.cs-flow li::before { content: counter(step, decimal-leading-zero); display: block; font-family: 'IBM Plex Mono', monospace; font-size: 0.76rem; color: var(--mute); margin-bottom: 0.3rem; }
.cs-flow li b { display: block; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 1.05rem; color: var(--ink); line-height: 1.25; }
.cs-flow li span { display: block; font-size: 0.92rem; color: var(--mute); margin-top: 0.2rem; line-height: 1.45; }
.cs-flow li.human { background: var(--bone); border-color: var(--mute); }
.cs-caption { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; color: var(--mute); margin-top: 0.65rem; }

/* Tables (role matrix, config) */
.cs-table-wrap { overflow-x: auto; margin-top: 1.25rem; border: 1px solid var(--line); }
.cs-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; min-width: 520px; }
.cs-table th, .cs-table td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.cs-table thead th { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); background: var(--bone); }
.cs-table tbody tr:last-child td, .cs-table tbody tr:last-child th { border-bottom: none; }
.cs-table code { font-size: 0.86em; }

/* Screenshot */
.cs-figure { margin-top: 1.5rem; }
.cs-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.cs-figure figcaption { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; color: var(--mute); margin-top: 0.6rem; }

/* Inline code */
.cs-body code { font-family: 'IBM Plex Mono', monospace; font-size: 0.86em; background: var(--bone); border: 1px solid var(--line); padding: 0.08em 0.36em; color: var(--ink); }

/* Repo / demo callout */
.cs-repo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); background: var(--bone); padding: 1.25rem 1.4rem; margin-top: 1.25rem; }
.cs-repo + .cs-repo { margin-top: 0.75rem; }
.cs-repo .rt { font-family: 'IBM Plex Mono', monospace; font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); margin-bottom: 0.3rem; }
.cs-repo .rn { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 600; font-size: 1.1rem; color: var(--ink); line-height: 1.25; overflow-wrap: anywhere; }
.cs-repo-btn { display: inline-flex; align-items: center; gap: 0.55rem; flex-shrink: 0; min-height: 46px; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.7rem 1.1rem; border: 1.5px solid var(--ink); color: var(--ink); transition: background .2s, color .2s; }
.cs-repo-btn:hover { background: var(--ink); color: var(--paper); }
.cs-repo-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.cs-rule { height: 1px; background: var(--line); margin-top: clamp(2.5rem, 6vw, 4rem); }

/* ── Footer ── */
.cs-foot { --focus: var(--bone); background: var(--footer-bg); color: var(--bone); padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 4vw, 2rem) clamp(2rem, 4vw, 3rem); }
.cs-foot .big { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; color: var(--bone); }
.cs-foot .big .accent { color: var(--bone); }
.cs-foot-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; margin-top: 1.4rem; }
.cs-cta { display: inline-flex; align-items: center; gap: 0.55rem; min-height: 48px; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.8rem 1.3rem; background: var(--ink); color: var(--paper); transition: background .2s; }
.cs-cta:hover { background: var(--night); }
.cs-cta svg { width: 15px; height: 15px; }
.cs-next { font-family: 'IBM Plex Mono', monospace; font-size: 0.88rem; color: var(--bone); border-bottom: 1px solid var(--night-line); padding: 0.3rem 0; }
.cs-next:hover { border-bottom-color: var(--bone); }

/* Restrained entrance; CSS-only, so content never depends on a script. */
@media (prefers-reduced-motion: no-preference) {
  .up { animation: csUp .6s ease both; }
  @keyframes csUp { from { opacity: 0; transform: translateY(12px); } }
}

@media (max-width: 700px) {
  .cs-meta { grid-template-columns: 1fr 1fr; }
  .cs-meta .cell, .cs-meta .cell + .cell { padding: 0.85rem 0.75rem 0.85rem 0; border-right: none; border-bottom: 1px solid var(--line); }
  .cs-meta .cell:nth-child(2n) { padding-left: 0.75rem; border-left: 1px solid var(--line); }
  .cs-meta .cell:nth-last-child(-n+2):nth-child(odd), .cs-meta .cell:last-child { border-bottom: none; }
  .cs-repo { flex-direction: column; align-items: flex-start; }
  .cs-repo-btn { width: 100%; justify-content: center; }
}
