/*
 * Base — element defaults, page width, section rhythm, surfaces.
 * Reads tokens only; no literals. See .claude/design.md.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-height);
}

body {
  margin: 0;
  background: var(--c-canvas);
  color: var(--c-plum);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--c-burgundy);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--ls-display);
  text-wrap: balance;
}

/* Imported headings often wrap their text in <strong>; a heading has one weight. */
:is(h1, h2, h3, h4, h5, h6) :is(strong, b) {
  font-weight: inherit;
}

.surface--film :is(h1, h2, h3, h4) {
  color: inherit;
}

/* Keep the site’s type rhythm when a block supplies its own font shorthand. */
p, .prose li { line-height: var(--lh-body) !important; }

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1) !important;
}

h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2) !important;
}

h3 {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3) !important;
}

h4,
h5,
h6 {
  font-size: var(--fs-h4);
  line-height: var(--lh-h4);
}

p,
ul,
ol,
blockquote,
figure {
  margin: 0;
}

p,
li {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: var(--border);
  text-underline-offset: var(--underline-offset);
}

:focus-visible {
  outline: var(--focus-width) solid var(--c-plum);
  outline-offset: var(--focus-offset);
}

/* Page width: every section spans the viewport; content is held by padding. */
.section {
  width: 100%;
  padding-inline: var(--page-inline);
}

.section--s {
  padding-block: var(--section-s);
}

.section--m {
  padding-block: var(--section-m);
}

.section--band {
  padding-block: var(--section-band);
}

/* Surfaces. Canvas is the default; the others are deliberate exceptions. */
.surface--cream {
  background: var(--c-cream);
}

.surface--burgundy {
  background: var(--c-burgundy);
  color: var(--c-white);
}

.surface--burgundy :is(h1, h2, h3, h4) {
  color: var(--c-pink);
}

.surface--burgundy :focus-visible,
.surface--film :focus-visible {
  outline-color: var(--c-cream);
}

.surface--film {
  background: var(--c-ink-deep);
  color: var(--c-cream);
}

/* Running text: paragraphs, lists and headings inside editor content. */
.prose {
  font-family: var(--font-display);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  max-width: var(--measure);
}

.prose > * + * {
  margin-block-start: var(--space-4);
}

.prose > :is(h2, h3, h4) {
  margin-block-start: var(--space-7);
}

/* Headings inside running text sit one step below a block heading (h3 size). */
.prose h2 {
  font-size: var(--fs-h4);
  line-height: var(--lh-h4);
}

.prose :is(h3, h4) {
  font-size: var(--fs-quote);
  line-height: var(--lh-h4);
}

.prose :is(ul, ol) {
  padding-inline-start: var(--space-5);
}

.prose blockquote {
  font-size: var(--fs-quote);
  line-height: var(--lh-lead);
}

.prose blockquote > * + * {
  margin-block-start: var(--space-4);
}

/* Type helpers */
.text-lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
}

.text-meta {
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  font-weight: 500;
  line-height: var(--lh-meta);
  letter-spacing: var(--ls-meta);
  color: var(--c-muted);
}

.surface--burgundy .text-meta {
  color: var(--c-muted-on-dark);
}

/* A fragment that must stay on one line, such as a style number. */
.nowrap {
  white-space: nowrap;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Accessibility */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: var(--z-skip);
  width: auto;
  height: auto;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  clip-path: none;
  background: var(--c-canvas);
  color: var(--c-plum);
  font-family: var(--font-ui);
}

@media print {
  video {
    display: none;
  }

  body {
    background: none;
    color: var(--c-ink);
  }
}

/* Block canvas: theme blocks are full-width <section>s; anything else an
   editor adds between them sits in the text column. */
.block-canvas > :where(:not(section)) {
  max-width: var(--measure);
  margin-inline: calc(var(--page-inline) + var(--split-start)) var(--page-inline);
}

.block-canvas > :where(:not(section)) + :where(:not(section)) {
  margin-block-start: var(--space-4);
}

/* A heading belongs to the text after it: more space above than below. */
.block-canvas > :where(h2, h3, h4):not(:first-child) {
  margin-block-start: var(--space-7);
}

/* .split — a heading in the left columns, its text in the right ones. The
   text never leaves half the page empty and keeps a readable measure. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-5) var(--split-gap);
  align-items: start;
}

/* .split__wide — a child that spans both columns */
.split__wide {
  grid-column: 1 / -1;
}

/* .crumbs — where the page sits; the last item is the page itself */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  align-items: center;
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-inline);
}

@media (max-width: 640px) {
  .block-canvas > :where(:not(section)) {
    margin-inline: var(--page-inline);
  }

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

@media (max-width: 1024px) {
  .crumbs a {
    min-height: var(--target-min);
  }
}
