/* Shared case-study styles */
:root {
  --bg:       #0b0d12;
  --surface:  #121520;
  --surface-2:#161a27;
  --border:   #1e2230;
  --border-2: #2a3045;
  --text:     #e6e8ee;
  --muted:    #8a91a3;
  --dim:      #5a6072;
  --accent:   #6b8eff;
  --accent-2: #8aa6ff;
  --accent-dim: rgba(107, 142, 255, 0.14);
  --success:  #7cffb2;
  --warn:     #ffd166;
  --danger:   #ff6b7d;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Geist', system-ui, -apple-system, Segoe UI, sans-serif;
  --maxw: 980px;
  --gutter: clamp(32px, 7vw, 96px);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.02);
  --shadow-md: 0 8px 24px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.03);
}
[data-theme="light"] {
  --bg:       #f6f7fb;
  --surface:  #ffffff;
  --surface-2:#f0f2f8;
  --border:   #e4e7ef;
  --border-2: #d4d8e3;
  --text:     #0f1115;
  --muted:    #5d6476;
  --dim:      #8a91a3;
  --accent:   #3d5bd9;
  --accent-dim: rgba(61, 91, 217, 0.1);
  --success:  #0a8f47;
  --warn:     #c88300;
  --danger:   #c92c45;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 90%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
::selection { background: var(--accent); color: #0b0d12; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.2;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, black 20%, transparent 80%);
  z-index: 0;
}
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); position: relative; z-index: 2; }
h1, h2, h3, h4 { font-family: var(--mono); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.1; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); margin-top: 56px; margin-bottom: 14px; }
h3 { font-size: 1.05rem; margin: 32px 0 8px; }
p { margin: 0 0 16px; color: var(--muted); text-wrap: pretty; }
a { color: var(--accent); }
.mono { font-family: var(--mono); }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px) saturate(180%);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: 1200px; margin: 0 auto;
  padding: 0 var(--gutter);
}
.brand {
  font-family: var(--mono); font-weight: 600; font-size: 0.95rem;
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--surface);
}
.back-link {
  font-family: var(--mono); font-size: 0.82rem;
  color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 6px;
  transition: all 0.15s;
}
.back-link:hover { color: var(--accent); background: var(--surface); }
.nav-toggle {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); width: 36px; height: 36px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* HERO */
.case-hero { padding: 60px 0 40px; }
.breadcrumb {
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--muted); margin-bottom: 24px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--dim); margin: 0 6px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--accent);
  padding: 5px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 100px;
  margin-bottom: 20px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.case-tag { color: var(--muted); font-family: var(--mono); font-size: 0.88rem; margin-bottom: 24px; font-style: italic; }
.case-lede { color: var(--text); font-size: 1.2rem; max-width: 56ch; margin-bottom: 32px; line-height: 1.55; }

/* META ROW */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 40px 0;
}
@media (max-width: 720px) { .meta-grid { grid-template-columns: repeat(2, 1fr); } }
.meta-cell {
  background: var(--surface);
  padding: 18px 20px;
}
.meta-cell .k {
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.meta-cell .v {
  font-family: var(--mono); font-size: 0.88rem; color: var(--text);
}

/* CONTENT */
.case-body { padding-bottom: 80px; }
.case-body p { font-size: 1rem; }
.case-body strong { color: var(--text); font-weight: 500; }
.case-body ul { padding-left: 0; list-style: none; }
.case-body li {
  color: var(--muted);
  padding: 6px 0 6px 22px;
  position: relative;
  line-height: 1.6;
}
.case-body li::before {
  content: "▸";
  position: absolute; left: 0;
  color: var(--accent);
  font-family: var(--mono);
}

.call-out {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 18px 22px;
  margin: 24px 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
}
.call-out .k { color: var(--accent); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.08em; display: block; margin-bottom: 6px; }

.tech-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 20px 0 40px;
}
.tech {
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--text);
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 32px 0;
}
@media (max-width: 720px) { .stat-grid { grid-template-columns: 1fr; } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.stat .big {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.stat .lab { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 20px 0;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text);
  overflow-x: auto;
}
.code-block .c { color: var(--dim); }
.code-block .k { color: var(--warn); }
.code-block .s { color: var(--success); }
.code-block .u { color: var(--accent); }
.code-block .p { color: var(--success); }

.hero-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(22px, 4vw, 44px);
  margin: 24px 0 40px;
  min-height: 260px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  overflow: hidden;
}

/* FOOTER nav */
.case-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 60px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px;
}
.next-link {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.86rem;
  color: var(--text); text-decoration: none;
  padding: 14px 20px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  transition: all 0.15s;
}
.next-link:hover { border-color: var(--accent); color: var(--accent); transform: translateX(3px); }
.next-link .arrow { transition: transform 0.2s; }
.next-link:hover .arrow { transform: translateX(3px); }

/* Reveal */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.7s cubic-bezier(.2,.6,.2,1), transform 0.7s cubic-bezier(.2,.6,.2,1);
}
.reveal.in { opacity: 1; transform: none; }

footer.main-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 30px;
  font-family: var(--mono); font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.btn-ext {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: 0.86rem; font-weight: 500;
  padding: 11px 18px; border-radius: 8px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-top: 8px;
}
.btn-ext:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(107,142,255,0.25); }
