/* Fiducia site styles — shared by every hand-written page.
   The mdBook docs (docs/manual, docs/lang-spec) and releases/index.html are
   generated by fic CI and keep their own styles. */

:root {
  --bg: #0a0e17;
  --bg-card: #111827;
  --bg-code: #0d1220;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #e2e8f0;
  --text-2: #cbd5e1;
  --text-dim: #94a3b8;
  --accent: #60a5fa;
  --accent-dim: #3b82f6;
  --green: #34d399;
  --amber: #fbbf24;
  --rose: #fb7185;
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --gold: #e3b55b;
  /* Ring colours of the homepage cloud, planet outward: ITP, ATP, agents, language.
     Chosen apart from the planet's blue and from each other. */
  --c-itp: #e8cf7e;
  --c-atp: #ee8872;
  --c-agent: #c98be6;
  --c-lang: #60a5fa; /* the site accent blue */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #93c5fd; text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.9em; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
img { max-width: 100%; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  min-height: 68px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 32px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 20px; }
.logo:hover { color: var(--text); text-decoration: none; }
.logo-name { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name small { font-size: 12px; font-weight: 500; color: var(--text-dim); letter-spacing: 0.01em; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 32px; font-size: 15px; font-weight: 500; }
.site-nav a { color: var(--text-2); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.nav-icon { display: inline-flex; align-items: center; color: var(--text-2); }
.nav-icon:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 6px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 8px;
  font-weight: 600; font-size: 15px; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-sm { min-height: 44px; padding: 0 20px; }
.btn-primary { background: var(--accent-dim); color: #fff; }
.btn-primary:hover { background: #2563eb; color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-dim); color: var(--text); }
.btn-dark { background: var(--border); color: #fff; }
.btn-dark:hover { background: var(--border-strong); color: #fff; }

/* ── Type helpers ── */
.eyebrow {
  margin: 0 0 12px; font-family: var(--mono); font-size: 13px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent);
}
.row-label {
  margin: 0 0 12px; font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
}
.lead { font-size: 20px; color: var(--text-2); max-width: 720px; }
.muted { color: var(--text-dim); }
.section { padding: 56px 0; border-top: 1px solid var(--border); }
.section h2 { font-size: 36px; margin: 0 0 12px; }
.section-desc { margin: 0 0 32px; max-width: 680px; color: var(--text-2); }
.mono { font-family: var(--mono); }

/* ── Layout: main column + sidebar ── */
.with-sidebar { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.with-sidebar > main { flex: 999 1 640px; min-width: 0; }
.with-sidebar > aside { flex: 1 1 300px; min-width: 0; }

/* ── Cards ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.card h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.01em; }
#why .card h3 { font-size: 16px; }
.card p, .card ul { margin: 0; font-size: 15px; color: var(--text-2); }
.card ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.card ul b { color: var(--text); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.card-icon {
  width: 40px; height: 40px; border-radius: 10px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
}
.card-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tint-blue { background: rgba(96,165,250,0.12); color: var(--accent); }
.tint-rose { background: rgba(251,113,133,0.12); color: var(--rose); }
.tint-green { background: rgba(52,211,153,0.12); color: var(--green); }
.tint-amber { background: rgba(251,191,36,0.12); color: var(--amber); }
.tint-purple { background: rgba(167,139,250,0.12); color: var(--purple); }
.tint-cyan { background: rgba(34,211,238,0.12); color: var(--cyan); }

/* ── Diagrams ── */
.figure { margin: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; overflow-x: auto; }
.figure svg { display: block; width: 100%; min-width: 640px; height: auto; margin: 0 auto; }
.figure svg text { font-family: var(--sans); }
.figure svg .mono { font-family: var(--mono); }
.steps { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px 32px; font-size: 15px; }
.steps span { color: var(--text-2); }

/* ── Code ── */
.code { background: var(--bg-code); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; min-width: 0; }
.code-head {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}
.code-head .path { color: var(--text); }
pre.code-body {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; color: #e6e8eb;
}
.k { color: #8ab4ff; } .c { color: #8b929c; } .s { color: #b5d88a; } .n { color: #f2c879; }
.f { color: #e6e8eb; font-weight: 600; } .ac { color: #f0a6ca; }
.lo { color: var(--accent); font-weight: 600; } .hi { color: var(--rose); font-weight: 600; }

/* ── File browser ── */
.files { display: flex; flex-wrap: wrap; align-items: stretch; }
.files-nav { flex: 1 1 210px; min-width: 0; padding: 12px 0; background: var(--bg-card); border-right: 1px solid var(--border); }
.files-group {
  margin: 10px 10px 4px; padding: 6px 8px; border-left: 3px solid var(--cyan); border-radius: 0 4px 4px 0;
  background: rgba(34,211,238,0.08); font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan);
}
.files-group:first-child { margin-top: 0; }
.files-nav button {
  display: flex; align-items: center; width: 100%; min-height: 36px; padding: 0 16px;
  border: 0; border-left: 2px solid transparent; background: transparent; color: var(--text-dim);
  font-family: var(--mono); font-size: 13px; text-align: left; cursor: pointer;
}
.files-nav button:hover { color: var(--text); }
.files-nav button[aria-selected="true"] { border-left-color: var(--accent); background: rgba(96,165,250,0.12); color: var(--text); font-weight: 600; }
.files-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.files-view { flex: 999 1 480px; min-width: 0; }
.files-view [role="tabpanel"] { max-height: 640px; overflow-y: auto; }

/* ── Keyword cloud (homepage hero) ── */
/* Without JS: a centred, wrapped list. site.js lays the words out as a cloud. */
.keywords { list-style: none; margin: 4px 0 36px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 18px; }
.keywords li { white-space: nowrap; line-height: 1; color: var(--text-dim); font-weight: 600; }
.keywords li[data-w="5"] { font-size: 38px; font-weight: 700; letter-spacing: -0.01em; }
.keywords li[data-w="4"] { font-size: 26px; }
.keywords li[data-w="3"] { font-size: 19px; font-weight: 500; }
.keywords li[data-w="2"] { font-size: 15px; font-weight: 500; color: var(--text-2); }
.keywords li[data-w="1"] { font-size: 13px; font-weight: 400; font-family: var(--mono); }
.keywords.is-cloud { display: block; position: relative; }
.keywords.is-cloud li { text-shadow: 0 1px 6px rgba(7,12,24,0.95), 0 0 2px rgba(7,12,24,0.8); position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform, opacity; }
.keywords.is-rings { margin-left: auto; margin-right: auto; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.keywords.is-rings.is-grabbing { cursor: grabbing; }
@media (min-width: 900px) { .keywords.is-rings { width: 80%; } }
.keywords .ring-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.keywords .ring-front { z-index: 50; }
.keywords li.c-blue   { color: var(--accent); }
.keywords li.c-agent { color: var(--c-agent); }
.keywords li.c-itp { color: var(--c-itp); }
.keywords li.c-green  { color: var(--green); }
.keywords li[data-ring="core"] { color: #78bdfa; font-weight: 800; font-size: 23px; line-height: 1.32; letter-spacing: -0.01em; }
/* With JS the centre label becomes an ice-giant with its own striped rings.
   Layers, bottom to top: far half of its ring, the globe, near half of its ring, the label.
   (The word belts are layered the same way around it, so the globe hides their far side.) */
.keywords.is-rings li[data-ring="core"] {
  display: flex; align-items: center; justify-content: center; text-align: center; white-space: normal;
  width: 8.3em; height: 8.3em; overflow: visible;
}
.core-planet { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.core-planet {
  width: 100%; height: 100%; border-radius: 50%; transform: translate(-50%, -50%);
  /* Matte marbled blue-grey planet in the site's blue: soft swirling bands, barely any highlight, dark lower-right limb. No outline. */
  background:
    radial-gradient(circle at 31% 25%, rgba(190,215,250,0.07) 0%, transparent 40%),
    radial-gradient(circle at 38% 32%, transparent 0 44%, rgba(2,8,44,0.42) 74%, rgba(1,4,26,0.80) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='n' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.026' numOctaves='5' seed='11' result='t'/%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.010' numOctaves='2' seed='4' result='w'/%3E%3CfeDisplacementMap in='t' in2='w' scale='90' xChannelSelector='R' yChannelSelector='G' result='d'/%3E%3CfeColorMatrix in='d' type='matrix' values='1 0 0 0 0  1 0 0 0 0  1 0 0 0 0  0 0 0 0 1'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='table' tableValues='0.03 0.08 0.17 0.32 0.55'/%3E%3CfeFuncG type='table' tableValues='0.07 0.17 0.32 0.52 0.72'/%3E%3CfeFuncB type='table' tableValues='0.20 0.38 0.60 0.82 0.96'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='360' height='360' filter='url%28%23n%29'/%3E%3C/svg%3E") 35% 45% / 185% 185%;
  box-shadow: 0 0 40px rgba(96,165,250,0.12);
}
.core-label { position: relative; z-index: 2; padding: 0 0.3em; text-shadow: 0 1px 3px rgba(5,22,50,0.95), 0 0 10px rgba(5,22,50,0.7), 0 0 20px rgba(5,22,50,0.5); }
.ring-legend { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; margin: -14px 0 36px; padding: 0; font-size: 13px; color: var(--text-dim); }
.ring-legend li { display: inline-flex; align-items: baseline; gap: 7px; }
.ring-legend li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; align-self: center; flex: none; }
.ring-legend b { font-weight: 700; }
.ring-legend .lg-itp b, .ring-legend .lg-itp::before { color: var(--c-itp); }
.ring-legend .lg-atp b, .ring-legend .lg-atp::before { color: var(--c-atp); }
.ring-legend .lg-lang b, .ring-legend .lg-lang::before { color: var(--c-lang); }
.ring-legend .lg-agent b, .ring-legend .lg-agent::before { color: var(--c-agent); }
.keywords li.c-lang { color: var(--c-lang); }
.keywords li.c-atp { color: var(--c-atp); }
.more-examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; font-size: 14px; }
.more-examples a { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text); font-weight: 500; }
.more-examples a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.more-examples a.more { border-color: transparent; color: var(--accent); font-weight: 600; }
.files-view [role="tabpanel"] { min-height: 440px; }

/* ── Topology chips ── */
.topo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.topo .pd { border: 1.5px solid var(--text-2); color: var(--text); border-radius: 6px; padding: 3px 10px; font-weight: 600; }
.topo .pd.low { border-color: var(--accent); color: var(--accent); }
.topo .pd.high { border-color: var(--rose); color: var(--rose); }

/* ── Tags & chips ── */
.tag { font-family: var(--mono); font-size: 12px; font-weight: 600; border-radius: 4px; padding: 1px 6px; }
.tag-post { color: var(--text-2); background: var(--border); }
.tag-release { color: var(--accent); background: rgba(96,165,250,0.12); }
.tag-publication { color: var(--purple); background: rgba(167,139,250,0.12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; font-weight: 600; }
.chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 16px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  font: inherit; cursor: pointer; z-index: 1;
}
.chip:hover { border-color: var(--text-dim); color: var(--text); text-decoration: none; }
.chip[aria-pressed="true"], .chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ── Feed (homepage sidebar and blog index) ── */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { border-top: 1px solid var(--border); padding: 16px 0; }
.feed li:last-child { border-bottom: 1px solid var(--border); }
.feed .meta { display: flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.feed .title { display: block; margin-top: 4px; color: var(--text); font-weight: 600; font-size: 15px; line-height: 1.4; }
.feed .title:hover { color: var(--accent); }
.feed .summary { display: block; margin-top: 4px; font-size: 14px; color: var(--text-2); }
.feed-lg .title { font-size: 19px; }
.feed-lg .summary { font-size: 15px; }
.feed-empty { padding: 16px 0; color: var(--text-dim); font-size: 15px; }

.release-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin-bottom: 32px; }
.release-card .ver { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.release-card .btn { width: 100%; }

/* ── Tabs (docs) ── */
.tabs { display: flex; flex-wrap: wrap; gap: 4px 28px; border-bottom: 1px solid var(--border); font-size: 15px; margin-bottom: 40px; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tab-btns, .tab-btns [role="tablist"] { display: flex; flex-wrap: wrap; gap: 12px; }
.tab-btns { margin-bottom: 36px; }
.tab-btns [role="tab"] { background: var(--bg-card); color: var(--text); border-color: var(--border-strong); font-family: inherit; cursor: pointer; }
.tab-btns [role="tab"]:hover { border-color: var(--text-dim); }
.tab-btns [role="tab"][aria-selected="true"] { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.tab-btns [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }

/* ── People ── */
.person { display: flex; flex-direction: column; gap: 12px; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  background: var(--border); color: var(--text-2); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.person .name { font-size: 19px; font-weight: 600; }
.role { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.person-sm { flex-direction: row; align-items: center; gap: 16px; padding: 18px; border-style: dashed; }
.person-sm .avatar { width: 48px; height: 48px; flex: none; font-size: 14px; }
.person-sm .name { font-size: 17px; }

/* ── Footer ── */
.site-footer { margin-top: 56px; background: var(--bg-card); border-top: 1px solid var(--border); color: var(--text-dim); font-size: 14px; }
.site-footer .container { padding-top: 48px; padding-bottom: 40px; display: flex; flex-wrap: wrap; gap: 32px 64px; }
.site-footer .brand { flex: 2 1 320px; }
.site-footer .brand b { display: block; color: var(--text); font-size: 20px; margin-bottom: 8px; }
.site-footer .brand p { margin: 0; max-width: 380px; }
.site-footer .col { flex: 1 1 160px; display: flex; flex-direction: column; gap: 8px; }
.site-footer .col b { color: var(--text); }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }

@media (max-width: 640px) {
  .logo-name small { display: none; }
  body { font-size: 16px; }
  .section h2 { font-size: 30px; }
  .lead { font-size: 18px; }
  .files-nav { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ── Justified body text ── */
/* Paragraphs, card text, list items and step text are aligned on both sides.
   Hyphenation keeps the gaps between words even in narrow cards. */
main p, main li, aside p, .steps span, .feed .summary {
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
}
/* Centred or single-line items keep their own alignment. */
.more-examples, .chips, .tabs, .keywords li, .feed-empty { text-align: initial; hyphens: manual; -webkit-hyphens: manual; }

/* ══ Motion and polish (homepage) ══ */

/* Hero: a soft glow and a faint grid behind the vision. */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: -40px 0 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 280px at 30% 30%, rgba(96,165,250,0.16), transparent 70%),
    radial-gradient(420px 220px at 75% 55%, rgba(167,139,250,0.10), transparent 70%),
    linear-gradient(rgba(148,163,184,0.06) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(148,163,184,0.06) 1px, transparent 1px) 0 0 / 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at 40% 40%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at 40% 40%, #000 30%, transparent 75%);
}

/* Install one-liner with a platform switch and a copy button. */
.oneliner { margin-top: 20px; max-width: 760px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-code); overflow: hidden; }
.oneliner-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 12px; }
.oneliner-head span { color: var(--text-dim); margin-right: 6px; font-family: var(--mono); }
.oneliner-head button { border: 0; background: transparent; color: var(--text-dim); font: 500 12px var(--mono); padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.oneliner-head button[aria-pressed="true"] { background: rgba(96,165,250,0.14); color: var(--text); }
.oneliner-body { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.oneliner-body code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font: 13px var(--mono); color: var(--text); background: none; padding: 0; }
.oneliner-body code::before { content: "$ "; color: var(--green); }
.copy-btn { flex: none; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-2); font: 600 12px var(--sans, inherit); padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.copy-btn:hover { color: var(--text); border-color: var(--accent); }

/* Trust strip. */
.trust { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.trust b { font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.trust a { display: inline-flex; align-items: center; height: 36px; padding: 0 10px; border-radius: 8px; background: #f1f5f9; opacity: 0.8; transition: opacity .2s; }
.trust a:hover { opacity: 1; }
.trust img { height: 24px; width: auto; display: block; }
.trust .hw { font-family: var(--mono); color: var(--text-2); }

/* Agent terminal. */
.term { border: 1px solid var(--border-strong); border-radius: 12px; background: #070a12; overflow: hidden; box-shadow: 0 20px 60px rgba(2,6,23,0.6), 0 0 0 1px rgba(96,165,250,0.05); }
.term-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #0d1220; font: 12px var(--mono); color: var(--text-dim); }
.term-head i { width: 10px; height: 10px; border-radius: 50%; background: #334155; display: inline-block; }
.term-head i:nth-child(1) { background: #fb7185; } .term-head i:nth-child(2) { background: #fbbf24; } .term-head i:nth-child(3) { background: #34d399; }
.term-head .title { margin-left: 8px; flex: 1; }
.term-head button { border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); font: 500 11px var(--mono); padding: 3px 8px; border-radius: 5px; cursor: pointer; }
.term-body { margin: 0; padding: 16px 18px; height: 480px; overflow-y: auto; scrollbar-width: thin; font: 13px/1.65 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.term-body .ln { display: block; }
.term-body .cmd { color: var(--text); } .term-body .cmd::before { content: "$ "; color: var(--green); }
.term-body .agent { color: var(--purple); } .term-body .agent::before { content: "agent › "; color: var(--purple); font-weight: 600; }
.term-body .you { color: var(--text); margin-top: 6px; } .term-body .you::before { content: "you › "; color: var(--accent); font-weight: 600; }
.term-body .file { color: var(--text-dim); }
.term-body .add { color: #86efac; background: rgba(52,211,153,0.10); } .term-body .add::before { content: "+ "; }
.term-body .del { color: #fda4af; background: rgba(251,113,133,0.10); text-decoration: line-through; text-decoration-color: rgba(253,164,175,0.5); } .term-body .del::before { content: "- "; }
.term-body .err { color: var(--rose); } .term-body .ok { color: var(--green); } .term-body .dim { color: #64748b; }
.term-body .caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: text-bottom; background: var(--text-2); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.term-note { margin: 10px 0 0; font-size: 13px; color: var(--text-dim); }

/* "Break it" buttons and the diagnostic panel under the file browser. */
.tryit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; }
.tryit > span { color: var(--text-dim); margin-right: 4px; }
.tryit button { border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text); font: 500 13px inherit; padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.tryit button:hover { border-color: var(--rose); background: rgba(251,113,133,0.08); }
.tryit button[data-break="reset"]:hover { border-color: var(--accent); background: rgba(96,165,250,0.08); }
.tryit button[aria-pressed="true"] { border-color: var(--rose); background: rgba(251,113,133,0.12); }
.code-body .ins { display: inline-block; min-width: 100%; background: rgba(251,191,36,0.12); box-shadow: inset 3px 0 0 var(--amber); }
.diag { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; background: #070a12; overflow: hidden; }
.diag.err { border-color: rgba(251,113,133,0.5); } .diag.warn { border-color: rgba(251,191,36,0.5); }
.diag-head { padding: 8px 14px; border-bottom: 1px solid var(--border); font: 12px var(--mono); color: var(--text-dim); }
.diag pre { margin: 0; padding: 14px; overflow-x: auto; font: 13px/1.6 var(--mono); color: var(--text-2); }
.diag .e { color: var(--rose); font-weight: 600; } .diag .w { color: var(--amber); font-weight: 600; } .diag .g { color: #64748b; }
.diag-note { padding: 0 14px 14px; font-size: 14px; color: var(--text-2); }

/* Closing call to action. */
.cta { position: relative; margin: 24px 0 8px; padding: 48px 36px; border-radius: 16px; border: 1px solid var(--border-strong); overflow: hidden; isolation: isolate;
  background: radial-gradient(500px 220px at 15% 0%, rgba(96,165,250,0.18), transparent 70%), radial-gradient(500px 240px at 90% 100%, rgba(251,113,133,0.12), transparent 70%), var(--bg-card); }
.cta h2 { margin: 0 0 10px; font-size: clamp(26px, 3vw, 36px); }
.cta p { margin: 0 0 24px; max-width: 560px; color: var(--text-2); text-align: left; }
.cta .btns { display: flex; flex-wrap: wrap; gap: 12px; }

/* Cards lift a little on hover. */
.card { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 12px 32px rgba(2,6,23,0.5), 0 0 0 1px rgba(96,165,250,0.08); }


@media (prefers-reduced-motion: reduce) {
  .card, .card:hover { transition: none; transform: none; }
  .term-body .caret { animation: none; }
}

/* ══ How it works: the animated loop ══ */
.loop3d { margin-top: 8px; }
.loop-wrap { position: relative; overflow: visible; }
.loop-stage { width: 824px; height: 496px; transform-origin: 0 0; }
.loop-board {
  position: relative; width: 824px; height: 496px;
  border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border);
}
.loop-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.loop-card {
  position: absolute; width: 200px; height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: #111827; color: var(--text);
  font: inherit; cursor: pointer; z-index: 1;
  transition: transform .5s cubic-bezier(.2,.8,.2,1), box-shadow .5s, border-color .3s, background .3s;
  --glow: 34,211,238;
}
.loop-card b { font-size: 15px; } .loop-card span { font: 12px var(--mono); color: var(--text-dim); }
.loop-card.fail { border-color: rgba(251,113,133,0.6); --glow: 251,113,133; }
.loop-card[data-step="5"] { background: rgba(251,113,133,0.12); }
.loop-card.image { border-color: var(--accent); background: #1e293b; --glow: 96,165,250; }
.loop-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.loop-card.is-active {
  transform: scale(1.04);
  border-color: rgb(var(--glow));
  box-shadow: 0 0 0 1px rgba(var(--glow),0.5), 0 0 32px rgba(var(--glow),0.35); z-index: 2;
}
.loop-dot {
  position: absolute; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: rgb(var(--dot, 34,211,238)); box-shadow: 0 0 0 6px rgba(var(--dot, 34,211,238),0.18), 0 0 24px rgb(var(--dot, 34,211,238));
  z-index: 0; opacity: 0; transition: opacity .3s;
}
.loop-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.loop-lap { font: 600 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.loop-lap.fail { color: var(--rose); } .loop-lap.hold { color: var(--accent); }
.loop-toggle { border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); font: 500 12px var(--mono); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.loop-detail { display: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); min-height: 210px; }
.loop3d.is-live .loop-detail { display: grid; }
.loop-detail-kicker { margin: 0 0 6px; font: 600 12px var(--mono); color: var(--text-dim); text-align: left; }
.loop-detail h3 { margin: 0 0 8px; font-size: 20px; }
.loop-detail p { margin: 0; color: var(--text-2); font-size: 15px; }
.loop-detail-code { margin: 0; min-width: 0; }
.loop-detail-code pre { margin: 0; padding: 14px; border-radius: 8px; background: var(--bg-code); border: 1px solid var(--border); font: 12.5px/1.6 var(--mono); color: var(--text-2); overflow-x: auto; white-space: pre; }
.loop-detail-code pre .a { color: #86efac; } .loop-detail-code pre .d { color: #fda4af; } .loop-detail-code pre .w { color: var(--amber); } .loop-detail-code pre .o { color: var(--green); } .loop-detail-code pre .k { color: var(--accent); }
.loop-detail-code figcaption { margin-top: 6px; font: 12px var(--mono); color: var(--text-dim); }
.loop-detail.swap { animation: loopswap .45s ease; }
@keyframes loopswap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.loop3d.is-live + .loop-fallback { display: none; }
@media (max-width: 760px) { .loop-detail { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .loop-card { transition: none; }
  .loop-dot { display: none; }
  .loop-detail.swap { animation: none; }
}
