/* questionkit.dev — drafting-sheet style */

:root {
  /* light-dark(light, dark): resolved from color-scheme below */
  --paper: light-dark(#F4EEE2, #142640);
  --shade: light-dark(#E6DFD0, #1C3352);
  --ink: light-dark(#1F3F6E, #D6E2F0);
  --ink-hover: light-dark(#3A6299, #FFFFFF);
  --text: light-dark(#2A2622, #EEE7D8);
  --body: light-dark(#3A342E, #D3CCBD);
  --muted: light-dark(#5E554B, #A3ADBB);
  --red: light-dark(#B4442A, #E58466);

  --line: light-dark(rgba(31, 63, 110, 0.45), rgba(214, 226, 240, 0.42));
  --line-strong: light-dark(rgba(31, 63, 110, 0.55), rgba(214, 226, 240, 0.55));
  --line-soft: light-dark(rgba(31, 63, 110, 0.3), rgba(214, 226, 240, 0.25));
  --grid: light-dark(rgba(31, 63, 110, 0.1), rgba(214, 226, 240, 0.08));

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 1160px;
  --gutter: 32px;
  --sheet-margin: 28px;
  --zone: 10px;

  color-scheme: light dark;
}

/* Theme: follows the system by default. The nav checkbox flips it,
   no JavaScript needed (it resets on reload). */
@media (prefers-color-scheme: light) {
  :root:has(#theme-toggle:checked) { color-scheme: dark; }
}
@media (prefers-color-scheme: dark) {
  :root:has(#theme-toggle:checked) { color-scheme: light; }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  padding: var(--sheet-margin);
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  position: relative;
  min-height: 100vh;
}

a { color: var(--ink); }
a:hover { color: var(--ink-hover); }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

code { font-family: var(--font-mono); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- sheet frame ---------- */

.crop {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 0 solid var(--ink);
}
.crop--tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
.crop--tr { top: 8px; right: 8px; border-top-width: 1px; border-right-width: 1px; }
.crop--bl { bottom: 8px; left: 8px; border-bottom-width: 1px; border-left-width: 1px; }
.crop--br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

.sheet {
  position: relative;
  border: 1px solid var(--line-strong);
  min-height: calc(100vh - 2 * var(--sheet-margin));
  display: flex;
  flex-direction: column;
}

.sheet__inner {
  /* Drafting paper: a faint 24px grid across the sheet, as on the docs site. */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  margin: 0 var(--zone);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.sheet__inner main { flex: 1; }

.zones {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  height: var(--zone);
  margin: 0 var(--zone);
}
.zones--top { border-bottom: 1px solid var(--line-soft); }
.zones--bottom { border-top: 1px solid var(--line-soft); }
.zones span { border-right: 1px solid var(--line-soft); }
.zones span:last-child { border-right: 0; }

.zones-side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--zone);
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.zones-side--left { left: 0; border-right: 1px solid var(--line-soft); }
.zones-side--right { right: 0; border-left: 1px solid var(--line-soft); }
.zones-side span { height: 1px; background: var(--line-soft); }

/* ---------- nav ---------- */

.nav {
  padding-top: 24px;
  padding-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--ink);
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 14px;
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
}

.nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.nav__links a {
  text-decoration: none;
  padding: 12px 0;
}
.nav__links a:hover { text-decoration: underline; text-underline-offset: 6px; }
.nav__links { align-items: center; }

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink-hover); }
.theme-toggle input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.theme-toggle:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- hero ---------- */

.hero {
  padding-top: 88px;
  padding-bottom: 112px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.hero__title {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* As wide as the title's longest line, so the dimension line under it measures the text. */
  width: fit-content;
  max-width: 100%;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.98;
  color: var(--ink);
}

.dim {
  display: flex;
  align-items: center;
  height: 14px;
  opacity: 0.6;
}
.dim svg { flex: 0 0 auto; display: block; }
.dim svg line { stroke: var(--ink); stroke-width: 1; }
.dim svg path { fill: var(--ink); }
.dim__line { flex: 1; height: 1px; background: var(--ink); }

.lede {
  margin: 0;
  max-width: 600px;
  font-size: 20px;
  line-height: 1.55;
  color: var(--body);
}

.lede--note {
  font-size: 16px;
  color: var(--muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  margin-top: 8px;
}

.install {
  font-size: 15px;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 12px 18px;
}

.install__note {
  color: var(--muted);
}

.mono-link {
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 12px 0;
}

/* ---------- kits ---------- */

.kits {
  padding-bottom: 112px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.section-head svg { fill: none; stroke: var(--ink); stroke-width: 1.1; }
.section-head h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
  gap: 24px;
}

.kit {
  border: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

.kit__strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
}

.kit__id {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* split detail bubble: number above a rule */
.bubble {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  letter-spacing: 0;
  line-height: 1;
  padding-top: 5px;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 15px;
  height: 1px;
  background: currentColor;
}

.kit__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  padding: 28px 24px;
}

.kit__drawing {
  flex: 0 0 150px;
  width: 150px;
  height: auto;
  display: block;
}

.kit__text {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kit__text h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  color: var(--ink);
}
.kit__text code {
  font-size: 13px;
  color: var(--muted);
}
.kit__text p {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
}

/* inlined part drawings */
.kit__drawing .ink { stroke: var(--ink); }
.kit__drawing .paper { fill: var(--paper); }
.kit__drawing .shade { fill: var(--shade); }
.kit__drawing .solid { fill: var(--ink); }
.kit__drawing .red { stroke: var(--red); }
.kit__drawing .red-fill { fill: var(--red); }

.kit--prelim { border-style: dashed; border-color: var(--red); }
.kit--prelim .kit__strip { border-bottom: 1px dashed var(--red); color: var(--red); }
.kit--prelim .bubble { border-style: dashed; }
.kit--prelim .kit__text code { color: var(--red); }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line-strong); }

.footer__row {
  padding-top: 20px;
  padding-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
}
.footer__links { display: flex; gap: 24px; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  :root { --gutter: 16px; --sheet-margin: 16px; }
  .crop { display: none; }
  .hero { padding-top: 48px; padding-bottom: 72px; }
  .kits { padding-bottom: 72px; }
  .kit__body { padding: 20px 16px; gap: 20px; }
}
