/* Blueprint technical-docs style: navy drafting paper, cyan ink, IBM Plex */
:root {
  --paper: #0a1f3d; --paper-2: #0e2a52; --ink: #e6f1ff; --line: rgba(125, 211, 252, .28); --line-2: rgba(125, 211, 252, .6);
  --cyan: #7dd3fc; --amber: #fbbf24; --muted: #9fb7d6; --ok: #4ade80;
  --mono: 'IBM Plex Mono', ui-monospace, monospace; --sans: 'IBM Plex Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; color: var(--ink); font-family: var(--sans); overflow-x: hidden;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(125, 211, 252, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(125, 211, 252, .09) 1px, transparent 1px),
    linear-gradient(rgba(125, 211, 252, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(125, 211, 252, .04) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); line-height: 1.7; }
.dim { color: var(--muted); }
.ok { color: var(--ok); }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--amber); color: #000; padding: .5rem 1rem; }
.skip:focus { left: 8px; }

.free-bar { background: var(--amber); color: #1a1405; font-size: .8rem; font-family: var(--mono); font-weight: 500; }
.free-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .45rem; }
.free-bar b { background: #1a1405; color: var(--amber); padding: .1rem .5rem; margin-right: .35rem; font-size: .7rem; }
.free-bar a { font-weight: 600; white-space: nowrap; } .free-bar a:hover { text-decoration: underline; }

.top { position: sticky; top: 0; z-index: 40; background: rgba(10, 31, 61, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--mono); font-weight: 600; letter-spacing: .06em; font-size: .92rem; }
.brand em { font-style: normal; color: var(--amber); margin: 0 .1em; }
.nav { display: flex; gap: 1.4rem; font-family: var(--mono); font-size: .85rem; }
.nav a { color: var(--muted); padding: .5rem 0; border-bottom: 1px dashed transparent; }
.nav a:hover { color: var(--ink); border-color: var(--cyan); }

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2.5rem; align-items: end; padding: 4rem 0 2rem; }
.stamp { display: inline-block; font-size: .75rem; letter-spacing: .1em; color: var(--amber); border: 1px solid rgba(251, 191, 36, .55); padding: .2rem .6rem; margin: 0 0 1rem; }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 5rem); line-height: 1; margin: 0 0 1.2rem; font-weight: 700; letter-spacing: -.03em; }
.hero h1 span { color: var(--cyan); }
.lead { font-size: 1.1rem; line-height: 1.7; color: #cfe2fb; max-width: 600px; }
.lead b { color: var(--amber); font-weight: 600; }
.badges { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8rem; }
.badges li { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--line-2); background: rgba(125, 211, 252, .06); }
.badges i { color: var(--cyan); } .badges i.ok { color: var(--ok); font-size: .55rem; }
.hero-copy > * { animation: draw .7s cubic-bezier(.2, .8, .2, 1) both; }
.hero-copy > *:nth-child(2) { animation-delay: .08s; } .hero-copy > *:nth-child(3) { animation-delay: .16s; } .hero-copy > *:nth-child(4) { animation-delay: .24s; }
@keyframes draw { from { opacity: 0; transform: translateY(18px); } }

.titleblock { border: 2px solid var(--cyan); background: rgba(10, 31, 61, .85); font-size: .8rem; animation: draw .8s .2s both; }
.titleblock span { display: block; color: var(--muted); font-size: .66rem; letter-spacing: .1em; }
.titleblock b { font-weight: 600; font-size: .92rem; }
.tb-title { padding: .8rem 1rem; border-bottom: 2px solid var(--cyan); }
.tb-title b { font-size: 1.1rem; color: var(--amber); }
.tb-grid { display: grid; grid-template-columns: 1fr 1fr; }
.tb-grid div { padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.tb-grid div:nth-child(odd) { border-right: 1px solid var(--line); }
.tb-grid div:nth-last-child(-n+2) { border-bottom: 0; }

.section { padding: 3.5rem 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.sec-head h2 { display: flex; align-items: center; gap: .7rem; font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0; font-weight: 700; }
.sec-head h2 span { font-size: .85rem; color: var(--amber); border: 1px solid rgba(251, 191, 36, .6); padding: .1rem .5rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.tabs button { font-family: var(--mono); font-size: .85rem; min-height: 44px; padding: .45rem 1rem; color: var(--muted); background: transparent; border: 1px solid var(--line-2); cursor: pointer; transition: all .2s; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--cyan); color: #06172e; border-color: var(--cyan); font-weight: 600; }

.board { margin: 1rem 0 0; border: 2px solid var(--cyan); background: rgba(6, 22, 46, .78); position: relative; }
.board:fullscreen { display: flex; flex-direction: column; background: var(--paper); }
.board:fullscreen .viewport { flex: 1; height: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .8rem; border-bottom: 1px solid var(--line-2); font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.tools { display: flex; align-items: center; gap: .3rem; }
.tools button { width: 40px; height: 40px; display: grid; place-items: center; background: transparent; color: var(--ink); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; }
.tools button:hover, .tools button[aria-pressed="true"] { border-color: var(--amber); background: rgba(251, 191, 36, .12); }
#zoom-label { min-width: 48px; text-align: center; }
.viewport { height: 620px; overflow: hidden; cursor: grab; position: relative; touch-action: none; }
.viewport.dragging { cursor: grabbing; }
.canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; padding: 24px; }
.canvas svg { display: block; max-width: none !important; height: auto; }
.loading { padding: 2rem; color: var(--muted); }
.src { margin: 0; max-height: 620px; overflow: auto; padding: 1.2rem; font-size: .8rem; line-height: 1.6; color: #cfe2fb; background: rgba(0, 0, 0, .25); border-bottom: 1px solid var(--line); }
.board figcaption { padding: .5rem .8rem; font-size: .75rem; }

.ruler-wrap { margin-top: 1.4rem; }
.ruler { position: relative; display: flex; height: 64px; border: 2px solid var(--cyan); background: rgba(6, 22, 46, .7); }
.seg { position: relative; height: 100%; border-right: 1px solid rgba(10, 31, 61, .9); background: var(--c); opacity: .85; transition: opacity .2s, transform .2s; cursor: default; }
.seg:hover, .seg.hl { opacity: 1; transform: scaleY(1.12); z-index: 2; }
.seg.gap { background: repeating-linear-gradient(45deg, transparent 0 5px, rgba(125, 211, 252, .18) 5px 7px); opacity: 1; }
.tick { position: absolute; bottom: -10px; width: 2px; height: 10px; background: var(--amber); transform: translateX(-1px); }
.ruler-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 14px; }
.ranges { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .6rem; margin-top: 1.5rem; }
.range { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid var(--line); background: rgba(6, 22, 46, .6); transition: border-color .2s; }
.range:hover, .range.hl { border-color: var(--c); }
.range i { width: 14px; height: 14px; flex: none; background: var(--c); }
.range b { display: block; font-family: var(--mono); font-size: .85rem; font-weight: 600; }
.range span { color: var(--muted); font-size: .88rem; }

.repo-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.2rem; }
.tree { margin: 0; padding: 1.4rem; border: 1px solid var(--line-2); background: rgba(6, 22, 46, .7); font-size: .85rem; line-height: 1.7; color: #cfe2fb; overflow-x: auto; }
.tree b { color: var(--amber); font-weight: 500; }
.author { padding: 1.4rem; border: 1px dashed var(--line-2); }
.author h3 { font-size: 1.8rem; margin: 0 0 .3rem; }
.links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 46px; padding: .6rem 1.1rem; font-family: var(--mono); font-weight: 500; font-size: .88rem; border: 1px solid var(--line-2); transition: border-color .2s, background .2s; }
.btn:hover { border-color: var(--amber); background: rgba(251, 191, 36, .1); }
.btn.primary { background: var(--amber); color: #1a1405; border-color: var(--amber); font-weight: 600; }
.btn.primary:hover { background: #fcd34d; }

.opensource { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem; padding: 2rem; border: 2px dashed var(--amber); background: rgba(6, 22, 46, .7); }
.opensource > div { max-width: 680px; }
.opensource h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: .6rem 0 .3rem; }
.opensource p { margin: 0; }
.free-pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .25rem .6rem; background: var(--amber); color: #1a1405; }

.footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; color: var(--muted); font-size: .8rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer a:hover { color: var(--ink); }

@media (max-width: 899.98px) {
  .hero, .repo-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .viewport { height: 460px; }
}
@media (max-width: 575.98px) {
  .free-bar .license { display: none; }
  .free-inner { font-size: .72rem; }
  .hero { padding-top: 2.5rem; }
  .toolbar #diagram-file { display: none; }
  .tools { width: 100%; justify-content: space-between; }
  .viewport { height: 400px; }
  .footer-inner { flex-direction: column; align-items: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  /* excludes SVG internals: forcing transitions there breaks Mermaid's text measurement */
  :not(svg, svg *), :not(svg, svg *)::before, :not(svg, svg *)::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
