/*
 * Theme "reading-room" (draft B, Lesesaal) (ADR-196). Self-contained and portable: fonts relative to
 * ../fonts/, every token of the contract (tests/test_theme_css.py), the
 * chrome of the header/footer markup contract. No external URL, no @import.
 * Dark mode follows the system; data-scheme on <html> is reserved for a
 * future manual toggle.
 */

/* 1. Fonts (vendored OFL fonts, see ../fonts/SOURCES.toml) */
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/public-sans-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/public-sans-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/public-sans-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/public-sans-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/public-sans-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/public-sans-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/literata-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/literata-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/literata-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/literata-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/literata-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/literata-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 2. Tokens */
:root {
  --color-bg: #fbfaf7;
  --color-surface: #ffffff;
  --color-panel: #f3efe8;
  --color-fg: #241f1a;
  --color-muted: #6f655b;
  --color-line: #e2dcd2;
  --color-control-border: #8f8478;
  --color-accent: #7a2e2a;
  --color-accent-fg: #fbfaf7;
  --color-accent-soft: #f3e4e1;
  --color-focus: #7a2e2a;
  --color-band-bg: #2b2622;
  --color-band-fg: #e9e1d6;
  --color-band-muted: #c8bfb4;
  --color-viewer-bg: #2b2622;
  --color-viewer-fg: #e9e1d6;
  --color-danger: #a4161a;
  --color-warning-bg: #fbf0dc;
  --color-warning-line: #a0671a;
  --color-success: #2f6b3a;
  --color-row-selected: #f3e4e1;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
  --font-ui: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 4px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.75rem;
  --space-6: 3rem;
  --measure: 52rem;
  --page-max: 72rem;
  --sidebar-w: 13rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --color-bg: #1b1815;
    --color-surface: #221e1a;
    --color-panel: #26211c;
    --color-fg: #ece5dc;
    --color-muted: #b0a596;
    --color-line: #3a332c;
    --color-control-border: #7a6f63;
    --color-accent: #e39a8f;
    --color-accent-fg: #1b1815;
    --color-accent-soft: #3a2522;
    --color-focus: #e39a8f;
    --color-band-bg: #0f0d0b;
    --color-band-fg: #e9e1d6;
    --color-band-muted: #c8bfb4;
    --color-viewer-bg: #0f0d0b;
    --color-viewer-fg: #e9e1d6;
    --color-danger: #ff9b8f;
    --color-warning-bg: #33280f;
    --color-warning-line: #c98d3a;
    --color-success: #8fca95;
    --color-row-selected: #3a2522;
    color-scheme: dark;
  }
}
:root[data-scheme="dark"] {
  --color-bg: #1b1815;
  --color-surface: #221e1a;
  --color-panel: #26211c;
  --color-fg: #ece5dc;
  --color-muted: #b0a596;
  --color-line: #3a332c;
  --color-control-border: #7a6f63;
  --color-accent: #e39a8f;
  --color-accent-fg: #1b1815;
  --color-accent-soft: #3a2522;
  --color-focus: #e39a8f;
  --color-band-bg: #0f0d0b;
  --color-band-fg: #e9e1d6;
  --color-band-muted: #c8bfb4;
  --color-viewer-bg: #0f0d0b;
  --color-viewer-fg: #e9e1d6;
  --color-danger: #ff9b8f;
  --color-warning-bg: #33280f;
  --color-warning-line: #c98d3a;
  --color-success: #8fca95;
  --color-row-selected: #3a2522;
  color-scheme: dark;
}

/* 3. Base typography */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
  overflow-wrap: break-word;
}
h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}
a {
  color: var(--color-accent);
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
::selection {
  background: var(--color-accent);
  color: var(--color-accent-fg);
}
code,
pre,
kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* 4. Chrome: header, tools, footer, skip link, kicker, band, buttons, controls */
.skip-link {
  background: var(--color-accent);
  color: var(--color-accent-fg);
  font-family: var(--font-ui);
  font-weight: 600;
  left: var(--space-2);
  padding: var(--space-2) var(--space-3);
  position: absolute;
  top: -100vh;
  z-index: 10;
}
.skip-link:focus {
  top: var(--space-2);
}
.site-header {
  align-items: center;
  border-bottom: 1px solid var(--color-line);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-3);
  padding-inline: max(var(--space-4), calc((100% - var(--page-max)) / 2));
}
.site-brand {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
}
.site-name {
  color: var(--color-fg);
  font-weight: 600;
  text-decoration: none;
}
.site-sub {
  color: var(--color-muted);
  font-size: 0.85rem;
}
.site-tools,
.service-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  gap: var(--space-1) var(--space-4);
}
.site-tools {
  margin-inline-start: auto;
}
.site-tools a,
.service-nav a,
.btn-link {
  align-items: center;
  display: inline-flex;
  min-height: 24px;
  padding-block: var(--space-1);
}
.site-tools a,
.btn-link {
  color: var(--color-accent);
  text-decoration: none;
}
.site-tools a:hover,
.btn-link:hover {
  text-decoration: underline;
}
.site-tools a[aria-current] {
  color: var(--color-fg);
  font-weight: 600;
}
.signed-in {
  color: var(--color-muted);
}
.btn-link {
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  min-height: 24px;
  padding-inline: 0;
}
.lang-switch:empty {
  display: none;
}
.site-footer {
  border-top: 1px solid var(--color-line);
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-6);
  padding-block: var(--space-4);
  padding-inline: max(var(--space-4), calc((100% - var(--page-max)) / 2));
}
.site-footer a {
  color: var(--color-muted);
}
.site-footer a:hover {
  color: var(--color-fg);
}
.kicker {
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  margin: 0;
  text-transform: uppercase;
}
.band {
  background: var(--color-band-bg);
  color: var(--color-band-fg);
}
/* Focus ring on the dark surfaces: 3:1 against the band (WCAG 1.4.11). */
.band {
  --color-focus: var(--color-band-fg);
}
.object-stage {
  --color-focus: var(--color-viewer-fg);
}
input,
select,
textarea {
  background: var(--color-surface);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
  color: var(--color-fg);
  font-family: var(--font-ui);
  font-size: 1rem;
  max-width: 100%;
  min-height: 2.25rem;
  padding: 0.4rem 0.6rem;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--color-accent);
  height: 1.1rem;
  min-height: 0;
  width: 1.1rem;
}
button,
.btn {
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  color: var(--color-accent-fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 2.25rem;
  padding: 0.4rem 0.9rem;
  text-decoration: none;
}
button.btn-link {
  background: none;
  border: 0;
  color: var(--color-accent);
  font-weight: 400;
  min-height: 24px;
  padding: var(--space-1) 0;
}
.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-control-border);
  color: var(--color-fg);
}
@media (max-width: 760px) {
  .site-tools {
    margin-inline-start: 0;
  }
}

/* 5. Reading room only: display brand, band, book typography, stacked labels */
.site-header {
  border-bottom-color: var(--color-line);
  padding-block: var(--space-4);
}
.site-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.site-sub {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.service-nav a {
  border-radius: var(--radius);
  color: var(--color-muted);
  padding-inline: var(--space-2);
  text-decoration: none;
}
.service-nav a:hover {
  color: var(--color-fg);
}
.service-nav a[aria-current] {
  background: var(--color-accent-soft);
  color: var(--color-fg);
}
.site-tools a {
  color: var(--color-fg);
}
.site-tools a[aria-current] {
  color: var(--color-accent);
}
h1 {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
}
h2 {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}
dl {
  display: grid;
  gap: 0.15rem;
  grid-template-columns: minmax(0, 1fr);
}
dd {
  margin-bottom: var(--space-3);
}
dt {
  color: var(--color-muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sub {
  color: var(--color-muted);
  font-style: italic;
}
.object-head .pills {
  display: none;
}
.hero {
  --color-focus: var(--color-band-fg);
  background: var(--color-band-bg);
  color: var(--color-band-fg);
  padding-block: var(--space-6);
}
.layout-page > .hero {
  margin-inline: 0;
}
.layout-page > .hero:first-child {
  margin-top: calc(-1 * var(--space-4));
}
.hero-inner {
  display: grid;
  gap: var(--space-3);
  margin-inline: auto;
  width: min(100% - 2 * var(--space-4), var(--measure));
}
.hero h1,
.hero h2 {
  color: var(--color-band-fg);
  margin: 0;
}
.hero .sub,
.hero .hint {
  color: var(--color-band-muted);
}
.hero a {
  color: var(--color-band-fg);
}
.hero label {
  color: var(--color-band-fg);
}
.layout-page > .landing {
  margin-inline: 0;
}
.object-layout {
  display: flex;
  flex-direction: column;
}
.object-aside,
.object-main {
  display: contents;
}
.object-layout > * > * {
  margin-inline: auto;
  width: min(100% - 2 * var(--space-4), var(--measure));
}
.object-layout > * > .object-stage {
  background: var(--color-band-bg);
  order: -1;
  width: 100%;
}
.landing section.citation {
  border-top: 2px solid var(--color-fg);
  padding-top: var(--space-3);
}
