/* guide.css — layout for the style guide (/style-guide.html).
 *
 * The page loads the stylesheets it documents (style.css, blog.css, pages.css, home.css, lists.css)
 * and its specimens use their classes unchanged. This file only lays out the page around them.
 * The two .stock panels need paper and night stock on screen together, so they carry a fallback copy
 * of the style.css colour tokens; a script on the page refreshes them from the live file. */

/* ── Page frame: contents rail + sections ────────────────────────────────── */
.guide {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0 clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  margin-top: 2.6rem;
}
.toc {
  position: sticky;
  top: 1.6rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.toc-label { margin: 0 0 0.8rem; color: var(--fg-3); }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line-strong); }
.toc li { margin: 0; }
.toc a {
  display: block;
  margin-left: -1px;
  padding: 0.42rem 0 0.42rem 0.9rem;
  border-left: 2px solid transparent;
  color: var(--fg-2);
  text-decoration: none;
}
.toc a:hover { color: var(--head); border-left-color: var(--coral); text-decoration: none; }

.g-sec { margin-bottom: 5rem; scroll-margin-top: 1.4rem; min-width: 0; }
.g-sec > p, .g-sec > ul, .g-sec > ol { max-width: 46rem; }
.g-sec > h3 {
  margin: 2.8rem 0 0.7rem;
  font-size: 1.4rem;
  font-weight: 600;
}
.g-sec > h3 + p { margin-top: 0; }
.stocks + p { margin-top: 1.8rem; }
.g-sec code { font-size: 0.8em; }
.g-intro { font-size: 1.08rem; color: var(--fg-2); }

/* ── Specimen frames ─────────────────────────────────────────────────────── */
.spec { margin: 1.4rem 0 2.2rem; }
.spec-label {
  margin: 0 0 0.55rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.spec-stage {
  position: relative;
  padding: 1.4rem 1.5rem 1.6rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  min-width: 0;
}
.spec-stage > :first-child { margin-top: 0; }
.spec-stage > :last-child { margin-bottom: 0; }
.spec details { margin-top: 0.6rem; }
.spec summary {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.spec pre { margin: 0.7rem 0 0; font-size: 0.74rem; }
.spec-note { margin: 0.7rem 0 0; font-size: 0.93rem; color: var(--fg-2); max-width: 46rem; }

/* ── Inks: paper and night stock side by side ────────────────────────────── */
.stocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; margin: 1.8rem 0 0.4rem; }
.stock {
  padding: 1.3rem 1.3rem 1.5rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}
.stock h3 {
  margin: 0 0 1rem;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-ink);
}
.stock--paper {
  --bg: #f5f0e8; --bg-2: #ebe4d6; --fg: #1e2a4a; --fg-2: #454e6b; --fg-3: #66604f; --head: #2b3a67;
  --line: #d5cfc3; --line-strong: #bdb5a4; --indigo: #2b3a67; --coral: #cf6853; --sage: #7a9e7e; --sage-ink: #4a6f4e;
}
.stock--night {
  --bg: #10172b; --bg-2: #18213d; --fg: #e8e2d4; --fg-2: #c9c3b4; --fg-3: #a8a291; --head: #b3bff0;
  --line: #2b3555; --line-strong: #3b476e; --indigo: #b3bff0; --coral: #f08a73; --sage: #9fc7a3; --sage-ink: #9fc7a3;
}
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin: 0; padding: 0; list-style: none; }
.swatches li { margin: 0; min-width: 0; }
.sw {
  display: block;
  height: 4.4rem;
  margin-bottom: 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
}
.swatches b { display: block; font-family: var(--f-display); font-size: 1rem; font-weight: 600; color: var(--head); }
.swatches code { display: block; padding: 0; background: none; font-size: 0.7rem; color: var(--fg-3); }
.swatches small { display: block; font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.03em; color: var(--fg-3); }
.swatches--small .sw { height: 2.6rem; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.tbl-wrap { margin: 1.4rem 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap table { margin: 0; min-width: 40rem; font-size: 0.9rem; }
.tbl-wrap td code, .tbl-wrap th code { white-space: nowrap; }
.tok-sw { display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.45em; vertical-align: -0.05em; border: 1px solid var(--line-strong); border-radius: 2px; }
.tok-group td { padding-top: 1.4rem; font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sage-ink); border-bottom: 2px solid var(--line-strong); }
.num { font-family: var(--f-mono); font-size: 0.8rem; white-space: nowrap; }

/* ── Type ────────────────────────────────────────────────────────────────── */
.faces { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin: 1.6rem 0; }
.face { margin: 0; padding: 1.2rem 1.3rem 1.4rem; border: 1px solid var(--line-strong); border-radius: 3px; }
.face-sample { margin: 0 0 0.6rem; font-size: 4.4rem; line-height: 1; color: var(--head); }
.face-sample--display { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.03em; text-shadow: 0.04em 0.03em 0 var(--coral-a); }
.face-sample--text { font-family: var(--f-text); font-weight: 400; }
.face-sample--mono { font-family: var(--f-mono); font-weight: 500; font-size: 3.6rem; letter-spacing: -0.04em; }
.face h3 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.face p { margin: 0 0 0.6rem; font-size: 0.93rem; line-height: 1.5; color: var(--fg-2); }
.face code { font-size: 0.72rem; }

.scale { margin: 1.6rem 0; border-top: 2px solid var(--head); }
.scale-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 0.6rem 2rem;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.scale-sample { min-width: 0; overflow: hidden; }
.scale-sample > * { margin: 0 !important; }
.scale-sample .page-head { padding: 0; border: 0; }
.scale-sample .page-head::after { display: none; }
.scale-spec { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--fg-2); }
.scale-spec dt { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 0.2rem; }
.scale-spec dd { margin: 0; }

/* ── Print devices ───────────────────────────────────────────────────────── */
.ink-bar {
  height: 5px;
  background: linear-gradient(90deg, var(--indigo) 0 33.34%, var(--coral) 33.34% 66.67%, var(--sage) 66.67% 100%);
}
.mis .wordmark { font-size: clamp(3.4rem, 9vw, 6.4rem); }
.grain-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grain-demo { height: 6.5rem; background: var(--bg) var(--grain); border: 1px solid var(--line-strong); border-radius: 3px; }
/* three offset layers of the same texture, so the specks are easy to see */
.grain-demo--deep {
  background:
    var(--grain) 0 0 / 220px 220px,
    var(--grain) 70px 40px / 220px 220px,
    var(--grain) 130px 110px / 220px 220px,
    var(--bg);
}
.reg-demo { height: 6.4rem; overflow: hidden; }
.reg-demo .page-head { height: 100%; padding: 0; border: 0; }
.reg-demo .page-head::after { top: 0.9rem; right: auto; left: 1.2rem; width: 64px; height: 64px; }
.sigil-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.sigil-box { width: 9.5rem; aspect-ratio: 4 / 3; border-radius: 2px; overflow: hidden; }
.sigil-row figure { margin: 0; }
.sigil-row figcaption { margin-top: 0.4rem; }
.spec-article { padding: 0.3rem 0 0; }
.spec-article h2 { margin-bottom: 0; }
.spec-article .post-meta { margin-bottom: 0.4rem; }

/* ── Components ──────────────────────────────────────────────────────────── */
.spec-stage .topbar { margin-top: 0; }
.spec-stage .year-group { margin-top: 0; }
.spec-stage .feature { margin-top: 0; padding-bottom: 0; border-bottom: 0; }
.spec-stage .page-head { padding-top: 0.4rem; }
.spec-stage .page-head h1 { font-size: clamp(2.4rem, 1.4rem + 4vw, 4.2rem); }
.spec-stage .page-head--art { padding-bottom: 1.6rem; }
.spec-stage .page-head--art .head-art { max-width: 20rem; }
.spec-stage .plate { max-width: 100%; }
.spec-stage footer { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1rem; }
.attr-table td:first-child { white-space: nowrap; }

/* ── Image generation ────────────────────────────────────────────────────── */
.plates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; margin: 1.6rem 0; }
.plates figure { margin: 0; }
.plates img { display: block; width: 100%; height: auto; background: var(--plate); box-shadow: var(--shadow); border-radius: 2px; }
.prompt {
  margin: 0 0 1.4rem;
  padding: 1.1rem 1.3rem 1.2rem;
  max-width: 52rem;
  background: var(--bg-2);
  border-left: 3px solid var(--indigo);
  border-radius: 0 3px 3px 0;
  font-size: 0.95rem;
  line-height: 1.55;
}
.prompt .label {
  margin: 0 0 0.45rem;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--head);
}
.prompt p { margin: 0; }
.prompt--night { border-left-color: var(--coral); }

.guidance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; margin: 1.6rem 0; }
.do, .dont { padding: 1.1rem 1.3rem 1.2rem; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--bg-2); }
.do { border-top: 4px solid var(--sage); }
.dont { border-top: 4px solid var(--coral); }
.do h3, .dont h3 { margin: 0 0 0.6rem; font-family: var(--f-mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; }
.do h3 { color: var(--sage-ink); }
.dont h3 { color: var(--link); }
.do ul, .dont ul { margin: 0; padding-left: 1.2rem; font-size: 0.95rem; }
.do li, .dont li { margin-bottom: 0.45rem; }
.guidance-label { margin: 2rem 0 0; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-3); }

.sources { margin: 1.4rem 0 0; padding: 0; list-style: none; border-top: 2px solid var(--head); }
.sources li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0 1.2rem; margin: 0; padding: 0.8rem 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.sources a { font-family: var(--f-mono); font-size: 0.8rem; }

/* ── Narrow screens ──────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .guide { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; margin-bottom: 2.2rem; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; border-left: 0; }
  .toc a { margin: 0; padding: 0.2rem 0; border-left: 0; border-bottom: 2px solid transparent; }
  .toc a:hover { border-bottom-color: var(--coral); }
  .faces { grid-template-columns: minmax(0, 1fr); }
  .scale-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .stocks, .plates, .guidance { grid-template-columns: minmax(0, 1fr); }
  .swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec-stage { padding: 1rem; }
  .sources li { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
}

/* ── Section titles ──────────────────────────────────────────────────────── */
.g-sec > .section-label { margin-bottom: 0.9rem; }
.g-title {
  margin: 0 0 1.1rem;
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.026em;
}
.g-sec > .section-label { max-width: none; }
.tbl-wrap td:nth-child(2) { min-width: 14rem; }
.tok-group td { min-width: 0 !important; }
