@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/alegreya-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/alegreya-latin-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/alegreya-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/alegreya-latin-700.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/alegreya-sans-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/alegreya-sans-latin-500.woff2") format("woff2");
}

@font-face {
  font-family: "Alegreya Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/alegreya-sans-latin-700.woff2") format("woff2");
}

:root {
  /* Palette */
  --ink-900: oklch(34% 0.03 202);
  --ink-800: oklch(38% 0.03 202);
  --ink-700: oklch(44% 0.03 202);

  --paper-200: oklch(88% 0.005 165);
  --paper-100: oklch(95% 0.005 165);
  --paper-050: oklch(98% 0.00 165);

  --gold-800: oklch(48% 0.10 86);
  --gold-500: oklch(65% 0.10 86);
  --gold-050: oklch(96% 0.01 86);

  --neutral-300: oklch(85% 0.01 202);

  /* Semantik */
  --color-text: var(--ink-900);
  --color-footer-gradient-start: var(--ink-800);
  --color-footer-gradient-end: var(--ink-700);
  --color-muted: var(--ink-700);

  --color-on-footer: var(--paper-200);
  --color-bg-soft: var(--paper-200);
  --color-bg-base: var(--paper-100);
  --color-surface: var(--paper-050);

  --color-accent-strong: var(--gold-800);
  --color-accent: var(--gold-500);
  --color-watermark: oklch(84% 0.035 86);

  --color-shadow: var(--neutral-300);

  /* Gradients */
  --gradient-light: linear-gradient(0deg, var(--color-bg-soft), var(--color-bg-base));
  --gradient-footer: linear-gradient(0deg, var(--color-footer-gradient-start), var(--color-footer-gradient-end));

  /* Shadows */
  --shadow-elevated: 0 0.5rem 1.2rem var(--color-shadow);

  /* Borders */
  --border-accent: 1px solid var(--color-accent);
  --border-accent-thick: 3px solid var(--color-accent);

  /* Radius */
  --radius: 0.5rem;

  /* Typography */
  --font-body: "Alegreya Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Alegreya", Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", "Times New Roman", serif;
  --letter-spacing-tight: -0.01em;
  --letter-spacing-normal: 0em;
  --letter-spacing-wide: 0.05em;
  --decoration-thickness: 0.05em;
  --text-underline-offset: 0.15em;

  /* Font sizes */
  /* Fluid sizes between 390px and 1440px viewport width.
     The preferred value is the middle part of clamp().
     It equals the min at 390px, the max at 1440px, and scales linearly between.
     A is the rem part, B is the vw part. Recompute both if min or max changes.
     clamp(min, calc(Arem + Bvw), max);
     100 comes from vw = 1/100 of the viewport width; 16px is the root size for 1rem.
     Together that means 1vw = viewportWidth / 1600 rem in this stylesheet.
     A = min - B * 390 / 1600.
     B = 1600 * (max - min) / (1440 - 390);
  */
  --font-size-caption: clamp(0.8rem, calc(0.76rem + 0.15vw), 0.9rem);
  --font-size-label: clamp(0.9rem, calc(0.86rem + 0.15vw), 1rem);
  --font-size-text: clamp(1.0rem, calc(0.96rem + 0.15vw), 1.1rem);
  --font-size-text-large: clamp(1.1rem, calc(1.03rem + 0.30vw), 1.3rem);
  --font-size-title-subtitle: clamp(1.3rem, calc(1.19rem + 0.46vw), 1.6rem);
  --font-size-section-title: clamp(1.4rem, calc(1.10rem + 1.22vw), 2.2rem);
  --font-size-display: clamp(2.2rem, calc(1.5rem + 2.74vw), 4rem);

  /* Layout widths */
  --width-full: 100%;
  --width-container-gutter: clamp(0.75rem, calc(0.29rem + 1.9vw), 2rem);
  --width-container: min(calc(100% - 2 * var(--width-container-gutter)), 72rem);

  /* Text measures */
  --measure-body-default: 35rem;

  /* Decorative widths */
  /* Consider mobile-specific adjustments later if the visual rhythm needs it. */
  --width-divider-long: clamp(3.0rem, calc(2.26rem + 3.05vw), 5.0rem);
  --width-divider-short: clamp(1.5rem, calc(0.94rem + 2.29vw), 3.0rem);

  /* Line heights */
  --leading-heading: 1.2;
  --leading-lead: 1.3;
  --leading-body: 1.4;

  /* Semantic spacing tokens */
  /* Consider mobile-specific adjustments later if the visual rhythm needs it. */
  --space-after-label: 0.3em;
  --space-after-heading: 0.6em;
  --space-between-paragraphs: 0.6em;

  /* Raw step scale */
  /* Fluid between 390px and the current desktop rhythm around 900px.
     The preferred value matches the mobile default at 390px and grows linearly.
     A is the rem part, B is the vw part; the max keeps a little headroom on wide screens. */
  --step-tight: clamp(0.35rem, calc(0.22rem + 0.53vw), 0.7rem);
  --step-compact: clamp(0.5rem, calc(0.31rem + 0.76vw), 1rem);
  --step-regular: clamp(0.6rem, calc(0.38rem + 0.91vw), 1.2rem);
  --step-comfortable: clamp(0.7rem, calc(0.44rem + 1.07vw), 1.4rem);
  --step-large: clamp(1.2rem, calc(0.75rem + 1.83vw), 2.4rem);
  --step-page: clamp(2.0rem, calc(1.26rem + 3.05vw), 4.0rem);

  /* Sticky-header math for anchor jumps.
     Mobile hides the title and keeps the nav on one line, so the header height is fixed. */
  --header-title-block: calc(var(--font-size-text-large) * var(--leading-heading));
  --header-nav-block: calc(var(--font-size-text) * var(--leading-heading));
  --anchor-offset-mobile: calc(
    2 * var(--step-regular) +
    var(--header-nav-block)
  );
  --anchor-offset-desktop: calc(
    2 * var(--step-regular) +
    max(var(--header-title-block), var(--header-nav-block))
  );
  --anchor-offset: var(--anchor-offset-mobile);

  /* Measures */
  --width-paired-figure: clamp(12.0rem, calc(10.00rem + 9.00vw), 18.0rem);

}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Base resets */
body {
  margin: 0;
  background: var(--color-bg-base);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-text);
  line-height: var(--leading-body);
}

img {
  display: block;
  max-width: var(--width-full);
  height: auto;
}

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

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

a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 4px;
}

h1,
h2,
h3,
p,
figure,
blockquote,
dl,
dt,
dd {
  margin: 0;
}

ul[class] {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  line-height: var(--leading-heading);
  letter-spacing: var(--letter-spacing-tight);
  text-wrap: pretty;
}

h1 {
  font-family: var(--font-serif);
  font-size: var(--font-size-display);
  font-weight: 700;
}

.intro h1 {
  margin-bottom: var(--space-after-heading);
}

.intro__subtitle {
  display: block;
  font-size: var(--font-size-title-subtitle);
  font-weight: 500;
  letter-spacing: var(--letter-spacing-normal);
  line-height: var(--leading-lead);
}

.section-heading {
  max-width: var(--measure-section-lead);
  margin-bottom: var(--space-after-heading);
  font-family: var(--font-serif);
  font-size: var(--font-size-section-title);
  font-weight: 700;
  line-height: var(--leading-heading);
  text-wrap: balance;
}

.section-heading--accent {
  color: var(--color-accent-strong);
}

h3 {
  font-size: var(--font-size-text);
  font-weight: 500;
  line-height: var(--leading-heading);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--font-size-label);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-accent-strong);
  margin-bottom: var(--space-after-label);
}

.eyebrow--spaced {
  margin-top: var(--space-after-heading);
}

.intro-kicker {
  max-width: var(--measure-body-default);
  font-weight: 500;
  text-wrap: pretty;
}

p {
  max-width: var(--measure-body-default);
  text-wrap: pretty;
}

/* Keep repeated paragraph spacing global; only the paragraph-to-eyebrow gap is section-specific. */
p + p {
  margin-top: var(--space-between-paragraphs);
}

.caption-text {
  font-size: var(--font-size-caption);
  line-height: var(--leading-body);
  color: var(--color-muted);
  text-wrap: pretty;
}

figcaption {
  margin-top: var(--step-tight);
  padding-inline: var(--step-tight);
}

.skip-link {
  position: absolute;
  left: var(--step-regular);
  top: var(--step-regular);
  z-index: 10;
  transform: translateY(-160%);
  background: var(--color-accent-strong);
  color: var(--color-surface);
  padding-block: var(--step-compact);
  padding-inline: var(--step-regular);
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: var(--border-accent);
  background: var(--color-surface);
}

.site-header-layout {
  display: flex;
  flex-direction: column;
  gap: var(--step-compact);
  padding-block: var(--step-regular);
}

.site-title {
  display: none;
  font-family: var(--font-serif);
  font-size: var(--font-size-text-large);
  font-weight: 700;
  line-height: var(--leading-heading);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow-x: auto;
  gap: var(--step-tight);
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: var(--font-size-label);
  font-weight: 500;
  line-height: var(--leading-heading);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--color-accent-strong);
}

.section {
  position: relative;
  padding-block: var(--step-large);
}

.section[id],
main[id] {
  scroll-margin-top: var(--anchor-offset);
}

.background-gradient-band {
  background: var(--gradient-light);
}

.container {
  width: var(--width-container);
  margin-inline: auto;
}

.tone {
  background: var(--color-surface);
  color: var(--color-muted);
  width: calc(100% + 2 * var(--width-container-gutter));
  margin-inline: calc(-1 * var(--width-container-gutter));
  padding-block: var(--step-comfortable);
  padding-left: var(--width-container-gutter);
  padding-right: var(--step-tight);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.frame {
  border-radius: 0;
  box-shadow: none;
}

.media-frame {
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
}

.intro {
  padding-top: var(--step-page);
  padding-bottom: var(--step-large);
}

.section-layout {
  display: grid;
  row-gap: var(--step-comfortable);
  column-gap: var(--step-compact);
  align-items: start;
}

.section-layout > * {
  min-width: 0;
}

.section-layout--intro {
  grid-template-areas:
    "figure"
    "copy";
}

.section-layout--intro .intro__content {
  grid-area: copy;
}

.section-layout--content > .section-heading {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.section-layout > .section-heading {
  margin-bottom: 0;
}

.paired-figure {
  grid-area: figure;
  width: min(100%, var(--width-paired-figure));
  justify-self: center;
}

.paired-figure > img.media-frame {
  width: var(--width-full);
}

.panel--accent {
  border-left: var(--border-accent-thick);
}

.divider::before {
  content: "";
  display: block;
  width: var(--width-divider-long);
  height: 1.5px;
  background: var(--color-accent);
  margin-bottom: var(--step-compact);
}

.divider--topic::before {
  width: var(--width-divider-short);
}

.topic__title {
  margin-bottom: var(--space-after-heading);
  font-family: var(--font-serif);
  font-size: var(--font-size-text-large);
  font-weight: 500;
  line-height: var(--leading-heading);
  text-wrap: balance;
}

.topic--with-image {
  padding: 0;
  overflow: hidden;
}

.topic--with-image > .topic__content,
.topic--with-image > figure > figcaption {
  padding-left: var(--step-comfortable);
  padding-right: var(--step-tight);
}

.topic--with-image > .topic__content {
  padding-block-start: var(--step-compact);
  padding-block-end: var(--step-comfortable);
}

.topics-grid {
  display: grid;
  gap: var(--step-compact);
}

.topics-grid > * {
  min-width: 0;
}

.text-lead {
  font-size: var(--font-size-text-large);
  line-height: var(--leading-lead);
  font-weight: 400;
  font-family: var(--font-body);
}

.lead-paragraph {
  max-width: var(--measure-body-default);
  margin-bottom: var(--space-after-heading);
  text-wrap: pretty;
}

.purchase-meta {
  font-size: var(--font-size-label);
  color: var(--color-muted);
}

.purchase-note {
  margin-top: var(--step-compact);
}

.purchase-title {
  font-family: var(--font-serif);
  color: var(--color-accent-strong);
}

.section-layout--edition {
  grid-template-areas:
    "copy"
    "figure";
}

.section-layout--edition > :first-child {
  grid-area: copy;
}

.section-layout--footer {
  padding-block: var(--step-large);
}

.section--purchase {
  padding-bottom: var(--step-page);
}

.panel--quote {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.panel--quote-mark {
  position: absolute;
  z-index: 0;
  left: -5%;
  bottom: -10%;
  width: min(50%, 32rem);
  aspect-ratio: 317 / 250;
  color: var(--color-watermark);
  opacity: 0.26;
  transform: rotate(-4deg);
  display: block;
  pointer-events: none;
}

.panel--quote > :not(.panel--quote-mark) {
  position: relative;
  z-index: 1;
}

.quote-list {
  display: grid;
  gap: var(--step-tight);
  margin-top: var(--step-tight);
}

.quote-list blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--font-size-text-large);
  line-height: var(--leading-lead);
}

.quote-list blockquote::before,
.quote-list blockquote::after {
  color: var(--color-accent-strong);
  font-style: normal;
}

.quote-list blockquote::before {
  content: "»";
  margin-right: 0.1em;
}

.quote-list blockquote::after {
  content: "«";
  margin-left: 0.1em;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--step-compact);
  margin-block: var(--step-compact);
}

.button {
  display: inline-block;
  max-width: 100%;
  padding-block: var(--step-tight);
  padding-inline: var(--step-compact);
  border: var(--border-accent);
  border-radius: var(--radius);
  font-weight: 500;
  line-height: var(--leading-heading);
  text-align: center;
  text-decoration: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.button:hover {
  transform: translateY(1px);
}

.button--primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-surface);
}

.button--primary:hover {
  background: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
  color: var(--color-surface);
}

.button--secondary {
  background: var(--color-surface);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.button--secondary:hover {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
}

.note {
  color: var(--color-muted);
  font-weight: 500;
}

.note--accent {
  color: var(--color-accent-strong);
}

.footer {
  background: var(--gradient-footer);
  color: var(--color-on-footer);
  --color-accent-strong: var(--color-on-footer);
  font-size: var(--font-size-label);
  line-height: var(--leading-lead);
}

.footer p + .eyebrow {
  margin-top: var(--space-after-heading);
}

.footer a {
  display: inline-block;
  text-decoration-thickness: var(--decoration-thickness);
  text-underline-offset: var(--text-underline-offset);
}

.footer a:hover {
  color: var(--color-accent);
}

/* iPad Mini has viewport width of 744px */
@media (min-width: 720px) {
  :root {
    --anchor-offset: var(--anchor-offset-desktop);
  }

  .site-header-layout {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .site-title {
    display: block;
  }

  .site-nav {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .section-layout {
    gap: var(--step-comfortable);
  }

  .tone {
    width: auto;
    margin-inline: 0;
    box-shadow: none;
  }

  .tone:not(.topic--with-image) {
    padding-left: var(--step-comfortable);
  }

  .frame {
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevated);
  }

  .panel--accent {
    border-left: var(--border-accent-thick);
  }

  .topic--with-image > .topic__content {
    padding-block-end: var(--step-comfortable);
  }

  .section-layout--intro {
    grid-template-columns: 3fr 6fr;
    grid-template-areas: "figure copy";
  }

  .section-layout--content {
    grid-template-columns: 5fr 4fr;
  }

  .section-layout--edition {
    grid-template-columns: 2fr 7fr;
    grid-template-areas: "figure copy";
  }

  .section-layout--purchase {
    grid-template-columns: 5fr 4fr;
  }

  .section-layout--footer {
    grid-template-columns: 3fr 6fr;
  }

  .topics-grid {
    grid-template-columns: 4fr 4fr;
  }

  .topic--with-image {
    grid-row: span 2;
  }
}

@media (min-width: 1024px) {
  .topics-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

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