/* ==========================================================================
   Mondios — reset, document, typography, photographic treatment
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 6rem;
}

body {
  min-height: 100svh;
  background: var(--ground);
  color: var(--bone);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.62;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Atmosphere: a fixed film of grain over everything. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 160px 160px;
  opacity: 0.035;
  mix-blend-mode: overlay;
}

/* Author display values beat the UA stylesheet's [hidden]{display:none}. */
[hidden] { display: none !important; }

/* --- media ------------------------------------------------------------ */
img, picture, video, svg, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
address { font-style: normal; }

/* --- headings --------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: var(--track-tight);
  text-wrap: balance;
}
h1 { font-size: var(--text-display); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); line-height: 1.14; }

p {
  max-width: var(--measure);
  text-wrap: pretty;
  hanging-punctuation: first last;
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 2px;
}

::selection { background: var(--gold); color: var(--ground-deep); }

/* --- shared type roles ------------------------------------------------- */
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--gold-dim);
  line-height: 1;
}
.eyebrow--mute { color: var(--bone-mute); }

.lead {
  font-family: var(--font-display);
  font-size: var(--text-lead);
  line-height: 1.38;
  letter-spacing: 0;
  color: var(--bone);
  max-width: var(--measure-tight);
}

.prose { color: var(--bone-dim); max-width: var(--measure); }
.prose + .prose { margin-block-start: var(--space-3); }

/* Chapter numerals — the accent serif runs alone here. */
.numeral {
  font-family: var(--font-accent);
  font-weight: 300;
  font-style: italic;
  font-size: var(--text-figure);
  line-height: 1;
  color: var(--gold-dim);
}

/* One italic accent per display line. */
.accent {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0;
}

/* Editorial drop cap on the opening paragraph of a chapter. */
.dropcap::first-letter {
  float: left;
  font-family: var(--font-accent);
  font-weight: 300;
  font-size: 3.6em;
  line-height: 0.78;
  padding-block-start: 0.1em;
  padding-inline-end: 0.12em;
  color: var(--gold);
}

/* Old-style numerals wherever figures sit in running text. */
.onum { font-feature-settings: 'onum' 1; font-variant-numeric: oldstyle-nums; }

/* --- photographic treatment — "one world" ------------------------------
   Every photograph renders monochrome with lifted blacks; colour blooms
   back on hover, and permanently on the closing band of each page. ------ */
.treated {
  position: relative;
  overflow: clip;
}
.treated img {
  filter: var(--treat-filter);
  transition: filter var(--treat-bloom-dur) var(--ease-out);
}
.treated--lift::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: var(--treat-lift);
  mix-blend-mode: screen;
  pointer-events: none;
}
@media (hover: hover) {
  .treated:hover img,
  .treated--bloom:hover img { filter: none; }
}
.treated--colour img { filter: none; }

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

.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 200;
  padding: var(--space-2) var(--space-3);
  background: var(--gold);
  color: var(--ground-deep);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* Spacing roles that used to be inline style attributes (removed so the CSP
   can drop 'unsafe-inline' for styles). */
.section--flush-top { padding-block-start: 0; }
.rule--spaced { margin-block: var(--space-5); }
.stack-4 { margin-block-start: var(--space-4); }
.stack-2 { margin-block-start: var(--space-2); }
