/* Khooneh — ink on paper, one turquoise. Bilingual: Persian in Vazirmatn (sans), English in Newsreader (serif).
   RTL-first; logical properties throughout. */
:root {
  --paper: #F7F7F4;
  --paper-2: #ECEDE9;
  --ink: #161C1B;
  --ink-2: #5A6664;
  --rule: #CFD5D2;
  --turq: #1D8F8A;
  --turq-wash: #DDEFED;
  --earth: #9C6B3C;
  --earth-wash: #EDE4D8;
  --leaf: #4F7D4A;
  --sheet: #FFFFFF;
  --ok: #3F9B62; --part: #D9A431; --open: #1D8F8A; --contra: #C05A4B;

  --fa: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  --en: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --measure: 66ch;
  --wide: 1160px;
  --gutter: clamp(16px, 4vw, 48px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131817; --paper-2: #1C2321; --ink: #E9ECE9; --ink-2: #AEB7B3; --rule: #3B4643;
    --turq: #4FB7B1; --turq-wash: #1C3634; --earth: #B98A5B; --earth-wash: #2A231C; --leaf: #7FAE78; --sheet: #F4F4F1;
  }
}
:root[data-theme="dark"] {
  --paper: #131817; --paper-2: #1C2321; --ink: #E9ECE9; --ink-2: #AEB7B3; --rule: #3B4643;
  --turq: #4FB7B1; --turq-wash: #1C3634; --earth: #B98A5B; --earth-wash: #2A231C; --leaf: #7FAE78; --sheet: #F4F4F1;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--fa); font-size: 1.05rem; line-height: 1.9; font-weight: 400;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* English pages: the serif, with real italics and optical sizes */
html[lang="en"] body { font-family: var(--en); line-height: 1.55; font-size: 1.0625rem; font-variation-settings: "opsz" 16; font-feature-settings: "tnum" 1; }
html[lang="en"] [lang="fa"] { font-family: var(--fa); font-size: 1.08em; line-height: 1.85; }
html[lang="fa"] [lang="en"] { font-family: var(--en); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--turq); }
:focus-visible { outline: 2px solid var(--turq); outline-offset: 3px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; margin-top: 2.2rem; }
h4 { font-size: 1.05rem; margin-top: 1.6rem; }
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3, html[lang="en"] h4 { font-weight: 400; line-height: 1.12; letter-spacing: -0.005em; }
html[lang="en"] h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); font-variation-settings: "opsz" 72; font-weight: 300; }
html[lang="en"] h2 { font-size: 1.75rem; font-variation-settings: "opsz" 36; }
html[lang="en"] h3 { font-size: 1.3rem; font-variation-settings: "opsz" 24; }
p { margin: 0 0 1em; }
em { font-style: normal; color: var(--turq); font-weight: 500; }
html[lang="en"] em { font-style: italic; color: inherit; font-weight: inherit; }
img { max-width: 100%; height: auto; display: block; }
table { border-collapse: collapse; width: 100%; margin: 1.2rem 0 2rem; }
caption { text-align: start; color: var(--ink-2); padding-bottom: .5rem; }
th, td { text-align: start; vertical-align: top; padding: .6rem 0; padding-inline-end: .8rem; border-top: 1px solid var(--rule); }
th { font-weight: 500; color: var(--ink-2); border-top: 0; }
html[lang="en"] th, html[lang="en"] caption { font-style: italic; }
ul, ol { padding-inline-start: 1.4rem; }
li { margin: .25rem 0; }
li::marker { color: var(--ink-2); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.muted { color: var(--ink-2); }
.small { font-size: .92rem; }
.it { color: var(--ink-2); }
html[lang="en"] .it { font-style: italic; }

/* header */
.site-head {
  display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; align-items: baseline; justify-content: space-between;
  padding: 1rem var(--gutter); border-bottom: 1px solid var(--rule);
}
.brand { text-decoration: none; font-size: 1.35rem; font-weight: 700; }
html[lang="en"] .brand { font-weight: 400; font-size: 1.25rem; }
.brand [lang="fa"] { margin-inline-end: .35rem; }
.brand small { font-weight: 400; color: var(--ink-2); font-size: .8em; margin-inline-start: .5rem; }
.site-head nav { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; font-size: .95rem; }
.site-head nav a { text-decoration: none; color: var(--ink-2); }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: var(--turq); }
.site-head nav a.lang { margin-inline-start: .6rem; padding-inline-start: 1rem; border-inline-start: 1px solid var(--rule); }
/* phones: the twelve links wrap into two short rows under the brand instead of three tall ones */
@media (max-width: 600px) {
  .site-head { padding: .5rem var(--gutter) .4rem; gap: 0 .8rem; align-items: center; }
  .brand { font-size: 1.1rem; line-height: 1.6; }
  .site-head nav { font-size: .8rem; line-height: 1.8; gap: 0 .6rem; }
  .site-head nav a.lang { margin-inline-start: 0; padding-inline-start: .5rem; }
}

/* breadcrumb */
.crumbs { max-width: var(--wide); margin: 0 auto; padding: 1rem var(--gutter) 0; font-size: .9rem; color: var(--ink-2); }
.crumbs a { text-decoration: none; }
.crumbs span::before { content: "›"; margin: 0 .5rem; color: var(--rule); }
html[dir="rtl"] .crumbs span::before { content: "‹"; }

/* hero (home) */
.hero { display: grid; gap: 2.5rem var(--gutter); padding: clamp(2rem, 6vw, 4.5rem) var(--gutter) 2.5rem; max-width: 1280px; margin: 0 auto; }
@media (min-width: 960px) { .hero { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); align-items: start; } }
.kicker { color: var(--ink-2); margin-bottom: 1.2rem; }
html[lang="en"] .kicker { font-style: italic; }
.lede { font-size: 1.15rem; max-width: 44ch; margin-top: 1.2rem; }
html[lang="en"] .lede { font-size: 1.2rem; max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }
.btn { display: inline-block; padding: .6rem 1.1rem; border: 1px solid var(--ink); text-decoration: none; font-size: .98rem; line-height: 1.4; border-radius: 3px; }
.btn:hover { border-color: var(--turq); color: var(--turq); }
.btn-accent { background: var(--turq); border-color: var(--turq); color: #fff; }
.btn-accent:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.hero-figure { margin: 0; }
.hero-figure figcaption { margin-top: .6rem; }
.fig-title { color: var(--ink-2); font-size: .95rem; margin-bottom: .4rem; }
html[lang="en"] .fig-title { font-style: italic; }
.fig-note { font-size: .98rem; min-height: 4.6em; }
.fig-note span { color: var(--ink-2); }

/* doors: the layers a visitor can enter from the home page */
.doors { max-width: var(--wide); margin: 1rem auto 0; padding: 1.5rem var(--gutter) 3rem; }
.doors h2 { margin-bottom: .4rem; }
.doors ol { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0 2.5rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.doors li { margin: 0; border-top: 1px solid var(--rule); padding: 1rem 0 1.1rem; }
.doors a { text-decoration: none; display: block; }
.doors a strong { display: block; font-size: 1.2rem; font-weight: 600; }
html[lang="en"] .doors a strong { font-weight: 400; font-size: 1.3rem; }
.doors a span { color: var(--ink-2); display: block; }
.doors a:hover strong { color: var(--turq); }

/* prose */
.prose { max-width: var(--measure); margin: 0 auto; padding: 3.5rem var(--gutter) 1rem; }
.prose > h2 { margin-bottom: 1rem; }
.deck { font-size: 1.2rem; color: var(--ink-2); margin-top: -.4rem; }
html[lang="en"] .deck { font-style: italic; }
.lead { font-size: 1.15rem; color: var(--ink-2); }

/* section diagram */
svg.section, svg.units { direction: ltr; }
svg.section { width: 100%; height: auto; display: block; overflow: visible; font-family: inherit; }
svg.section .earth rect { fill: var(--earth-wash); }
svg.section .earth .cut { fill: var(--paper); }
svg.section .slab { fill: var(--ink); }
svg.section .wall { stroke: var(--ink); stroke-width: 2.2; }
svg.section .ghost rect { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 5 5; }
svg.section .ghost-label { fill: var(--ink-2); font-size: 12px; }
svg.section .void { fill: var(--turq-wash); }
svg.section .water { fill: var(--turq); }
svg.section .car-body { fill: var(--paper-2); stroke: var(--ink-2); stroke-width: 1.3; stroke-linejoin: round; }
svg.section .car-glass { fill: var(--turq-wash); stroke: var(--ink-2); stroke-width: .9; stroke-linejoin: round; }
svg.section .car-wheel { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; }
svg.section .car-hub { fill: var(--ink-2); }
svg.section .car-lamp { fill: #F2C94C; }
svg.section .shabak { stroke: var(--turq); stroke-width: 2; stroke-dasharray: 3 4; }
svg.section .green { fill: none; stroke: var(--leaf); stroke-width: 1.6; }
svg.section .tree .trunk { fill: none; stroke: var(--earth); stroke-width: 5; stroke-linecap: round; }
svg.section .tree .branch { fill: none; stroke: var(--earth); stroke-width: 2.4; stroke-linecap: round; }
svg.section .tree .canopy-light { fill: #fff; opacity: .28; }
svg.section .tree .root { stroke: var(--earth); stroke-width: 1.5; }
svg.section .tree .canopy { fill: var(--leaf); opacity: .42; }
svg.section .dim { stroke: var(--ink-2); stroke-width: .8; }
svg.section .dim-label, svg.section .tag { fill: var(--ink-2); font-size: 11.5px; }
svg.section .lead { stroke: var(--rule); stroke-width: .6; stroke-dasharray: 2 4; }
svg.section .lvl { fill: var(--ink); font-size: 12.5px; }
svg.section .lvl-name { fill: var(--ink-2); font-size: 11.5px; }
svg.section .band rect { fill: transparent; stroke: transparent; stroke-width: 1.5; cursor: pointer; transition: stroke .15s; }
svg.section .band.is-active rect, svg.section .band:hover rect { stroke: var(--turq); }
svg.section .band:focus { outline: none; }
svg.section .band:focus-visible rect { stroke: var(--turq); stroke-width: 2.5; }

/* timeline: a real sequence */
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0 1.2rem; padding: 1.1rem 0; border-top: 1px solid var(--rule); margin: 0; }
.timeline time { color: var(--ink-2); padding-top: .2rem; }
.timeline h3 { margin: 0 0 .3rem; font-size: 1.15rem; }
.timeline p { margin: 0; }
@media (max-width: 480px) { .timeline li { grid-template-columns: 1fr; } }

/* facts */
.facts { margin: 1.5rem 0 0; }
.facts div { display: grid; grid-template-columns: 7rem 1fr; gap: 0 1.2rem; padding: .8rem 0; border-top: 1px solid var(--rule); }
.facts dt { color: var(--ink-2); }
html[lang="en"] .facts dt { font-style: italic; }
.facts dd { margin: 0; }
@media (max-width: 480px) { .facts div { grid-template-columns: 1fr; } }

/* brief */
.lang-toggle { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1.2rem 0 .8rem; }
.lang-toggle button { font: inherit; font-size: .92rem; color: var(--ink-2); background: none; border: 1px solid var(--rule); padding: .3rem .8rem; cursor: pointer; border-radius: 3px; }
.lang-toggle button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.lang-toggle button:hover { border-color: var(--turq); color: var(--turq); }
.brief { padding-inline-start: 2.2rem; margin: 0 0 2.5rem; }
.brief li { padding: .8rem 0; border-top: 1px solid var(--rule); margin: 0; }
.brief p { margin: 0; }
.brief p[lang="fa"] { margin-bottom: .35rem; }
html[lang="en"] .brief p[lang="fa"] { text-align: right; direction: rtl; }
.brief p[lang="en"] { color: var(--ink-2); }
.brief[data-show="fa"] p[lang="en"], .brief[data-show="en"] p[lang="fa"] { display: none; }
.brief[data-show="en"] p[lang="en"] { color: var(--ink); }
.brief a { text-decoration: none; }
.brief a:hover { text-decoration: underline; }

.pull { margin: 2.2rem 0; padding: .2rem 0; padding-inline-start: 1.4rem; border-inline-start: 3px solid var(--turq); }
.pull p { font-size: 1.35rem; line-height: 1.6; margin: 0; font-weight: 500; }
html[lang="en"] .pull p { font-size: 1.45rem; font-style: italic; font-weight: 400; font-variation-settings: "opsz" 36; line-height: 1.3; }

.features { padding-inline-start: 1.2rem; margin: 1.2rem 0 2rem; }
.features li::marker, .invite li::marker { color: var(--turq); }

/* sheets galleries */
.sheets { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 1.6rem 1.2rem; margin: 2.4rem 0 1.5rem; }
.sheets[data-set="2024"], .sheets[data-set="a3"] { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.sheet { text-decoration: none; display: block; }
.sheet img { background: var(--sheet); border: 1px solid var(--rule); width: 100%; height: auto; }
.sheet:hover img { border-color: var(--turq); }
.sheet span { display: block; margin-top: .45rem; font-size: .92rem; color: var(--ink-2); }
.sheet:hover span { color: var(--turq); }

/* units diagram */
.units-figure { margin: 2.4rem 0 1.5rem; }
.units-figure .units-host, .units-figure #units-diagram { max-width: 760px; margin: 0 auto; }
.units-figure .legend, .units-figure figcaption { max-width: var(--measure); margin-inline: auto; }
svg.units { width: 100%; height: auto; display: block; font-family: inherit; }
svg.units .axis { fill: var(--ink-2); font-size: 11.5px; }
svg.units .row-label { fill: var(--ink-2); font-size: 12.5px; }
svg.units .seg rect { transition: opacity .15s; cursor: pointer; }
svg.units .seg.dim rect { opacity: .28; }
svg.units .seg-label { fill: #161C1B; font-size: 12px; pointer-events: none; }
svg.units .seg:focus { outline: none; }
svg.units .seg:focus-visible rect { stroke: var(--ink); stroke-width: 2; }
.legend { list-style: none; padding: 0; margin: .8rem 0 .4rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .92rem; }
.legend li { margin: 0; }
.legend i { display: inline-block; width: .85em; height: .85em; margin-inline-end: .4em; vertical-align: -0.05em; }
.legend span { color: var(--ink-2); }
.units-table td:nth-child(3) { white-space: nowrap; }
.readings td:first-child { color: var(--ink-2); }
html[lang="en"] .readings td:first-child { font-style: italic; }
/* a comparison table keeps its columns; on narrow screens the wrapper scrolls sideways instead of widening the page */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.options-table th[scope="row"] { color: var(--ink-2); font-weight: 500; }
@media (max-width: 600px) {
  .table-wrap .units-table { min-width: 560px; }
  /* units: name — area on one line, place under it, character as its own line */
  .units-table:not(.options-table) thead { display: none; }
  .units-table:not(.options-table) tr { display: grid; grid-template-columns: 1fr auto; gap: 0 .8rem; border-top: 1px solid var(--rule); padding: .6rem 0; }
  .units-table:not(.options-table) td { border: 0; padding: 0; white-space: normal; }
  .units-table:not(.options-table) td:nth-child(1) { font-weight: 500; }
  .units-table:not(.options-table) td:nth-child(2) { color: var(--ink-2); font-size: .92rem; }
  .units-table:not(.options-table) td:nth-child(3) { grid-column: 2; grid-row: 1; color: var(--ink-2); }
  .units-table:not(.options-table) td:nth-child(4) { grid-column: 1 / -1; font-size: .95rem; }
  /* readings: three sentences per row, one under the other; the first is the label */
  .readings thead { display: none; }
  .readings tr { display: block; border-top: 1px solid var(--rule); padding: .6rem 0; }
  .readings td { display: block; border: 0; padding: 0 0 .25rem; }
}

/* open questions (list) */
.questions { padding-inline-start: 2.2rem; margin: 1.5rem 0 0; }
.questions li { padding: .9rem 0; border-top: 1px solid var(--rule); margin: 0; }
.questions h3 { margin: 0 0 .25rem; font-size: 1.15rem; }
.questions p { margin: 0; }
.questions a { text-decoration: none; }
.questions a:hover { text-decoration: underline; }

/* invitation */
.invite { border-top: 3px solid var(--turq); margin-top: 3rem; padding-top: 3rem; }
.invite ul { padding-inline-start: 1.2rem; }

/* downloads */
.dl { list-style: none; padding: 0; margin: 1rem 0 3rem; columns: 2; column-gap: 2rem; }
.dl li { break-inside: avoid; padding: .3rem 0; margin: 0; }
@media (max-width: 600px) { .dl { columns: 1; } }

/* ---- layered pages ---- */
.node { max-width: var(--wide); margin: 0 auto; padding: 1.5rem var(--gutter) 3rem; display: grid; gap: 2rem var(--gutter); }
.node > * { min-width: 0; }   /* a wide table or SVG scrolls inside its wrapper instead of widening the column */
@media (min-width: 1000px) { .node { grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); align-items: start; } .node > .side { position: sticky; top: 1rem; } }
.node-head { max-width: var(--measure); }
.node-head .kind { color: var(--turq); font-size: .95rem; font-weight: 500; margin-bottom: .3rem; }
.node-head h1 { margin-bottom: .6rem; }
.node-body { max-width: var(--measure); }
.node-body h2 { font-size: 1.35rem; margin-top: 2.2rem; }
.side h2 { font-size: 1rem; color: var(--ink-2); font-weight: 500; margin: 0 0 .4rem; }
.side ul { list-style: none; padding: 0; margin: 0 0 1.6rem; border-top: 1px solid var(--rule); }
.side li { margin: 0; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.side a { text-decoration: none; }
.side a:hover { color: var(--turq); }
.side .tag { display: inline-block; font-size: .8rem; color: var(--ink-2); margin-inline-end: .4rem; }

.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--ink-2); }
.status::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--ink-2); }
.status[data-s="answered"]::before { background: var(--ok); }
.status[data-s="partly"]::before { background: var(--part); }
.status[data-s="open"]::before { background: var(--open); }
.status[data-s="contradicted"]::before { background: var(--contra); }

.index-list { list-style: none; padding: 0; margin: 1.5rem 0 0; border-top: 1px solid var(--rule); }
.index-list li { margin: 0; padding: .9rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 3rem 1fr auto; gap: .2rem 1rem; align-items: baseline; }
.index-list li.no-n { grid-template-columns: 1fr auto; }
.index-list .n { color: var(--ink-2); }
.index-list a { text-decoration: none; font-weight: 500; }
.index-list a:hover { color: var(--turq); }
.index-list .lead { grid-column: 2 / -1; font-size: .98rem; margin: 0; }
.index-list li.no-n .lead { grid-column: 1 / -1; }

.verbatim { font-size: 1.25rem; line-height: 1.95; padding: .5rem 0; padding-inline-start: 1.2rem; border-inline-start: 3px solid var(--turq); margin: 1rem 0 1.5rem; }
.two-col { display: grid; gap: 1rem 2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 1rem 0 1.5rem; }
.two-col > div { border-top: 1px solid var(--rule); padding-top: .6rem; }
.two-col h3 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--ink-2); font-weight: 500; }

.sheet-view { margin: 0 0 1.5rem; }
.sheet-view img { background: var(--sheet); border: 1px solid var(--rule); width: 100%; }
.sheet-view figcaption { font-size: .92rem; color: var(--ink-2); margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.sheet-nav { display: flex; justify-content: space-between; gap: 1rem; margin: 1.5rem 0; font-size: .95rem; }
.sheet-nav a { text-decoration: none; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.6rem 1.2rem; margin: 1.5rem 0; }
.sheet-grid .sheet span strong { display: block; color: var(--ink); font-weight: 500; }

.moves { list-style: none; padding: 0; margin: 1rem 0; counter-reset: mv; }
.moves > li { margin: 0; padding: 1.1rem 0; border-top: 1px solid var(--rule); counter-increment: mv; display: grid; grid-template-columns: 2.6rem 1fr; gap: 0 .8rem; }
.moves > li::before { content: counter(mv); color: var(--turq); font-weight: 600; font-size: 1.2rem; }
.moves h3 { margin: 0 0 .3rem; font-size: 1.15rem; }
.moves .keeps { font-size: .88rem; color: var(--ink-2); margin-bottom: .4rem; }
.moves .answers { font-size: .9rem; color: var(--ink-2); margin: .3rem 0 0; }
.moves .answers a { text-decoration: none; margin-inline-end: .5rem; }
.moves .answers a:hover { color: var(--turq); }
.notice { border: 1px solid var(--turq); border-radius: 4px; padding: .8rem 1rem; margin: 1rem 0 1.5rem; background: var(--turq-wash); }
.notice p { margin: 0; }

/* backlinks: other paths to this page */
.paths { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter) 3rem; }
.paths h2 { font-size: 1rem; color: var(--ink-2); font-weight: 500; border-top: 1px solid var(--rule); padding-top: 1rem; }
.paths ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem .6rem; }
.paths li { margin: 0; }
.paths a { text-decoration: none; border: 1px solid var(--rule); border-radius: 999px; padding: .2rem .8rem; font-size: .9rem; display: inline-block; }
.paths a:hover { border-color: var(--turq); color: var(--turq); }
.paths a .tag { color: var(--ink-2); font-size: .8em; margin-inline-end: .35rem; }

/* footer */
.site-foot { border-top: 1px solid var(--rule); padding: 2rem var(--gutter) 3rem; color: var(--ink-2); font-size: .95rem; max-width: var(--measure); margin: 2rem auto 0; }

/* lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(14, 18, 17, .93); }
.lightbox figure { margin: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 3rem 4rem 1rem; }
.lightbox img { max-height: calc(100vh - 7rem); max-width: 100%; width: auto; background: #fff; }
.lightbox figcaption { color: #E9ECE9; font-size: .95rem; padding: .6rem 0; text-align: center; }
.lightbox figcaption strong { font-weight: 600; }
.lightbox .lb-meta { color: #AEB7B3; margin-inline-start: .5rem; }
.lightbox .lb-pdf { color: #4FB7B1; margin-inline-start: .8rem; }
.lightbox .lb-count { color: #AEB7B3; margin-inline-start: .8rem; }
.lightbox button { position: fixed; background: none; border: 0; color: #E9ECE9; font: inherit; font-size: 2.4rem; line-height: 1; cursor: pointer; padding: .4rem .8rem; }
.lightbox button:hover { color: #4FB7B1; }
.lb-close { top: .6rem; inset-inline-end: 1rem; }
.lb-prev { inset-inline-start: .4rem; top: 50%; transform: translateY(-50%); }
.lb-next { inset-inline-end: .4rem; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lightbox figure { padding: 3rem .5rem 1rem; } }

/* breakout: wider than the text measure, still centred. Declared last so it wins over section margins. */
.prose .breakout { --bw: min(1120px, 100vw - 2 * var(--gutter) - 20px); width: var(--bw); margin-inline-start: calc(50% - var(--bw) / 2); margin-inline-end: 0; }

/* next chapter */
.next-chapter { max-width: var(--wide); margin: 1rem auto 0; padding: 0 var(--gutter); }
.next-chapter a { display: grid; gap: .1rem; text-decoration: none; border-top: 3px solid var(--turq); padding: 1.2rem 0 1.6rem; }
.next-chapter a strong { font-size: 1.4rem; font-weight: 600; }
.next-chapter a span { color: var(--ink-2); }
.next-chapter a:hover strong { color: var(--turq); }

/* story interlude */
.timeline li.interlude { background: var(--turq-wash); margin: .4rem 0; padding: 1.1rem 1rem; border-top: 0; border-radius: 4px; }
.timeline li.interlude time { color: var(--turq); }
.timeline li.interlude a { text-decoration: none; font-weight: 500; }

/* plan views: a crop of a sheet with the zone highlighted */
.view { margin: 1.2rem 0 1.8rem; }
.view-frame { position: relative; border: 1px solid var(--rule); background: #fff; overflow: hidden; }
.view-frame img { width: 100%; height: auto; display: block; }
.view-label { position: absolute; transform: translate(0, -110%); background: var(--turq); color: #fff; font-size: .8rem; line-height: 1.5; padding: .05rem .5rem; border-radius: 3px; white-space: nowrap; }
html[dir="rtl"] .view-label { transform: translate(0, -110%); }
.view figcaption { display: flex; gap: .8rem; align-items: flex-start; margin-top: .5rem; font-size: .92rem; color: var(--ink-2); }
.view figcaption a { text-decoration: none; color: var(--ink); }
.view figcaption a:hover { color: var(--turq); }
.view-locator { position: relative; flex: 0 0 auto; display: inline-block; border: 1px solid var(--rule); background: #fff; line-height: 0; }
.view-locator img { display: block; height: auto; }
.view-locator i { position: absolute; border: 1.5px solid var(--turq); background: rgba(29,143,138,.18); }


/* schematic plans */
svg.plan { width: 100%; height: auto; display: block; font-family: inherit; direction: ltr; background: #fff; border: 1px solid var(--rule); }
svg.plan .plot { fill: none; stroke: #CFD5D2; stroke-width: 1; stroke-dasharray: 4 4; }
svg.plan .yard { fill: #ECEDE9; }
svg.plan .body { fill: #fff; stroke: #161C1B; stroke-width: 3; }
svg.plan .room-fill { stroke: #5A6664; stroke-width: .8; }
svg.plan .room { cursor: pointer; }
svg.plan .room:hover .room-fill, svg.plan .room:focus-visible .room-fill { stroke: #1D8F8A; stroke-width: 2; }
svg.plan .room:focus { outline: none; }
svg.plan .room-label { fill: #161C1B; font-size: 10.5px; pointer-events: none; }
svg.plan .room-area { fill: #5A6664; font-size: 9px; pointer-events: none; }
svg.plan .kind-living .room-fill { fill: #E6EFEB; } svg.plan .kind-kitchen .room-fill { fill: #F5E6C6; } svg.plan .kind-dining .room-fill { fill: #F2E3C4; }
svg.plan .kind-bedroom .room-fill { fill: #E8E5F2; } svg.plan .kind-bath .room-fill { fill: #D8EDF4; } svg.plan .kind-study .room-fill { fill: #EFE9D7; }
svg.plan .kind-storage .room-fill { fill: #E9E9E4; } svg.plan .kind-service .room-fill { fill: #E2DDD6; } svg.plan .kind-circulation .room-fill { fill: #F4F4F1; }
svg.plan .kind-outdoor .room-fill { fill: #E5EEDD; } svg.plan .kind-void .room-fill { fill: #DDEFED; } svg.plan .kind-parking .room-fill { fill: #EBECE8; }
svg.plan .kind-water .room-fill { fill: #BFE0DE; } svg.plan .kind-green .room-fill { fill: #CFE3C6; } svg.plan .kind-caretaker .room-fill { fill: #F0E3D2; } svg.plan .kind-hall .room-fill { fill: #F6F6F3; }
svg.plan .is-dim { opacity: .28; }
svg.plan .is-focus .room-fill { stroke: #1D8F8A; stroke-width: 2.5; }
svg.plan .stair { fill: #F4F4F1; stroke: #5A6664; stroke-width: .8; } svg.plan .tread { stroke: #5A6664; stroke-width: .7; }
svg.plan .lift { fill: #F4F4F1; stroke: #5A6664; stroke-width: .8; }
svg.plan .car-top { fill: #ECEDE9; stroke: #5A6664; stroke-width: 1; } svg.plan .car-roof { fill: #fff; stroke: #5A6664; stroke-width: .7; }
svg.plan .canopy { fill: #4F7D4A; opacity: .38; } svg.plan .trunk-dot { fill: #9C6B3C; }
svg.plan .void { fill: #DDEFED; fill-opacity: .6; stroke: #1D8F8A; stroke-width: 1; stroke-dasharray: 4 3; }
svg.plan .water { fill: #1D8F8A; opacity: .75; } svg.plan .green-bed { fill: #4F7D4A; opacity: .45; }
svg.plan .balcony { fill: none; stroke: #5A6664; stroke-width: .8; stroke-dasharray: 3 3; } svg.plan .door { fill: #fff; }
svg.plan .elem-label { fill: #5A6664; font-size: 9.5px; pointer-events: none; }
svg.plan .tag { fill: #5A6664; font-size: 10px; } svg.plan .north-arrow { fill: #161C1B; } svg.plan .scale-line { stroke: #5A6664; stroke-width: 1; }
.plan-browser { margin: 1.2rem 0 2rem; }
.plan-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.plan-tabs button { font: inherit; font-size: .9rem; color: var(--ink-2); background: none; border: 1px solid var(--rule); border-radius: 3px; padding: .25rem .7rem; cursor: pointer; }
.plan-tabs button[aria-selected="true"] { border-color: var(--ink); color: var(--ink); }
.plan-tabs button:hover { border-color: var(--turq); color: var(--turq); }
.plan-host { max-width: 560px; margin: 0 auto; }
.plan-browser .plan-host { max-width: 640px; }
.plan-legend { justify-content: center; }
.plan-legend i.kind-living { background: #E6EFEB; } .plan-legend i.kind-kitchen { background: #F5E6C6; } .plan-legend i.kind-dining { background: #F2E3C4; } .plan-legend i.kind-bedroom { background: #E8E5F2; }
.plan-legend i.kind-bath { background: #D8EDF4; } .plan-legend i.kind-study { background: #EFE9D7; } .plan-legend i.kind-storage { background: #E9E9E4; } .plan-legend i.kind-service { background: #E2DDD6; }
.plan-legend i.kind-circulation { background: #F4F4F1; border: 1px solid var(--rule); } .plan-legend i.kind-outdoor { background: #E5EEDD; } .plan-legend i.kind-void { background: var(--turq-wash); } .plan-legend i.kind-parking { background: #EBECE8; }
.plan-legend i.kind-water { background: #BFE0DE; } .plan-legend i.kind-green { background: #CFE3C6; } .plan-legend i.kind-caretaker { background: #F0E3D2; } .plan-legend i.kind-hall { background: #F6F6F3; border: 1px solid var(--rule); }
.planfig { margin: 1rem 0 1.6rem; }
.planfig figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin-top: .4rem; font-size: .95rem; }
.planfig figcaption a { text-decoration: none; color: var(--ink-2); }
.planfig figcaption a:hover { color: var(--turq); }
.btn-small { padding: .2rem .7rem; font-size: .85rem; }
.planfig-sheet .plan-host { max-width: 520px; margin: 0 auto; }

/* 3D model */
.model3d { margin: 1.2rem 0 2rem; border: 1px solid var(--rule); background: #fff; }
.m3-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .4rem .6rem; border-bottom: 1px solid var(--rule); font-size: .9rem; background: var(--paper); }
.m3-bar button { font: inherit; font-size: .9rem; color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 3px; padding: .15rem .6rem; cursor: pointer; }
.m3-bar button:hover { border-color: var(--turq); color: var(--turq); }
.m3-bar button[aria-pressed="true"] { border-color: var(--ink); }
.m3-bar .m3-hint { margin-inline-start: auto; color: var(--ink-2); font-size: .82rem; }
.m3-stage { position: relative; line-height: 0; background: #F6F5F0; }
.m3-stage canvas { display: block; width: 100% !important; height: auto !important; }
/* OrbitControls sets touch-action: none inline; on a phone that traps the page scroll on every 3D view, so vertical swipes stay with the page */
@media (hover: none) { .m3-stage canvas { touch-action: pan-y !important; } }

/* folded details */
.fold { margin: 1rem 0 1.5rem; border-top: 1px solid var(--rule); padding-top: .6rem; }
.fold summary { cursor: pointer; color: var(--ink-2); }
.fold summary:hover { color: var(--turq); }
.two-col .features { padding-inline-start: 1.1rem; margin: .3rem 0 .6rem; }

/* zoomable vector sheet */
.zoomer { border: 1px solid var(--rule); background: #fff; }
.zoom-stage { height: 70vh; min-height: 420px; overflow: hidden; position: relative; touch-action: pan-y; background: #fff; }
.zoom-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.zoom-layer img { display: block; max-width: none; }
.pv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .4rem .6rem; border-bottom: 1px solid var(--rule); font-size: .9rem; background: var(--paper); }
.pv-bar button, .pv-bar a { font: inherit; font-size: .9rem; color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 3px; padding: .15rem .6rem; cursor: pointer; text-decoration: none; }
.pv-bar button:hover, .pv-bar a:hover { border-color: var(--turq); color: var(--turq); }
.pv-bar .pv-zoom { min-width: 3.5em; text-align: center; color: var(--ink-2); }
.pv-bar .pv-hint { margin-inline-start: auto; color: var(--ink-2); font-size: .82rem; }
.pv-stage { cursor: grab; direction: ltr; }
.pv-stage.is-dragging { cursor: grabbing; }
.zoomer:fullscreen { background: #fff; } .zoomer:fullscreen .zoom-stage { height: calc(100vh - 3rem); touch-action: none; }
/* no mouse: the wheel/Ctrl hints make no sense */
@media (hover: none) { .pv-bar .pv-hint, .m3-bar .m3-hint { display: none; } }
/* chrome added by the build: provenance under redraws, no-JS notes, series jumps, the landing's quiet line */
.provenance { font-size: .85rem; color: var(--ink-2); margin: .3rem 0 0; }
.planfig figcaption + .provenance { margin-top: .1rem; }
.noscript-note { font-size: .92rem; color: var(--ink-2); border: 1px dashed var(--rule); padding: .6rem .8rem; margin: 0; }
.sheet-nav .jump { color: var(--turq); font-size: .88em; }
.sheet-view figcaption .orient { flex-basis: 100%; }
.hero-note { font-size: .92rem; color: var(--ink-2); margin-top: 1rem; }
.hero-note a { color: var(--ink); text-decoration-color: var(--rule); }
.hero-note a:hover { color: var(--turq); }
.planfig-3d .model3d { margin: 0; }

/* next design: every floor separately, and the small idea drawings */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.2rem; margin: 1rem 0 2rem; }
.plan-grid figure { margin: 0; }
.plan-grid figure > div { background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: .4rem; }
.plan-grid .fig-note { min-height: 2.4em; font-size: .85rem; }
