
:root {
  /* High-contrast primary: ground flat pure white, carbon ink, vermilion primary accent */
  --bg: #FFF;
  --ink: #121413;
  --accent: #C73216;
  --accent-hover: #A8250E;
  --muted: #595C57;
  --line: #E4E0D8;
  --line-dark: #C6C0B4;
  --surface: #F9F8F6;
  --surface-contrast: #121413;
  --surface-alt: #F2EFE9;
  --surface-highlight: #FFF4F1;

  /* Typography scale */
  --pobo-8d2: "Cinzel", Georgia, "Times New Roman", serif;
  --pobo-366: "Crimson Pro", Garamond, "Hoefler Text", Georgia, serif;
  --pobo-be4: "JetBrains Mono", "Courier New", monospace;

  --fs-hero: clamp(2.35rem, 5.5vw + 1rem, 4.75rem);
  --fs-verb: clamp(2.2rem, 4.5vw + 0.8rem, 3.85rem);
  --fs-h2: clamp(1.75rem, 3vw + 0.5rem, 2.6rem);
  --fs-h3: clamp(1.35rem, 1.8vw + 0.4rem, 1.85rem);
  --fs-h4: clamp(1.15rem, 1vw + 0.3rem, 1.4rem);
  --fs-body: clamp(1.125rem, 0.4vw + 1rem, 1.3rem);
  --fs-body-large: clamp(1.25rem, 0.6vw + 1.1rem, 1.5rem);
  --fs-small: clamp(0.92rem, 0.2vw + 0.88rem, 1.02rem);
  --fs-mono: clamp(0.85rem, 0.15vw + 0.82rem, 0.95rem);

  --lh-tight: 1.12;
  --lh-heading: 1.22;
  --lh-body: 1.62;
  --lh-loose: 1.75;

  --measure-narrow: 42ch;

  --measure-prose: 58ch;
  --measure-ledger: 72ch;
  --measure-wide: 1180px;

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.25rem;
  --space-xl: 3.5rem;
  --space-2xl: 5rem;
  --space-3xl: 7.5rem;

  /* Structural signatures: Draughtsman ledger lines */
  --ledger-rule: 1px solid var(--line);
  --ledger-rule-dark: 1px solid var(--line-dark);
  --ledger-rule-bold: 1px solid var(--ink);
  --ledger-rule-accent: 2px solid var(--accent);

  --radius-none: 0px;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;

  --duration-fast: 140ms;
  --duration-normal: 220ms;
  --duration-deliberate: 360ms;
  --ease-ledger: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --z-base: 1;
  --z-floating: 20;
  --z-header: 100;
  --z-modal: 500;
  --z-chat: 900;
  --z-banner: 1000;
}

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

html {
  font-size: 16px;
  background-color: var(--bg);
  color: var(--ink);
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--pobo-366);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Form controls only: inherit font */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-ledger), text-decoration-color var(--duration-fast) var(--ease-ledger);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--pobo-8d2);
  font-weight: 700;
  line-height: var(--lh-heading);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-hero);
  line-height: var(--lh-tight);
  letter-spacing: 0.01em;
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

h4 {
  font-size: var(--fs-h4);
}

p {
  margin-block-end: var(--space-md);
  max-width: var(--measure-prose);
}

p:last-child {
  margin-block-end: 0;
}

ul,
ol {
  list-style-position: outside;
  padding-inline-start: 1.5rem;
  margin-block-end: var(--space-md);
  max-width: var(--measure-prose);
}

li {
  margin-block-end: 0.4rem;
}

li:last-child {
  margin-block-end: 0;
}

hr {
  border: 0;
  border-top: var(--ledger-rule);
  margin-block: var(--space-xl);
}

blockquote {
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: var(--space-md);
  margin-block: var(--space-xl);
  font-style: italic;
  font-size: var(--fs-body-large);
  line-height: var(--lh-loose);
  color: var(--ink);
  max-width: var(--measure-prose);
}

code,
kbd,
samp,
pre {
  font-family: var(--pobo-be4);
  font-size: var(--fs-mono);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-block: var(--space-lg);
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: var(--ledger-rule);
  vertical-align: top;
}

th {
  font-family: var(--pobo-8d2);
  font-weight: 600;
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: var(--ledger-rule-bold);
}

.skip-link {
  position: absolute;
  top: -120px;
  left: var(--space-md);
  background: var(--surface-contrast);
  color: var(--bg);
  padding: var(--space-xs) var(--space-md);
  font-family: var(--pobo-be4);
  font-size: var(--fs-small);
  text-decoration: none;
  z-index: 10000;
  transition: top var(--duration-fast) var(--ease-ledger);
  border-radius: var(--radius-xs);
  border: 1px solid var(--accent);
}

.skip-link:focus {
  top: var(--space-md);
}

.icon {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  vertical-align: -0.2em;
  fill: currentColor;
  flex-shrink: 0;
}

.wrapper {
  width: 100%;
  max-width: var(--measure-wide);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .wrapper {
    padding-inline: var(--space-xl);
  }
}

.column-reading {
  width: 100%;
  max-width: var(--measure-prose);
  margin-inline: auto;
}

.column-ledger {
  width: 100%;

  max-width: var(--measure-ledger);
  margin-inline: auto;
}

.ledger-grid {
  position: relative;
}

.ledger-grid::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  border-top: var(--ledger-rule);
  pointer-events: none;
}

.ledger-rule-t {
  border-top: var(--ledger-rule);

}

.ledger-rule-b {
  border-bottom: var(--ledger-rule);
}

.ledger-rule-bold-t {
  border-top: var(--ledger-rule-bold);
}

.ledger-rule-bold-b {
  border-bottom: var(--ledger-rule-bold);
}

.mono {
  font-family: var(--pobo-be4);
  font-size: var(--fs-mono);
  letter-spacing: -0.01em;
}

.meta-code {
  font-family: var(--pobo-be4);
  font-size: var(--fs-mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.grid-flow,
.flex-flow {
  min-width: 0;
}

.grid-flow > *,
.flex-flow > * {
  min-width: 0;
}

::selection {
  background-color: var(--accent);
  color: #FFF;
}

::-moz-selection {
  background-color: var(--accent);
  color: #FFF;
}

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