/* Core layout and type. Colours and frame looks come from the skin (skins/<name>/skin.css),
   which defines the site tokens below and the .frame, .well and .plate looks. */
:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--under); }
body { margin: 0; min-height: 100vh; background: var(--page, var(--bg)); color: var(--fg); font: 400 16px/1.6 var(--sans); }
a { color: inherit; text-decoration-color: var(--faint); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
img.px { image-rendering: pixelated; image-rendering: crisp-edges; display: block; max-width: 100%; height: auto; }
main, article, .doc > * { min-width: 0; }
button, select { font: 500 14px var(--sans); }
.plate { padding: 5px 12px; cursor: pointer; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* top bar. --gui is one GUI pixel in CSS px (live.js: chrome scale / devicePixelRatio, whole device pixels);
   every size in the bar is a multiple of it, so the frame and the controls land on whole device pixels. */
:root { --gui: 2px; --ctl: calc(17 * var(--gui)); }
.top { position: sticky; top: 12px; z-index: 30; width: fit-content; max-width: calc(100% - 32px); margin: 12px auto 0; padding: calc(4 * var(--gui) - 1px); }
.top .wrap { display: flex; align-items: center; gap: calc(11 * var(--gui)); flex-wrap: nowrap; max-width: none;
  min-height: calc(17 * var(--gui) + 4 * var(--gui)); padding: calc(2 * var(--gui)) calc(6 * var(--gui)) calc(2 * var(--gui)) calc(9 * var(--gui)); }
.top .wrap > *, .drop > *, .look > * { flex: none; margin: 0; }
.drop { display: contents; }
.brand { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; }
.nav { display: flex; gap: calc(8 * var(--gui)); font-size: 15px; }
.nav a { text-decoration: none; color: var(--soft); }
.nav a[aria-current="page"], .nav a:hover { color: var(--fg); }
.look { margin-left: auto; display: flex; gap: calc(4 * var(--gui)); align-items: center; }
.look .pick-btn { height: calc(16 * var(--gui)); font-size: 14px; }
.pick { position: relative; }
.pick-btn { padding-right: 28px; position: relative; }
.pick-btn::after { content: ""; position: absolute; right: 12px; top: 50%; width: 5px; height: 5px; margin-top: -4px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pick-list { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: min(60vh, 340px); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 6px; list-style: none; outline: none; white-space: nowrap; }
.pick-opt { padding: 4px 12px; cursor: pointer; font: 500 14px/1.4 var(--sans); }
.pick-opt[aria-selected="true"] { font-weight: 700; }
.gh { display: grid; place-items: center; width: var(--ctl); height: var(--ctl); color: var(--soft); flex: none; }
.gh:hover { color: var(--fg); }
/* the menu button: three pixel bars, 1 GUI px thick */
:root { --share-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath d='M6 0h1v1h-1zM6 1h2v1h-2zM2 2h7v1h-7zM1 3h7v1h-7zM0 4h3v1h-3zM6 4h1v1h-1zM0 5h2v4h-2z'/%3E%3C/svg%3E"); }
.reset { width: calc(20 * var(--gui)); height: calc(16 * var(--gui)); padding: 0; display: grid; place-items: center; }
.share.done { color: var(--accent, var(--fg)); }
.share.done i { transform: scale(1.15); }
.reset:disabled { opacity: .4; cursor: default; }
.reset i { display: block; width: calc(9 * var(--gui)); height: calc(9 * var(--gui)); pointer-events: none; image-rendering: pixelated; }
:root:not([data-chrome="live"]) .share i { background: currentColor; -webkit-mask: var(--share-mask) 0 0 / 100% 100% no-repeat; mask: var(--share-mask) 0 0 / 100% 100% no-repeat; }
:root[data-chrome="live"] .reset i { background: var(--nine-reset) 0 0 / 100% 100% no-repeat; }
:root[data-chrome="live"] .share i { background: var(--nine-share) 0 0 / 100% 100% no-repeat; }
.menu { display: none; width: calc(20 * var(--gui)); height: calc(16 * var(--gui)); padding: 0; place-items: center; }
.menu i { display: block; width: calc(8 * var(--gui)); height: calc(5 * var(--gui)); pointer-events: none;
  background: repeating-linear-gradient(to bottom, currentColor 0 var(--gui), transparent var(--gui) calc(2 * var(--gui))); }
/* the row does not fit (app.js measures it): wordmark, GitHub and the menu button stay; the rest drops into a panel */
.top.compact { width: calc(100% - 32px); }
.top.compact .brand { margin-right: auto; }
.top.compact .menu { display: grid; }
.top.compact .drop { display: none; }
.top.compact.open .drop { display: flex; flex-direction: column; align-items: stretch; gap: calc(6 * var(--gui)); position: absolute; z-index: 25;
  left: 0; right: 0; top: calc(100% + 10px); padding: calc(9 * var(--gui) - 1px); background: var(--panel); border: 1px solid var(--line); }
.top.compact .nav { flex-direction: column; gap: 0; }
.top.compact .nav a { display: block; padding: calc(2 * var(--gui)) calc(2 * var(--gui)); }
.top.compact .look { margin: 0; flex-wrap: wrap; justify-content: space-between; }

/* type */
h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 700; margin: 0 0 16px; max-width: 18ch; }
h2 { font-size: 25px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 18px; margin: 0 0 4px; font-weight: 600; }
p { margin: 0 0 14px; max-width: 68ch; }
.lead { font-size: 19px; color: var(--soft); max-width: 62ch; }
.muted { color: var(--soft); }
.note { font-size: 14px; color: var(--faint); margin-top: 12px; }
section { padding: 52px 0; }
section + section { border-top: 1px solid var(--line); }

/* code */
code { font: 500 0.88em var(--mono); color: var(--fg); background: var(--code); padding: 1px 5px; border-radius: var(--radius); }
.snippet { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 6px 4px 14px; }
.code-name { font: 500 13px var(--mono); }
.copy { font-size: 13px; padding: 3px 10px; }
pre.code { margin: 0; padding: 16px 18px; font: 13.5px/1.6 var(--mono); overflow-x: auto; tab-size: 4; }
pre.code code { font: inherit; background: none; padding: 0; }
code, pre, pre.code { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
/* token colours come from the skin (--t-*); a skin that sets none leaves the text plain */
.k, .kd, .kn, .kr, .kc, .kp, .ow { color: var(--t-kw); font-weight: 700; }
.kt, .nc, .nn { color: var(--t-type); }
.nf, .fm, .nb, .nt { color: var(--t-name); }
.nd, .na, .no { color: var(--t-mark); }
.s, .sa, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss { color: var(--t-str); }
.m, .mb, .mf, .mh, .mi, .mo, .il, .l { color: var(--t-num); }
.c, .ch, .cm, .cp, .cpf, .c1, .cs { color: var(--t-comment); font-style: italic; }
.o, .nv, .vc, .vg, .vi { color: var(--t-op); }
.p { color: var(--t-punct); }

/* preview box: the render at GUI scale 3. data-component and data-variant mark it for a later
   script that may replace the picture with a live canvas. */
.stage { display: grid; place-items: center safe center; overflow: auto hidden; min-width: 0; width: fit-content; max-width: 100%; margin-inline: auto; padding: 12px; }
.hero-grid { width: fit-content; max-width: 100%; margin-inline: auto; }
.hero-grid #hero-stage .stage { margin: 0; }

/* home */
.hero { padding: 64px 0 36px; text-align: center; }
.hero h1 { max-width: none; margin-bottom: 18px; }
.hero .wordmark { display: block; font-size: clamp(56px, 10vw, 104px); line-height: 1; letter-spacing: -0.05em; }
.hero .tagline { display: block; font-size: clamp(24px, 3.4vw, 36px); font-weight: 600; letter-spacing: -0.02em; margin-top: 10px; }
.hero .lead { margin: 0 auto; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.cta .plate { text-decoration: none; padding: 8px 18px; font-weight: 600; font-size: 15px; }

/* home mosaic: one live minuit scene per tile, each at a whole number of device pixels per GUI pixel
   (172 GUI px wide; --tile, set by app.js, is the whole device-pixel scale nearest 2 CSS px per GUI pixel, and the
   columns take the tile's width); the outer columns repeat cards, faded, as edges
   that run off the page. Narrower, the ghosts go, then the three columns reflow into two, then one
   (column order kept), and a card drops a pixel scale step rather than stretch. */
.mosaic { --tile: 344px; display: flex; justify-content: center; align-items: flex-start; gap: 16px; overflow: hidden; padding: 8px 0 4px; overflow-anchor: none; }
.mosaic .col { flex: 0 0 var(--tile); min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mosaic .col:nth-child(3) { margin-top: 28px; }
.mosaic .ghost { opacity: 0.32; pointer-events: none; margin-top: 56px; }
.mosaic .stage.tile, :root[data-chrome="live"] .mosaic .stage.tile { padding: 0; margin: 0; width: 100%; background: none; border: 0; border-image: none; }
@media (max-width: 1100px) {
  .mosaic { display: block; columns: 2 var(--tile); column-gap: 16px; max-width: calc(2 * var(--tile) + 48px); margin-inline: auto; padding-inline: 16px; }
  .mosaic .col.ghost { display: none; }
  .mosaic .col { display: contents; }
  .mosaic .stage.tile, :root[data-chrome="live"] .mosaic .stage.tile { break-inside: avoid; max-width: var(--tile); margin: 0 auto 16px; }
}
.depend { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; margin-top: 18px; }
.depend h3 { font-size: 15px; color: var(--soft); font-weight: 500; }

/* catalogue */
.catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 24px; }
.card { display: grid; grid-template-rows: 190px auto; text-decoration: none; overflow: hidden; }
.card .thumb { display: grid; place-items: center; padding: 14px; min-height: 0; overflow: hidden; }
.card .thumb img { max-width: none; max-height: none; }
.card .meta { padding: 12px 14px 14px; }
.card .meta h3 { font-size: 15.5px; margin: 0 0 2px; }
.card .meta p { font-size: 14px; color: var(--soft); margin: 0; }
/* phones: two columns of small cards, the preview cropped at its top in a short box (still whole device
   pixels per GUI pixel, one scale step at least), the name wrapping anywhere */
@media (max-width: 560px) {
  .catalogue { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
  .card { grid-template-rows: 92px auto; }
  .card .thumb { padding: 8px; place-items: start center; }
  .card .meta { padding: 8px 10px 10px; }
  .card .meta h3 { font-size: 13px; overflow-wrap: break-word; }
  .card .meta p { font-size: 12.5px; line-height: 1.4; }
}

/* mods page: the logo is the whole card (no frame, no well); name and line sit on a scrim at the bottom.
   6px radius: the mod logos ship as rounded tiles on CurseForge and Modrinth, and 6px keeps that read
   without clashing with the square pixel frames of the default skin. */
.mods { --mod-r: 6px; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
:root main .mods.mods .card { display: block; position: relative; min-width: 0; aspect-ratio: 1; background: var(--r-well); border: 0; border-image: none; border-radius: var(--mod-r); box-shadow: none; overflow: hidden; image-rendering: auto; padding: 0; }
:root main .mods.mods .card .thumb { position: absolute; inset: 0; display: block; padding: 0; margin: 0; background: none; border: 0; border-image: none; border-radius: 0; box-shadow: none; }
:root main .mods.mods .card .thumb img.mod-logo { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; image-rendering: auto; }
:root main .mods.mods .card .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 64px 16px 14px; background: linear-gradient(to top, rgba(0,0,0,.9) 0, rgba(0,0,0,.78) 45%, rgba(0,0,0,.4) 75%, transparent); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
:root main .mods.mods .card .meta h3 { font-size: 16px; line-height: 1.25; margin: 0 0 4px; color: #fff; }
:root main .mods.mods .card .meta p { font-size: 13.5px; line-height: 1.4; margin: 0; color: rgba(255,255,255,.92); }
:root main .mods.mods .card.mod-add { background: none; border: 2px dashed var(--faint); color: var(--fg); }
:root main .mods.mods .card.mod-add:hover { border-color: var(--fg); }
:root main .mods.mods .card.mod-add .meta { background: none; color: var(--fg); text-shadow: none; }
:root main .mods.mods .card.mod-add .meta h3 { color: var(--fg); }
:root main .mods.mods .card.mod-add .meta p { color: var(--soft); }
:root main .mods.mods .mod-empty { position: absolute; inset: 0; display: grid; place-items: center; font: 700 56px/1 var(--mono); color: var(--faint); padding-bottom: 40px; }
@media (max-width: 560px) { .mods { grid-template-columns: repeat(2, minmax(0, 1fr)); } :root main .mods.mods .card .meta { padding: 36px 10px 9px; } :root main .mods.mods .card .meta h3 { font-size: 13px; margin-bottom: 2px; } :root main .mods.mods .card .meta p { font-size: 11.5px; line-height: 1.35; } :root main .mods.mods .mod-empty { font-size: 36px; } }

/* component page */
.doc { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 44px; padding-top: 40px; padding-bottom: 72px; }
.side { position: sticky; top: 84px; align-self: start; font-size: 14.5px; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side a { display: block; padding: 4px 10px; border-radius: var(--radius); text-decoration: none; color: var(--soft); }
.side a:hover { color: var(--fg); background: var(--panel); }
.side a[aria-current="page"] { color: var(--sel-fg); background: var(--sel); font-weight: 500; }
@media (max-width: 820px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .side { position: static; margin: 0 calc(-1 * var(--gut, 16px)); }
  .side ul { display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; padding: 0 var(--gut, 16px); scroll-padding: 0 var(--gut, 16px);
    mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); }
  .side ul::-webkit-scrollbar { display: none; }
  .side li { flex: none; scroll-snap-align: start; }
  .side a { padding: 6px 12px; white-space: nowrap; background: var(--panel); }
}
.doc h1 { font-size: clamp(26px, 4vw, 38px); max-width: none; }
.variant { margin-top: 36px; }
h2 + .variant { margin-top: 12px; }
.tabs { display: inline-flex; gap: 4px; margin: 10px 0; }
.tabs .plate { padding: 4px 14px; font-size: 13.5px; }

/* themes */
.families { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 18px; margin-top: 20px; }
.family { overflow: hidden; text-decoration: none; cursor: pointer; display: flex; flex-direction: column; }
.family .meta { flex: 1; }
.family .stage { width: auto; margin-inline: 0; padding: 14px; }
.family .meta { padding: 12px 14px; font-size: 14.5px; }
.family[aria-current="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }

/* accent row: "None" plate, then one square swatch per preset (fill set inline from the accents data) */
.acc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.acc-label { font-weight: 600; font-size: 14px; margin-right: 4px; }
.acc-sw { width: 30px; height: 30px; padding: 0; cursor: pointer; border: 1px solid var(--line); }
.acc-sw[aria-pressed="true"] { outline: 2px solid var(--fg); outline-offset: 2px; }
.table-wrap { overflow-x: auto; margin-top: 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--soft); font-size: 13.5px; }
tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; background: none; padding: 0; }
.sw { display: inline-block; width: 22px; height: 22px; vertical-align: middle; margin-right: 8px; position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .4);
  background-image: linear-gradient(45deg, #bbb 25%, transparent 25%, transparent 75%, #bbb 75%), linear-gradient(45deg, #bbb 25%, #fff 25%, #fff 75%, #bbb 75%);
  background-size: 8px 8px; background-position: 0 0, 4px 4px; }
.sw i { position: absolute; inset: 0; }
.hex { font: 12.5px var(--mono); color: var(--soft); }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--soft); }
footer .legal { margin: 8px 0 0; font-size: 12px; color: var(--faint); letter-spacing: .02em; }
.brand .accent, h1 .accent { color: var(--accent); }
.note.caption { text-align: center; }
.hero-grid .note.caption { text-align: right; margin-top: 8px; }

/* light or dark switch: live, the family's groove, glyph and knob (live.js) in a fixed 34 x 17 GUI box, with 3 GUI
   px of bleed outside it; the knob sits left for light, right for dark (15 x 15 live at x 2 or 17, y 1;
   the fallback's 11 x 11 at x 4 or 19, y 3). The flat groove
   and knob are the fallback before it loads. */
button.switch { position: relative; width: calc(34 * var(--gui)); height: calc(17 * var(--gui)); padding: 0; border: 0; background: none; cursor: pointer; flex: none; image-rendering: pixelated; }
button.switch::before { content: ""; position: absolute; left: calc(2 * var(--gui)); top: calc(1 * var(--gui)); width: calc(30 * var(--gui)); height: calc(15 * var(--gui)); background: var(--r-wellEdge); }
.switch-knob { position: absolute; left: calc(4 * var(--gui)); top: calc(3 * var(--gui)); width: calc(11 * var(--gui)); height: calc(11 * var(--gui)); background: var(--r-raised); transition: transform 140ms steps(6); }
button.switch[data-on="1"] .switch-knob { transform: translateX(calc(15 * var(--gui))); }
button.switch:disabled { cursor: default; opacity: 0.5; }
button.switch:focus-visible { outline: 2px solid var(--r-text); outline-offset: 3px; }
:root[data-chrome="live"] button.switch::before { left: calc(-3 * var(--gui)); top: calc(-3 * var(--gui)); width: calc(40 * var(--gui)); height: calc(23 * var(--gui)); background: var(--nine-switch-light) 0 0 / 100% 100% no-repeat; }
:root[data-chrome="live"] button.switch[data-on="1"]::before { background-image: var(--nine-switch-dark); }
:root[data-chrome="live"] .switch-knob { left: calc(-1 * var(--gui)); top: calc(-2 * var(--gui)); width: calc(21 * var(--gui)); height: calc(21 * var(--gui)); background: var(--nine-switch-knob) 0 0 / 100% 100% no-repeat; }
@media (prefers-reduced-motion: reduce) { .switch-knob { transition: none; } }
.rotate { display: inline-block; color: var(--accent, inherit); transition: opacity 220ms, transform 220ms; }
.rotate.out { opacity: 0.3; transform: translateY(-0.15em); }

.motion-pick { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
