/* EntLab — site styling.
   Deliberately monochrome: the program itself is strictly black and white,
   so the site is too. Colours come straight from entlab/config.py:
   #000 outside the board, #0f0f0f the board, #171717 the grid lines. */

:root {
    --bg:      #000000;
    --board:   #0f0f0f;
    --line:    #171717;
    --edge:    #262626;   /* readable border — grid lines are too faint */
    --edge-lit:#3d3d3d;
    --ink:     #e8e8e8;
    --ink-dim: #9a9a9a;
    --ink-faint:#6b6b6b;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
            "Liberation Mono", monospace;
    --measure: 66ch;
    --pad: clamp(1.25rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration-color: var(--edge-lit);
    text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(2rem, 7vw, 3.25rem); letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 1.35rem; margin: 3rem 0 1rem; }
h3 { font-size: 1.05rem; margin: 2rem 0 .5rem; }
h2:first-child, h3:first-child { margin-top: 0; }

p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: .35rem; }

code {
    font-family: var(--mono);
    font-size: .92em;
    background: var(--board);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: .1em .35em;
}

pre {
    background: var(--board);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;          /* long lines scroll here, never the page */
    margin: 0 0 1.25rem;
}
pre code { background: none; border: 0; padding: 0; font-size: .88rem; }

hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

/* wide content scrolls inside its own box so the page never does */
.scroll-x { overflow-x: auto; margin: 0 0 1.25rem; }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-dim); font-weight: 700; white-space: nowrap;
     border-bottom-color: var(--edge); }
td:first-child { white-space: nowrap; }

/* ─────────────────────────────────────────────────────── shell ───────── */

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 var(--pad); }

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(0, 0, 0, .82);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-in {
    max-width: 1060px; margin: 0 auto; padding: .7rem var(--pad);
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand {
    font-weight: 700; letter-spacing: .02em; text-decoration: none;
    display: flex; align-items: center; gap: .55rem;
}
/* the EntLab mark — logo.svg, the same glider-on-a-grid as the favicon
   and the app's own window icon */
.brand .glyph {
    width: 20px; height: 20px; flex: none;
    display: block; border-radius: 2px;
}
.topbar nav { display: flex; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.topbar nav a { color: var(--ink-dim); text-decoration: none; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--ink); }

footer {
    border-top: 1px solid var(--line);
    margin-top: 5rem; padding: 2.5rem 0 3.5rem;
    color: var(--ink-faint); font-size: .85rem;
}
footer p { margin: 0 0 .4rem; }
footer a { color: var(--ink-dim); }

/* ──────────────────────────────────────────────────────── hero ───────── */

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
#life {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: .55;
}
/* Scrim between the automaton and the words. Text sits on near-solid black
   and the life shows through where there is nothing to read: to the right
   on wide screens, below the copy on narrow ones. */
.hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(95deg,
        #000 0%, rgba(0,0,0,.93) 40%, rgba(0,0,0,.40) 70%, rgba(0,0,0,.12) 100%);
}
.hero-in {
    position: relative; z-index: 1;
    /* keep .wrap's horizontal padding — a `0` here would shove the hero
       out of line with every section below it */
    padding: clamp(3.5rem, 11vh, 7rem) var(--pad) clamp(3rem, 9vh, 5.5rem);
}

@media (max-width: 860px) {
    .hero::after {
        background: linear-gradient(178deg,
            #000 0%, rgba(0,0,0,.94) 46%, rgba(0,0,0,.55) 82%, rgba(0,0,0,.2) 100%);
    }
    #life { opacity: .45; }
}
.tag { color: var(--ink-dim); font-size: 1rem; margin: 1rem 0 0; max-width: 54ch; }
.byline { color: var(--ink-faint); font-size: .85rem; margin: 2rem 0 0; }
.eyebrow {
    color: var(--ink-faint); font-size: .8rem; letter-spacing: .16em;
    text-transform: uppercase; margin: 0 0 1.1rem;
}

.btn-row { display: flex; gap: .7rem; flex-wrap: wrap; margin: 2rem 0 0; }
.btn {
    display: inline-block; padding: .6rem 1.15rem;
    border: 1px solid var(--edge); border-radius: 5px;
    background: var(--board); color: var(--ink);
    text-decoration: none; font-size: .92rem;
}
.btn:hover { border-color: var(--ink-dim); background: #151515; }
.btn-primary { background: var(--ink); color: #000; border-color: var(--ink); font-weight: 700; }
.btn-primary:hover { background: #fff; border-color: #fff; }

/* ───────────────────────────────────────────────────── sections ──────── */

section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--line); }

/* .prose caps the line length of the text it holds rather than its own
   width — so a `.wrap.prose` still starts flush left with everything else
   instead of shrinking and re-centring itself. Tables and .scroll-x boxes
   are deliberately left free to use the full column. */
.prose > p, .prose > ul, .prose > ol,
.prose > h2, .prose > h3, .prose > pre, .prose > .note {
    max-width: var(--measure);
}

.grid2 { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
    background: var(--board); border: 1px solid var(--line);
    border-radius: 6px; padding: 1.1rem 1.2rem;
}
.card h3 { margin: 0 0 .4rem; font-size: .98rem; }
.card p { margin: 0; color: var(--ink-dim); font-size: .9rem; }

.shot {
    display: block; width: 100%; height: auto;
    border: 1px solid var(--line); border-radius: 6px;
}
figure { margin: 0; }
figcaption { color: var(--ink-faint); font-size: .82rem; margin-top: .6rem; }

.note {
    border-left: 2px solid var(--edge);
    padding: .1rem 0 .1rem 1rem; margin: 0 0 1.25rem;
    color: var(--ink-dim);
}

/* ───────────────────────────────────────────────────── docs page ─────── */

.docs { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 3rem;
        align-items: start; padding: 2.75rem 0 0; }
.sidebar { position: sticky; top: 4.2rem; font-size: .9rem; }
.sidebar strong { display: block; color: var(--ink-faint); font-size: .75rem;
                  letter-spacing: .14em; text-transform: uppercase; margin: 0 0 .7rem; }
.sidebar ol { list-style: none; padding: 0; margin: 0 0 1.75rem; }
.sidebar li { margin: 0; }
.sidebar a {
    display: block; padding: .3rem 0 .3rem .7rem;
    border-left: 1px solid var(--line);
    color: var(--ink-dim); text-decoration: none;
}
.sidebar a:hover { color: var(--ink); border-left-color: var(--edge-lit); }
.sidebar a[aria-current] { color: var(--ink); border-left-color: var(--ink); }

.doc-body { min-width: 0; }          /* lets <pre> scroll instead of stretching */
.doc-body > section { padding: 0 0 2.5rem; border: 0; }
.doc-body p, .doc-body ul, .doc-body ol { max-width: 74ch; }

.pager { display: flex; gap: 1rem; justify-content: space-between;
         border-top: 1px solid var(--line); padding-top: 1.5rem; margin-top: 1rem; }
.pager a { color: var(--ink-dim); text-decoration: none; font-size: .9rem; }
.pager a:hover { color: var(--ink); }

.kbd {
    font-family: var(--mono); font-size: .82rem;
    background: #141414; border: 1px solid var(--edge);
    border-bottom-width: 2px; border-radius: 4px;
    padding: .1em .4em; white-space: nowrap;
}

@media (max-width: 760px) {
    .docs { grid-template-columns: 1fr; gap: 1.75rem; }
    .sidebar { position: static; border-bottom: 1px solid var(--line); padding-bottom: 1.25rem; }
    .sidebar ol { display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin-bottom: 0; }
    .sidebar a { border-left: 0; padding-left: 0; }
    .sidebar a[aria-current] { border-left: 0; text-decoration: underline; }
}

@media (max-width: 560px) {
    :root { --pad: 1rem; }
    .topbar-in { gap: .65rem; padding-block: .55rem; }
    .topbar nav {
        width: 100%;
        margin-left: 0;
        gap: .35rem 1rem;
    }
    .topbar nav a { padding: .2rem 0; }
    .hero-in { padding-top: 2.75rem; padding-bottom: 2.75rem; }
    .btn-row { display: grid; grid-template-columns: 1fr; }
    .btn { width: 100%; text-align: center; padding-block: .75rem; }
    section { padding: 2.75rem 0; }
    footer { margin-top: 3rem; }
}

/* people who ask for less motion get a still frame */
@media (prefers-reduced-motion: reduce) {
    #life { opacity: .32; }
}

/* Links that need a repo URL stay hidden until site.js has one, at which
   point it strips the attribute. !important because this has to beat every
   layout rule that sets a display (.sidebar a, .btn, …) — site.js removing
   the attribute is what reveals the element, not a specificity contest. */
[data-repo] { display: none !important; }
