/* ============================================================
   case-study.css — shared styles for project detail pages.
   Direction B aesthetic: terminal / engineering log.
   Token names follow the root index.html for theme parity.
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/inter-latin.v1.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin.v1.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/fraunces-latin.v1.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/fraunces-latin.v1.woff2') format('woff2-variations');
  font-synthesis: style;
}

:root {
  --bg:           #0a0a12;
  --bg-2:         #0f0f1a;
  --surface:      #14141f;
  --surface-hi:   #1a1a28;
  --border:       #1e1e2e;
  --border-hi:    #2a2a3d;
  --text:         #f4f4f0;
  --text-2:       #e6e6ee;
  --text-dim:     #b8b8cc;
  --muted:        #9090b8;
  --muted-2:      #8585a8;
  --accent:       #00e5a0;
  --accent-glow:  rgba(0, 229, 160, 0.20);

  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
}
[data-theme="light"] {
  --bg:          #f4f4f0;
  --bg-2:        #e9e9e2;
  --surface:     #ffffff;
  --surface-hi:  #fafaf5;
  --border:      #c4c4bc;
  --border-hi:   #a8a8a0;
  --text:        #14141e;
  --text-2:      #2a2a3c;
  --text-dim:    #2a2a3c;
  --muted:       #555566;
  --muted-2:     #5e6066;
  --accent:      #006e4a;
  --accent-glow: rgba(0, 110, 74, 0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.accent { color: var(--accent); }

/* ─── reading-progress bar ─── */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 100;
  pointer-events: none;
  transition: transform 0.08s linear;
  box-shadow: 0 0 8px var(--accent-glow);
}
@media (prefers-reduced-motion: reduce) {
  .reading-progress { transition: none; }
}

/* ─── window-chrome bar ─── */
.chrome {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-hi);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.chrome .lights { display: flex; gap: 8px; align-items: center; }
.chrome .back {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--border-hi);
  margin-right: 4px;
  transition: color .15s;
}
.chrome .back:hover { color: var(--accent); }
.chrome .lt { width: 12px; height: 12px; border-radius: 50%; background: var(--border-hi); }
.chrome .lt.live { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.chrome .path { color: var(--muted); }
.chrome .path b { color: var(--text); font-weight: 500; }
.chrome .clock { color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ─── theme toggle ─── */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  margin-left: 12px;
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ─── hero ─── */
.hero {
  padding: 56px 64px;
  border-bottom: 1px solid var(--border);
}
.prompt {
  display: flex; gap: 12px;
  color: var(--muted-2);
  font-size: 12.5px;
  margin-bottom: 28px;
}
.prompt b { color: var(--accent); font-weight: 500; }

.title-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.hero h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}
.hero h1 .em { color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-glow);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.hero .tagline {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 64ch;
  font-weight: 400;
}

/* ─── status block ─── */
.status {
  margin-top: 36px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  background: var(--bg-2);
  font-size: 12.5px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.status .row .k {
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.status .row .v { color: var(--text); font-size: 14px; }
.status .row .v.acc { color: var(--accent); }

/* ─── section (file-listing aesthetic) ─── */
.sect {
  padding: 56px 64px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
}
.sect .gutter {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sect .gutter .head {
  display: block;
  color: var(--accent);
  margin-bottom: 12px;
}
.sect .gutter .meta {
  display: block;
  margin-top: 18px;
  color: var(--muted-2);
  line-height: 1.7;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 11.5px;
}
.sect h2 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 24px;
  word-break: break-word;
}
.sect h2::before {
  content: '## ';
  color: var(--accent);
  font-weight: 400;
}
.sect p {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
  max-width: 64ch;
  margin: 0 0 16px;
}
.sect p:last-child { margin-bottom: 0; }
.sect p strong { color: var(--text); font-weight: 600; }
.sect p em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text);
  font-weight: 400;
}
.sect p code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--accent);
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ─── ASCII pipe ─── */
.ascii {
  margin: 28px 0;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  white-space: pre;
  overflow-x: auto;
}
.ascii .a { color: var(--accent); font-weight: 500; }
.ascii .c { color: var(--muted-2); }

/* ─── file listing for stack / parts list ─── */
.listing {
  margin-top: 28px;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.listing .row {
  display: grid;
  grid-template-columns: 24px 200px 1fr 80px;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  align-items: center;
}
.listing .row:last-child { border-bottom: none; }
.listing .row .ico { color: var(--accent); }
.listing .row .name { color: var(--text); font-weight: 500; }
.listing .row .desc { color: var(--muted); font-family: var(--font-sans); font-size: 13.5px; }
.listing .row .ver { color: var(--muted-2); text-align: right; font-size: 11.5px; }

/* ─── decisions as commit log ─── */
.commits { margin: 0; padding: 0; list-style: none; }
.commits li {
  padding: 18px 0 18px 26px;
  border-bottom: 1px dashed var(--border-hi);
  position: relative;
}
.commits li:last-child { border-bottom: none; }
.commits li::before {
  content: '◆';
  position: absolute;
  left: 0; top: 18px;
  color: var(--accent);
  font-size: 12px;
}
.commits .sha {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.commits h3 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.005em;
}
.commits p {
  font-family: var(--font-sans);
  font-size: 14.5px;
  color: var(--text-dim);
  margin: 0;
  max-width: 70ch;
  line-height: 1.65;
}

/* ─── shot / image block placeholder ─── */
.shot {
  margin: 28px 0;
  border: 1px solid var(--border);
  background: var(--bg-2);
  aspect-ratio: 16 / 9;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.shot::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(45deg, var(--border) 25%, transparent 25%),
    linear-gradient(-45deg, var(--border) 25%, transparent 25%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  opacity: 0.35;
}
.shot .placeholder-tag {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 6px 12px;
  border: 1px solid var(--border-hi);
  background: var(--bg);
}

/* ─── generative shot variants ───
   When .shot also has .viz, suppress the checkered overlay and let the inline
   <svg> + caption tag carry the visual. This is the "intentional placeholder" —
   not a real photo, but a project-specific diagram that earns its place. */
.shot.viz { background: var(--surface); padding: 0; }
.shot.viz::before { display: none; }
.shot.viz svg {
  display: block;
  width: 100%;
  height: 100%;
}
.shot.viz .placeholder-tag {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 2;
}
.shot.viz .viz-legend {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 4px 8px;
  border: 1px solid var(--border-hi);
  background: var(--bg);
  display: flex; align-items: center; gap: 8px;
}
.shot.viz .viz-legend .swatch {
  width: 8px; height: 8px;
  background: var(--accent);
  display: inline-block;
}

/* SVG element styling — driven by CSS so light-theme tokens flow through. */
.shot.viz .grid-line { stroke: var(--border); stroke-width: 1; }
.shot.viz .axis      { stroke: var(--border-hi); stroke-width: 1.25; }
.shot.viz .accent-stroke { stroke: var(--accent); fill: none; }
.shot.viz .accent-fill   { fill: var(--accent); }
.shot.viz .dim-stroke    { stroke: var(--muted-2); fill: none; }
.shot.viz .text-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  fill: var(--muted-2);
}
.shot.viz .text-label {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--text);
  font-weight: 500;
}
.shot.viz .text-accent {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--accent);
  font-weight: 500;
}
.shot.viz .surface-fill { fill: var(--bg-2); }

@media (prefers-reduced-motion: no-preference) {
  .shot.viz .pulse {
    animation: viz-pulse 3.4s ease-in-out infinite;
    transform-origin: center;
  }
  @keyframes viz-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }
  .shot.viz .stream {
    stroke-dasharray: 4 6;
    animation: viz-stream 1.2s linear infinite;
  }
  @keyframes viz-stream {
    to { stroke-dashoffset: -10; }
  }
}

/* ─── next-up cards ─── */
.nx-wrap {
  padding: 56px 64px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.nx-head {
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.nx-head b { color: var(--accent); font-weight: 500; }
.nx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.nx-card {
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s, transform .15s;
}
.nx-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.nx-card .k {
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.nx-card h3 {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
  margin: 0 0 6px;
}
.nx-card p {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
}

/* ─── footer ─── */
.ftr {
  padding: 24px 64px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.ftr a:hover { color: var(--accent); }

/* ─── responsive ─── */
@media (max-width: 900px) {
  .chrome { padding: 12px 18px; gap: 12px; flex-wrap: wrap; }
  .chrome .clock { display: none; }
  .hero { padding: 40px 24px; }
  .hero h1 { font-size: 40px; }
  .hero .tagline { font-size: 16px; }
  .status { grid-template-columns: 1fr 1fr; gap: 16px; }
  .sect { padding: 40px 24px; grid-template-columns: 1fr; gap: 18px; }
  .sect .gutter { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: baseline; }
  .sect .gutter .head { margin-bottom: 0; }
  .sect .gutter .meta { margin-top: 4px; flex: 1 1 100%; }
  .sect h2 { font-size: 26px; }
  .listing .row { grid-template-columns: 20px 1fr; }
  .listing .row .desc, .listing .row .ver { grid-column: 2; }
  .nx-wrap { padding: 40px 24px; }
  .nx-grid { grid-template-columns: 1fr; }
  .ftr { padding: 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .badge .dot { animation: none; }
}

/* ─── print ─── */
@media print {
  @page { margin: 0.6in 0.5in; }
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10.5pt;
    line-height: 1.5;
  }
  body { font-family: 'Inter', system-ui, sans-serif; }

  .chrome,
  .nx-wrap,
  .ftr,
  .reading-progress,
  .theme-toggle,
  .badge .dot { display: none !important; }

  a { color: #000 !important; text-decoration: none; }
  .sect a[href^="http"]::after {
    content: ' (' attr(href) ')';
    font-size: 9pt;
    color: #555;
    word-break: break-all;
  }

  .hero, .sect {
    padding: 16pt 0 !important;
    border-color: #bbb !important;
    page-break-inside: avoid;
  }
  .sect { grid-template-columns: 130pt 1fr; gap: 18pt; }
  .sect .gutter { font-size: 8.5pt; }
  .sect .gutter .head { color: #000 !important; }
  .sect .gutter .meta { color: #555 !important; }
  .sect h2 {
    font-size: 16pt;
    color: #000 !important;
    page-break-after: avoid;
  }
  .sect h2::before { color: #000 !important; }
  .sect p { color: #000 !important; max-width: none; font-size: 10.5pt; }
  .sect p strong { color: #000 !important; }
  .sect p em { color: #000 !important; }
  .sect p code {
    color: #000 !important;
    background: #f0f0f0 !important;
    border: 1px solid #ddd;
  }
  .accent, .em { color: #000 !important; }

  .hero h1 { font-size: 24pt; color: #000 !important; }
  .hero .tagline { font-size: 11.5pt; color: #000 !important; max-width: none; }
  .badge {
    border: 1px solid #000 !important;
    color: #000 !important;
    background: transparent !important;
  }

  .status {
    border: 1px solid #999 !important;
    border-left-width: 2px !important;
    background: #f7f7f7 !important;
    page-break-inside: avoid;
  }
  .status .row .k { color: #555 !important; }
  .status .row .v,
  .status .row .v.acc { color: #000 !important; }

  .ascii {
    background: #fafafa !important;
    border-color: #bbb !important;
    color: #000 !important;
    font-size: 8.5pt;
    page-break-inside: avoid;
  }
  .ascii .a, .ascii .c { color: #000 !important; }

  .listing {
    border-color: #bbb !important;
    background: #fff !important;
    page-break-inside: avoid;
  }
  .listing .row { border-color: #ddd !important; }
  .listing .row .ico { color: #000 !important; }
  .listing .row .name { color: #000 !important; }
  .listing .row .desc { color: #333 !important; }
  .listing .row .ver { color: #777 !important; }

  .commits li { page-break-inside: avoid; border-color: #ccc !important; }
  .commits li::before { color: #000 !important; }
  .commits .sha { color: #555 !important; }
  .commits h3 { color: #000 !important; }
  .commits p { color: #000 !important; }

  .shot {
    border-color: #ccc !important;
    background: #fafafa !important;
    aspect-ratio: 16 / 9;
    page-break-inside: avoid;
  }
  .shot::before { display: none; }
  .shot .placeholder-tag {
    color: #555 !important;
    border-color: #bbb !important;
    background: #fff !important;
  }
}
