:root {
  --bg: #efede7;
  --surface: #faf7f0;
  --surface-2: #f6f3ec;
  --chrome: #e7e4dd;
  --ink: #1f1d1a;
  --soft: #4d4a45;
  --muted: #7c7973;
  --faint: #bebab2;
  --border: #cfcbc2;
  --border-soft: #e2ded5;
  --accent: #2f5c7e;
  --accent-fg: #ffffff;
  --accent-hover: #3a6e92;
  --accent-pressed: #264a66;
  --accent-soft: #e0e9f0;
  --paper-accent: #8a3a2a;
  --paper-accent-soft: #f2e7d7;
  --ok: #4c6a35;
  --warning: #a65a5a;
  --warning-bg: #f1ddd7;
  --code-bg: #ebe7dc;
  --code-pill: #d8dde6;
  --shadow: 0 18px 45px rgba(31, 29, 26, 0.12);
  --radius: 8px;
  --max: 1160px;
}

body[data-site-theme="dark"] {
  --bg: #0f1722;
  --surface: #131e2c;
  --surface-2: #172436;
  --chrome: #101923;
  --ink: #e6eef7;
  --soft: #a9bbd0;
  --muted: #7f93ad;
  --faint: #4a5f78;
  --border: #26384f;
  --border-soft: #1c2a3d;
  --accent: #5dd9e8;
  --accent-fg: #07111a;
  --accent-hover: #7ee6f1;
  --accent-pressed: #34b9cb;
  --accent-soft: #193847;
  --paper-accent: #e8b86d;
  --paper-accent-soft: #2a251d;
  --ok: #8fc779;
  --warning: #e18d8d;
  --warning-bg: #3b2228;
  --code-bg: #101923;
  --code-pill: #213149;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-pressed);
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

code,
kbd {
  font-family: "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
}

code {
  background: var(--code-pill);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
  font-size: 0.92em;
}

pre {
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(231, 228, 221, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

body[data-site-theme="dark"] .site-header {
  background: rgba(16, 25, 35, 0.94);
}

.nav {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  padding: 0.34rem 0.58rem 0.34rem 0.42rem;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--border);
  text-decoration: none;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px var(--border), 0 6px 18px rgba(0, 0, 0, 0.12);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--soft);
  font-weight: 600;
  font-size: 0.94rem;
}

.site-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 76px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  background: var(--surface-2);
  color: var(--soft);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.site-theme-toggle:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.site-theme-toggle:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 0.35rem;
  border-left: 1px solid var(--border-soft);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-soft);
  color: var(--accent-pressed);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: currentColor;
}

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-soft);
  background:
    radial-gradient(ellipse 80% 60% at 75% 30%, var(--accent-soft) 0%, transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

.accent-text {
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}

.hero-grid,
.section-inner,
.page-shell,
.site-footer .footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.hero-grid {
  padding-top: 4.5rem;
  padding-bottom: 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  align-items: center;
  gap: 3rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  max-width: 22ch;
  line-height: 1.15;
}

h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.25;
}

h3 {
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  line-height: 1.3;
}

.page-title {
  max-width: 880px;
  padding-top: 3.5rem;
  padding-bottom: 1.5rem;
}

.page-title h1 {
  max-width: 24ch;
  font-size: clamp(1.85rem, 3.2vw, 2.85rem);
}

.lead {
  color: var(--soft);
  font-size: clamp(1.08rem, 2vw, 1.3rem);
  max-width: 66ch;
}

.hero .lead {
  margin: 1.35rem 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.72rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-weight: 750;
  text-decoration: none;
  transition: background 0.18s ease-out, color 0.18s ease-out, border-color 0.18s ease-out, transform 0.12s ease-out, box-shadow 0.18s ease-out;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.btn.primary:hover {
  background: var(--accent-hover);
  color: var(--accent-fg);
  box-shadow: 0 6px 18px rgba(47, 92, 126, 0.22);
}

.btn.secondary {
  background: var(--surface);
  color: var(--accent);
}

.btn.secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.screenshot-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--chrome);
  box-shadow:
    0 1px 3px rgba(31, 29, 26, 0.06),
    0 8px 24px rgba(31, 29, 26, 0.10),
    0 24px 60px rgba(31, 29, 26, 0.08);
}

.screenshot-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.section {
  padding: 4.5rem 0;
}

.section.alt {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-top: none;
  border-bottom: none;
}

.section-header {
  max-width: 760px;
  margin-bottom: 2rem;
}

.section-header h2,
.content h2 {
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  color: var(--ink);
  line-height: 1.25;
}

.section-header p {
  margin: 0.85rem 0 0;
  color: var(--soft);
  font-size: 1.08rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out, border-color 0.18s ease-out;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(31, 29, 26, 0.04), 0 12px 28px rgba(31, 29, 26, 0.10);
  border-color: var(--accent-soft);
}

.card a:hover {
  color: var(--accent-pressed);
}

.alt .card {
  background: var(--surface-2);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.55rem;
}

.card p,
.card li {
  color: var(--soft);
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.feature-list {
  margin: 0;
  padding-left: 1.1rem;
}

.palette-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.swatch {
  min-height: 110px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  font-weight: 800;
}

.swatch.normal-light {
  background: #faf7f0;
  color: #2f5c7e;
}

.swatch.normal-dark {
  background: #111827;
  color: #5dd9e8;
}

.swatch.paper-light {
  background: #f8ecd6;
  color: #8a3a2a;
}

.swatch.paper-dark {
  background: #0c0c0d;
  color: #e8b86d;
}

.content-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.toc {
  position: sticky;
  top: 5.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
}

.toc a {
  display: block;
  padding: 0.35rem 0.75rem 0.35rem 1rem;
  color: var(--soft);
  font-weight: 650;
  border-left: 3px solid transparent;
  border-radius: 0 4px 4px 0;
  margin-left: -1rem;
  transition: background 0.15s ease-out, color 0.15s ease-out, border-color 0.15s ease-out;
}

.toc a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.toc a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  border-left-color: var(--accent);
}

.content {
  max-width: 820px;
}

.content h2 {
  margin-top: 2.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-soft);
}

.content h2:first-child {
  margin-top: 0;
}

.content h3 {
  margin-top: 1.7rem;
}

.content p,
.content li {
  color: var(--soft);
}

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.callout.warning {
  border-left-color: var(--warning);
  background: var(--warning-bg);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--code-bg);
  color: var(--ink);
}

tr:last-child td {
  border-bottom: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--chrome);
  color: var(--soft);
}

.footer-inner {
  padding-top: 2rem;
  padding-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--soft);
  font-weight: 650;
}

:focus-visible {
  outline: 3px solid var(--accent-hover);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .hero-grid,
  .content-layout,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    min-height: auto;
    padding-top: 3.5rem;
  }

  .toc {
    position: static;
  }
}

@media (max-width: 720px) {
  .nav {
    align-items: center;
    flex-wrap: wrap;
    padding-inline: 1rem;
  }

  .brand {
    font-size: 1rem;
    padding-right: 0.35rem;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .nav-actions {
    order: 2;
    margin-left: auto;
    padding-left: 0;
    border-left: 0;
  }

  .menu-toggle {
    order: 3;
    display: block;
  }

  .nav-links {
    order: 4;
    position: fixed;
    inset: 64px 0 auto 0;
    display: none;
    background: var(--chrome);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    border-radius: var(--radius);
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .palette-strip {
    grid-template-columns: 1fr 1fr;
  }

  .section {
    padding: 3rem 0;
  }
}

/* === Accessibility === */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 1000;
  font-weight: 600;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === Live demo widget (homepage) === */

.demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.demo-source {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  font-family: "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  outline: none;
}

.demo-source:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 92, 126, 0.15);
}

.demo-output {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  min-height: 360px;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.65;
}

.demo-output h1,
.demo-output h2,
.demo-output h3 {
  margin-top: 0.6em;
  margin-bottom: 0.3em;
  color: var(--ink);
}

.demo-output h1 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.2em; }
.demo-output h2 { font-size: 1.25em; border-bottom: 1px solid var(--border-soft); padding-bottom: 0.15em; }
.demo-output h3 { font-size: 1.1em; }

.demo-output p { margin: 0.5em 0; }
.demo-output ul, .demo-output ol { margin: 0.5em 0; padding-left: 1.5rem; }
.demo-output li { margin: 0.2em 0; }
.demo-output code { font-size: 0.88em; }
.demo-output pre { margin: 0.6em 0; padding: 0.75rem 1rem; font-size: 0.85rem; }
.demo-output pre code { background: transparent; border: 0; padding: 0; }
.demo-output table { width: 100%; border-collapse: collapse; margin: 0.6em 0; font-size: 0.9em; }
.demo-output th, .demo-output td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; text-align: left; }
.demo-output th { background: var(--chrome); }
.demo-output input[type="checkbox"] { margin-right: 0.4em; }

.demo-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .demo {
    grid-template-columns: 1fr;
  }
  .demo-source,
  .demo-output {
    min-height: 240px;
  }
}

/* === FAQ === */

.faq {
  display: grid;
  gap: 0.75rem;
  max-width: 820px;
  margin: 0 auto;
}

.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.faq details[open] {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(47, 92, 126, 0.08);
}

.faq summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 0.25s ease-out;
  margin-right: 0.4rem;
  flex-shrink: 0;
}

.faq details[open] summary::before {
  transform: rotate(45deg);
}

.faq details p {
  margin: 0.6rem 0 0;
  color: var(--soft);
  line-height: 1.6;
}

/* === Math symbol reference === */

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}

.sym {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  gap: 0.5rem;
}

.sym code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--soft);
}

.sym span {
  color: var(--ink);
  font-size: 1.05rem;
}

.symbol-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.5rem;
}

.symbol-table th,
.symbol-table td {
  border: 1px solid var(--border-soft);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: middle;
}

.symbol-table th {
  background: var(--chrome);
  font-weight: 600;
}

.symbol-table td:first-child {
  width: 22%;
  color: var(--soft);
}

.symbol-table td:nth-child(2) {
  width: 38%;
}

.symbol-table td code {
  font-size: 0.85rem;
}

.math-playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0 0.5rem;
}

.math-output {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  font-size: 1.1rem;
}

@media (max-width: 760px) {
  .math-playground {
    grid-template-columns: 1fr;
  }
}

/* === Shortcut search === */

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 0.75rem 0;
  z-index: 5;
  border-bottom: 1px solid var(--border-soft);
}

.search-bar input[type="search"] {
  flex: 1;
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
}

.search-bar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 92, 126, 0.15);
}

.search-hint {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.shortcut-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1.5rem;
}

.shortcut-table th,
.shortcut-table td {
  border: 1px solid var(--border-soft);
  padding: 0.55rem 0.85rem;
  text-align: left;
  vertical-align: top;
}

.shortcut-table th {
  background: var(--chrome);
  font-weight: 600;
}

.shortcut-table td:first-child {
  width: 22%;
  white-space: nowrap;
}

.shortcut-table td:nth-child(2) {
  width: 28%;
  font-weight: 500;
}

.shortcut-table td:nth-child(3) {
  color: var(--soft);
  font-size: 0.95em;
}

kbd {
  background: var(--chrome);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.82em;
  color: var(--ink);
  display: inline-block;
  margin: 0 1px;
}

/* === Print stylesheet === */

@media print {
  .site-header,
  .site-footer,
  .toc,
  .skip-link,
  .menu-toggle,
  .nav-links,
  .search-bar,
  .demo,
  .demo-source,
  .actions,
  .btn {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  .page-shell,
  .section-inner,
  .content-layout,
  .content {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    grid-template-columns: 1fr !important;
  }

  h1, h2, h3 {
    page-break-after: avoid;
    color: #000 !important;
  }

  pre, blockquote, table, .sym, .faq details {
    page-break-inside: avoid;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }

  .symbol-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .callout {
    border: 1px solid #888;
    background: #f5f5f5 !important;
    color: #000 !important;
  }
}

/* === Tier 2 polish: demo pane labels, noscript, mobile micro-breakpoint, typography === */

.demo-pane-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.demo-pane {
  display: flex;
  flex-direction: column;
}

.js-required {
  padding: 1rem 1.15rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.95rem;
  margin: 1rem 0;
}

@media (max-width: 480px) {
  h1 { font-size: clamp(1.5rem, 7vw, 2rem); max-width: 18ch; }
  .page-title h1 { font-size: clamp(1.4rem, 6.5vw, 1.85rem); max-width: 20ch; }
  .actions { gap: 0.5rem; }
  .nav { padding: 0.5rem 0.75rem; }
  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    text-align: center;
  }
  .footer-links {
    justify-content: center;
  }
}

/* Typography micro-polish */
body {
  font-feature-settings: "kern" 1, "liga" 1;
}

h1 {
  letter-spacing: -0.02em;
}

.shortcut-table td:first-child kbd,
.symbol-table td code,
.demo-source,
.demo-output,
.math-output {
  font-variant-numeric: tabular-nums;
}
