/* ============================================================================
 * apprun.icu — guides (articles)                                  article.css
 * ----------------------------------------------------------------------------
 * A thin layer on ds.css (tokens, materials, extruded blocks) and tools.css
 * (top bar, hero, cards, fields, stat tiles, tables, footer) for long-form
 * pages: a reading measure, a sticky table of contents, the answer-first box,
 * figure plates with a small SVG vocabulary, always-visible Q&A, the author's
 * desk box, the share bar and the hub list.
 *
 * Built by includes/guides-build.php. The builder hashes this file into the
 * ?v= of every guide, so editing it and rebuilding busts Cloudflare's
 * immutable cache.
 * ==========================================================================*/

body.guide { font-size: 16px; }
.guide .thero h1 { font-size: clamp(1.7rem, 3.7vw, 2.75rem); line-height: 1.04; }
.guide .thero-in { max-width: 700px; }
.guide .thero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
@media (max-width: 860px) { .guide .thero-grid { grid-template-columns: 1fr; } .guide .thero-scene { order: -1; aspect-ratio: 1.7; max-height: 230px; min-height: 170px; } }

/* breadcrumbs --------------------------------------------------------------- */
.crumbs { margin: 0 0 12px; font-size: 13px; font-weight: 700; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--ink-3); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-2); }
.crumbs a { color: var(--m-ink); }
.crumbs li[aria-current] { color: var(--ink-3); overflow-wrap: anywhere; }

/* layout -------------------------------------------------------------------- */
.g-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 26px 0 40px; }
@media (min-width: 1040px) {
  .g-layout { grid-template-columns: 250px minmax(0, 740px); justify-content: center; gap: 56px; padding-top: 40px; }
  .g-toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 104px); overflow: auto; }
}

/* table of contents ----------------------------------------------------------- */
.g-toc { background: #fff; border: 2px solid var(--line-2); border-radius: var(--r-md); font-size: 14px; }
.g-toc summary { cursor: pointer; padding: 12px 16px; font: 850 0.95rem/1.2 var(--display); font-stretch: 110%; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.g-toc summary::-webkit-details-marker { display: none; }
.g-toc summary::after { content: "+"; font: 800 1.2rem/1 var(--font-ui); color: var(--m-ink); }
.g-toc[open] summary::after { content: "\2013"; }
.g-toc ol { list-style: none; counter-reset: toc; padding: 0 8px 10px; }
.g-toc li { counter-increment: toc; }
.g-toc li a { display: grid; grid-template-columns: 1.6em 1fr; gap: 4px; padding: 7px 8px; color: var(--ink-2); font-weight: 600; line-height: 1.35; border-radius: 2px; }
.g-toc li a::before { content: counter(toc); font-weight: 850; color: var(--m-ink); font-variant-numeric: tabular-nums; }
.g-toc li a:hover { background: var(--m-soft); color: var(--ink); }
.g-toc li a[aria-current="location"] { background: var(--m); color: var(--on-m); }
.g-toc li a[aria-current="location"]::before { color: var(--on-m); }
@media (min-width: 1040px) { .g-toc summary { pointer-events: none; } .g-toc summary::after { content: none; } }

/* prose ----------------------------------------------------------------------- */
.g-article { font-size: 1.0625rem; line-height: 1.72; color: var(--ink-2); counter-reset: fig; min-width: 0; }
.g-article > * + * { margin-top: 1.05em; }
.g-article h2 { font-size: clamp(1.4rem, 2.5vw, 1.85rem); font-weight: 850; font-stretch: 116%; line-height: 1.12; margin-top: 2.5em; scroll-margin-top: 84px; position: relative; }
.g-article h3 { font-size: 1.14rem; font-weight: 850; font-stretch: 110%; line-height: 1.2; margin-top: 1.7em; }
.g-article p, .g-article li { max-width: 68ch; }
.g-article ul, .g-article ol { padding-left: 1.3em; }
.g-article li + li { margin-top: 0.4em; }
.g-article li::marker { color: var(--m-ink); font-weight: 800; }
.g-article strong { color: var(--ink); }
.g-article a:not(.btn):not(.g-rel):not(.h-anchor) { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--m) 70%, transparent); }
.g-article a:not(.btn):not(.g-rel):not(.h-anchor):hover { color: var(--m-ink); text-decoration-color: var(--m); }
.g-article code { background: var(--m-soft); color: var(--ink); padding: 0.08em 0.38em; border-radius: 3px; font-size: 0.88em; overflow-wrap: anywhere; }
.g-article sup { font-size: 0.7em; line-height: 0; }
.g-article hr { border: 0; height: 2px; background: var(--line-2); margin: 2.2em 0; }

.h-anchor { position: absolute; left: -1.05em; top: 0; width: 1em; text-align: center; color: var(--m-ink); text-decoration: none; opacity: 0; transition: opacity 0.15s; font-weight: 850; }
.h-anchor::before { content: "#"; }
h2:hover .h-anchor, .h-anchor:focus-visible { opacity: 1; }
@media (max-width: 760px) { .h-anchor { display: none; } }

/* the short answer ------------------------------------------------------------- */
.answer.blk { --face: var(--m-soft); --side: var(--m); --under: var(--m-top); color: var(--ink); padding: 18px 22px 20px; margin: 0 8px 8px 0; }
.answer-k { display: flex; align-items: center; gap: 0.55em; font: 850 0.98rem/1 var(--display); font-stretch: 112%; color: var(--m-ink); margin: 0 0 10px; }
.answer-k::before { content: ""; width: 1.1em; height: 1.1em; flex: none; clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); background: conic-gradient(from 300deg at 50% 50%, var(--m-top) 0 120deg, var(--m-side) 0 240deg, var(--m) 0 360deg); }
.answer p { font-size: 1.1rem; line-height: 1.58; font-weight: 600; color: var(--ink); max-width: none; }
.answer p + p { margin-top: 0.7em; }
.answer ul { margin-top: 0.7em; font-weight: 600; color: var(--ink); }

/* formulas ---------------------------------------------------------------------- */
.formula { background: #fff; border: 2px solid var(--line-2); border-radius: var(--r-md); padding: 14px 18px; font: 750 1.06rem/1.6 var(--display); font-stretch: 104%; color: var(--ink); overflow-x: auto; font-variant-numeric: tabular-nums; }
.formula small { display: block; margin-top: 6px; font: 600 0.86rem/1.5 var(--font-ui); font-stretch: 100%; color: var(--ink-3); }
.formula em { font-style: normal; color: var(--m-ink); }

/* figure plates ----------------------------------------------------------------- */
.plate { background: #fff; border: 2px solid var(--line-2); border-radius: var(--r-md); padding: 14px 14px 12px; counter-increment: fig; margin-top: 1.7em; margin-bottom: 1.7em; }
.plate figcaption { margin-top: 10px; font-size: 0.9rem; line-height: 1.5; color: var(--ink-3); max-width: none; }
.plate figcaption::before { content: "Fig. " counter(fig) " \2014  "; font-weight: 850; color: var(--ink); }
.g-svg { display: block; width: 100%; max-width: 500px; height: auto; margin-inline: auto; overflow: visible; }
.g-svg.wide { max-width: none; }
.g-svg text { font-family: var(--font-ui); fill: var(--ink); }
.g-svg .svg-t { font-size: 18px; font-weight: 700; }
.g-svg .svg-s { font-size: 15.5px; font-weight: 600; fill: var(--ink-2); }
.g-svg .svg-h { font-family: var(--display); font-stretch: 112%; font-weight: 850; font-size: 21px; }
.g-svg .svg-n { font-variant-numeric: tabular-nums; font-weight: 800; }
.g-svg .svg-m { fill: var(--m-ink); }
.g-svg .svg-bt { font-family: var(--display); font-stretch: 112%; font-weight: 850; }
.g-svg .svg-bs { font-weight: 650; }
.g-svg .ink { fill: var(--ink); }
.g-svg .on { fill: #fff; }
.svg-blk .svg-face, .svg-blk .svg-side, .svg-blk .svg-under { stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.svg-white .svg-face { fill: #fff; } .svg-white .svg-side { fill: var(--line-2); } .svg-white .svg-under { fill: var(--line); }
.svg-water .svg-face { fill: var(--water); } .svg-water .svg-side { fill: var(--water-side); } .svg-water .svg-under { fill: var(--water-top); }
.svg-sand .svg-face { fill: var(--sand-top); } .svg-sand .svg-side { fill: var(--sand-side); } .svg-sand .svg-under { fill: var(--sand); }
.svg-grass .svg-face { fill: var(--grass); } .svg-grass .svg-side { fill: var(--grass-side); } .svg-grass .svg-under { fill: var(--grass-top); }
.svg-lava .svg-face { fill: var(--lava); } .svg-lava .svg-side { fill: var(--lava-side); } .svg-lava .svg-under { fill: var(--lava-top); }
.svg-rose .svg-face { fill: var(--rose); } .svg-rose .svg-side { fill: var(--rose-side); } .svg-rose .svg-under { fill: var(--rose-top); }
.svg-diamond .svg-face { fill: var(--diamond-top); } .svg-diamond .svg-side { fill: var(--diamond-side); } .svg-diamond .svg-under { fill: var(--diamond); }
.svg-amethyst .svg-face { fill: var(--amethyst); } .svg-amethyst .svg-side { fill: var(--amethyst-side); } .svg-amethyst .svg-under { fill: var(--amethyst-top); }
.svg-stone .svg-face { fill: var(--stone); } .svg-stone .svg-side { fill: var(--stone-side); } .svg-stone .svg-under { fill: var(--stone-top); }
.svg-arrow { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.svg-flow { stroke-dasharray: 11 9; animation: g-dash 1.1s linear infinite; }
@keyframes g-dash { to { stroke-dashoffset: -20; } }
.svg-axis { stroke: var(--ink-3); stroke-width: 2; fill: none; }
.svg-grid { stroke: var(--line); stroke-width: 1.5; fill: none; }
.svg-plot { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.svg-p1 { stroke: var(--water); } .svg-p2 { stroke: var(--grass); } .svg-p3 { stroke: var(--lava); }
.svg-bar-a { fill: var(--water); } .svg-bar-b { fill: var(--sand); } .svg-bar-c { fill: var(--grass); } .svg-bar-d { fill: var(--lava); } .svg-bar-e { fill: var(--rose); }
.svg-ok { fill: var(--ok); } .svg-no { fill: var(--bad); } .svg-maybe { fill: var(--sand-side); }
.svg-pulse { animation: g-pulse 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes g-pulse { 50% { transform: scale(1.18); } }
.svg-slide { animation: g-slide 3.2s ease-in-out infinite alternate; }
@keyframes g-slide { to { transform: translateX(var(--dx, 24px)); } }
@media (prefers-reduced-motion: reduce) { .svg-flow, .svg-pulse, .svg-slide { animation: none; } }

/* tables ------------------------------------------------------------------------ */
.g-article .tblwrap { margin-top: 1.4em; margin-bottom: 1.4em; width: fit-content; max-width: 100%; }
.g-article .tbl { width: auto; min-width: min(100%, 480px); }
.g-article .tbl caption { caption-side: top; text-align: left; padding: 12px 14px 10px; font: 800 0.95rem/1.35 var(--display); font-stretch: 106%; color: var(--ink); white-space: normal; background: #fff; }
.g-article .tbl td.yes { color: var(--ok); font-weight: 800; }
.g-article .tbl td.no { color: var(--bad); font-weight: 800; }
.g-article .tbl td.maybe { color: var(--warn); font-weight: 800; }
.g-article .tbl td small { color: var(--ink-3); }
.g-article .tbl th[scope="row"] { background: transparent; border-bottom: 1px solid var(--line); font-size: 14px; }

/* tool CTA + calculators -------------------------------------------------------- */
.g-tool.card, .g-calc.card { margin-top: 1.8em; margin-bottom: 1.8em; }
.g-tool .card-b p { max-width: none; }
.g-calc .card-b > p { max-width: none; }
.g-calc .stats { margin-top: 14px; }
.g-calc .msgs { margin-top: 14px; }
.g-calc .fgrid { align-items: start; }
.g-calc input[type="range"] { width: 100%; accent-color: var(--m); }
.g-calc .calc-note { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin-top: 12px; max-width: none; }
.g-calc .card-b .btn-row { margin-top: 12px; }
.calc-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.calc-list li { margin: 0; max-width: none; }
.g-article .calc-list { padding-left: 0; }
.g-article .calc-list li + li { margin-top: 0; }
.g-article .calc-list li { max-width: none; }
.calc-row { display: grid; grid-template-columns: 1fr 5.6rem; gap: 10px; align-items: center; padding: 6px 10px; background: var(--page); border: 2px solid var(--line); border-radius: var(--r-sm); }
.calc-row.on { background: var(--m-soft); border-color: var(--m); }
.calc-row label { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; line-height: 1.3; }
.calc-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--m); }
.calc-row input[type="number"] { padding: 6px 8px; font-size: 14px; text-align: right; }
.calc-row small { display: block; font-weight: 600; font-size: 12px; color: var(--ink-3); }
.calc-sub { font: 850 0.95rem/1.2 var(--display); font-stretch: 108%; color: var(--ink); margin: 18px 0 10px; }

/* Q&A (always visible: readers and crawlers see exactly the same text) ---------- */
.g-qa { background: #fff; border: 2px solid var(--line-2); border-radius: var(--r-sm); padding: 14px 18px 16px; }
.g-qa + .g-qa { margin-top: 12px; }
.g-article .g-qa h3 { margin-top: 0; font-size: 1.06rem; }
.g-qa-a { margin-top: 8px; }
.g-qa-a > * + * { margin-top: 0.7em; }

/* sources ------------------------------------------------------------------------ */
.sources { font-size: 0.95rem; line-height: 1.55; }
.sources li { max-width: none; }

/* callouts reuse tools.css .msg; just give them article rhythm ------------------- */
.g-article .msg { max-width: none; }
.g-article .msg div > * + * { margin-top: 0.5em; }

/* the author's desk --------------------------------------------------------------- */
.g-desk.blk { --face: var(--m-soft); --side: var(--m-side); --under: var(--m); color: var(--ink); display: grid; grid-template-columns: 112px 1fr; gap: 18px; padding: 18px 20px; margin: 2.6em 8px 8px 0; align-items: start; }
.g-desk:not(:has(.g-desk-cover)) { grid-template-columns: 1fr; }
.g-desk-cover img { display: block; width: 112px; height: auto; border: 2px solid var(--ink); background: #fff; }
.g-desk-k { font: 850 0.9rem/1 var(--display); font-stretch: 110%; color: var(--m-ink); margin: 0 0 8px; }
.g-article .g-desk h3 { margin: 0; font-size: 1.22rem; line-height: 1.18; }
.g-article .g-desk h3 a { text-decoration: none; }
.g-desk-tag { font-weight: 700; color: var(--ink); margin-top: 4px; }
.g-desk p { max-width: none; font-size: 1rem; line-height: 1.55; }
.g-desk p + p { margin-top: 0.6em; }
.g-desk-facts { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .g-desk.blk { grid-template-columns: 1fr; } .g-desk-cover img { width: 96px; } }

.g-author { font-size: 0.95rem; line-height: 1.6; color: var(--ink-3); border-top: 2px solid var(--line-2); padding-top: 1.1em; margin-top: 2em; }
.g-author p { max-width: none; }

/* share ---------------------------------------------------------------------------- */
.g-share { margin-top: 18px; }
.g-share [hidden] { display: none !important; }
.g-share-h { font: 850 1.05rem/1.2 var(--display); font-stretch: 112%; color: var(--ink); margin: 0 0 10px; }
.g-share-row { display: flex; flex-wrap: wrap; gap: 4px 4px; align-items: center; }
.g-share .btn { margin: 0 6px 6px 0; }
.g-article > .g-share { margin-top: 2.2em; padding-top: 1.3em; border-top: 2px solid var(--line-2); }

/* related reading ------------------------------------------------------------------ */
.g-related { margin-top: 2.6em; }
.g-article .g-sec-h { margin-top: 0; font-size: 1.3rem; }
.g-rel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px 16px; margin-top: 14px; }
.g-rel.blk { --face: #fff; --side: var(--m-side); --under: var(--m); display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; color: var(--ink); text-decoration: none; margin: 0 8px 8px 0; }
.g-rel-k { font: 800 0.8rem/1 var(--font-ui); color: var(--m-ink); }
.g-rel-t { font: 850 1.04rem/1.25 var(--display); font-stretch: 108%; color: var(--ink); }
.g-rel-d { font-size: 0.9rem; line-height: 1.5; color: var(--ink-2); }

/* hub list ---------------------------------------------------------------------------- */
.g-hub-grid { display: grid; gap: 20px; margin-top: 18px; max-width: 940px; }
.g-hub-grid + .sec-h { margin-top: 3rem; }
.g-row-cta { display: inline-block; margin-top: 0.55rem; font-weight: 800; font-size: 0.95rem; color: var(--m-ink); }
.g-row:hover .g-row-cta { text-decoration: underline; text-underline-offset: 3px; }
.g-row.blk { --face: #fff; --side: var(--m-side); --under: var(--m); display: grid; grid-template-columns: 168px 1fr; gap: 20px; align-items: center; padding: 16px 20px 16px 16px; color: var(--ink); text-decoration: none; margin: 0 8px 8px 0; }
.g-row-scene { position: relative; aspect-ratio: 1.2; min-height: 118px; }
.g-row h3 { font-size: 1.28rem; line-height: 1.15; margin: 4px 0 8px; }
.g-row p { color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; max-width: 62ch; }
.g-row-meta { font-size: 13px; font-weight: 750; color: var(--m-ink); }
@media (max-width: 640px) { .g-row.blk { grid-template-columns: 1fr; gap: 12px; } .g-row-scene { aspect-ratio: 1.9; min-height: 0; max-height: 150px; } }
.g-hub-note { max-width: 66ch; }

/* toast (copy link) -------------------------------------------------------------------- */
.guide .toast { z-index: 120; }

/* print: the article, minus the chrome ------------------------------------------------- */
@media print {
  .tbar, .thero-scene, .g-toc, .g-share, .skip-link, .g-tool, .g-rel-grid, .tfoot, .scroll-blocks, #grw-root { display: none !important; }
  body.guide { background: #fff; }
  .thero { background: none; padding: 0; }
  .thero::after { display: none; }
  .g-layout { display: block; padding: 0; }
  .plate, .g-qa, .g-calc.card { break-inside: avoid; }
  .g-article a[href^="http"]:not(.btn)::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; word-break: break-all; }
}

/* calculators on phones: one column so labels and selects keep their width ----------- */
@media (max-width: 560px) { .g-calc .fgrid, .g-calc .fgrid.three { grid-template-columns: 1fr; } }

/* compact matrix tables: every column visible on a phone ------------------------------ */
.g-article .tblwrap:has(.tbl.compact) { width: 100%; }
.g-article .tbl.compact { width: 100%; min-width: 0; }
.g-article .tbl.compact th, .g-article .tbl.compact td { padding: 9px 6px; white-space: normal; text-align: center; font-size: 13px; line-height: 1.3; }
.g-article .tbl.compact th:first-child, .g-article .tbl.compact td:first-child { text-align: left; padding-left: 12px; }
.g-article .tbl.compact th[scope="row"] { font-size: 13.5px; }
.g-article .tbl.compact th[scope="row"] small { display: block; margin-top: 2px; font-weight: 600; font-size: 11.5px; color: var(--ink-3); }
.g-article .tbl.compact td.yes { background: var(--ok-soft); }
.g-article .tbl.compact td.maybe { background: var(--warn-soft); }
.g-article .tbl.compact td.no { background: var(--bad-soft); }

/* rows with two inputs (how many + amount each), e.g. the pedal sizer ----------------- */
.calc-row.calc-row-pair { grid-template-columns: minmax(0, 1fr) auto; }
.calc-pair { display: grid; grid-template-columns: 4.2rem 5.4rem; gap: 8px; }
.calc-headrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 0 10px; margin: 0 0 6px; font-size: 12px; font-weight: 750; color: var(--ink-3); }
.calc-headrow .calc-pair span { text-align: right; padding-right: 4px; }
