/*! StiffStruct, (c) 2026 Mohammad Asad. All rights reserved. Proprietary: copying, mirroring or reusing this code is not permitted without written permission (see terms.html#intellectual-property). build 20261018-2123 */
/* Examples gallery (examples.html) and worked-example pages (example.html). Link after tokens.css and site.css;
 * example.html also links report.css (the step-by-step solution reuses the calculator's report styling).
 * Colours come from the design tokens only, so light / dark and high / normal contrast work automatically. Prefix: ex-
 */

.ex-nopr {}
.ex-facts { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; color: var(--fg-muted); font-size: .95rem; }
p.ex-facts { display: block; }
.ex-badge {
  display: inline-block; padding: 2px 10px; font-size: .76rem; font-weight: 700; letter-spacing: .03em; line-height: 1.6; white-space: nowrap;
  color: var(--accent-text); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 999px;
}

/* ================= gallery ================= */
.ex-toolbar { display: grid; gap: 14px; margin: 26px 0 10px; }
.ex-search { position: relative; max-width: 480px; }
.ex-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-muted); pointer-events: none; }
.ex-search input {
  width: 100%; min-height: 44px; padding: 10px 14px 10px 40px; font: inherit; color: var(--fg); background: var(--bg-elev);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.ex-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring, 0 0 0 3px var(--accent-soft)); }
.ex-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 15px; font: inherit; font-size: .93rem; font-weight: 600; cursor: pointer;
  color: var(--fg); background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 999px;
}
.ex-chip:hover { background: var(--bg-sunken); }
.ex-chip .n { font-weight: 500; font-size: .82rem; opacity: .75; }
.ex-chip[aria-pressed="true"] { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.ex-status { margin: 0; min-height: 1.4em; font-size: .9rem; color: var(--fg-muted); }
.ex-grid { display: grid; gap: 20px; padding: 10px 0 48px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.ex-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); transition: box-shadow .15s, border-color .15s; }
.ex-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.ex-thumb { position: relative; display: block; aspect-ratio: 16 / 9; color: inherit; background: var(--bg); border-bottom: 1px solid var(--border); }
.ex-thumb svg { display: block; width: 100%; height: 100%; }
.ex-thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font-size: .85rem; color: var(--fg-muted); }
.ex-card-body { display: flex; flex: 1; flex-direction: column; gap: 9px; padding: 16px 18px 18px; }
.ex-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .84rem; color: var(--fg-muted); }
.ex-card h3 { margin: 0; font-size: 1.08rem; line-height: 1.3; }
.ex-card h3 a { color: var(--fg); text-decoration: none; }
.ex-card h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.ex-desc { margin: 0; font-size: .92rem; color: var(--fg-muted); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ex-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; }
.ex-card-actions .s-btn { min-height: 42px; padding: 8px 14px; font-size: .92rem; }
.ex-empty { max-width: 560px; }
.ex-more-cta { padding: 8px 0 64px; }

/* ================= worked-example page ================= */
.ex-crumbs { margin: 0 0 14px; font-size: .88rem; }
.ex-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin: 0; padding: 0; list-style: none; }
.ex-crumbs li { display: inline-flex; align-items: center; min-width: 0; color: var(--fg-muted); }
.ex-crumbs li + li::before { content: "\203A"; margin: 0 8px; color: var(--fg-subtle); }
.ex-crumbs a { color: var(--accent-text); text-decoration: none; }
.ex-crumbs a:hover { text-decoration: underline; }
.ex-crumbs [aria-current="page"] span { display: block; max-width: min(60ch, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.ex-head h1 { max-width: 28ch; }
.ex-head .s-cta { margin-top: 18px; }

.ex-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 28px; padding-bottom: 64px; }
.ex-content { min-width: 0; }
@media (min-width: 1180px) { .ex-layout { grid-template-columns: 224px minmax(0, 1fr); gap: 36px; } }
.ex-toc-wrap { min-width: 0; }
@media (min-width: 1180px) { .ex-toc-wrap { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; } }
.ex-toc { font-size: .9rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.ex-toc summary { cursor: pointer; padding: 11px 14px; font-weight: 700; list-style: none; }
.ex-toc summary::-webkit-details-marker { display: none; }
.ex-toc summary::after { content: ""; float: right; width: 8px; height: 8px; margin-top: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.ex-toc[open] summary::after { transform: rotate(-135deg); margin-top: 9px; }
.ex-toc ol { margin: 0; padding: 0 14px 12px 28px; }
.ex-toc ol ol { padding: 2px 0 4px 16px; list-style: none; font-size: .86rem; }
.ex-toc li { margin: 3px 0; }
.ex-toc a { color: var(--fg-muted); text-decoration: none; }
.ex-toc a:hover { color: var(--accent-text); text-decoration: underline; }

.ex-section { margin: 0 0 48px; scroll-margin-top: 76px; }
.ex-section > h2 { margin-bottom: 16px; padding-bottom: 8px; font-size: clamp(1.4rem, 3vw, 1.75rem); border-bottom: 1px solid var(--border); }
.ex-section h3 { margin: 22px 0 8px; font-size: 1.1rem; }
.ex-h4 { margin: 20px 0 8px; font-size: .84rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.ex-statement { font-size: 1.08rem; max-width: 70ch; }
.ex-source { padding: 10px 14px; max-width: 70ch; font-size: .95rem; color: var(--fg-muted); background: var(--bg-elev); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); }
.ex-source strong { color: var(--fg); }
.ex-note { margin: 10px 2px 0; font-size: .88rem; color: var(--fg-muted); }
.ex-busy { padding: 28px 12px; text-align: center; color: var(--fg-muted); }

/* tables */
.ex-tablewrap { position: relative; overflow-x: auto; margin: 0 0 14px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.ex-table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.ex-table th, .ex-table td { padding: 8px 12px; text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--border); }
.ex-table thead th { white-space: nowrap; font-weight: 700; background: var(--bg-sunken); border-bottom: 1px solid var(--border-strong); }
.ex-table tbody tr:last-child th, .ex-table tbody tr:last-child td { border-bottom: 0; }
.ex-table .num { text-align: right; white-space: nowrap; }
.ex-table .ctr { text-align: center; }
.ex-table tbody th { font-weight: 600; }
.ex-table small { display: block; margin-top: 1px; font-weight: 400; color: var(--fg-muted); }
.ex-check-table { min-width: 640px; }
.ex-check-table td .math { font-size: .95em; }
.ex-more { margin: 14px 0; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.ex-more > summary { cursor: pointer; padding: 10px 14px; font-weight: 650; }
.ex-more > summary:hover { background: var(--bg-hover); }
.ex-more[open] > summary { border-bottom: 1px solid var(--border); }
.ex-more > .ex-tablewrap { margin: 12px; }

/* check marks */
.ex-ok, .ex-bad { display: inline-grid; place-items: center; width: 26px; height: 26px; font-size: 1rem; font-weight: 800; border-radius: 50%; }
.ex-ok { color: color-mix(in srgb, var(--success) 82%, var(--fg)); background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 45%, transparent); }
.ex-bad { color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.ex-verdict { display: inline-block; margin: 0 0 14px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border); }
.ex-verdict.is-ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.ex-verdict.is-bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.ex-verdict strong { color: var(--fg); }

/* figure */
.ex-figure { box-shadow: var(--shadow-1); }
.ex-figure .s-figure-body { padding: 6px 6px 0; }
.ex-figure svg { display: block; width: 100%; height: auto; }
.ex-figure .s-figure-title { flex-basis: 260px; }

/* controls */
.ex-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
.ex-select { min-height: 42px; max-width: 100%; padding: 8px 12px; font: inherit; font-weight: 500; color: var(--fg); background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.ex-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius); }
.ex-seg button { min-height: 36px; padding: 5px 14px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--fg-muted); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.ex-seg button:hover { color: var(--fg); }
.ex-seg button[aria-pressed="true"] { color: var(--accent-text); background: var(--bg-elev); box-shadow: var(--shadow-1); }
.ex-case-line { margin: 0 0 12px; color: var(--fg-muted); }
.ex-case-line strong { color: var(--fg); }

/* answer tiles */
.ex-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.ex-tile { min-width: 0; padding: 14px 16px; background: var(--bg-elev); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.ex-tile-wide { grid-column: 1 / -1; }
.ex-tile-k { font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); }
.ex-tile-v { margin: 2px 0; font-size: 1.55rem; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ex-tile-s { margin-top: 4px; font-size: .86rem; color: var(--fg-muted); }
.ex-react { margin: 6px 0 4px; padding: 0; list-style: none; columns: 2 280px; column-gap: 28px; font-variant-numeric: tabular-nums; }
.ex-react li { margin: 3px 0; break-inside: avoid; }
.ex-react b { margin-right: 4px; }

/* the embedded calculator report */
.ex-report.rv-root { min-height: 0; background: transparent; }
.ex-report .rv-doc { max-width: none; margin: 0; padding: 8px 28px 32px; }
.ex-report .rv-doc h2.rv-h1:first-child, .ex-report .rv-doc > h2.rv-h1:first-of-type { margin-top: 20px; }
.ex-report .math:not([data-rendered]), .ex-check-table .math:not([data-rendered]) { font-family: var(--font-mono); font-size: .86em; }
@media (max-width: 700px) { .ex-report .rv-doc { padding: 4px 12px 24px; } }

/* previous / next */
.ex-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 24px 0 18px; }
.ex-pn a { display: block; padding: 14px 18px; color: var(--fg); text-decoration: none; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ex-pn a:hover { border-color: var(--accent); background: var(--accent-soft); }
.ex-pn small { display: block; margin-bottom: 4px; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); }
.ex-pn span { font-weight: 650; line-height: 1.3; }
.ex-pn-next { text-align: right; }
@media (max-width: 640px) { .ex-pn { grid-template-columns: 1fr; } .ex-pn-next { text-align: left; } }

@media (max-width: 600px) {
  .ex-grid { gap: 16px; }
  .ex-head .s-cta .s-btn { flex: 1 1 100%; }
  .ex-tile-v { font-size: 1.35rem; }
}

/* ================= print / save as PDF ================= */
@media print {
  @page { size: A4; margin: 15mm 13mm; }
  .s-header, .s-footer, .s-skip, .ex-nopr, .ex-toc-wrap, .s-tabs, .ex-crumbs { display: none !important; }
  html, body { background: #fff !important; color: #111 !important; }
  .s-page-head { padding: 0 0 8pt; border: 0; background: none; }
  .s-page-head h1 { font-size: 20pt; max-width: none; }
  .ex-layout { display: block; padding: 8pt 0 0; max-width: none; }
  .ex-sheet, .ex-head {
    --bg: #fff; --bg-elev: #fff; --bg-sunken: #f1f3f6; --bg-hover: transparent; --fg: #111827; --fg-muted: #4b5563; --fg-subtle: #6b7280;
    --border: #d9dde4; --border-strong: #aab1bd; --accent: #4f46e5; --accent-soft: #eef0ff; --accent-text: #3730a3; --accent-fg: #fff;
    --danger: #b91c1c; --danger-soft: #fdecec; --warning: #b45309; --warning-soft: #fdf3e1; --success: #15803d; --success-soft: #e7f6ec;
    --info: #0369a1; --info-soft: #e6f3fb; --shadow-1: none; --shadow-2: none;
    --member: #334155; --node: #0f172a; --grid: #e3e6ec; --load: #dc2626; --support: #475569; --reaction: #0d9488; --deflected: #16a34a;
    --diag-N: #7c3aed; --diag-V: #0284c7; --diag-M: #e11d48; --diag-T: #b45309; --diag-d: #16a34a; --tension: #2563eb; --compression: #ea580c; --zero-force: #94a3b8;
    color: #111827;
  }
  .ex-section { margin-bottom: 14pt; }
  .ex-section > h2 { font-size: 14pt; break-after: avoid; page-break-after: avoid; }
  .ex-section h3, .ex-h4 { break-after: avoid; page-break-after: avoid; }
  .ex-figure, .ex-tile, .ex-tablewrap, .ex-table tr, .ex-verdict { break-inside: avoid; page-break-inside: avoid; }
  .ex-tablewrap, .ex-check-table { overflow: visible !important; min-width: 0; }
  .ex-table { font-size: 8.5pt; }
  .ex-tile-v { font-size: 13pt; }
  .ex-figure { box-shadow: none; }
  .ex-report .rv-doc { padding: 0; }
  #solution { break-before: page; page-break-before: always; }
}
