/* Remakecraft site. Greyscale plus the two brand colours, used with one meaning each:
   silver = the original and everything on the room side, teal = the remake and the clean side. */

:root {
  --bg: #f7f7f6;
  --bg-sunk: #eeeeed;
  --ink: #161616;
  --ink-2: #4d4d4d;
  --ink-3: #6e6e6e;
  --rule: #dcdcdb;
  --rule-strong: #bdbdbc;
  --silver: #c0c0c0;
  --teal: #008080;
  --teal-ink: #006d6d;
  --room-wash: #e9e9e8;
  --clean-wash: #e3efee;
  --px-edge: #111;
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --measure: 42rem;
  --wide: 68rem;
  --gutter: 1rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #19191a;
    --bg-sunk: #202022;
    --ink: #ececeb;
    --ink-2: #b9b9b8;
    --ink-3: #8f8f8e;
    --rule: #2e2e30;
    --rule-strong: #47474a;
    --teal-ink: #4fb9b9;
    --room-wash: #222224;
    --clean-wash: #172524;
    --px-edge: #4a515c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #19191a;
  --bg-sunk: #202022;
  --ink: #ececeb;
  --ink-2: #b9b9b8;
  --ink-3: #8f8f8e;
  --rule: #2e2e30;
  --rule-strong: #47474a;
  --teal-ink: #4fb9b9;
  --room-wash: #222224;
  --clean-wash: #172524;
  --px-edge: #4a515c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font);
  font-feature-settings: "ss01", "tnum" 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---------- pixel art ---------- */
.px, .pximg { image-rendering: pixelated; shape-rendering: crispEdges; display: block; flex: none; }
.px-wall .edge g,
.px-blit-sleeping .edge g,
.px-blit-confused .edge g { fill: var(--px-edge); }
.px[class*="px-phase-"] g[fill="#111"] { fill: var(--px-edge); }
.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-dark { display: block; }
  :root:not([data-theme="light"]) .on-light { display: none; }
}
:root[data-theme="dark"] .on-dark { display: block; }
:root[data-theme="dark"] .on-light { display: none; }

/* ---------- type ---------- */
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.375rem, 1.6rem + 3.4vw, 3.75rem); letter-spacing: -0.03em; font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); letter-spacing: -0.02em; }
h3 { font-size: 1.1875rem; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 1em; }
.lede { font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.375rem); line-height: 1.5; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: 0.9375rem; }
strong { font-weight: 600; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--teal); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }

code, kbd, pre { font-family: var(--mono); font-size: 0.875em; }
:not(pre) > code { background: var(--bg-sunk); padding: 0.1em 0.35em; border-radius: 3px; overflow-wrap: anywhere; }

/* ---------- layout ---------- */
.wrap { max-width: calc(var(--measure) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: 4.5rem 0; }
.section > * + * { margin-top: 1.25rem; }
.section h2 + p { margin-top: 0.875rem; }
.page-head { padding-block: 4rem 0; }
.page-head h1 { font-size: clamp(2.25rem, 1.7rem + 2.4vw, 3.25rem); }
.page-head .lede { margin-top: 1rem; }
main { padding-bottom: 6rem; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 0.5rem 0.75rem; z-index: 10; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.top-in { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding: 0.75rem var(--gutter); display: flex; align-items: center; gap: 2rem; }
.brand { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand .px { width: 32px; height: 32px; }
.nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; }
.nav a, .gh { text-decoration: none; color: var(--ink-2); }
.nav a:hover, .gh:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: 0.45em; }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: 0.9375rem; }
.theme { appearance: none; border: 1px solid var(--rule-strong); background: none; color: var(--ink); width: 2.25rem; height: 2.25rem; display: grid; place-items: center; border-radius: 6px; cursor: pointer; }
.theme:hover { border-color: var(--ink-3); }
.theme svg { image-rendering: pixelated; }

@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; row-gap: 0.25rem; padding-block: 0.625rem 0.5rem; }
  .nav { order: 3; width: 100%; gap: 1.125rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.25rem; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}

/* ---------- hero ---------- */
.hero { padding-block: 5rem 0; }
.wordmark { width: 576px; height: 100px; }
.wordmark img { width: 576px; height: 100px; image-rendering: pixelated; }
.hero h1 { margin-top: 3rem; max-width: 14ch; }
.hero .lede { margin-top: 1.25rem; max-width: 36rem; }
.hero .cmd { margin-top: 2.25rem; max-width: 36rem; }
.hero-links { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.9375rem; color: var(--ink-3); }
@media (max-width: 640px) {
  .hero { padding-top: 3rem; }
  .wordmark, .wordmark img { width: 288px; height: 50px; }
  .hero h1 { margin-top: 2rem; }
}

/* ---------- commands ---------- */
.cmd { position: relative; background: var(--bg-sunk); border: 1px solid var(--rule); border-radius: 8px; }
.cmd pre { margin: 0; padding: 1rem 5rem 1rem 1.125rem; overflow-x: auto; line-height: 1.75; }
.cmd code { font-size: 0.875rem; }
.cmd .p { color: var(--ink-3); user-select: none; }
.copy { position: absolute; top: 0.625rem; right: 0.625rem; appearance: none; font: 500 0.8125rem var(--font); color: var(--ink-2); background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 5px; padding: 0.25rem 0.625rem; cursor: pointer; }
.copy:hover { color: var(--ink); border-color: var(--ink-3); }
.cmd-label { font-size: 0.875rem; color: var(--ink-3); margin-bottom: 0.5rem; }

/* ---------- demo slot ---------- */
.demo { margin-top: 4rem; }
.demo-frame { aspect-ratio: 16 / 9; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--bg-sunk); display: grid; place-items: center; align-content: center; gap: 1rem; text-align: center; padding: 1.5rem; }
.demo-frame .px { width: 96px; height: 88px; }
.demo-frame p { color: var(--ink-3); font-size: 0.9375rem; max-width: 28rem; }
.demo figcaption { margin-top: 0.875rem; font-size: 0.9375rem; color: var(--ink-2); max-width: var(--measure); }

/* ---------- side markers (room / clean) ---------- */
.side { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap; }
.side::before { content: ""; width: 10px; height: 10px; background: var(--silver); flex: none; }
.side.clean::before { background: var(--teal); }

/* ---------- phase list ---------- */
.phases { list-style: none; padding: 0; margin: 2rem 0 0; border-top: 1px solid var(--rule); counter-reset: ph; }
.phases > li { display: grid; grid-template-columns: 28px 9.5rem 1fr auto; gap: 0 1.25rem; align-items: center; padding: 0.875rem 0; border-bottom: 1px solid var(--rule); }
.phases .px { width: 28px; height: 28px; }
.phases .name { font-weight: 600; }
.phases .name span { color: var(--ink-3); font-weight: 400; margin-right: 0.5rem; font-variant-numeric: tabular-nums; }
.phases .what { color: var(--ink-2); font-size: 0.9375rem; }
.phases > li.gate { position: relative; }
.phases .gate-note { grid-column: 2 / -1; font-size: 0.875rem; color: var(--teal-ink); font-weight: 500; margin-top: 0.25rem; }
@media (max-width: 640px) {
  .phases > li { grid-template-columns: 28px 1fr auto; row-gap: 0.25rem; }
  .phases .what { grid-column: 2 / -1; grid-row: 2; }
  .phases .gate-note { grid-column: 2 / -1; }
}

/* ---------- the wall band ---------- */
.wallband { margin-top: 4.5rem; border-block: 1px solid var(--rule); background: linear-gradient(90deg, var(--room-wash) 50%, var(--clean-wash) 50%); }
.wallband-in { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding: 3.5rem var(--gutter); display: grid; grid-template-columns: 1fr auto 1fr; gap: 2.5rem; align-items: center; }
.wallband .px-wall { width: 354px; height: 126px; }
.tree-title { font-size: 1.0625rem; font-weight: 600; }
.tree code.path { display: inline-block; margin-top: 0.25rem; background: none; padding: 0; color: var(--ink-3); font-size: 0.875rem; }
.tree ul { margin: 0.875rem 0 0; padding: 0; list-style: none; font-size: 0.9375rem; color: var(--ink-2); }
.tree li + li { margin-top: 0.25rem; }
.tree.room { text-align: right; }
.wallband-head { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding: 0 var(--gutter); }
@media (max-width: 900px) {
  .wallband { background: var(--room-wash); }
  .wallband-in { grid-template-columns: 1fr; gap: 1.5rem; padding-block: 2.5rem 0; }
  .tree.room { text-align: left; }
  .wallband .px-wall { justify-self: start; }
  .tree.clean { background: var(--clean-wash); margin-inline: calc(-1 * var(--gutter)); padding: 1.5rem var(--gutter) 2.5rem; }
}

/* ---------- log ---------- */
.log { background: var(--bg-sunk); border: 1px solid var(--rule); border-radius: 8px; margin: 0; padding: 1rem 1.125rem; overflow-x: auto; font-size: 0.8125rem; line-height: 1.7; }
.log .k { color: var(--ink-3); }
.log .deny { color: var(--teal-ink); }
.log-entry + .log-entry { margin-top: 0.875rem; padding-top: 0.875rem; border-top: 1px dashed var(--rule-strong); }
.log-caption { font-size: 0.875rem; color: var(--ink-3); }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; margin-top: 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; vertical-align: top; padding: 0.75rem 1rem 0.75rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; font-size: 0.8125rem; color: var(--ink-3); border-bottom-color: var(--rule-strong); }
td:last-child, th:last-child { padding-right: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.rec td:first-child { font-weight: 600; }
.ph { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap; }

/* ---------- score ---------- */
.score { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 2.5rem; align-items: end; margin-top: 2rem; padding: 2rem 0; border-block: 1px solid var(--rule); }
.score-num { font-size: clamp(3rem, 2rem + 5vw, 5.5rem); font-weight: 700; letter-spacing: -0.04em; line-height: 0.9; font-variant-numeric: tabular-nums; }
.score-num .ph { font-size: 0.875rem; letter-spacing: 0; vertical-align: middle; }
.score dl { margin: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 0.25rem 2rem; justify-content: start; }
.score dt { font-size: 0.8125rem; color: var(--ink-3); }
.score dd { margin: 0; grid-row: 2; font-weight: 600; }
@media (max-width: 640px) {
  .score { grid-template-columns: 1fr; }
  .score dl { grid-template-columns: 1fr 1fr; }
  .score dd { grid-row: auto; margin-bottom: 0.5rem; }
}

/* ---------- prose blocks ---------- */
.steps { list-style: none; padding: 0; margin: 1.5rem 0 0; counter-reset: st; }
.steps > li { counter-increment: st; position: relative; padding-left: 2.75rem; }
.steps > li + li { margin-top: 2rem; }
.steps > li::before { content: counter(st); position: absolute; left: 0; top: 0.05rem; width: 1.75rem; height: 1.75rem; display: grid; place-items: center; font-size: 0.875rem; font-weight: 600; border: 1px solid var(--rule-strong); border-radius: 50%; color: var(--ink-2); }
.steps h3 + * { margin-top: 0.5rem; }
.steps .cmd { margin-top: 0.875rem; }
.bullets { padding-left: 1.25rem; margin: 1rem 0 0; }
.bullets li + li { margin-top: 0.5rem; }
.bullets li::marker { color: var(--ink-3); }

.phase-detail { display: grid; grid-template-columns: 56px 1fr; gap: 0 1.5rem; padding-block: 2.5rem; border-bottom: 1px solid var(--rule); }
.phase-detail .px { width: 56px; height: 56px; }
.phase-detail h2 { font-size: 1.5rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.phase-detail h2 .n { color: var(--ink-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.phase-detail .meta { margin-top: 0.75rem; display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.25rem 1rem; font-size: 0.9375rem; }
.phase-detail .meta dt { color: var(--ink-3); }
.phase-detail .meta dd { margin: 0; color: var(--ink-2); }
.phase-detail .body { margin-top: 1rem; }
.phase-detail .body > * + * { margin-top: 0.875rem; }
.bookend { padding-block: 2rem; border-bottom: 1px solid var(--rule); color: var(--ink-2); }
.bookend h2 { font-size: 1.1875rem; color: var(--ink); margin-bottom: 0.5rem; }
@media (max-width: 640px) {
  .phase-detail { grid-template-columns: 1fr; }
  .phase-detail .px { width: 42px; height: 42px; margin-bottom: 1rem; }
}

.callout { position: relative; padding-left: 1.5rem; color: var(--ink-2); }
.callout::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 10px; height: 10px; background: var(--teal); }
.callout strong { color: var(--ink); }

.faq { margin-top: 2rem; }
.faq > div { padding-block: 1.75rem; border-top: 1px solid var(--rule); }
.faq h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
.faq h2 a { text-decoration: none; }
.faq h2 + * { margin-top: 0.625rem; }
.faq p, .faq li { color: var(--ink-2); }

.next { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9375rem; }
.next a { text-decoration: none; }
.next a span { display: block; color: var(--ink-3); font-size: 0.8125rem; }
.next a strong { text-decoration: underline; text-decoration-color: var(--teal); text-underline-offset: 0.2em; }
.next .fwd { text-align: right; margin-left: auto; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--rule); }
.foot-in { max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding: 2rem var(--gutter) 3rem; font-size: 0.875rem; color: var(--ink-3); display: flex; justify-content: space-between; gap: 1rem 3rem; flex-wrap: wrap; }
.foot-in p:first-child { max-width: 34rem; }
.foot-links { display: flex; gap: 1.25rem; flex-wrap: wrap; margin: 0 !important; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- fixes after first screenshots ---------- */
figure { margin: 0; }
.cmd.fit { width: fit-content; max-width: 100%; }
@media (max-width: 640px) {
  table.stack thead { position: absolute; left: -999px; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
  table.stack td { border: 0; padding: 0.125rem 0; }
  table.stack td[data-l]::before { content: attr(data-l); display: block; font-size: 0.8125rem; color: var(--ink-3); margin-top: 0.5rem; }
  table.stack td:first-child { font-weight: 500; }
}
@media (max-width: 640px) {
  .cmd pre { padding: 1rem 1.125rem 3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
  .theme { width: 2.75rem; height: 2.75rem; }
  .copy { top: auto; bottom: 0.625rem; }
  .log { white-space: pre-wrap; overflow-wrap: anywhere; }
}
table.sheet caption { text-align: left; font-weight: 600; font-size: 1.0625rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--rule-strong); }
table.sheet th { width: 11rem; font-size: 0.9375rem; font-weight: 400; color: var(--ink-3); border-bottom-color: var(--rule); }
@media (min-width: 1080px) {
  .hero { display: grid; grid-template-columns: minmax(0, 33rem) minmax(0, 1fr); column-gap: 4rem; align-items: start; }
  .hero > * { grid-column: 1; }
  .hero .wordmark { grid-column: 1 / -1; }
  .hero .demo { grid-column: 2; grid-row: 2 / span 4; margin-top: 3.5rem; }
  .hero .cmd { max-width: none; }
}
