/* ==========================================================================
   iStruct2D — user guide + FAQ additions (Nov 2026 refresh: iPad & Mac)
   Loaded AFTER css/styles.css on guide.html and faq.html. Only components
   that styles.css doesn't already have live here: platform tags, comparison
   / command / shortcut tables, side-by-side screenshots, the combination-table
   and section-sketcher widgets, the results demo's Model Layers control and
   small FAQ helpers. Colours are the app's own (see styles.css tokens).
   ========================================================================== */

/* ---------------------------------------------------------------- Utilities */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Numbered steps use their own counter badge — hide the browser's list numbers. */
.guide-ol { list-style: none; padding-left: 0; }

/* ---------------------------------------------------------------- TOC */
/* A long table of contents stays usable on short screens. */
.legal-toc.guide-toc {
  max-height: calc(100vh - 120px); overflow-y: auto; overscroll-behavior: contain;
  padding-right: 6px; scrollbar-width: thin;
}
.legal-toc.guide-toc .toc-group {
  font: 700 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin: 16px 0 6px 16px;
}

/* ---------------------------------------------------------------- Screenshots */
/* width/height attributes reserve the space; keep the real aspect ratio. */
.guide-figure .device img { height: auto; }
.guide-figure picture { display: block; }
.shot-duo { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(18px, 3vw, 32px); align-items: start; margin-top: 30px; }
.shot-duo.even { grid-template-columns: 1fr 1fr; }
.shot-duo .guide-figure figcaption { font-size: 12.5px; }
@media (max-width: 760px) {
  .shot-duo, .shot-duo.even { grid-template-columns: 1fr; gap: 26px; }
  .shot-duo .guide-figure { max-width: 520px; margin-inline: auto; width: 100%; }
}

/* ---------------------------------------------------------------- Platform tags & sub-headings */
.ptag {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font: 800 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 999px; vertical-align: middle;
}
.ptag svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ptag.ipad { color: #1f6fd1; background: rgba(48, 147, 255, .11); }
.ptag.mac  { color: #7a35d8; background: rgba(151, 71, 255, .11); }
.ptag.both { color: var(--indigo-deep); background: rgba(91, 108, 246, .11); }

.gs-sub { font-size: 20px; margin: 40px 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gs-sub + .gs-lead-sm, .gs-lead-sm { font-size: 15.5px; color: var(--body); line-height: 1.7; max-width: 70ch; margin-bottom: 18px; }

/* Two columns: what you do on iPad / on Mac. */
.plat-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.plat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 22px; min-width: 0; }
.plat-card > h4 { font-size: 16.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plat-card .guide-points { gap: 11px; }
.plat-card .guide-points li { font-size: 14.5px; }
.plat-card .guide-ol li { font-size: 14.5px; }
@media (max-width: 760px) { .plat-split { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Inline code & keys */
.guide-body code, .faq-a code {
  font: 600 .86em/1.25 var(--mono); color: var(--indigo-ink);
  background: rgba(91, 108, 246, .08); border: 1px solid rgba(91, 108, 246, .14);
  padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere;
}
.guide-body .kbd, .faq-a .kbd { white-space: nowrap; display: inline-block; line-height: 1.15; }

/* ---------------------------------------------------------------- Tables (compare, commands) */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-top: 10px; }
.gtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.gtable caption { text-align: left; padding: 14px 16px 0; font: 700 12px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.gtable th, .gtable td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); line-height: 1.55; }
.gtable thead th { font: 700 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: #fafbfe; border-bottom-color: var(--line); }
.gtable tbody th { color: var(--ink); font-weight: 700; }
.gtable td { color: var(--body); }
.gtable tbody tr:last-child > * { border-bottom: 0; }
.gtable tbody tr:nth-child(even) > * { background: #fcfcff; }
.gtable .muted { color: var(--faint); }
.gtable.cmd td:first-child code { font-weight: 800; }
.gtable.cmd .alias { display: block; margin-top: 4px; font: 600 11.5px/1.4 var(--mono); color: var(--faint); }
@media (max-width: 680px) {
  .gtable.stack thead { display: none; }
  .gtable.stack, .gtable.stack tbody, .gtable.stack tr, .gtable.stack th, .gtable.stack td { display: block; width: 100%; }
  .gtable.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
  .gtable.stack tbody tr:last-child { border-bottom: 0; }
  .gtable.stack th, .gtable.stack td { padding: 3px 0; border: 0; background: none !important; }
  .gtable.stack td[data-label]::before {
    content: attr(data-label); display: block; margin-top: 6px;
    font: 700 10.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  }
}

/* ---------------------------------------------------------------- Shortcut cards */
.sc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 10px; }
.sc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 12px; min-width: 0; }
.sc-card h4 { font: 700 12px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--indigo); margin-bottom: 8px; }
.sc-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; color: var(--body); }
.sc-row:last-child { border-bottom: 0; }
.sc-row > span:first-child { min-width: 0; }
.sc-row .sc-keys { display: inline-flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 55%; }
.sc-row .none { font: 600 12px/1 var(--mono); color: var(--faint); }
.sc-card h4 .sc-fixed { margin-left: 6px; font: 700 9.5px/1 var(--mono); letter-spacing: .08em; color: var(--muted); background: var(--bg-2); padding: 3px 6px; border-radius: 5px; vertical-align: 1px; }
@media (max-width: 700px) { .sc-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Visibility chip: Dim */
.vis-chip.dim { color: var(--muted); opacity: .78; filter: blur(.35px); }

/* ---------------------------------------------------------------- Results demo: Model Layers control */
.ml-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.ml-card .ml-title { display: inline-flex; align-items: center; gap: 7px; font: 700 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ml-card .ml-title svg { width: 14px; height: 14px; fill: none; stroke: var(--indigo); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ml-row { display: inline-flex; align-items: center; gap: 10px; }
.ml-row .ml-k { font: 700 13px/1 var(--font); color: var(--ink); min-width: 62px; }
.ml-seg { padding: 3px; gap: 2px; border-radius: 10px; }
.ml-seg button { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.ml-seg button.on { color: var(--indigo-deep); }
.ml-seg button:focus-visible { outline: 3px solid var(--indigo); outline-offset: 1px; }

/* ---------------------------------------------------------------- Combination table widget */
.combo-demo { background: linear-gradient(180deg, #fbfcff, #f2f4fc); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.cd-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cd-new { display: inline-flex; align-items: center; gap: 6px; font: 700 12.5px/1 var(--font); color: #fff; background: var(--indigo); padding: 10px 12px; border-radius: 9px; white-space: nowrap; box-shadow: 0 4px 10px -4px rgba(91,108,246,.6); }
.cd-new svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.cd-field { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; min-width: 0; background: #fff; border: 1.5px solid #dce4ff; border-radius: 9px; padding: 5px 5px 5px 10px; transition: border-color .25s, box-shadow .25s; }
.cd-field.focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(91,108,246,.14); }
.cd-fx { font: italic 700 14px/1 var(--mono); color: var(--indigo-deep); flex: none; }
.cd-typed { font: 600 13.5px/1.2 var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; min-width: 0; }
.cd-caret { width: 2px; height: 16px; background: var(--indigo); flex: none; opacity: 0; }
.cd-field.focus .cd-caret { opacity: 1; animation: cd-blink 1s steps(1) infinite; }
@keyframes cd-blink { 50% { opacity: 0; } }
.cd-spacer { flex: 1; }
.cd-add { font: 700 12px/1 var(--font); color: #fff; background: var(--indigo); padding: 8px 11px; border-radius: 7px; flex: none; }
.ls-badge { display: inline-block; font: 800 10px/1 var(--font); letter-spacing: .02em; color: #fff; padding: 4px 7px; border-radius: 999px; flex: none; vertical-align: middle; }
.ls-badge.uls { background: #5B6CF6; }
.ls-badge.sls { background: #10B981; }
.cd-preview { display: flex; align-items: baseline; gap: 6px; margin: 9px 0 0 4px; font-size: 12.5px; color: var(--muted); min-height: 18px; transition: opacity .3s; }
.cd-preview b { font: 600 13px/1 var(--mono); color: var(--ink); }
.cd-preview svg { width: 12px; height: 12px; flex: none; align-self: center; fill: #16A34A; }
.cd-scroll { margin-top: 12px; border: 1px solid #e1e4eb; border-radius: 12px; background: #fff; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cd-table { width: 100%; min-width: 380px; border-collapse: collapse; font-size: 13px; }
.cd-table th, .cd-table td { padding: 9px 10px; border-bottom: 1px solid #eaecf4; text-align: center; white-space: nowrap; }
.cd-table thead th { font: 700 11.5px/1 var(--font); color: var(--muted); background: #f7f8fc; }
.cd-table thead th:first-child, .cd-table tbody th { text-align: left; }
.cd-table tbody th { font: 700 13px/1.2 var(--font); color: var(--ink); }
.cd-table tbody th .ls-badge { margin-left: 6px; }
.cd-table td { font: 600 13px/1 var(--mono); color: var(--ink); }
.cd-table td.dash { color: #cccfde; }
.cd-table td.expr { text-align: left; color: var(--indigo-ink); border-left: 1px solid #eaecf4; }
.cd-table tbody tr:last-child > * { border-bottom: 0; }
.cd-table tbody tr > * { background: #fff; }
.cd-table tbody tr:nth-child(even) > * { background: #fbfbfe; }
/* Like the app's table, the name column stays put while the case columns scroll sideways. */
.cd-table thead th:first-child, .cd-table tbody th { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 #eaecf4; }
.cd-table thead th:first-child { background: #f7f8fc; }
.cd-case { display: inline-flex; align-items: center; gap: 5px; }
.cd-case i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; background: var(--c); }
.cd-foot { margin-top: 12px; font: 600 12px/1.55 var(--mono); color: var(--muted); }
/* Animation states (set by js/guide.js; never applied with reduced motion). */
.combo-demo.cd-anim tbody tr.cd-pending { opacity: 0; }
.combo-demo.cd-anim tbody tr { transition: opacity .35s var(--ease); }
.combo-demo.cd-anim td.cd-hold, .combo-demo.cd-anim .cd-preview.cd-hold { opacity: 0; }
.combo-demo.cd-anim td { transition: opacity .25s ease; }
.combo-demo tbody tr.cd-flash > * { animation: cd-flash 1.2s ease; }
@keyframes cd-flash { 0% { background: rgba(91,108,246,.16); } 100% { background: transparent; } }

/* ---------------------------------------------------------------- Section sketcher widget */
.section-demo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; background: linear-gradient(180deg, #fbfcff, #f3f5fd); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.section-demo .sd-top { grid-column: 1 / -1; display: flex; justify-content: center; }
.section-demo .sd-stage { width: 100%; max-width: 260px; height: auto; margin-inline: auto; overflow: visible; }
.sd-panel { display: grid; gap: 10px; min-width: 0; }
.sd-name { font: 800 16px/1.2 var(--font); color: var(--ink); }
.sd-dims { display: grid; gap: 4px; }
.sd-dims div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); border-bottom: 1px dashed var(--line); padding: 4px 0; }
.sd-dims b { font: 700 13px/1.2 var(--mono); color: var(--ink); white-space: nowrap; }
.sd-dims i { font-style: normal; font-family: var(--mono); color: var(--faint); margin-left: 4px; }
.sd-used { font: 700 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-top: 4px; }
.sd-values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sd-val { background: #f0f2fc; border-radius: 9px; padding: 9px 11px; min-width: 0; }
.sd-val .k { display: block; font: 700 11px/1.2 var(--font); color: var(--muted); }
.sd-val .v { display: block; font: 800 15.5px/1.25 var(--mono); color: #2a3bb7; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-val .u { display: block; font: 700 11px/1 var(--mono); color: var(--muted); margin-top: 2px; }
.sd-axis { font: 600 12px/1.4 var(--mono); color: var(--muted); }
.section-demo .seg button:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }

/* ---------------------------------------------------------------- Example command lines */
.cmd-examples { display: grid; gap: 11px; margin-top: 18px; padding: 16px 18px; border-radius: var(--radius); background: #0f1020; color: rgba(255,255,255,.9); font: 600 13px/1.45 var(--mono); }
.cmd-examples div { display: grid; gap: 1px; min-width: 0; }
.cmd-examples span { overflow-wrap: anywhere; }
.cmd-examples span:first-child::before { content: "› "; color: #8ea0ff; }
.cmd-examples span:last-child { padding-left: 1.25em; font: 500 12px/1.4 var(--font); color: rgba(255,255,255,.52); }

/* ---------------------------------------------------------------- FAQ helpers */
.faq-cat { scroll-margin-top: 96px; }
.faq-item { scroll-margin-top: 96px; }
.faq-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 34px; }
.faq-jump a {
  font: 700 12.5px/1 var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px;
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.faq-jump a:hover { color: var(--indigo); border-color: rgba(91,108,246,.4); box-shadow: var(--shadow-sm); }
.faq-a ul { list-style: disc; padding-left: 20px; margin: 0 0 10px; display: grid; gap: 4px; }
.contact-card .btn-email { background: #fff; color: var(--ink); }
.contact-card .btn-email svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .cd-field.focus .cd-caret { animation: none; }
  .combo-demo tbody tr.cd-flash > * { animation: none; }
}

/* progressive Mac screenshot slots (see the end of js/guide.js) */
.guide-figure.is-missing { display: none; }
.shot-duo:has(> .guide-figure.is-missing) { grid-template-columns: 1fr; max-width: 760px; margin-inline: auto; }
.guide-split:has(> .guide-figure.is-missing) { grid-template-columns: 1fr; }
