/* Questions For. — a reference on a shelf, so it reads like paper and follows
   the system into dark when the system goes there. */

:root {
  color-scheme: light dark;
  --paper: #F7F4ED;
  --paper-2: #FFFDF8;
  --ink: #1B1811;
  --dim: #6B6355;
  --faint: #9A9184;
  --rule: #1b18111c;
  --accent: #B4462A;
  --accent-soft: #b4462a14;
  --serif: "Spectral", ui-serif, Georgia, serif;
  --ui: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15140F;
    --paper-2: #1D1B15;
    --ink: #F2EEE4;
    --dim: #A79E8E;
    --faint: #6E6656;
    --rule: #f2eee41f;
    --accent: #E8895C;
    --accent-soft: #e8895c1a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.view {
  max-width: 47rem;
  margin: 0 auto;
  padding: 24px 20px calc(60px + env(safe-area-inset-bottom));
  animation: rise .28s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.015em; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ── the sentence that is also the search box ─────────────────────────── */

.mast { padding: 6vh 0 3vh; }
.sentence {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.1rem, 8.5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -.03em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .35em;
}
.blankwrap { flex: 1 1 7em; min-width: 6em; position: relative; }
.blankwrap::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: .08em;
  border-bottom: 2px solid var(--accent);
  opacity: .5;
}
#q {
  width: 100%;
  font: inherit;
  font-style: italic;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0 .06em .06em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#q::placeholder { color: var(--faint); font-style: italic; }
#q::-webkit-search-cancel-button { -webkit-appearance: none; }
.blankwrap:focus-within::after { opacity: 1; }

.lede {
  margin: 22px 0 0;
  max-width: 34rem;
  color: var(--dim);
  font-size: .98rem;
  line-height: 1.6;
}

/* ── shelves ──────────────────────────────────────────────────────────── */

.quicknav { display: flex; flex-wrap: wrap; gap: 7px; margin: 30px 0 8px; }
.navchip {
  text-decoration: none;
  font-size: .8rem; font-weight: 500;
  padding: 6px 13px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--dim);
}
.navchip:hover { border-color: var(--accent); color: var(--accent); }

.shelf { margin-top: 38px; scroll-margin-top: 20px; }
.shelfhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.shelfhead h2 { font-size: 1.3rem; }
.shelfhead p { margin: 0; color: var(--faint); font-size: .84rem; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column;
  text-decoration: none;
  padding: 16px 17px 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper-2);
  transition: border-color .16s ease, transform .16s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { font-size: 1.16rem; font-weight: 600; line-height: 1.2; }
.card h3::first-letter { text-transform: capitalize; }
.cardblurb { margin: 8px 0 0; color: var(--dim); font-size: .86rem; line-height: 1.5; flex: 1; }
.cardfoot {
  margin: 13px 0 0;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
}

/* ── search results ───────────────────────────────────────────────────── */

.results { margin-top: 34px; }
.resh {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  font-family: var(--ui); font-weight: 700;
  color: var(--faint);
  margin: 26px 0 12px;
}
.results .resh:first-child { margin-top: 0; }
.nothing { color: var(--dim); font-size: .95rem; line-height: 1.6; }

.qhits { list-style: none; padding: 0; margin: 0; }
.qhits li { border-bottom: 1px solid var(--rule); }
.qhit { display: block; text-decoration: none; padding: 12px 2px; }
.qhit .qtext { display: block; font-family: var(--serif); font-size: 1.02rem; line-height: 1.35; }
.qhit .qfrom { display: block; margin-top: 4px; font-size: .74rem; color: var(--faint); }
.qhit:hover .qtext { color: var(--accent); }

/* ── bars, chips ──────────────────────────────────────────────────────── */

.bar { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.back { color: var(--dim); font-size: .86rem; padding: 6px 0; }
.back::before { content: "← "; }
.back:hover { color: var(--accent); }
.tools { margin-left: auto; display: flex; gap: 7px; }
.chip {
  font-size: .8rem; font-weight: 500;
  padding: 7px 13px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--dim);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.danger:hover { border-color: #C0392B; color: #C0392B; }

/* ── a stack ──────────────────────────────────────────────────────────── */

.stackhead { margin-bottom: 34px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700;
  color: var(--accent);
}
.stackhead h1 {
  font-weight: 600;
  font-size: clamp(2rem, 7.5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.03em;
}
.stackhead h1 .thin { font-weight: 300; color: var(--dim); }
.blurb { margin: 16px 0 0; color: var(--dim); font-size: 1rem; line-height: 1.6; max-width: 34rem; }

.runbtn {
  margin-top: 22px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper-2);
  font-weight: 600; font-size: .95rem;
}
.runbtn:hover { filter: brightness(1.08); }

.movement { margin-bottom: 34px; }
.movehead { display: flex; align-items: baseline; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.movehead h2 { font-size: 1.05rem; font-weight: 600; }
.mnum {
  font-family: var(--ui); font-size: .68rem; font-weight: 700;
  width: 19px; height: 19px; flex: none;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

.qrow {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--rule);
}
.qrow:last-child { border-bottom: 0; }
.qrow .qtext {
  flex: 1; margin: 0;
  font-family: var(--serif); font-size: 1.08rem; line-height: 1.4;
}
.qrow.on .qtext { color: var(--accent); }
.starbtn {
  flex: none;
  font-size: 1rem; line-height: 1;
  padding: 3px 4px;
  color: var(--rule);
  transition: color .15s ease, transform .15s ease;
}
.starbtn:hover { color: var(--accent); transform: scale(1.15); }
.qrow.on .starbtn { color: var(--accent); }

.keptheadrow { margin-top: 28px; }
.kepthead { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; text-decoration: none; }
.kepthead:hover { color: var(--accent); }

.tail { margin-top: 30px; color: var(--faint); font-size: .8rem; }

/* ── run ──────────────────────────────────────────────────────────────── */

#v-run { display: flex; flex-direction: column; min-height: 100dvh; }
#v-run .bar { margin-bottom: 0; }
.counter { margin-left: auto; font-size: .8rem; color: var(--faint); font-variant-numeric: tabular-nums; }

.runbody { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 6vh 0; }
.runbody .eyebrow { margin-bottom: 18px; }
.bigq {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.7rem, 6.6vw, 2.9rem);
  line-height: 1.18;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.runfoot { padding-top: 10px; }
.dots { display: flex; gap: 3px; margin-bottom: 18px; }
.dot { height: 3px; flex: 1; background: var(--rule); border-radius: 2px; }
.dot.done { background: var(--dim); }
.dot.now { background: var(--accent); }
.dot.first { margin-left: 7px; }
.dot.first:first-child { margin-left: 0; }

.runctl { display: flex; align-items: center; gap: 10px; }
.ghost {
  width: 52px; height: 52px; flex: none;
  border: 1px solid var(--rule); border-radius: 999px;
  font-size: 1.1rem;
}
.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ghost:disabled { opacity: .3; cursor: default; }
#r-next { width: auto; min-width: 52px; padding: 0 18px; }
.star {
  flex: 1;
  padding: 15px;
  border: 1px solid var(--rule); border-radius: 999px;
  font-weight: 600; font-size: .95rem;
  color: var(--dim);
}
.star:hover { border-color: var(--accent); color: var(--accent); }
.star.on { background: var(--accent); border-color: var(--accent); color: var(--paper-2); }

/* ── about ────────────────────────────────────────────────────────────── */

.prose p { color: var(--dim); font-size: 1rem; line-height: 1.7; margin: 0 0 18px; max-width: 36rem; }
.prose h2 { font-size: 1.2rem; margin: 30px 0 12px; }
.prose b { color: var(--ink); font-weight: 600; }
.prose i { font-style: italic; color: var(--ink); }
.prose a { color: var(--accent); }
.colophon { font-size: .86rem !important; color: var(--faint) !important; margin-top: 34px !important; }

/* ── footer + toast ───────────────────────────────────────────────────── */

.bottom {
  margin-top: 52px; padding-top: 18px;
  border-top: 1px solid var(--rule);
  color: var(--faint); font-size: .8rem;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
}
.link { color: var(--dim); font-size: .8rem; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--accent); }
.sep { opacity: .5; }

.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top));
  transform: translateX(-50%);
  padding: 11px 18px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: .86rem; font-weight: 500;
  box-shadow: 0 14px 40px -14px #0009;
  z-index: 10;
  animation: toastin .24s ease both;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ── print: one stack as sixteen cut-out cards ────────────────────────── */

.printsheet { display: none; }

@media print {
  body { background: #fff; color: #000; }
  .view, .toast { display: none !important; }
  .printsheet { display: block; }
  @page { margin: 12mm; }

  .printtitle {
    font-family: var(--serif); font-size: 12pt; margin-bottom: 6mm;
    letter-spacing: .02em;
  }
  .printgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .printcard {
    border: 1px dashed #999;
    margin: -0.5px 0 0 -0.5px;
    padding: 8mm 7mm;
    height: 42mm;
    display: flex; flex-direction: column;
    break-inside: avoid;
  }
  .printcard p {
    flex: 1;
    margin: 4mm 0 0;
    font-family: var(--serif); font-size: 11pt; line-height: 1.3;
  }
  .pcnum {
    font-family: var(--ui); font-size: 6.5pt; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase; color: #555;
  }
  .pcfoot {
    font-family: var(--ui); font-size: 6.5pt; color: #999;
    letter-spacing: .08em;
  }
}
