/* studio.kinogaki.com: kinogaki.com's colors and type (JetBrains Mono on near-black). */
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/fonts/jetbrains-mono-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/fonts/jetbrains-mono-medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/assets/fonts/jetbrains-mono-semibold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #101211;
  --surface: #191c1a;
  --surface-2: #222623;
  --line: #343a35;
  --text: #efefe8;
  --muted: #adb4ac;
  --faint: #7f8a80;
  --green: #627f64;
  --light-green: #b0c8ad;
  --orange: #e8a43a;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 14px; line-height: 1.75; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--light-green); text-decoration: none; }
a:hover { color: var(--orange); }
::selection { background: var(--orange); color: var(--bg); }
h1, h2, h3, h4, h5, h6 { font-weight: 500; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(30px, 5vw, 52px); letter-spacing: -.05em; }
h2 { font-size: clamp(21px, 2.6vw, 28px); letter-spacing: -.04em; margin: 56px 0 18px; }
h3 { font-size: 17px; letter-spacing: -.02em; margin: 34px 0 12px; }
h4, h5, h6 { font-size: 14px; margin: 26px 0 10px; color: var(--text); }
p { margin: 0 0 14px; color: var(--muted); }
li { color: var(--muted); }
strong { color: var(--text); font-weight: 500; }
code { font-family: var(--mono); font-size: .93em; color: var(--text); overflow-wrap: anywhere; }
ul, ol { padding-left: 22px; margin: 0 0 16px; }
blockquote { margin: 0 0 16px; padding-left: 16px; border-left: 2px solid var(--line); }

.container { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.brand img { width: 118px; height: 26px; object-fit: contain; }
.brand span { font-size: 12px; color: var(--muted); }
.site-header nav { display: flex; gap: 24px; margin-left: auto; font-size: 12px; flex-wrap: wrap; }
.site-header nav a { color: var(--text); }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--light-green); }

.crumbs { font-size: 12px; color: var(--faint); padding: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line); }
.crumbs .up { margin-left: auto; }

.hero { padding: 36px 0 28px; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; color: var(--light-green); margin-bottom: 16px; }
.eyebrow::before { content: ''; width: 6px; height: 6px; background: var(--green); }
.lead { max-width: 820px; margin-top: 18px; font-size: 15px; color: var(--muted); }
.lead p { font-size: 15px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tag { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--bg); background: var(--light-green); padding: 1px 8px; border-radius: 2px; }
.tag.alt { background: var(--orange); }
.tag.dim { background: var(--surface-2); color: var(--muted); }

main { padding-bottom: 40px; }
.section { border-top: 1px solid var(--line); margin-top: 48px; }
.section > h2:first-child { margin-top: 36px; }
.prose { max-width: 860px; }
.prose h2 { margin-top: 44px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 8px 0 24px; }
.facts > div { background: var(--surface); padding: 14px 16px; }
.facts dt { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.facts dd { margin: 4px 0 0; color: var(--text); font-size: 13px; overflow-wrap: anywhere; }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 0 0 20px; }
th, td { text-align: left; vertical-align: top; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line); }
th { font-weight: 500; color: var(--faint); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.name { white-space: nowrap; }
tr:target td { background: var(--surface-2); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 0 0 24px; }
.cards > a, .cards > div { background: var(--surface); padding: 16px 18px; color: var(--muted); display: block; }
.cards > a:hover { background: var(--surface-2); color: var(--muted); }
.cards h3 { margin: 0 0 6px; font-size: 14px; color: var(--light-green); }
.cards p { font-size: 12.5px; margin: 0; }
.cards .meta { display: block; margin-top: 8px; font-size: 11px; color: var(--faint); }

.figure { margin: 8px 0 18px; border: 1px solid var(--line); background: #0c0e0d; }
.figure .scroll { padding: 6px; }
.figure figcaption, .legend { font-size: 11.5px; color: var(--faint); padding: 10px 14px; border-top: 1px solid var(--line); }
.legend span { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid #5b665c; }
.legend i.against { border-color: var(--orange); }
.legend i.box { width: 12px; height: 10px; border: 1px solid var(--line); background: var(--surface); }
.legend i.box.test { border-style: dashed; }
figure.diagram { margin: 10px 0 24px; border: 1px solid var(--line); background: #0c0e0d; padding: 6px; }

svg.graph { display: block; margin: 0 auto; max-width: none; }
svg.graph text { font-family: var(--mono); fill: var(--text); text-anchor: middle; font-size: 12px; pointer-events: none; }
svg.graph .sub { font-size: 10px; fill: var(--faint); }
svg.graph .n rect { fill: var(--surface); stroke: #48514a; stroke-width: 1; }
svg.graph a.n:hover rect, svg.graph .n.on rect { stroke: var(--light-green); fill: var(--surface-2); }
svg.graph .n.self rect { stroke: var(--orange); fill: #2a2418; }
svg.graph .n.test rect { stroke-dasharray: 4 3; }
svg.graph .n.ext rect { fill: #121413; stroke: #3a413b; }
svg.graph .n.ext .label { fill: var(--muted); }
svg.graph .n.linked .label { fill: var(--light-green); }
svg.graph .band rect { fill: #131614; stroke: #262b27; }
svg.graph .band text { text-anchor: start; fill: var(--light-green); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; pointer-events: auto; }
svg.graph .band text a { fill: var(--light-green); }
svg.graph .band .note { fill: var(--faint); text-transform: none; letter-spacing: 0; }
svg.graph .e { fill: none; stroke: #566158; stroke-width: 1.15; }
svg.graph .e.against { stroke: var(--orange); stroke-width: 1.5; }
svg.graph .e.hidden { display: none; }
svg.graph .arrow { fill: #6c786e; }
svg.graph .elabel { font-size: 10px; fill: var(--muted); text-anchor: start; paint-order: stroke; stroke: #0c0e0d; stroke-width: 4px; }
svg.graph.focus .n { opacity: .28; }
svg.graph.focus .n.on, svg.graph.focus .n.near { opacity: 1; }
svg.graph.focus .e { opacity: .07; }
svg.graph.focus .e.on { opacity: 1; stroke: var(--light-green); display: inline; }
svg.graph.focus .e.against.on { stroke: var(--orange); }

.modules { list-style: none; padding: 0; margin: 0 0 18px; font-size: 12.5px; }
.modules li { padding: 5px 0; border-bottom: 1px solid #22272380; display: grid; grid-template-columns: minmax(180px, 30%) 1fr auto; gap: 14px; }
.modules li .path { color: var(--text); overflow-wrap: anywhere; }
.modules li .priv { color: var(--faint); }
.modules li .lines { color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.names { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; }
.names code { margin-right: 10px; display: inline-block; }
details { margin: 0 0 14px; }
details > summary { cursor: pointer; color: var(--light-green); font-size: 12.5px; padding: 4px 0 10px; }
details .doc { border-left: 2px solid var(--line); padding-left: 18px; margin: 6px 0 20px; }
.doc h3 { font-size: 15px; } .doc h4 { font-size: 13.5px; }
.muted { color: var(--faint); }
.note { color: var(--faint); font-size: 12px; }

.site-footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px 0 44px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); margin-top: 40px; }

@media (max-width: 820px) {
  .container { width: calc(100% - 32px); }
  .facts { grid-template-columns: 1fr 1fr; }
  .modules li { grid-template-columns: 1fr auto; }
  .modules li .doc1 { grid-column: 1 / -1; }
  .crumbs .up { margin-left: 0; width: 100%; }
}
@media (max-width: 520px) {
  body { font-size: 13.5px; }
  .site-header nav { gap: 14px; margin-left: 0; }
  .brand span { display: none; }
  .facts { grid-template-columns: 1fr; }
}

/* A graph wider than the text: the window's width, centred on the column. */
.figure.wide { width: calc(100vw - 32px); max-width: 1640px; position: relative; left: 50%; transform: translateX(-50%); }
/* A phone sees each graph whole, as a map to pinch into; the lists under it hold the same boxes. */
@media (max-width: 820px) {
  svg.graph { width: 100%; height: auto; }
  .figure.wide { width: auto; left: 0; transform: none; }
}
