/* ============================================================
   Zero Trust BYOC — twelve principles
   Design language: omnistrate.com (light)
   Inter (body) · Instrument Serif (display) · JetBrains Mono (code)
   Brand green #38B601 for Omnistrate; enterprise blue for customer-owned.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-raised: #f8fafc;
  --bg-panel: #ffffff;
  --ink: #111827;
  --ink-dim: #4b5563;
  --ink-faint: #98a2b3;
  --brand: #38b601;
  --brand-deep: #2e9a03;
  --brand-dark: #257a02;
  --blue: #2563eb;
  --teal: #0ca99b;
  --red: #e5484d;
  --line: rgba(56, 182, 1, 0.22);
  --line-soft: rgba(17, 24, 39, 0.07);
  --border: #e6eaef;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -12%, rgba(56, 182, 1, 0.08), transparent 60%),
    radial-gradient(ellipse 45% 35% at 88% 8%, rgba(12, 169, 155, 0.05), transparent 65%),
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 72px 72px, 72px 72px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--brand); color: #fff; }

a { color: var(--brand-deep); text-decoration: none; }
a:hover { color: var(--brand); }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 28px; }
.wrap-wide { max-width: 1020px; margin: 0 auto; padding: 0 28px; }

/* ---------- top nav ---------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1020px; margin: 0 auto; padding: 0 28px;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em;
  color: var(--ink); text-transform: uppercase;
}
.brand:hover { color: var(--ink); }
.brand .sigil {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-family: var(--serif); font-style: italic;
  font-size: 17px; transform: translateY(4px);
  box-shadow: 0 4px 14px rgba(56, 182, 1, 0.35);
}
.brand em { font-family: var(--serif); font-style: italic; text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--brand-deep); }
.topbar nav { display: flex; gap: 26px; font-size: 13.5px; font-weight: 500; }
.topbar nav a { color: var(--ink-dim); }
.topbar nav a:hover { color: var(--ink); }

/* ---------- hero (index) ---------- */

.hero { padding: 96px 0 72px; text-align: left; position: relative; }
.eyebrow {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--brand-deep);
  display: flex; align-items: center; gap: 10px; margin-bottom: 28px;
}
.eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--brand); opacity: 0.7; }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(46px, 7.5vw, 84px);
  line-height: 1.04; letter-spacing: -0.015em; margin-bottom: 30px;
  color: var(--ink);
}
.hero h1 em {
  font-style: italic;
  background: linear-gradient(100deg, var(--brand-dark), var(--brand) 55%, var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede {
  font-size: 20px; line-height: 1.65; color: var(--ink-dim);
  max-width: 620px; font-weight: 300;
}
.hero .lede strong { color: var(--ink); font-weight: 500; }

/* staggered reveal */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.hero > *, .reveal { animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
.hero > *:nth-child(2) { animation-delay: 0.08s; }
.hero > *:nth-child(3) { animation-delay: 0.16s; }

/* ---------- prose ---------- */

.prose { padding: 8px 0 40px; }
.prose p { margin-bottom: 26px; color: var(--ink-dim); font-weight: 300; }
.prose p strong, .prose p b { color: var(--ink); font-weight: 500; }
.prose h2 {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: 34px; margin: 56px 0 20px; color: var(--ink);
}
.prose code, .factor-body code {
  font-family: var(--mono); font-size: 0.82em;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px; color: var(--brand-dark); white-space: nowrap;
}

/* ---------- figures / diagrams ---------- */

.diagram {
  margin: 64px 0; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-panel);
  overflow: hidden;
  box-shadow: 0 20px 50px -30px rgba(17, 24, 39, 0.25);
}
.diagram-title {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  display: flex; align-items: center; gap: 8px;
}
.diagram-title .dot { width: 9px; height: 9px; border-radius: 50%; }

/* figures break out of the text column so diagrams render large */
.fig {
  --figw: min(1100px, calc(100vw - 40px));
  width: var(--figw);
  margin-left: calc((var(--figw) - 100%) / -2);
}
.fig .fig-body { padding: 26px 24px 22px; }
.fig svg { width: 100%; height: auto; display: block; }
.fig-hero .fig-body { padding: 22px 26px 22px; }
.factor-hero + .fig { margin-top: 30px; }

/* animated channel flow through the pipe (right → left) */
.fig .flow {
  stroke-dasharray: 4 14;
  stroke-linecap: round;
  animation: figflow 1.1s linear infinite;
}
@keyframes figflow {
  from { stroke-dashoffset: 18; }
  to   { stroke-dashoffset: 0; }
}

/* scrolling export-audit log; -168px = AUDIT_LOOP_H in diagrams.py */
.fig .audit-scroll { animation: figaudit 11s linear infinite; }
@keyframes figaudit {
  from { transform: translateY(0); }
  to   { transform: translateY(-168px); }
}

/* slow dash crawl — offline / occasional transfer (installer artifacts, polls) */
.fig .crawl { stroke-dasharray: 6 7; stroke-linecap: round; animation: figcrawl 1.6s linear infinite; }
@keyframes figcrawl {
  from { stroke-dashoffset: 13; }
  to   { stroke-dashoffset: 0; }
}

/* pulse — actively-enforced denials (blocked ✕, warnings) */
.fig .pulse { animation: figpulse 2.2s ease-in-out infinite; }
@keyframes figpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* spin — reconcile loops and clock hands */
.fig .spin { animation: figspin 3.5s linear infinite; }
@keyframes figspin { to { transform: rotate(360deg); } }

/* relay — sequential emphasis along a chain (gates, handoffs, panels) */
.fig .relay { animation: figrelay 3.6s ease-in-out infinite; }
@keyframes figrelay {
  0%, 100% { opacity: 0.5; }
  12%, 32% { opacity: 1; }
  48% { opacity: 0.5; }
}

/* seq — states appearing in order (rollout squares filling) */
.fig .seq { opacity: 0; animation: figseq 4.5s ease-in-out infinite; }
@keyframes figseq {
  0% { opacity: 0; }
  15%, 50% { opacity: 0.85; }
  65%, 100% { opacity: 0; }
}

/* expire — grants and credentials that fade unless they persist */
.fig .expire { animation: figexpire 5.2s ease-in-out infinite; }
@keyframes figexpire {
  0%, 52% { opacity: 1; }
  68%, 82% { opacity: 0.18; }
  100% { opacity: 1; }
}

/* the hero's mode slider — the spectrum from flexibility to fully restricted */
.fig-slider-wrap { padding: 18px 26px 0; }
.fig-axis {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
}
.fig-axis .from { color: var(--brand-deep); }
.fig-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; margin-top: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, #9db4a0 55%, #374151 100%);
  outline: none; cursor: pointer;
}
.fig-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand);
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.3); cursor: pointer;
}
.fig-slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand);
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.3); cursor: pointer;
}
.fig-slider:focus-visible { box-shadow: 0 0 0 3px rgba(56, 182, 1, 0.3); }
.fig-stops { display: grid; margin-top: 4px; }
.fig-stop {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint); background: none; border: none;
  padding: 4px 0; cursor: pointer; transition: color 0.2s;
}
.fig-stop:hover { color: var(--ink-dim); }
.fig-stop.active { color: var(--ink); font-weight: 700; }
.fig-mode-desc {
  margin-top: 2px; text-align: center;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim);
}
.fig-pane { display: none; }
.fig-pane.active { display: block; animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- principles index list ---------- */

.toc { padding: 24px 0 96px; }
.toc-head {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 26px;
  display: flex; align-items: center; gap: 10px;
}
.toc-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.toc ol { list-style: none; }
.toc a.item {
  display: grid; grid-template-columns: 88px 1fr auto;
  gap: 22px; align-items: baseline;
  padding: 22px 18px; margin: 0 -18px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 10px;
  color: inherit;
  transition: background 0.25s ease, transform 0.25s ease;
}
.toc a.item:hover { background: rgba(56, 182, 1, 0.06); transform: translateX(6px); }
.toc .num {
  font-family: var(--serif); font-style: italic; font-size: 30px;
  color: var(--brand); line-height: 1;
}
.toc .t { font-size: 19px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.toc .e { display: block; font-size: 14.5px; color: var(--ink-dim); font-weight: 300; margin-top: 3px; }
.toc .arrow { font-family: var(--mono); color: var(--ink-faint); font-size: 14px; transition: color 0.25s, transform 0.25s; }
.toc a.item:hover .arrow { color: var(--brand); transform: translateX(4px); }
.toc a.item { animation: rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ---------- factor page ---------- */

.factor-hero { padding: 84px 0 20px; position: relative; }
.factor-hero .numeral {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(120px, 20vw, 210px); line-height: 0.85;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(56, 182, 1, 0.35);
  position: absolute; right: 0; top: 30px;
  pointer-events: none; user-select: none; z-index: -1;
}
.factor-hero .kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--brand-deep); margin-bottom: 20px;
}
.factor-hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6vw, 64px); line-height: 1.08;
  letter-spacing: -0.01em; margin-bottom: 26px; max-width: 620px;
  color: var(--ink);
}
.factor-hero .epigram {
  font-family: var(--serif); font-style: italic; font-size: 24px;
  line-height: 1.5; color: var(--brand-dark); max-width: 560px;
  padding-left: 22px; border-left: 2px solid var(--brand);
  margin-bottom: 26px;
}

.factor-body { padding: 20px 0 30px; }
.factor-body p { margin-bottom: 26px; color: var(--ink-dim); font-weight: 300; }
.factor-body p strong { color: var(--ink); font-weight: 500; }

/* in-practice panel */
.practice {
  margin: 44px 0; border: 1px solid rgba(56, 182, 1, 0.3); border-radius: 14px;
  background: #f5fcef;
  overflow: hidden;
}
.practice-head {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--brand-dark);
  padding: 13px 22px; border-bottom: 1px solid rgba(56, 182, 1, 0.2);
  display: flex; align-items: center; gap: 9px;
}
.practice-head::before { content: "✓"; font-size: 13px; }
.practice ul { list-style: none; padding: 18px 22px; }
.practice li {
  font-family: var(--mono); font-size: 13.5px; line-height: 1.75;
  color: var(--ink-dim); padding: 7px 0 7px 24px; position: relative;
}
.practice li::before {
  content: "▸"; position: absolute; left: 0; color: var(--brand);
}
.practice li b, .practice li strong { color: var(--ink); font-weight: 600; }

/* anti-pattern panel */
.smell {
  margin: 44px 0; border: 1px solid rgba(229, 72, 77, 0.3); border-radius: 14px;
  background: #fdf3f3; overflow: hidden;
}
.smell-head {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--red);
  padding: 13px 22px; border-bottom: 1px solid rgba(229, 72, 77, 0.2);
  display: flex; align-items: center; gap: 9px;
}
.smell-head::before { content: "✕"; font-size: 13px; }
.smell ul { list-style: none; padding: 18px 22px; }
.smell li {
  font-size: 15px; line-height: 1.7; color: var(--ink-dim); font-weight: 300;
  padding: 6px 0 6px 24px; position: relative;
}
.smell li::before { content: "—"; position: absolute; left: 0; color: var(--red); }

/* prev / next */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 26px 0 96px;
}
.pager a {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; color: inherit;
  background: var(--bg-panel);
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}
.pager a:hover {
  border-color: rgba(56, 182, 1, 0.5);
  background: rgba(56, 182, 1, 0.05);
  transform: translateY(-3px);
  box-shadow: 0 12px 26px -18px rgba(17, 24, 39, 0.3);
}
.pager .dir {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 7px;
}
.pager .name { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.pager .name .rn { font-family: var(--serif); font-style: italic; color: var(--brand); margin-right: 8px; }
.pager a.next { text-align: right; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--border);
  padding: 44px 0 64px;
  font-size: 13.5px; color: var(--ink-faint);
  background: var(--bg-raised);
}
footer .foot-inner {
  max-width: 1020px; margin: 0 auto; padding: 0 28px;
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
footer .mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; }
footer a { color: var(--ink-dim); }
footer a:hover { color: var(--brand-deep); }

/* ---------- motion & responsive ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero > *, .reveal, .toc a.item, .fig-pane.active,
  .fig .flow, .fig .audit-scroll, .fig .crawl, .fig .pulse,
  .fig .spin, .fig .relay, .fig .seq, .fig .expire { animation: none; }
  * { transition: none !important; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .fig .fig-body { position: relative; }
  .fig .fig-body svg { min-width: 0; width: 100%; }
  .fig .fig-body::after {
    content: "tap to enlarge";
    position: absolute; right: 10px; bottom: 6px;
    font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--ink-faint);
    pointer-events: none;
  }
  #dimensions .fig-body::after { content: none; }
  .fig-tabs { padding: 14px 16px 0; }
  .fig-slider-wrap { padding: 14px 18px 0; }
  .fig-axis { font-size: 9px; }
  .fig-stop { font-size: 9.5px; letter-spacing: 0.05em; }
  .fig-mode-desc { font-size: 10.5px; }
  .diagram-title { font-size: 10px; letter-spacing: 0.12em; }
  .hero { padding: 64px 0 48px; }
  .toc a.item { grid-template-columns: 56px 1fr; }
  .toc .arrow { display: none; }
  .toc .num { font-size: 24px; }
  .factor-hero .numeral { font-size: 110px; top: 10px; opacity: 0.5; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { text-align: left; }
  .topbar nav { display: none; }
}

/* ---------- mobile diagram zoom overlay ---------- */
.fig-zoom {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(255, 255, 255, 0.98);
  display: none; overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 56px 16px 24px;
}
.fig-zoom.open { display: block; }
.fig-zoom svg { width: 900px; max-width: none; height: auto; display: block; }
.fig-zoom-close {
  position: fixed; top: 12px; right: 12px; z-index: 201;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer;
  font-family: var(--sans);
}
