/* feature.css — shared design system for mlx-serve deep-dive pages.
   Matches the landing page (Apple-style light theme) with a per-page accent:
   each page overrides --accent / --accent2 in a tiny inline <style>. */

:root {
  --white: #ffffff;
  --bg-alt: #f5f5f7;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #30d158;
  --ink: #08080c;
  --border: rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --code-bg: #1d1d1f;
  --code-text: #e5e5e7;
  --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* per-page accent — overridden per page */
  --accent: #0071e3;
  --accent2: #00c6fb;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, transparent);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  background: var(--white);
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
}

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ─── NAV ─── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1040px) / 2));
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border);
}

.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-primary); }
.nav-logo-img { width: 28px; height: 28px; border-radius: 7px; }
.nav-logo span { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.nav-links { display: flex; align-items: center; gap: 26px; list-style: none; }
.nav-links a { font-size: 13px; color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--text-primary); }
.nav-github { display: flex; align-items: center; gap: 6px; }
.nav-github svg { width: 18px; height: 18px; fill: var(--text-primary); transition: fill 0.2s; }
.nav-github:hover svg { fill: var(--accent); }

.nav-dl {
  font-size: 12.5px; font-weight: 600; color: var(--white) !important;
  background: var(--text-primary); padding: 6px 14px; border-radius: 100px;
  transition: transform 0.2s ease, background 0.2s ease;
}
.nav-dl:hover { transform: scale(1.03); background: var(--ink); }

/* ─── HERO ─── */
.hero-f {
  padding: 148px 24px 76px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-f-glow { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.hero-f-glow span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: drift 18s ease-in-out infinite; }
.hero-f-glow .g1 { width: 560px; height: 560px; top: -220px; left: 50%; margin-left: -400px; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); }
.hero-f-glow .g2 { width: 460px; height: 460px; top: -140px; left: 50%; margin-left: 60px; background: radial-gradient(circle, color-mix(in srgb, var(--accent2) 18%, transparent), transparent 70%); animation-delay: -7s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 24px) scale(1.08); }
  66% { transform: translate(34px, -18px) scale(0.95); }
}

.hero-f > *:not(.hero-f-glow) { position: relative; z-index: 1; }

.crumbs {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-tertiary); margin-bottom: 26px;
  animation: fadeUp 0.6s ease both;
}
.crumbs a { color: var(--text-secondary); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 10px; border-radius: 100px;
}

.hero-f h1 {
  font-size: clamp(38px, 6.4vw, 68px);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.04;
  max-width: 860px; margin: 0 auto 20px;
  animation: fadeUp 0.6s ease 0.08s both;
}

.hero-f h1 .grad {
  background: linear-gradient(120deg, var(--accent) 10%, var(--accent2) 90%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.hero-f-sub {
  font-size: clamp(16px, 2.1vw, 20px); color: var(--text-secondary);
  max-width: 640px; margin: 0 auto 36px; line-height: 1.55; font-weight: 400;
  animation: fadeUp 0.6s ease 0.16s both;
}
.hero-f-sub b, .hero-f-sub strong { color: var(--text-primary); font-weight: 600; }

.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; animation: fadeUp 0.6s ease 0.24s both; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 100px;
  font-size: 15px; font-weight: 500; text-decoration: none;
  transition: all 0.2s ease; cursor: pointer; border: none;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { transform: scale(1.02); filter: brightness(1.06); }
.btn-secondary { background: transparent; color: var(--accent); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn svg { width: 18px; height: 18px; }

.hero-f-meta { margin-top: 42px; display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; animation: fadeUp 0.6s ease 0.32s both; }
.hero-f-meta span { font-size: 13px; color: var(--text-tertiary); }
.hero-f-meta b { color: var(--text-secondary); font-weight: 600; }

/* ─── SECTIONS ─── */
.section { padding: 92px 24px; }
.section-alt { background: var(--bg-alt); }
.section-header { text-align: center; max-width: 680px; margin: 0 auto 52px; }
.section-label {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); margin-bottom: 12px;
}
.section-title { font-size: clamp(28px, 4.2vw, 42px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 14px; }
.section-desc { font-size: 16.5px; color: var(--text-secondary); line-height: 1.55; }
.section-desc b { color: var(--text-primary); font-weight: 600; }

/* ─── SPLIT ROWS (text + visual) ─── */
.split {
  display: grid; grid-template-columns: 1.02fr 0.98fr; gap: 56px; align-items: center;
  max-width: 1000px; margin: 0 auto;
}
.split + .split { margin-top: 84px; }
.split.flip .split-copy { order: 2; }
.split.flip .split-visual { order: 1; }
/* grid items default to min-width: auto, so an unbreakable child (e.g. a
   `white-space: pre` code block) can force the track — and the whole page —
   wider than the viewport on mobile, bypassing .code-body's own overflow-x:auto. */
.split-copy, .split-visual { min-width: 0; }

.split-kicker {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 6px; margin-bottom: 14px;
}
.split h3 { font-size: clamp(22px, 2.8vw, 28px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 12px; }
.split p { font-size: 15px; color: var(--text-secondary); line-height: 1.62; margin-bottom: 12px; }
.split p b { color: var(--text-primary); font-weight: 600; }
.split p code, .ticks code, .mini-card code, .faq-item p code, .section-desc code {
  font-family: var(--mono); font-size: 0.86em; background: var(--bg-alt);
  color: var(--text-primary); padding: 1.5px 6px; border-radius: 5px;
}
.section-alt .split p code, .section-alt .ticks code, .section-alt .mini-card code, .section-alt .faq-item p code { background: rgba(0,0,0,0.05); }

.ticks { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.ticks li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-secondary); line-height: 1.55; }
.ticks li b { color: var(--text-primary); font-weight: 600; }
.ticks svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; stroke: var(--accent); }

/* ─── MINI CARD GRID ─── */
.mini-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px; max-width: 1000px; margin: 0 auto;
}
.mini-card {
  padding: 26px 24px; background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-card); transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.mini-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-elevated); }
.mini-k {
  display: inline-block; font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 5px; margin-bottom: 13px;
}
.mini-card h4 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 7px; }
.mini-card p { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; }
.mini-card p b { color: var(--text-primary); font-weight: 600; }

/* ─── STAT BAND ─── */
.stat-band { display: flex; justify-content: center; gap: 52px; flex-wrap: wrap; max-width: 900px; margin: 0 auto; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat .n {
  font-family: var(--mono); font-size: clamp(32px, 4.8vw, 46px); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat .l { font-size: 13px; color: var(--text-tertiary); margin-top: 9px; text-align: center; max-width: 170px; line-height: 1.4; }

/* ─── COMPARISON TABLE ─── */
.tbl-wrap {
  max-width: 900px; margin: 0 auto; overflow-x: auto;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.tbl th {
  text-align: center; font-size: 12.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-tertiary);
  padding: 16px 14px; border-bottom: 1px solid var(--border);
}
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 24px; }
.tbl th.hl { color: var(--accent); }
.tbl td { padding: 13px 14px; text-align: center; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.tbl tr:last-child td { border-bottom: none; }
.tbl td:first-child { color: var(--text-primary); font-weight: 500; }
.tbl td.hl { background: var(--accent-soft); font-weight: 600; color: var(--text-primary); }
.tbl .yes { color: var(--green); font-weight: 700; }
.tbl .no { color: var(--text-tertiary); }
.tbl-note { max-width: 900px; margin: 16px auto 0; text-align: center; font-size: 12.5px; color: var(--text-tertiary); line-height: 1.6; }

/* ─── CODE BLOCKS ─── */
.code-wrap { max-width: 680px; margin: 0 auto; }
.code-block { background: var(--code-bg); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px; text-align: left; }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.code-header span { font-family: var(--mono); font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
.copy-btn { background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-tertiary); transition: color 0.2s; display: flex; align-items: center; }
.copy-btn:hover { color: var(--white); }
.copy-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.code-body { padding: 18px; overflow-x: auto; }
.code-body pre { font-family: var(--mono); font-size: 13px; line-height: 1.75; color: var(--code-text); white-space: pre; }
.code-body .comment { color: #6e6e73; }
.code-body .cmd { color: #30d158; }
.code-body .flag { color: #64d2ff; }
.code-body .string { color: #ffd60a; }
.code-body .url { color: #ff9f0a; }

/* ─── SCREENSHOT FRAMES ─── */
.shot { max-width: 920px; margin: 0 auto; }
.split .shot, .split-visual .shot { max-width: none; }
.shot + .shot { margin-top: 28px; }
.shot-frame {
  border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-elevated), 0 20px 70px rgba(0, 0, 0, 0.12);
  background: linear-gradient(160deg, var(--bg-alt), #fff);
}
.shot-frame img { width: 100%; display: block; }
.shot figcaption { margin-top: 13px; text-align: center; font-size: 13px; color: var(--text-tertiary); line-height: 1.5; }

/* graceful placeholder while the screenshot file doesn't exist yet */
.shot.missing .shot-frame {
  aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 32%, transparent);
  box-shadow: none;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%),
    linear-gradient(160deg, var(--bg-alt), #fff);
}
.shot.missing .shot-frame img { display: none; }
.shot.missing .shot-frame::after {
  content: attr(data-pending);
  font-family: var(--mono); font-size: 12.5px; color: var(--text-tertiary);
  padding: 0 24px; text-align: center; line-height: 1.7;
}

.shot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 1000px; margin: 0 auto; align-items: start; }
.shot-row .shot { max-width: none; }

/* ─── FAQ ─── */
.faq-wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.faq-item[open] { box-shadow: var(--shadow-card); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.faq-item summary {
  cursor: pointer; padding: 18px 22px; font-size: 15.5px; font-weight: 600;
  letter-spacing: -0.005em; color: var(--text-primary); list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; font-family: var(--mono); font-size: 22px; font-weight: 400;
  color: var(--text-tertiary); flex-shrink: 0; transition: transform 0.2s ease, color 0.2s ease; line-height: 1;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq-item summary:hover { color: var(--accent); }
.faq-item p { padding: 0 22px 20px; font-size: 14.5px; color: var(--text-secondary); line-height: 1.62; }
.faq-item p b { color: var(--text-primary); font-weight: 600; }
.faq-item p a { color: var(--accent); text-decoration: none; }
.faq-item p a:hover { text-decoration: underline; }

/* ─── RELATED / MORE DEEP DIVES ─── */
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 1000px; margin: 0 auto; }
.related-card {
  display: block; padding: 20px 22px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-primary);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.related-kicker { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.related-card h4 { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; margin: 7px 0 5px; }
.related-card h4 .go { color: var(--accent); font-weight: 400; opacity: 0; transition: opacity 0.2s ease; }
.related-card:hover h4 .go { opacity: 1; }
.related-card p { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

/* ─── CTA BAND ─── */
.cta-band {
  position: relative; max-width: 1000px; margin: 0 auto;
  background: var(--ink); color: #f5f5f7; border-radius: 24px;
  padding: 68px 32px; text-align: center; overflow: hidden;
}
.cta-band::before {
  content: ''; position: absolute; top: -60%; left: 50%; transform: translateX(-50%);
  width: 900px; height: 600px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 34%, transparent) 0%, transparent 65%);
  pointer-events: none;
}
.cta-band > * { position: relative; z-index: 1; }
.cta-band h2 { font-size: clamp(26px, 3.8vw, 38px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; margin-bottom: 12px; }
.cta-band p { font-size: 15.5px; color: #c7c7cf; max-width: 540px; margin: 0 auto 30px; line-height: 1.6; }
.cta-band .btn-primary { background: #fff; color: var(--ink); }
.cta-band .btn-secondary { color: #d6d6de; border-color: rgba(255,255,255,0.22); }
.cta-band .btn-secondary:hover { border-color: #fff; background: rgba(255,255,255,0.06); }

/* ─── UTIL ─── */
.kbd {
  font-family: var(--mono); font-size: 0.82em; font-weight: 600;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px;
  color: var(--text-primary); white-space: nowrap;
}

.prose-link { color: var(--accent); text-decoration: none; }
.prose-link:hover { text-decoration: underline; }

/* ─── FOOTER ─── */
footer { padding: 44px 24px; text-align: center; border-top: 0.5px solid var(--border); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; list-style: none; flex-wrap: wrap; }
.footer-links a { font-size: 13px; color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 12px; color: var(--text-tertiary); }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
  .split.flip .split-copy { order: 1; }
  .split.flip .split-visual { order: 2; }
  .split + .split { margin-top: 64px; }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .shot-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  nav { padding: 0 16px; }
  .nav-links { gap: 14px; }
  .nav-links .hide-mobile { display: none; }
  .hero-f { padding: 124px 20px 56px; }
  .section { padding: 68px 20px; }
  .stat-band { gap: 28px 38px; }
}

@media (max-width: 520px) {
  .related-grid { grid-template-columns: 1fr; }
  .hero-ctas { flex-direction: column; align-items: center; }
}
