/*! 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-2133 */
/* StiffStruct theory notes page (theory.html, generated by tools/build_theory.py).
 * Link order: css/tokens.css, css/site.css, KaTeX css, css/theory.css. Every colour is a token (light/dark, high/normal contrast).
 * Class prefix: th-
 */

.th-page { --th-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif; }

/* ---- page head actions ---- */
.th-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 20px !important; }
.th-actions .s-meta { margin: 0; }

/* ---- two-column layout: sticky contents + article ---- */
.th-layout {
  display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); gap: 40px;
  align-items: start; padding-top: 32px; padding-bottom: 80px;
}

.th-toc {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto;
  padding: 14px 14px 14px 16px; font-size: .88rem; line-height: 1.4;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overscroll-behavior: contain;
}
.th-toc summary {
  cursor: pointer; list-style: none; margin: 0 0 8px; padding: 0;
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted);
}
.th-toc summary::-webkit-details-marker { display: none; }
.th-toc ol { list-style: none; margin: 0; padding: 0; }
.th-toc ol ol { margin: 2px 0 6px 0; }
.th-toc li { margin: 0; }
.th-toc a {
  display: flex; gap: .55em; padding: 4px 8px; border-left: 2px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--fg-muted); text-decoration: none;
}
.th-toc a:hover { color: var(--fg); background: var(--bg-hover); }
.th-toc a[aria-current="true"] { color: var(--accent-text); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.th-toc .th-n { flex: none; min-width: 2.1em; font-variant-numeric: tabular-nums; color: var(--fg-subtle); }
.th-toc a[aria-current="true"] .th-n { color: var(--accent-text); }
.th-toc ol ol a { padding-left: 22px; font-size: .94em; }
.th-toc .katex { font-size: 1em; }

/* ---- article typography (serif body, sans headings) ---- */
.th-article { max-width: 54rem; font-family: var(--th-serif); font-size: 1.07rem; line-height: 1.72; color: var(--fg); }
.th-article h2, .th-article h3 { font-family: var(--font-ui); line-height: 1.25; text-wrap: balance; }
.th-article h2 {
  margin: 0 0 .7em; padding-top: 1.6em; font-size: 1.65rem; font-weight: 750; letter-spacing: -.01em;
  border-top: 1px solid var(--border);
}
.th-sec:first-child h2 { border-top: 0; padding-top: 0; }
.th-article h3 { margin: 2.1em 0 .55em; font-size: 1.2rem; font-weight: 700; color: var(--fg); }
.th-num { color: var(--accent-text); font-variant-numeric: tabular-nums; margin-right: .15em; }
.th-article h2 .th-num { display: inline-block; min-width: 1.5em; }
.th-article p { margin: 0 0 1em; }
.th-article ul, .th-article ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.th-article li { margin: .4em 0; }
.th-article li > p { margin: 0 0 .55em; }
.th-article li::marker { color: var(--fg-subtle); }
.th-article strong { font-weight: 700; }
.th-article code { font-size: .86em; }
.th-article a { text-decoration-thickness: 1px; }
.th-article a.th-ref { text-decoration: none; font-family: var(--font-ui); font-size: .9em; font-weight: 600; white-space: nowrap; }
.th-article a.th-ref:hover { text-decoration: underline; }
.th-intro > p:first-of-type { font-size: 1.14rem; color: var(--fg); }

/* ---- equations ---- */
.th-eq {
  margin: 1.2em 0; padding: .55em .9em; overflow-x: auto; overflow-y: hidden;
  background: var(--bg-elev); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.th-eq .katex-display { margin: 0; padding: .2em 0; }
.th-eq .katex-display > .katex { text-align: left; }
.th-article .katex { font-size: 1.1em; }
.th-article .katex-display > .katex { font-size: 1.16em; }
.katex-error { color: var(--danger); }

/* ---- tables (booktabs-style: rules only) ---- */
.th-table-wrap { position: relative; margin: 1.3em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.th-article table { width: 100%; border-collapse: collapse; font-size: .96rem; border-top: 2px solid var(--fg); border-bottom: 2px solid var(--fg); }
.th-article th {
  padding: .55em .8em; text-align: left; font-family: var(--font-ui); font-size: .8rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--fg-muted); border-bottom: 1px solid var(--fg);
}
.th-article td { padding: .55em .8em; vertical-align: middle; border-bottom: 1px solid var(--border); }
.th-article tbody tr:last-child td { border-bottom: 0; }
.th-article td .katex { white-space: nowrap; }

/* ---- code blocks / figures (none in the source today, styled for future use) ---- */
.th-article pre {
  margin: 1.2em 0; padding: 12px 16px; overflow-x: auto; font-size: .85rem; line-height: 1.55;
  background: var(--bg-sunken); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.th-article pre code { background: none; border: 0; padding: 0; font-size: 1em; }
.th-article figure { margin: 1.4em 0; }
.th-article figcaption { margin-top: .4em; font-family: var(--font-ui); font-size: .85rem; color: var(--fg-muted); }

.th-end { margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--border); font-family: var(--font-ui); font-size: .85rem; color: var(--fg-muted); }
.th-nojs, .th-mathfail { margin: 0 0 20px; }

/* ---- narrow screens: contents becomes a collapsible block above the article ---- */
@media (max-width: 960px) {
  .th-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .th-toc { position: static; max-height: none; overflow: visible; }
  .th-toc summary { margin-bottom: 0; padding: 4px 0; font-size: .85rem; }
  .th-toc summary::after { content: "+"; float: right; font-size: 1.1rem; line-height: 1; }
  .th-toc details[open] summary { margin-bottom: 8px; }
  .th-toc details[open] summary::after { content: "\2212"; }
  .th-article { font-size: 1.02rem; }
  .th-article h2 { font-size: 1.4rem; }
  .th-article h3 { font-size: 1.1rem; }
  .th-eq { padding: .4em .6em; }
}
@media (min-width: 961px) {
  .th-toc summary { pointer-events: none; cursor: default; }
}
@media (max-width: 480px) {
  .th-layout { padding-left: 16px; padding-right: 16px; }
  .th-article table { font-size: .9rem; }
}

/* ---- print from the web page (the polished A4 version is the PDF) ---- */
@media print {
  .s-header, .s-footer, .s-skip, .th-toc, .th-actions, .th-mathfail, .th-nojs { display: none !important; }
  body { background: #fff; color: #000; }
  .s-page-head { background: none; border: 0; padding: 0 0 12px; }
  .th-layout { display: block; padding: 0; }
  .th-article { max-width: none; font-size: 10.5pt; line-height: 1.5; }
  .th-article h2 { break-after: avoid; }
  .th-article h3 { break-after: avoid; }
  .th-article p, .th-article li { orphans: 3; widows: 3; }
  .th-eq, .th-article table, .th-article pre { break-inside: avoid; }
  .th-eq { overflow: visible; background: none; }
  .th-table-wrap { overflow: visible; }
}
