/* ==========================================================================
   The guide — /guide/ and /guide/<page>.html
   Generated by ../../Evonex/tools/build_web_guide.py; this file is the styling
   for what it emits. Every colour comes from tokens.css, so the guide follows
   the site's light/dark toggle without a single hard-coded value.

   TWO WIDTHS, not one. The rail is fixed; the page column gives prose a narrow
   reading measure and screenshots the whole width. A single cap over both would
   either shrink every screenshot to a column chosen for paragraphs or stretch
   every paragraph to a width chosen for pictures — the app's guide learned this
   the same way and kept the same split.
   ========================================================================== */

.guide-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 64px;
}

/* ---- the contents rail --------------------------------------------------- */
.guide-rail {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  border-right: 1px solid var(--hairline);
}
.guide-rail::-webkit-scrollbar { width: 8px; }
.guide-rail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.guide-searchbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 12px;
}
.guide-searchbox .sym { width: 16px; height: 16px; color: var(--text3); flex: none; }
.guide-searchbox input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--fs-1);
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  padding: 8px 10px;
}
.guide-searchbox input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.guide-searchbox input::-webkit-search-cancel-button { display: none; }
.guide-searchclear {
  position: absolute; right: 6px;
  background: none; border: 0; cursor: pointer; padding: 4px;
  color: var(--text3); line-height: 0;
}
.guide-searchclear:hover { color: var(--text); }
.guide-searchclear .sym { width: 14px; height: 14px; }

.guide-tree { font-size: var(--fs-1); }
.guide-sec { border-bottom: 1px solid var(--hairline); }
.guide-sec > summary {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 4px; cursor: pointer; list-style: none;
  color: var(--text2);
  font-family: var(--font-display);
  font-size: var(--fs-2);
  letter-spacing: var(--track-display);
  text-transform: var(--display-case);
}
.guide-sec > summary::-webkit-details-marker { display: none; }
.guide-sec > summary:hover { color: var(--text); }
.gsec-title { flex: 1; }
.gsec-ico { width: 16px; height: 16px; flex: none; color: var(--text3); }
.gsec-chev { width: 14px; height: 14px; flex: none; color: var(--text3);
             transition: transform var(--mo-state) var(--ease-state); }
.guide-sec[open] > summary .gsec-chev { transform: rotate(180deg); }
.guide-sec[open] > summary { color: var(--text); }

.guide-sec-list { list-style: none; margin: 0 0 10px; padding: 0 0 0 25px; }
.guide-sec-list a {
  display: block;
  padding: 5px 8px;
  color: var(--text2);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-micro) var(--r-micro) 0;
}
.guide-sec-list a:hover { color: var(--text); background: var(--input-bg); }
.guide-sec-list a[aria-current="page"] {
  color: var(--text); border-left-color: var(--grease); background: var(--input-bg);
  font-weight: 600;
}
.guide-noresult { padding: 14px 4px; color: var(--text2); font-size: var(--fs-1); }

/* Search hides non-matching rows; a section with nothing left goes too. */
.guide-sec-list li[hidden], .guide-sec[hidden] { display: none; }

.guide-railtoggle { display: none; }

/* ---- the page column ----------------------------------------------------- */
.guide-main { min-width: 0; }
.guide-main > * { max-width: 78ch; }
.guide-main > .guide-fig,
.guide-main > .guide-cards { max-width: none; }

.guide-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding-bottom: 20px; margin-bottom: 22px;
  border-bottom: 1px solid var(--hairline);
  max-width: none;
}
.guide-themepick { display: inline-flex; align-items: center; gap: 8px;
                   font-size: var(--fs-1); color: var(--text2); }
.guide-themepick select {
  font: inherit; font-size: var(--fs-1);
  color: var(--text); background: var(--input-bg);
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 5px 8px;
}
.guide-themepick select:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.guide-themehint { font-size: var(--fs-0); color: var(--text3); margin: 0; }

.guide-crumb {
  font-family: var(--font-mono); font-size: var(--fs-0); font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text3);
  margin-bottom: 10px;
}
.guide-title { font-size: var(--fs-6); margin-bottom: 10px; }
.guide-tagline { font-size: var(--fs-3); color: var(--text2); line-height: 1.55;
                 margin-bottom: 26px; }

.guide-h { font-size: var(--fs-4); margin: 34px 0 12px; }
.guide-p { margin: 0 0 14px; line-height: 1.7; }
.guide-main a { color: var(--link); text-decoration: underline;
                text-underline-offset: 2px; text-decoration-thickness: 1px; }
.guide-main a:hover { color: var(--text); }

.guide-bullets, .guide-steps { margin: 0 0 16px; padding: 0; list-style: none; }
.guide-bullets li, .guide-steps li {
  position: relative; padding-left: 30px; margin-bottom: 9px; line-height: 1.7;
}
.guide-bullets li::before {
  content: ""; position: absolute; left: 10px; top: 0.72em;
  width: 5px; height: 5px; background: var(--text3);
}
.guide-steps { counter-reset: gstep; }
.guide-steps li { counter-increment: gstep; }
.guide-steps li::before {
  content: counter(gstep);
  position: absolute; left: 0; top: 0.15em;
  width: 21px; height: 21px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-0); font-weight: 600;
  color: var(--on-accent); background: var(--accent);
  border-radius: var(--r-lamp);
}

/* ---- callouts ------------------------------------------------------------ */
.guide-callout {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; margin: 18px 0;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--r-card);
  background: var(--input-bg);
  line-height: 1.65;
}
.guide-callout .sym { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.guide-callout[data-kind="tip"] { border-left-color: var(--green); background: var(--green-soft); }
.guide-callout[data-kind="tip"] .sym { color: var(--green-on); }
.guide-callout[data-kind="warn"] { border-left-color: var(--orange); background: var(--orange-soft); }
.guide-callout[data-kind="warn"] .sym { color: var(--orange-on); }
.guide-callout[data-kind="info"] { border-left-color: var(--blue); background: var(--blue-soft); }
.guide-callout[data-kind="info"] .sym { color: var(--blue-on); }

/* ---- option table -------------------------------------------------------- */
.guide-opts { margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.guide-opt {
  display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 16px;
  padding: 11px 14px;
  border: 1px solid var(--hairline); border-radius: var(--r-card);
  background: var(--input-bg);
}
.guide-opt-name { font-weight: 650; color: var(--text); }
.guide-opt-desc { color: var(--text2); line-height: 1.6; }
@media (max-width: 620px) { .guide-opt { grid-template-columns: 1fr; gap: 4px; } }

/* ---- chips --------------------------------------------------------------- */
.guide-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 20px; }
.guide-needs-cap, .guide-related .guide-crumb { margin: 0; }
.guide-needs-cap {
  font-family: var(--font-mono); font-size: var(--fs-0); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text3);
}
.guide-chip {
  display: inline-block; padding: 4px 10px;
  font-size: var(--fs-1); color: var(--text2);
  border: 1px solid var(--border); border-radius: var(--r-chip);
  background: var(--input-bg);
}
a.guide-chip.is-link { text-decoration: none; color: var(--text); }
a.guide-chip.is-link:hover { border-color: var(--text); background: var(--surface2); }
.guide-related { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.guide-chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---- screenshots --------------------------------------------------------- */
.guide-fig { margin: 22px 0 26px; }
.guide-shot {
  display: block; position: relative;
  width: 100%; padding: 0; cursor: zoom-in;
  background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--r-card);
  overflow: hidden; line-height: 0;
}
.guide-shot:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.guide-shot img { display: block; width: 100%; height: auto; }
.guide-shot-missing {
  padding: 44px 16px; text-align: center; color: var(--text3);
  font-family: var(--font-mono); font-size: var(--fs-1);
  border: 1px dashed var(--border); border-radius: var(--r-card);
}
.guide-fig figcaption { margin-top: 9px; font-size: var(--fs-1); color: var(--text2);
                        max-width: 78ch; line-height: 1.6; }

/* Pins are placed as percentages of the shot, so they track it at any width. */
.guide-pin {
  position: absolute; transform: translate(-50%, -50%);
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--on-accent); background: var(--accent);
  border: 2px solid var(--on-accent); border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  pointer-events: none;
}
.guide-legend { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: gpin;
                max-width: 78ch; }
.guide-legend li {
  counter-increment: gpin; position: relative; padding-left: 30px;
  margin-bottom: 7px; font-size: var(--fs-1); color: var(--text2); line-height: 1.6;
}
.guide-legend li::before {
  content: counter(gpin);
  position: absolute; left: 0; top: 0.1em;
  width: 21px; height: 21px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: var(--fs-0); font-weight: 700;
  color: var(--on-accent); background: var(--accent); border-radius: 50%;
}

/* ---- lightbox ------------------------------------------------------------ */
.guide-lightbox {
  position: fixed; inset: 0; z-index: 900;
  background: var(--scrim);
  display: grid; grid-template-rows: 1fr auto; gap: 12px;
  padding: 32px 32px 24px;
  overflow: auto;
}
.guide-lightbox[hidden] { display: none; }
.guide-lightbox-inner { position: relative; margin: auto; line-height: 0; }
.guide-lightbox img { display: block; max-width: none; }
.guide-lightbox figcaption { color: var(--on-scrim); text-align: center;
                             font-size: var(--fs-1); line-height: 1.6; }
.guide-lightbox-close {
  position: fixed; top: 16px; right: 20px;
  background: none; border: 1px solid var(--border2); border-radius: var(--r-ctl);
  color: var(--on-scrim); cursor: pointer; padding: 7px; line-height: 0;
}
.guide-lightbox-close:hover { background: rgba(255,255,255,0.1); }

/* ---- pager --------------------------------------------------------------- */
.guide-pager {
  display: flex; align-items: center; gap: 16px;
  margin-top: 48px; padding-top: 20px;
  border-top: 1px solid var(--hairline);
  max-width: none;
}
.guide-pagelink {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: var(--fs-1);
  color: var(--text2); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  max-width: 40%;
}
.guide-pagelink:hover { color: var(--text); border-color: var(--text); }
.guide-pagelink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide-pagelink .sym { width: 15px; height: 15px; flex: none; }
.guide-pagelink.is-next { margin-left: auto; }
.guide-pagelink.is-spacer { border: 0; pointer-events: none; }
.guide-pagelink.is-spacer + .guide-pagepos { margin-left: auto; }
.guide-pagepos { margin: 0 auto; font-family: var(--font-mono);
                 font-size: var(--fs-0); color: var(--text3); }

/* ---- contents page ------------------------------------------------------- */
.guide-hero { max-width: 640px; margin-bottom: 44px; }
.guide-hero h1 { font-size: var(--fs-6); margin-bottom: 14px; }
.guide-lead { font-size: var(--fs-3); color: var(--text2); line-height: 1.6;
              margin-bottom: 24px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
               gap: 18px; }
.guide-card { background: var(--card-bg); border: 1px solid var(--glass-edge);
              border-radius: var(--r-card); padding: 20px; }
.guide-card header { display: flex; gap: 12px; align-items: flex-start;
                     margin-bottom: 14px; }
.guide-card header .sym { width: 20px; height: 20px; flex: none; color: var(--text2);
                          margin-top: 3px; }
.guide-card h2 { font-size: var(--fs-4); margin-bottom: 4px; }
.guide-card header p { font-size: var(--fs-1); color: var(--text2); line-height: 1.5; }
.guide-card-links { display: flex; flex-direction: column; }
.guide-card-links a {
  padding: 6px 0; font-size: var(--fs-1); color: var(--text2);
  text-decoration: none; border-top: 1px solid var(--hairline);
}
.guide-card-links a:hover { color: var(--text); }

/* ---- narrow ------------------------------------------------------------- */
@media (max-width: 900px) {
  .guide-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .guide-railtoggle {
    display: inline-flex; align-items: center; gap: 8px;
    margin-bottom: 16px; padding: 9px 14px;
    font: inherit; font-size: var(--fs-1); color: var(--text);
    background: var(--input-bg); border: 1px solid var(--border);
    border-radius: var(--r-ctl); cursor: pointer;
  }
  .guide-railtoggle .sym { width: 16px; height: 16px; }
  .guide-rail {
    position: static; max-height: none; border-right: 0;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 24px; padding-bottom: 16px;
  }
  /* Collapsed by default on a phone — 55 links above the article is not a page.
     Hidden only once JS is there to reopen it. */
  .js .guide-rail[data-collapsed="1"] { display: none; }
  .guide-title, .guide-hero h1 { font-size: var(--fs-5); }
  .guide-lightbox { padding: 16px; }
}
