/* ferdi.tech v2 — shared santifer-style component system.
   Builds on site.css tokens (--bg, --bg-soft, --text, --text-muted, --text-faint,
   --accent, --accent-soft, --border, --font-display, --dur, --ease) so the
   theme toggle keeps working. Load BEFORE any page css. Do not edit page CSS
   into this file — orchestrator owns it. */

/* ---------- page-wide dot grid: exact hero pattern everywhere.
   The grain layer is site.css's own body background — keep it UNDER the dots
   so pages keep the same texture the hero had. Do not drop either layer. */
body {
  background-image:
    radial-gradient(circle, var(--border) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.25'/%3E%3C/svg%3E");
  background-size: 24px 24px, 160px 160px;
}

/* ---------- coming-soon banner (writing pages while in development) ---------- */
.soon-banner {
  max-width: var(--maxw); margin: 18px auto 0; padding: 10px 16px;
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--bg));
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px;
  color: var(--text-muted); text-align: center;
}

/* ---------- layout primitives ---------- */
.v2-wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.v2-section { padding: 64px 0; border-top: 1px solid var(--border); }
.v2-section:first-of-type { border-top: 0; }

/* ---------- kickers & titles ---------- */
.kicker {
  display: block; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 10px;
}
.v2-title {
  font-family: var(--font-display); font-weight: 600; line-height: 1.12;
  font-size: clamp(30px, 5vw, 44px); margin: 0 0 12px; color: var(--text);
}
.v2-lede { color: var(--text-muted); max-width: 62ch; margin: 0 0 28px; }

/* ---------- chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft);
  font-size: 13px; font-weight: 600; color: var(--text-muted); line-height: 1.5;
}
.chip--solid { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-soft); }

/* ---------- status badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-soft);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--shipped, .badge--live { color: #2e7d43; border-color: color-mix(in srgb, #2e7d43 35%, transparent); background: color-mix(in srgb, #2e7d43 10%, transparent); }
.badge--in-production { color: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.badge--building { color: #8a6d1f; border-color: color-mix(in srgb, #8a6d1f 35%, transparent); background: color-mix(in srgb, #8a6d1f 10%, transparent); }
[data-theme="dark"] .badge--shipped, [data-theme="dark"] .badge--live { color: #7fce92; }

/* ---------- stat bands (signature motif) ---------- */
.stat-band {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; margin: 26px 0;
}
.stat { background: var(--bg); padding: 18px 16px; text-align: center; }
.stat-num { display: block; font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 34px); font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { display: block; font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---------- capability cards ---------- */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.cap-card { border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--bg); }
.cap-card h3 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.cap-card p { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }

/* ---------- timeline ---------- */
.timeline { display: grid; gap: 16px; }
.tl-entry { border: 1px solid var(--border); border-radius: 14px; padding: 20px; background: var(--bg); }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 0 0 4px; }
.tl-head h3 { margin: 0; font-size: 17px; color: var(--text); }
.tl-meta { font-size: 13px; color: var(--text-faint); }
.tl-bullets { margin: 10px 0 0; padding-left: 20px; color: var(--text-muted); font-size: 14px; line-height: 1.65; }
.tl-bullets li + li { margin-top: 6px; }
.tl-bullets strong { color: var(--text); }

/* ---------- source-of-truth box + mini tools ---------- */
.sot-box {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
  border-radius: 16px; padding: 22px; margin: 22px 0;
}
.sot-box > .kicker { margin-bottom: 6px; }
.mini-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.mini-tool { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--bg); }
.mini-tool b { display: block; font-size: 13px; color: var(--text); }
.mini-tool span { display: block; font-size: 12px; color: var(--accent-soft); margin-top: 4px; font-weight: 600; }

/* ---------- project cards ---------- */
.proj-card {
  display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; background: var(--bg);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.proj-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); transform: translateY(-2px); }
.proj-status { display: flex; gap: 8px; flex-wrap: wrap; }
.proj-card h3 { margin: 0; font-size: 19px; color: var(--text); }
.proj-card .proj-desc { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.proj-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.proj-tags .tag {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.proj-metric { margin: 0; font-size: 14px; color: var(--text); }
.proj-metric strong { font-family: var(--font-display); font-size: 19px; color: var(--accent-soft); }
.proj-img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); display: block; }
.proj-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: auto; padding-top: 4px; }
.proj-links a { font-size: 13px; font-weight: 600; color: var(--accent-soft); text-decoration: none; }
.proj-links a:hover { text-decoration: underline; }

/* ---------- article system ---------- */
.article-hero { padding: 40px 0 8px; }
.crumb { font-size: 13px; color: var(--text-faint); margin-bottom: 14px; }
.crumb a { color: var(--text-muted); }
.deck { font-size: 18px; line-height: 1.6; color: var(--text-muted); max-width: 64ch; margin: 14px 0; }
.byline { font-size: 14px; color: var(--text-muted); }
.byline a { font-weight: 700; color: var(--text); }
.meta-row { font-size: 13px; color: var(--text-faint); margin: 8px 0 0; }
.pull-quote {
  font-family: var(--font-display); font-size: clamp(20px, 3vw, 27px); line-height: 1.35;
  color: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 18px;
  margin: 26px 0; max-width: 34ch;
}
.article-body { max-width: 72ch; }
.article-body h2 { font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 31px); margin: 40px 0 12px; color: var(--text); }
.article-body h2 .h-link { font-size: .6em; color: var(--text-faint); text-decoration: none; margin-left: 8px; }
.article-body h3 { font-size: 17px; margin: 26px 0 8px; }
.article-body p { color: var(--text-muted); line-height: 1.75; }
.article-body strong { color: var(--text); }
.article-body a { color: var(--accent-soft); }

/* numbered lists with bold lead-ins */
.lead-list { margin: 16px 0; padding: 0; list-style: none; counter-reset: lead; }
.lead-list li { counter-increment: lead; position: relative; padding-left: 40px; margin-bottom: 12px; color: var(--text-muted); line-height: 1.65; }
.lead-list li::before {
  content: counter(lead); position: absolute; left: 0; top: 1px; width: 26px; height: 26px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-soft);
  font-size: 12px; font-weight: 700; color: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
}
.lead-list strong { display: block; color: var(--text); margin-bottom: 2px; font-size: 15px; }

/* definition lists (modes/components) */
.def-list { display: grid; gap: 8px; margin: 16px 0; padding: 0; }
.def-list > div { display: flex; gap: 14px; align-items: baseline; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.def-list dt { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--accent-soft); white-space: nowrap; margin: 0; }
.def-list dd { margin: 0; font-size: 13.5px; color: var(--text-muted); }

/* tables */
.table-wrap { overflow-x: auto; margin: 20px 0; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp-table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); padding: 10px 12px; border-bottom: 2px solid var(--border); }
.cmp-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-muted); vertical-align: top; }
.cmp-table td:first-child { color: var(--text); font-weight: 600; }

/* stat-card grids inside articles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.stat-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; background: var(--bg); }
.stat-card .stat-num { font-size: clamp(20px, 2.8vw, 27px); }

/* figures + media slots */
.figure { margin: 24px 0; }
.figure img, .figure video, .figure iframe { width: 100%; border-radius: 12px; border: 1px solid var(--border); display: block; }
.figure figcaption { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }
.media-slot {
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 12px;
  padding: 34px 18px; text-align: center; color: var(--text-muted); background: var(--bg-soft);
}
.media-slot b { display: block; color: var(--accent-soft); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.media-slot span { font-size: 13px; }

/* callout + blockquote + lessons */
.callout { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--bg-soft); border-radius: 10px; padding: 16px 18px; margin: 20px 0; color: var(--text-muted); font-size: 14.5px; }
.article-body blockquote { margin: 26px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); }
.article-body blockquote p { font-family: var(--font-display); font-size: 19px; color: var(--text); line-height: 1.5; }
.article-body blockquote footer { font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.lesson-list { counter-reset: lesson; list-style: none; padding: 0; margin: 16px 0; }
.lesson-list li { counter-increment: lesson; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--bg); }
.lesson-list li::before { content: counter(lesson); display: block; font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--accent-soft); margin-bottom: 4px; }
.lesson-list strong { display: block; font-size: 15px; }

/* FAQ accordion */
.faq { display: grid; gap: 10px; margin: 20px 0; }
.faq details { border: 1px solid var(--border); border-radius: 12px; background: var(--bg); overflow: hidden; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: 15px; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::after { content: "+"; font-size: 18px; color: var(--accent-soft); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 16px 14px; color: var(--text-muted); font-size: 14px; line-height: 1.65; }

/* related grid + cta + author */
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 24px 0; }
.related-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--bg); text-decoration: none; display: flex; flex-direction: column; gap: 6px; transition: border-color var(--dur) var(--ease); }
.related-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.related-card .kicker { margin: 0; }
.related-card h3 { margin: 0; font-size: 15px; color: var(--text); }
.related-card p { margin: 0; font-size: 13px; color: var(--text-muted); }
.cta-box { border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); border-radius: 16px; padding: 24px; margin: 30px 0; text-align: center; }
.cta-box .cta-row { justify-content: center; }
.author-box { display: flex; gap: 16px; align-items: flex-start; border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--bg); margin: 24px 0; }
.author-box .avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--bg-soft); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 22px; color: var(--accent-soft); flex-shrink: 0; }
.author-box b { display: block; color: var(--text); }
.author-box p { margin: 4px 0 6px; font-size: 13.5px; color: var(--text-muted); }
.author-box .meta-row { margin: 0; }

/* logo / find-me strip */
.logo-strip { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; padding: 16px 0; }
.logo-strip span, .logo-strip a { font-family: var(--font-display); font-size: 17px; color: var(--text-faint); text-decoration: none; font-weight: 600; }
.logo-strip a:hover { color: var(--accent); }

/* responsive */
@media (max-width: 640px) {
  .v2-section { padding: 44px 0; }
  .sot-box, .tl-entry, .proj-card { padding: 16px; }
  .author-box { flex-direction: column; }
}
