/* AII OS docs — custom theme in the aiii.id design language.
   Warm paper, near-black ink, copper accents; Fraunces/Inter/JetBrains Mono;
   60ch reading measure; dark "ledger" code blocks; hairline rules.
   Absorbs the earlier rendering fixes (skip link, contained tables/pre,
   wrap-safe brand, focus visibility) so nothing regresses. */

:root {
  --paper: #F5F2EC;
  --paper-alt: #EDE9E0;
  --ink: #1A1916;
  --ink-soft: #4A463D;
  --ink-quiet: #6F6A5E;
  --copper: #A85F22;
  --copper-light: #C08347;
  --copper-dark: #8A4D1C;
  --hairline: #D8D2C6;
  --night: #131211;
  --night-ink: #E8E4DA;
  --night-quiet: #A39D8F;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --measure: 60ch;
  --focus: 2px solid #A85F22;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 242, 236, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.site-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.navbar-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.06rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.navbar-brand:hover { color: var(--copper-dark); }

.site-header-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
}

.header-link:hover { color: var(--copper-dark); background: var(--paper-alt); }

.icon { width: 15px; height: 15px; display: block; }

/* hamburger */
.navbar-toggler {
  display: none;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}

.navbar-toggler .toggler-bar {
  display: block;
  width: 18px;
  height: 1.6px;
  background: var(--ink);
  margin: 3.5px 0;
}

@media (max-width: 900px) {
  .navbar-toggler { display: block; }
  .sidebar { display: none; }
  .page { grid-template-columns: 1fr; }
}

/* ---------- mobile nav panel ---------- */

.site-nav-panel { display: none; }
.site-nav-panel.open { display: block; border-bottom: 1px solid var(--hairline); }

.nav-sections { list-style: none; margin:  0; padding: 0; }
.nav-sections .nav-sections { margin: 0; }

.nav-group { margin-bottom: 1.15rem; }
.nav-group-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper-dark);
  margin: 0 0 0.4rem;
}

.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group ul li a, .nav-single {
  display: block;
  padding: 0.29rem 0;
  color: var(--ink-soft);
  text-decoration: none;
  font-size:  0.94rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.nav-group ul li a:hover { color: var(--copper-dark); }

.nav-group ul li a.active,
.nav-single.active {
  color: var(--copper-dark);
  font-weight: 500;
}

.site-nav-panel .site-nav { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1.25rem 1.5rem; }

/* ---------- layout ---------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.35rem 3rem;
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

@media (max-width: 1250px) {
  .page { gap: 2rem; }
}

.sidebar { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow-y: auto; }

/* ---------- article ---------- */

.article { min-width: 0; outline: none; }

.article h1, .modal-panel h2 {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 1.5rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.article h1 { margin-top: 0; }

.article h2 {
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 600;
  margin: 2.4rem 0 0.75rem;
  line-height: 1.3;
  color: var(--ink);
}

.article h2::after {
  content: "";
  display: block;
  width: 2.6rem;
  height: 2px;
  background: var(--copper);
  margin-top: 0.5rem;
  border-radius: 2px;
}

.article h3 {
  font-size: 1.08rem;
  font-weight: 600;
  margin: 1.8rem 0 0.5rem;
  color: var(--ink);
}

.article h4 { font-size: 1rem; font-weight: 600; margin: 1.4rem 0 0.4rem; }

.article p, .article ul, .article ol { max-width: var(--measure); }

.article p { margin: 0 0 1.05rem; }
.article p, .article li, .article h1, .article h2, .article h3, .article h4, .article h5 { overflow-wrap: break-word; }

.article a { color: var(--copper-dark); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article a:hover { color: var(--copper-dark); text-decoration-thickness: 2px; }

.article ul, .article ol { padding-left: 1.4rem; }
.article li { margin-bottom: 0.35rem; }

.article img, .article svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
}

.article blockquote {
  margin: 1.5rem 0;
  padding: 0.05rem 1.1rem;
  border-left: 2px solid var(--copper-light);
  color: var(--ink-soft);
}

.article hr { border: none; border-top: 1px solid var(--hairline); margin: 2.5rem 0; }

/* ---------- draft status + sources (prose transform targets) ---------- */
/* Final definitions live in "prose ornaments" section below; kept here only for the a rules. */

.sources-line a { color: var(--copper-dark); text-decoration: none; }
.sources-line a:hover { text-decoration: underline; }

/* ---------- tables ---------- */

.article table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.6rem 0;
}

.article th, .article td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.article th {
  background: var(--paper-alt);
  font-weight: 600;
  font-size: 0.86rem;
}

/* ---------- code ---------- */

.article pre {
  background: var(--night);
  color: var(--night-ink);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  max-width: 100%;
  font-size: 0.86rem;
  line-height: 1.6;
  margin: 1.6rem 0;
}

.article pre code, .article code { font-family: var(--mono); }

.article :not(pre) > code {
  background: var(--paper-alt);
  color: var(--ink);
  padding: 0.12em 0.38em;
  border-radius: 5px;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.article pre code { background: none; color: inherit; padding: 0; border-radius: 0; font-size: inherit; }

/* ---------- toc ---------- */

.toc { margin-bottom: 2.2rem; }

.toc-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper-dark);
  margin-bottom: 0.5rem;
}

.toc-list, .toc-list ul { list-style: none; margin: 0; padding: 0; }
.toc-list ul { padding-left: 1rem; border-left: 1px solid var(--hairline); }
.toc-list li { margin: 0.18rem 0; }

.toc-link {
  display: inline-block;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toc-link:hover { color: var(--copper-dark); }

/* ---------- pager ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--hairline);
}

.pager a {
  text-decoration: none;
  color: var(--ink);
  max-width: 48%;
}

.pager-direction { display: block; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--copper-dark); font-weight: 600; margin-bottom: 0.25rem; }
.pager-title { font-size: 0.95rem; color: var(--ink-soft); }
.pager a:hover .pager-title { color: var(--copper-dark); text-decoration: underline; }
.pager-disabled { visibility: hidden; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 1.6rem 1.25rem 2rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--ink-quiet);
}

.site-footer a { color: var(--copper-dark); }

.footer-quiet { font-size: 0.8rem; }

/* ---------- skip link ---------- */

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2000;
  padding: 0.5rem 1rem;
  background: var(--night);
  color: var(--night-ink);
  border-radius: 8px;
  transform: translateY(-200%);
  transition: transform 0.1s ease-out;
}

.skip-link:focus { transform: translateY(0); outline: 3px solid var(--copper); outline-offset: 2px; }

/* ---------- focus ---------- */

a:focus-visible, button:focus-visible, input:focus-visible, .article:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: 4px;
}

.article:focus { outline: none; }
.article:focus-visible { outline: 2px solid var(--copper); }

/* ---------- modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(19, 18, 17, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
}

.modal.show { display: flex; }

.modal-panel {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  margin-top: 10vh;
  width: min(640px, calc(100vw - 2rem));
  max-height: 76vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(19, 18, 17, 0.18);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--hairline);
}

.modal-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
}

.modal-close:hover { color: var(--ink); background: var(--paper-alt); }

.modal-body { padding: 1.1rem 1.2rem 1.3rem; }
.modal-hint { margin: 0 0 0.7rem; color: var(--ink-soft); font-size: 0.92rem; }

.modal-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--hairline);
  outline: none;
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.98rem;
  margin-bottom: 0.9rem;
}

.modal-input:focus { outline: 2px solid var(--copper); outline-offset: 1px; border-color: var(--copper-light); }

#mkdocs-search-results { font-size: 0.94rem; }
#mkdocs-search-results a { display: block; padding: 0.45rem 0.6rem; color: var(--ink); text-decoration: none; border-radius: 6px; }
#mkdocs-search-results a:hover { background: var(--paper-alt); color: var(--copper-dark); }
#mkdocs-search-results article h3 { margin: 0 0 0.15rem; font-size: 0.98rem; }
#mkdocs-search-results article p { margin: 0 0 0.2rem; font-size: 0.86rem; color: var(--ink-quiet); }

.key-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.key-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--hairline); }
.key-table kbd {
  font-family: var(--mono);
  background: var(--paper-alt);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.45em;
  font-size: 0.86em;
}

/* ---------- misc ---------- */

.article strong { color: var(--ink); font-weight: 600; }

.article .section-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper-dark);
  font-weight: 600;
}

/* ---------- prose ornaments (runtime-tagged by base.js) ---------- */

/* Sources lines: quiet, compact, off the reading line */
.sources-line {
  margin: 0.35rem 0 1.3rem;
  padding: 0.45rem 0.7rem;
  border-left: 2px solid var(--hairline);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-quiet);
  overflow-wrap: anywhere;
}

/* Draft status: one quiet line in the page head, not a banner */
.draft-status {
  margin: 0 0 1.6rem;
  padding: 0.4rem 0.75rem;
  border-left: 2px solid var(--copper);
  background: var(--paper-alt);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- mobile <=560px ---------- */

@media (max-width: 560px) {
  .page { padding: 1.8rem 1rem 2.4rem; }
  .article h1 { font-size: 1.62rem; }
  .article h2 { font-size: 1.24rem; }
  .article pre { padding: 0.9rem 1rem; font-size: 0.8rem; }
  .modal-panel { margin-top: 6vh; }
}

/* ---------- print ---------- */

@media print {
  .site-header, .sidebar, .site-nav-panel, .pager, .site-footer, .modal, .skip-link, .toc { display: none !important; }
  .page { display: block; max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
  .article a { color: #000; text-decoration: underline; }
}

/* ═══════════════ aiii.id polish layer ═══════════════
   The eye-candy pass: hero, ledger code blocks, night footer,
   buttons, selection, labels. Authored as an append file, validated
   before merge. All motion wrapped in prefers-reduced-motion. */

/* ---------- selection ---------- */

::selection { background: var(--copper); color: var(--paper); }

/* ---------- section labels: copper uppercase + hairline dash ---------- */

.nav-group-title, .toc-title, .pager-direction {
  position: relative;
}

.nav-group-title::before,
.toc-title::before,
.pager-direction::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--copper);
  vertical-align: middle;
  margin-right: 0.5rem;
}

/* active nav: copper text + left dash */
.nav-group ul li a.active::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 1px;
  background: var(--copper);
  vertical-align: middle;
  margin-left: -1.15rem;
  margin-right: 0.4rem;
}

/* ---------- ledger code blocks: dots + language label ---------- */

.code-block {
  margin: 1.6rem 0;
  border: 1px solid #2F2C28;
  border-radius: 10px;
  overflow: hidden;
}

.code-block .code-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: #1F1D1A;
  border-bottom: 1px solid #2F2C28;
  color: #A39D8F;
}

.code-dots { display: flex; gap: 0.4rem; color: #A39D8F; }
.code-dots i {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #2F2C28;
  display: block;
}

.code-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #A39D8F;
  letter-spacing: 0.05em;
}

.code-block pre {
  margin: 0;
  border-radius: 0;
  background: #131211;
  max-width: none;
}

/* ---------- night footer ---------- */

.site-footer {
  background: var(--night);
  color: var(--night-quiet);
  border-top: none;
  padding: 3rem 0 2rem;
  text-align: left;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--night-ink);
  margin-bottom: 0.3rem;
}

.footer-brand span { color: var(--copper-light); }

.footer-tagline {
  font-size: 0.85rem;
  color: var(--night-quiet);
  margin: 0;
  max-width: 40ch;
}

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

.footer-links a {
  color: var(--night-quiet);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--copper-light); }

.footer-bottom {
  border-top: 1px solid #2F2C28;
  padding-top: 1.25rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-bottom a { color: var(--night-quiet); }
.footer-bottom a:hover { color: var(--copper-light); }

/* ---------- buttons (page-bottom CTA + hero) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7rem 1.4rem;
  font-size: 0.94rem;
  font-weight: 500;
  border-radius: 3px;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  border: none;
  font-family: var(--sans);
  text-decoration: none;
}

.btn.btn-primary {
  background: var(--copper-dark);
  color: var(--paper);
}

.btn.btn-primary:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(26, 25, 22, 0.25);
}

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

.btn.btn-secondary:hover {
  border-color: var(--copper);
  color: var(--copper-dark);
}

.btn .arrow { transition: transform 0.15s; }
.btn:hover .arrow { transform: translateX(2px); }

/* ---------- homepage hero ---------- */

/* The runtime hero (base.js buildHero) lifts the real h1 and first
   paragraph into section.hero; nothing is hidden, so the page stays
   correct with JavaScript unavailable. */

.hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 4rem);
}

.hero-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--copper-dark);
  margin-bottom: 1.25rem;
}

.hero-label::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--copper);
  vertical-align: middle;
  margin-right: 0.75rem;
}

/* Signature ring inside the hero label: seamed arc + copper node,
   copper via currentColor, sized to the label's small-caps line. */
.hero-label svg {
  display: inline-block;
  width: 26px;
  height: 26px;
  margin-right: 0.5rem;
  vertical-align: middle;
  color: var(--copper-dark);
}

/* Diagrams: paper-on-paper, framed by a hairline so the explicit
   canvas edge is quiet rather than a white rectangle. */
.article img {
  max-width: 100%;
  height: auto;
  border: 1px solid #D8D2C6;
  border-radius: 8px;
  background: #F5F2EC;
}

.article img[src$=".svg"] {
  background: #F5F2EC;
}

/* Standalone "open this diagram" links render as quiet captions. */
.article p > a[href$=".svg"] {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.5vw, 3.9rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  color: #1A1916;
  max-width: 16ch;
}

.hero-sub {
  font-size: clamp(1.02rem, 1.8vw, 1.18rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 1.75rem;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* the draft-status paragraph inside the hero renders as a quiet dict-card */
.article.home .draft-status {
  margin: 2rem 0 0;
  padding: 1.1rem 1.4rem;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--copper);
  border-radius: 2px;
  background: #F8F5EF;
  max-width: 30rem;
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
  position: relative;
}

/* ---------- route table (home): aiii.id bottom-border rows ---------- */

.article table.route-table {
  font-size: 0.92rem;
}

/* ---------- entrance animation ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero > * {
    opacity: 0;
    animation: fadeUp 0.6s ease forwards;
  }
  .hero > *:nth-child(2) { animation-delay: 0.05s; }
  .hero > *:nth-child(3) { animation-delay: 0.1s; }
  .hero > *:nth-child(4) { animation-delay: 0.15s; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- print: keep footer text visible ---------- */

@media print {
  .site-footer { background: #fff; color: #000; border-top: 1px solid #999; }
  .footer-brand, .footer-bottom, .footer-tagline { color: #000; }
  .footer-links { display: none; }
  .code-block { border-color: #999; }
  .code-block .code-head { display: none; }
}

/* ---------- scrollbar (WebKit) ---------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-alt); }
::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--copper-light); }

/* ═══════════════ shine layer ═══════════════
   The motion and depth pass: link underlines that breathe, ring
   rotation, admonition panels, TOC/table hover, modal entrance,
   editorial drop cap. Motion confined to prefers-reduced-motion:
   no-preference; print-neutral; contrast-safe by construction. */

/* article links: old .md-content rule removed (dead wrapper) — see UPGRADE section */

/* ---------- ring ornament: rotation (see signature section below) ---------- */

@keyframes ringturn {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* admonitions: removed — the corpus renders none and mkdocs.yml has no
   admonition extension; the old rule was dead both ways. */

/* ---------- toc: hover hairline + active copper ---------- */

.toc a {
  transition: color 0.15s ease;
}
.toc a:hover {
  color: var(--copper-dark);
  text-decoration: none;
}

/* tables: old .md-content row-hover removed — see UPGRADE section */

/* ---------- modal: fade-scale entrance ---------- */

@media (prefers-reduced-motion: no-preference) {
  .modal-panel {
    animation: modalIn 0.18s ease-out;
  }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* drop cap: old .md-content rule removed (doubly dead) — see UPGRADE section */

/* ---------- print: motion-free, solid colors ---------- */

@media print {
  .article > p a:not(.btn),
  .article > ul a:not(.btn),
  .article > ol a:not(.btn),
  .article > table a:not(.btn),
  .article > blockquote p a:not(.btn) {
    background-image: none;
  }
  .hero-label svg { animation: none; }
}/* ============================================================
   SIGNATURE — the seamed ring
   One seam, one copper node seated in the gap: continuity
   honest about its breaks, the present moment marked.
   Every surface carries the same geometry: favicon, hero,
   record-end, footer sign, 404.
   ============================================================ */

/* Footer sign: quiet line on the night footer, above the bottom bar.
   Night hairline + quiet tone match the footer-bottom's established pattern. */
.footer-sign {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--night-quiet);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  margin: 0 0 1.1rem;
  padding-top: 1.4rem;
  border-top: 1px solid #2F2C28;
}

.footer-sign svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* Record-end mark: the close of every article. Small, quiet, still —
   in the signature copper, bookending the hero ring's opening mark. */
.record-end {
  margin: 2.75rem 0 0.5rem;
  color: var(--copper-dark);
}

.record-end svg {
  display: block;
  width: 26px;
  height: 26px;
}

/* 404: the broken-record moment, where the mark means the most. */
.nf-hero {
  text-align: center;
  padding: clamp(2rem, 5vw, 4rem) 0 1rem;
}

.nf-hero .nf-mark {
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--copper-dark);
}

.nf-hero .nf-mark svg {
  width: 44px;
  height: 44px;
}

/* Ring rotation now turns the whole svg — the copper node rides
   the seam's slow orbit. (The ring is path+node, not circles.) */
@media (prefers-reduced-motion: no-preference) {
  .hero-label svg {
    animation: ringturn 90s linear infinite;
  }
}/* ============================================================
   EYE-CANDY LAYER — section emblems, h2 nodes, pull-quote,
   hero glow. Visual language, not stickers.
   ============================================================ */

/* Section emblem: the record-ring carrying its section's mark,
   above the section-index h1, in the hero-label family. */
.section-emblem {
  color: var(--copper-dark);
  margin-bottom: 1rem;
}

.section-emblem svg {
  display: block;
  width: 46px;
  height: 46px;
}

/* h2 node: the copper node from the signature, quietly marking
   every section break. Sits before the title text; the existing
   h2::after underline rule is untouched. */
.article h2::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--copper-dark);
  margin-right: 0.55rem;
  vertical-align: 0.12rem;
}

/* Pull-quote: the one blockquote in the corpus (an example prompt)
   gets the editorial treatment — serif, larger, hairline frame
   top and bottom, no left bar. */
.article blockquote {
  border-left: none;
  padding: 0.9rem 0 0.85rem;
  margin: 2.1rem 0;
  position: relative;
}
.article blockquote::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 2.4rem; height: 1px;
  background: var(--copper);
}
.article blockquote p {
  font-family: var(--serif);
  font-size: 1.13rem;
  line-height: 1.55;
  color: var(--ink);
}

/* Hero warm glow: a breath of warmth behind the hero, the paper
   equivalent of light catching the copper. */
.hero {
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  inset: -3rem -2rem 0 -2rem;
  background: radial-gradient(
    ellipse 60% 55% at 22% 8%,
    rgba(168, 95, 34, 0.07),
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}

/* Print: candy stays on screen. */
@media print {
  .section-emblem { display: none; }
  .article h2::before { display: none; }
  .hero::after { display: none; }
}/* --- generation stamp: reviewer-facing version marker ------------------- */
/* The payload assembler stamps window.AIIGEN at build time; this badge
   renders it in the footer so a reviewer can verify at a glance which
   theme generation is in front of them. file:// caching can serve a
   stale copy — this is the visible check against that. */
.gen-stamp {
  display: inline-block;
  margin-left: 1.25rem;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--night-quiet);
  border: 1px solid #6F6A5E;
  border-radius: 2px;
}
.footer-bottom .gen-stamp { vertical-align: middle; }/* ============================================================
   UPGRADE — fixed selectors + the visible path
   Fixes the five shine rules authored against .md-content, a
   Material-theme wrapper this custom theme never had (content
   is direct children of main.article). Adds the reader-path
   layer: Begin step-cards, install step numerals, why-cards.
   ============================================================ */

/* ---------- FIXED: article links (was .md-content a) ---------- */
/* Scoped to prose containers that are direct children of main. */
.article > p a:not(.btn),
.article > ul a:not(.btn),
.article > ol a:not(.btn),
.article > table a:not(.btn),
.article > blockquote p a:not(.btn) {
  text-decoration: none;
  background-image: linear-gradient(var(--hairline), var(--hairline));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 calc(100% - 0.12em);
  transition: background-size 0.2s ease, background-image 0.2s ease;
  padding-bottom: 1px;
}
.article > p a:not(.btn):hover,
.article > ul a:not(.btn):hover,
.article > ol a:not(.btn):hover,
.article > table a:not(.btn):hover,
.article > blockquote p a:not(.btn):hover {
  background-image: linear-gradient(var(--copper), var(--copper));
  background-size: 100% 2px;
}

/* ---------- FIXED: table row hover (was .md-content table) ---------- */
.article table tbody tr:hover {
  background: var(--paper-alt);
}

/* ---------- FIXED: editorial drop cap ----------
   The old rule (.md-content > p:first-of-type:not(.draft-status))
   was doubly dead: the wrapper never existed, and first-of-type
   ignores :not — draft-status IS the first p, so the selector
   matched nothing even where the wrapper existed. Correct rule:
   the first paragraph AFTER the draft-status line, excluding
   sources-lines; home excluded (the hero owns the index). */
.article:not(.home) > p.draft-status + p:not(.sources-line)::first-letter {
  font-family: var(--serif);
  font-size: 3.3em;
  line-height: 0.85;
  float: left;
  padding: 0.06em 0.10em 0 0;
  color: var(--copper-dark);
  font-weight: 500;
}

/* ---------- BEGIN step-cards: the home path as a visible road ---------- */
.begin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
  margin: 1.4rem 0;
}
.begin-card {
  display: block;
  padding: 1.1rem 1.15rem 1.05rem;
  background: var(--paper-alt);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.begin-card:hover {
  border-color: var(--copper);
  box-shadow: 0 2px 10px rgba(26, 25, 22, 0.07);
}
.begin-num {
  display: block;
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1;
  color: var(--copper-dark);
  margin-bottom: 0.5rem;
}
.begin-title {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
}
.begin-sub {
  display: block;
  color: var(--ink-soft);
  font-size: 0.84rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ---------- WHY cards: the front door's reason block ---------- */
.why-list {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
}
.why-list li {
  background: var(--paper-alt);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 1.05rem 1.15rem;
}
.why-list strong {
  display: block;
  font-family: var(--serif);
  color: var(--ink);
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
}

/* ---------- install step numerals: big serif figures ---------- */
.step-num {
  font-family: var(--serif);
  font-size: 2.3rem;
  line-height: 1;
  color: var(--copper-dark);
  font-weight: 500;
  margin-right: 0.6rem;
  vertical-align: -0.3rem;
}
/* The numeral replaces the copper node on step headings. */
h2.has-stepnum::before {
  display: none;
}

/* ---------- print: cards read as plain blocks ---------- */
@media print {
  .begin-card, .why-list li {
    box-shadow: none;
  }
}
/* Visual teaching revision: stable content before decoration. */
.hero { padding: .5rem 0 1.4rem; }
.hero > * { opacity: 1; animation: none; transform: none; }
.hero::after { display: none; }
.hero-label { margin-bottom: .7rem; }
.hero-label svg { animation: none; margin: 0 0 0 .5rem; }
.article .hero-title { font-size: clamp(2rem, 4vw, 3rem); max-width: 23ch; margin-bottom: 1rem; }
.hero-sub { font-size: 1.08rem; max-width: 54ch; }
.hero-ctas { margin-top: 1rem; }
.page { grid-template-columns: 205px minmax(0, 1fr); gap: 3rem; padding-top: 2rem; }
.nav-group { margin-bottom: .8rem; }
.nav-group-title { cursor: pointer; padding: .4rem 0; letter-spacing: .07em; }
summary.nav-group-title::before { display: none; }
.nav-group ul { padding-left: .8rem; border-left: 1px solid var(--hairline); }
.nav-group a { padding: .45rem 0; }
.page-outline { margin: 0 0 1.25rem; font-size: .85rem; color: var(--ink-soft); }
.page-outline summary { cursor: pointer; padding: .35rem 0; }
.page-outline ul { margin: .5rem 0; padding-left: 1.2rem; }
.article > .draft-status, .article.home .draft-status { font-family: var(--sans); font-size: .78rem; color: var(--ink-soft); border: 0; background: none; padding: 0; max-width: none; margin-bottom: 1rem; }
.draft-status strong { font-weight: 400; }
.article:not(.home) > p.draft-status + p:not(.sources-line)::first-letter { float: none; font: inherit; padding: 0; color: inherit; }
.article .visual-block { max-width: none; }
.article img { width: auto; max-width: 100%; max-height: none; }
.article img[src$=".svg"] { width: min(100%, 480px); }
.visual-block + p:has(> em:only-child) { font-size: .82rem; color: var(--ink-soft); max-width: 64ch; margin: -.5rem auto 1.5rem; }
.route-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; margin: 1rem 0 2rem; }
.route-grid a { display: grid; grid-template-columns: 2rem 1fr; gap: .3rem .6rem; padding: 1rem; border: 1px solid var(--hairline); border-radius: 8px; text-decoration: none; background: #fffaf2; }
.route-grid b { grid-row: span 2; font: 1.8rem var(--serif); color: var(--copper-dark); }
.route-grid strong { color: var(--ink); }
.route-grid span { color: var(--ink-soft); font-size: .85rem; }
.route-grid a:hover { border-color: var(--copper); }
.continuity-picture { padding: 1.2rem; border: 1px solid var(--hairline); border-radius: 10px; background: #fffcf7; margin: 1rem 0 1.5rem; }
.continuity-stages { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.continuity-stages > div { position: relative; padding: .8rem; background: var(--paper-alt); border-radius: 10px 10px 10px 0; border: 1px solid var(--hairline); }
.continuity-stages > div:not(:last-child)::after { content: '→'; position: absolute; right: -1rem; top: 36%; color: var(--copper-dark); }
.continuity-stages small { display: block; color: var(--copper-dark); font-weight: 600; letter-spacing: .06em; }
.continuity-stages strong { display: block; margin: .4rem 0; }
.continuity-stages span { font-size: .85rem; color: var(--ink-soft); }
.record-rail { border-top: 3px solid var(--copper-dark); margin-top: 1rem; padding-top: .6rem; color: var(--ink-soft); font-size: .85rem; }
.record-rail strong { color: var(--ink); }
@media (max-width: 900px) { .page { grid-template-columns: minmax(0,1fr); padding: 1.25rem; } .sidebar { display: none; } }
@media (max-width: 560px) { .page { padding: 1rem; } .route-grid { grid-template-columns: 1fr; } .continuity-stages { grid-template-columns: 1fr; gap: 1.2rem; } .continuity-stages > div:not(:last-child)::after { content: '↓'; right: 50%; top: auto; bottom: -1.4rem; } .hero-label { display: none; } .article h1 { font-size: 1.9rem; } }
@media print { .page-outline,.sidebar { display: none; } .hero { padding: 0; } .continuity-picture,.route-grid a { break-inside: avoid; } }

summary.nav-group-title::after { content: ' +'; float: right; font-size: 1rem; }
details[open] > summary.nav-group-title::after { content: ' −'; }
.article img[src$=".svg"] { width: min(100%,400px); }
.article img[src$="dashboard-first-run.svg"], .article img[src$="dashboard-composer.svg"], .article img[src$="system-boundaries.svg"] { width: 100%; }

.article img[src$="dashboard-first-run.svg"], .article img[src$="dashboard-composer.svg"], .article img[src$="system-boundaries.svg"] { width: min(100%,400px); }

/* Public website navigation, separate from the documentation outline. */
.global-nav {max-width:1200px;margin:auto;padding:12px 24px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #ddd6cc;font-size:14px;}
.global-nav>div {display:flex;flex-wrap:wrap;gap:10px 20px;align-items:center;}
.global-nav a {color:#504b43;text-decoration:none;}
.global-nav a:hover,.global-nav a[aria-current] {color:#93491d;text-decoration:underline;text-underline-offset:4px;}
.global-nav .global-brand {font-weight:700;white-space:nowrap;}
@media(max-width:600px){.global-nav{padding:10px 16px;align-items:flex-start;flex-direction:column}.global-nav>div{gap:8px 14px;font-size:13px}}
