/* Self-hosted fonts (previously Google Fonts) */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("assets/fonts/fraunces-var.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("assets/fonts/newsreader-var.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/newsreader-italic-var.woff2") format("woff2");
}

:root {
  --paper: #f6efe0;
  --paper-deep: #eee4cd;
  --ink: #22333b;
  --ink-soft: #4b5a60;
  --indigo: #174f78;
  --coral: #b04434;
  --gold: #b98a2e;
  --line: rgba(34, 51, 59, .25);
  --shell: min(72rem, calc(100vw - 3rem));
  --serif-display: "Fraunces", Georgia, serif;
  --serif-body: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--paper); }

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    repeating-linear-gradient(105deg, transparent 0 47px, rgba(34, 51, 59, .016) 47px 48px),
    radial-gradient(circle at 85% 8%, rgba(185, 138, 46, .05), transparent 26rem),
    var(--paper);
  font-family: var(--serif-body);
  font-size: 1.06rem;
  line-height: 1.68;
}

img, video { display: block; width: 100%; height: auto; }
figure { margin: 0; }
h1, h2, h3, p { margin: 0; }

.skip-link {
  position: fixed;
  z-index: 60;
  top: .75rem;
  left: .75rem;
  transform: translateY(-160%);
  padding: .7rem 1rem;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--serif-display);
  text-decoration: none;
}
.skip-link:focus { transform: none; }

.scroll-meter {
  position: fixed;
  z-index: 45;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: rgba(34, 51, 59, .1);
}
.scroll-meter span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--coral), var(--gold), var(--indigo));
}

/* Header */
.site-header {
  position: fixed;
  z-index: 40;
  top: 0; right: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.2rem;
  padding: 0 max(1.5rem, calc((100vw - 72rem) / 2));
  transition: background-color .35s ease, box-shadow .35s ease;
}
.site-header.scrolled {
  background: var(--paper);
  box-shadow: 0 1px 0 var(--line);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: .95rem;
  font-weight: 400;
  letter-spacing: .02em;
  text-decoration: none;
}
.wordmark svg { width: 1.6rem; height: 1.6rem; color: var(--coral); }

.page-navigation {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-left: auto;
  font-family: var(--serif-body);
}
.page-navigation a {
  position: relative;
  padding: .75rem 0;
  color: var(--ink);
  font-size: clamp(.6875rem, .98vw, .9375rem);
  line-height: 1.3;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.page-navigation a::after {
  content: "";
  position: absolute;
  bottom: .375rem;
  left: 0;
  right: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform .2s ease;
}
.page-navigation a:hover::after,
.page-navigation a[aria-current="page"]::after { transform: scaleX(1); }
.page-navigation a:focus-visible { outline: 2px solid var(--indigo); outline-offset: 5px; }
.site-header .sound-control { margin-left: 1.75rem; }

@media (max-width: 760px) {
  .page-navigation { gap: 1.125rem; }
  .page-navigation a { font-size: .6875rem; letter-spacing: .06em; }
  .site-header .sound-control { margin-left: 1.125rem; }
}
@media (max-width: 420px) {
  .page-navigation { gap: .75rem; }
  .page-navigation a { font-size: .625rem; }
  .site-header .sound-control { margin-left: .75rem; }
}

.sound-control {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-height: 2.5rem;
  padding: .4rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-family: var(--serif-display);
  cursor: pointer;
  transition: color .25s ease, background-color .25s ease;
}
.sound-control:hover { color: var(--paper); background: var(--ink); }
.hero-copy .sound-control { display: flex; width: fit-content; margin-top: 1.25rem; }
.sound-control:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }
.sound-label { font-size: .8rem; letter-spacing: .06em; }
.sound-bars { display: flex; align-items: flex-end; gap: 2px; height: .85rem; }
.sound-control[aria-pressed="false"] .sound-bars { display: none; }
.sound-bars i { width: 2px; height: 30%; background: currentColor; }
.sound-control[aria-pressed="true"] .sound-bars i { animation: sound-bar .8s ease-in-out infinite alternate; }
.sound-control[aria-pressed="true"] .sound-bars i:nth-child(2) { animation-delay: -.42s; }
.sound-control[aria-pressed="true"] .sound-bars i:nth-child(3) { animation-delay: -.18s; }
.sound-control[aria-pressed="true"] .sound-bars i:nth-child(4) { animation-delay: -.6s; }
@keyframes sound-bar { from { height: 25%; } to { height: 100%; } }

/* Type */
.display {
  font-family: var(--serif-display);
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
  font-weight: 340;
  line-height: 1.02;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.display em { color: var(--coral); font-style: italic; font-weight: 400; }

.kicker {
  font-family: var(--serif-display);
  font-size: .82rem;
  font-weight: 560;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--indigo);
}

.lead {
  font-size: clamp(1.18rem, 1.7vw, 1.4rem);
  line-height: 1.6;
  text-wrap: pretty;
}

/* Hero */
.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 96svh;
  overflow: hidden;
}
.hero-art { position: absolute; inset: 0; }
.hero-art img, .hero-art video { width: 100%; height: 100%; object-fit: cover; object-position: 62% 55%; }
.hero-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(246, 239, 224, .95) 0 20%, rgba(246, 239, 224, .62) 36%, rgba(246, 239, 224, 0) 54%),
    linear-gradient(0deg, rgba(246, 239, 224, .85) 0 5%, rgba(246, 239, 224, 0) 26%);
}
.hero-copy {
  position: relative;
  z-index: 2;
  width: var(--shell);
  margin: 6rem auto 4rem;
}
.hero h1 {
  font-family: var(--serif-display);
  font-size: clamp(4.6rem, 13vw, 11rem);
  font-weight: 340;
  line-height: .9;
  letter-spacing: -.03em;
  color: #14384f;
}
.hero-deck {
  max-width: 27rem;
  margin-top: 1.6rem;
  font-size: clamp(1.2rem, 1.9vw, 1.45rem);
  line-height: 1.55;
  color: #6b3a2c;
}
.begin-link {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 2.4rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: .88rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: gap .3s ease, color .3s ease;
}
.begin-link:hover { gap: 1.8rem; color: var(--coral); }
.begin-link i { font-style: normal; }

/* Contents */
.contents {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(3.5rem, 6vw, 5.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}
.contents-title span {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  font-family: var(--serif-display);
  font-size: .8rem;
  font-weight: 560;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
}
.contents-title span::after {
  content: "";
  width: 3.5rem;
  height: 1px;
  background: currentColor;
}
.contents ol {
  max-width: 34rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}
.contents a {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
  padding: .85rem .2rem .85rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--serif-display);
  font-size: 1.12rem;
  text-decoration: none;
  transition: color .25s ease, padding-left .25s ease;
}
.contents a:hover { color: var(--coral); padding-left: .5rem; }
.contents-no {
  flex: 0 0 2.4rem;
  font-size: .78rem;
  font-weight: 560;
  letter-spacing: .18em;
  color: var(--gold);
}
.contents-interlude a { font-style: italic; font-size: 1rem; color: var(--ink-soft); }
.contents-interlude a:hover { color: var(--coral); }

/* Chapters */
.chapter {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(4.5rem, 8vw, 7rem) 0;
}
.chapter + .chapter { border-top: 1px solid var(--line); }

.chapter-head { display: grid; gap: 1.1rem; margin-bottom: 2.2rem; }
.chapter-no span {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  font-family: var(--serif-display);
  font-size: .8rem;
  font-weight: 560;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
}
.chapter-no span::after {
  content: "";
  width: 3.5rem;
  height: 1px;
  background: currentColor;
}

.prose { max-width: 40rem; display: grid; gap: 1.1rem; }
.prose-later { margin-top: clamp(3.5rem, 7vw, 6rem); }
.prose-lead { font-size: 1.15rem; color: var(--ink-soft); }

/* Plates */
.plate { margin-top: clamp(2.2rem, 5vw, 3.5rem); }
.plate img, .plate video, .margin-note img {
  --feather: clamp(12px, 2vw, 26px);
  mask-image:
    linear-gradient(90deg, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent),
    linear-gradient(180deg, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.plate figcaption {
  max-width: 44rem;
  padding-top: .85rem;
  font-size: .92rem;
  font-style: italic;
  color: var(--ink-soft);
}
.plate-wide { width: min(56rem, 100%); }
.plate-full { width: 100%; }
.plate-tall { max-width: 26rem; }
.plate-tall video { aspect-ratio: 3 / 4; object-fit: cover; }

/* Watercolor wash-in for images */
.js .wash-in img, .js .wash-in video {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.3s cubic-bezier(.3, .5, .2, 1);
}
.js .wash-in.in-view img, .js .wash-in.in-view video { clip-path: inset(0); }

/* Margin note */
.margin-note {
  display: grid;
  grid-template-columns: minmax(14rem, 22rem) 1fr;
  gap: 2rem;
  align-items: center;
  width: min(48rem, 100%);
  margin: clamp(2.5rem, 5vw, 4rem) 0 0 auto;
}
.margin-note img { box-shadow: none; }
.margin-note p {
  max-width: 20rem;
  font-size: .95rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* Dark chapter */
.chapter-dark {
  width: 100%;
  margin: clamp(4.5rem, 8vw, 7rem) 0;
  padding: 0;
  color: var(--paper);
  background: #16323f;
}
.chapter + .chapter-dark, .chapter-dark + .chapter { border-top: 0; }
.dark-inner {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(5rem, 9vw, 8rem) 0;
}
.chapter-dark .chapter-no span { color: #e9b45c; }
.chapter-dark .display em { color: #e9b45c; }
.chapter-dark .lead { color: rgba(246, 239, 224, .88); }
.chapter-dark .prose p { color: rgba(246, 239, 224, .82); }
.chapter-dark .plate figcaption { color: rgba(246, 239, 224, .72); }

.timeline {
  width: min(44rem, 100%);
  margin: clamp(2.5rem, 5vw, 4rem) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(246, 239, 224, .35);
}
.timeline li {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.5rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid rgba(246, 239, 224, .22);
}
.timeline time {
  font-family: var(--serif-display);
  font-size: .82rem;
  font-weight: 560;
  letter-spacing: .12em;
  color: #e9b45c;
}
.timeline h3 {
  font-family: var(--serif-display);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.15;
}
.timeline p { max-width: 30rem; margin-top: .5rem; color: rgba(246, 239, 224, .75); font-size: .98rem; }


/* Arts */
.arts-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 26rem) 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  margin-top: clamp(2rem, 4vw, 3rem);
}
.arts-side { display: grid; gap: clamp(2rem, 4vw, 3rem); align-content: start; }
.art-entry { max-width: 30rem; padding-top: 1.5rem; }
.art-entry-late { margin-top: clamp(3rem, 6vw, 5rem); }
.art-entry h3 {
  font-family: var(--serif-display);
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  font-weight: 340;
}
.art-entry p { margin-top: .8rem; color: var(--ink-soft); }

.weave-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.weave-pair .plate:nth-child(2) { margin-top: clamp(3.5rem, 7vw, 6rem); }

/* Word moment */
.word-moment {
  display: grid;
  justify-items: start;
  gap: .4rem;
  margin: clamp(3rem, 6vw, 5rem) 0 0;
  padding: 1.8rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.word-moment span {
  font-family: var(--serif-display);
  font-size: .78rem;
  font-weight: 560;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--indigo);
}
.word-moment strong {
  font-family: var(--serif-display);
  font-size: clamp(3.4rem, 9vw, 7.5rem);
  font-weight: 340;
  line-height: .95;
  letter-spacing: -.02em;
  color: var(--coral);
}
.word-moment small {
  font-size: .85rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.chapter-dark .word-moment { border-color: rgba(246, 239, 224, .3); }
.chapter-dark .word-moment span { color: rgba(246, 239, 224, .8); }
.chapter-dark .word-moment strong { color: #e9b45c; }
.chapter-dark .word-moment small { color: rgba(246, 239, 224, .65); }

/* Royal */
.royal-grid {
  display: grid;
  grid-template-columns: minmax(17rem, .8fr) 1.2fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.royal-copy { display: grid; gap: 1.1rem; max-width: 36rem; }
.royal-copy h3 {
  font-family: var(--serif-display);
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  font-weight: 340;
  line-height: 1.05;
  text-wrap: balance;
}
.royal-role {
  font-family: var(--serif-display);
  font-size: 1.15rem;
  color: var(--coral);
}
.lineage {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}
.lineage li { display: grid; gap: .15rem; padding-left: 1.1rem; border-left: 2px solid var(--line); }
.lineage time, .lineage small {
  font-family: var(--serif-display);
  font-size: .72rem;
  font-weight: 560;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lineage strong { font-family: var(--serif-body); font-size: 1rem; font-weight: 500; }
.lineage-now { border-left-color: var(--coral); }
.lineage-now strong { color: var(--coral); }

/* Closing */
.closing { position: relative; margin-top: clamp(4.5rem, 8vw, 7rem); }
.closing-art img {
  width: 100%;
  max-height: 88svh;
  object-fit: cover;
  --feather: clamp(16px, 3vw, 40px);
  mask-image: linear-gradient(180deg, transparent, #000 var(--feather), #000 calc(100% - var(--feather)), transparent);
}
.closing-copy {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(4rem, 7vw, 6rem);
}
.closing-copy .lead { max-width: 40rem; margin-top: 1.4rem; color: var(--ink-soft); }
.closing-invite {
  max-width: 40rem;
  margin-top: clamp(2.2rem, 4vw, 3.2rem);
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}
.closing-invite span {
  font-family: var(--serif-display);
  font-size: .78rem;
  font-weight: 560;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--indigo);
}
.closing-invite p { margin-top: .9rem; }
.closing-invite strong { color: var(--coral); font-weight: 500; }

/* Footer */
.site-footer {
  display: grid;
  gap: 1rem;
  width: 100%;
  padding: 3.5rem max(1.5rem, calc((100vw - 72rem) / 2)) 4rem;
  color: var(--paper);
  background: #16323f;
}
.footer-mark {
  font-family: var(--serif-display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 340;
  letter-spacing: .04em;
  color: #d9714f;
}
.site-footer p { max-width: 44rem; }
.credits { font-size: .82rem; line-height: 1.7; color: rgba(246, 239, 224, .55); }
.site-footer a {
  justify-self: start;
  margin-top: 1rem;
  color: var(--paper);
  font-family: var(--serif-display);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid rgba(246, 239, 224, .4);
  padding-bottom: .3rem;
}
.site-footer a:hover { color: #e9b45c; }

/* Hero entrance: pure CSS so it never waits on script or font timing */
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 24px, 0); }
  to { opacity: 1; transform: none; }
}
.hero-copy > * { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero-copy > *:nth-child(2) { animation-delay: .1s; }
.hero-copy > *:nth-child(3) { animation-delay: .2s; }
.hero-copy > *:nth-child(4) { animation-delay: .3s; }

/* Reveal */
.reveal { opacity: 1; transform: none; }
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity .8s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.js .reveal.in-view { opacity: 1; transform: none; }

/* Responsive */
@media (max-width: 880px) {
  :root { --shell: calc(100vw - 2.4rem); }
  .hero { min-height: 92svh; }
  .hero-wash {
    background: linear-gradient(0deg, rgba(246, 239, 224, .96) 0 34%, rgba(246, 239, 224, .1) 68%);
  }
  .hero-copy { align-self: end; margin-bottom: 3rem; }
  .margin-note { grid-template-columns: 1fr; width: 100%; }
  .margin-note img { max-width: 18rem; }
  .arts-grid, .weave-pair, .royal-grid { grid-template-columns: 1fr; }
  .weave-pair .plate:nth-child(2) { margin-top: 0; }
  .plate-tall { max-width: 100%; }
  .plate-tall video { aspect-ratio: 4 / 5; }
  .timeline li { grid-template-columns: 1fr; gap: .4rem; }
  .chapter { padding: 3rem 0; }
  .chapter-dark { margin: 2.5rem 0; }
  .dark-inner { padding: 3.2rem 0; }
  .prose-later { margin-top: 2.4rem; }
  .plate { margin-top: 1.6rem; }
  .art-entry-late { margin-top: 2.4rem; }
  .word-moment { margin-top: 2.4rem; }
  .contents { padding-top: 2.4rem; }
}

@media (max-width: 480px) {
  body { font-size: 1rem; }
  .wordmark span { display: none; }
  .contents a { font-size: 1.02rem; gap: 1rem; }
  .margin-note img { max-width: 100%; }
  .timeline time { font-size: .78rem; }
  .site-footer { padding-top: 2.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .js .reveal, .js .wash-in img, .js .wash-in video { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
