/* ==========================================================================
   case-study.css — Dedicated case study pages for The Digital Oak
   Loads AFTER main.css (inherits all :root variables, nav, footer, buttons).
   Namespaced with .cs- to avoid collision with existing page styles.
   ========================================================================== */

/* ── Layout containers ───────────────────────────────────────────────── */
.cs-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.cs-col {
  max-width: 760px;
  margin: 0 auto;
}

/* ── Back link ───────────────────────────────────────────────────────── */
.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.cs-back:hover { color: var(--accent); }

/* ── Hero ────────────────────────────────────────────────────────────── */
.cs-hero {
  padding: calc(var(--nav-h) + 3.5rem) 0 2.5rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.cs-hero-inner { position: relative; z-index: 2; }

.cs-status-badge {
  display: inline-block;
  width: fit-content;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 100px;
  padding: 0.3rem 0.85rem;
  margin-bottom: 1.5rem;
}

.cs-eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1.5rem 0 1rem;
}

.cs-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 1.25rem;
  max-width: 16ch;
}
.cs-title em { font-style: italic; color: var(--accent); }

.cs-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  line-height: 1.4;
  color: var(--muted);
  max-width: 34ch;
  margin: 0 0 2.5rem;
}

/* ── Meta strip ──────────────────────────────────────────────────────── */
.cs-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cs-meta-item { display: flex; flex-direction: column; gap: 0.35rem; }
.cs-meta-label {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.cs-meta-value {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.4;
}
.cs-meta-value a { color: var(--accent); text-decoration: none; }
.cs-meta-value a:hover { text-decoration: underline; }

/* ── Media frames (image placeholders until real screenshots land) ───── */
.cs-media {
  margin: 0;
  padding: 0;
}
.cs-media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.cs-media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Circuit-grid texture for empty placeholders */
.cs-media-frame--empty::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--faint) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
}
.cs-media-frame--empty::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.cs-media-caption {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--muted);
  margin-top: 0.85rem;
  text-align: center;
}

/* ── Body sections ───────────────────────────────────────────────────── */
.cs-section { padding: 3.5rem 0; }
.cs-section--tight { padding: 1.75rem 0 3.5rem; }
.cs-section-eyebrow {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
}
.cs-section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 1.5rem;
}

/* Prose */
.cs-prose { font-family: var(--sans); font-weight: 300; color: var(--muted); line-height: 1.85; font-size: 1rem; }
.cs-prose p { margin: 0 0 1.35rem; }
.cs-prose p:last-child { margin-bottom: 0; }
.cs-prose strong { color: var(--text); font-weight: 500; }
.cs-prose ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.cs-prose ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.cs-prose ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 1px;
}
.cs-prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s ease; }
.cs-prose a:hover { border-bottom-color: var(--accent); }

/* ── Pull quote ──────────────────────────────────────────────────────── */
.cs-quote {
  margin: 0;
  padding: 3rem 0;
  text-align: center;
}
.cs-quote-text {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  line-height: 1.3;
  color: var(--text);
  max-width: 22ch;
  margin: 0 auto 1.25rem;
}
.cs-quote-text .hl { color: var(--accent); }
.cs-quote-cite {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* ── Highlight / signature cards ─────────────────────────────────────── */
.cs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.cs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.75rem;
}
.cs-card-tag {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.75rem;
}
.cs-card-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--text);
  margin: 0 0 0.6rem;
  line-height: 1.2;
}
.cs-card-text {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

/* Big stat inside a card */
.cs-stat {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 2.75rem;
  line-height: 1;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.cs-stat-label {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Palette swatches (Kirk) — superseded by the constrained rule below ── */
.cs-swatch-chip { height: 72px; width: 100%; display: block; }
.cs-swatch-meta { padding: 0.7rem 0.85rem; }
.cs-swatch-name {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  display: block;
}
.cs-swatch-hex {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ── Status columns (Twisted) ────────────────────────────────────────── */
.cs-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}
.cs-status-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.75rem;
}
.cs-status-head {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.cs-status-head--done { color: var(--accent); }
.cs-status-head--wip { color: var(--muted); }
.cs-status-list { list-style: none; margin: 0; padding: 0; }
.cs-status-list li {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 1.4rem;
  position: relative;
  margin-bottom: 0.85rem;
}
.cs-status-list li:last-child { margin-bottom: 0; }
.cs-status-list--done li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 0.85rem;
}
.cs-status-list--wip li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border: 1px solid var(--muted);
  border-radius: 50%;
}

/* ── "What this demonstrates" ────────────────────────────────────────── */
.cs-demo { margin-top: 2rem; }
.cs-demo-item {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.5rem;
  align-items: baseline;
}
.cs-demo-item:last-child { border-bottom: 1px solid var(--border); }
.cs-demo-lead {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.2rem;
  color: var(--text);
  line-height: 1.25;
}
.cs-demo-text {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Alt-background section wrapper ──────────────────────────────────── */
.cs-band { background: var(--bg-alt); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .cs-status { grid-template-columns: 1fr; gap: 1.25rem; }
  .cs-demo-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .cs-section { padding: 2.5rem 0; }
  .cs-hero { padding: calc(var(--nav-h) + 2rem) 0 2rem; }
}

/* ── Motion (respect reduced-motion) ─────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .cs-hero-inner > * { opacity: 0; transform: translateY(12px); animation: cs-rise 0.6s ease forwards; }
  .cs-hero-inner > *:nth-child(1) { animation-delay: 0.05s; }
  .cs-hero-inner > *:nth-child(2) { animation-delay: 0.12s; }
  .cs-hero-inner > *:nth-child(3) { animation-delay: 0.19s; }
  .cs-hero-inner > *:nth-child(4) { animation-delay: 0.26s; }
  .cs-hero-inner > *:nth-child(5) { animation-delay: 0.33s; }
  @keyframes cs-rise { to { opacity: 1; transform: translateY(0); } }
}

/* ── Hero split layout (text left, logo right) ───────────────────────── */
.cs-hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto;
  column-gap: 3rem;
  align-items: start;
}
/* Back link, badge, eyebrow, title, tagline, meta all stay in col 1 */
.cs-back,
.cs-status-badge,
.cs-eyebrow,
.cs-title,
.cs-tagline,
.cs-meta { grid-column: 1; }

.cs-hero-logo {
  grid-column: 2;
  grid-row: 1 / 6;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 2.5rem;
}
.cs-hero-logo img {
  width: 180px;
  height: auto;
  display: block;
  /* transparent-bg logos sit fine on dark; no panel needed */
}

@media (max-width: 720px) {
  .cs-hero-inner {
    grid-template-columns: 1fr;
  }
  .cs-hero-logo {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
    padding-top: 0;
    margin-bottom: 1.5rem;
    order: -1; /* logo above title on mobile */
  }
  .cs-hero-logo img { width: 120px; }
}

/* ── Multiple media frames ────────────────────────────────────────────── */
.cs-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.cs-media-grid .cs-media-frame { aspect-ratio: 16 / 9; }
/* Wide single frame (full width) stays as .cs-media-frame alone */

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

/* ── Palette: fix alignment to match cs-cards grid ───────────────────── */
.cs-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
  align-items: stretch;  /* was causing collapse on short rows */
  max-width: 760px;      /* align left edge with .cs-col text above */
  margin-left: auto;
  margin-right: auto;
}
.cs-swatch {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}
.cs-swatch-chip {
  height: 80px;
  width: 100%;
  display: block;
  flex-shrink: 0;
}
.cs-swatch-meta {
  padding: 0.75rem 0.9rem;
  flex: 1;
}
