/* ==========================================================================
   Château du Sendat — main stylesheet
   Palette drawn from the building: limestone, Landes-pine night, aged gilt,
   and the oxblood red of Duban's window joinery.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --night: #0d120f;
  --night-2: #141a16;
  --night-3: #1c241f;
  --parchment: #f3ede2;
  --parchment-2: #ebe3d4;
  --vellum: #e0d5c1;
  --ink: #18160f;
  --ink-2: #3a362e;
  --ink-3: #6a6458;
  --stone: #b9b1a3;
  --stone-2: #8d8679;
  --gilt: #b08f55;
  --gilt-hi: #cdb07a;
  --gilt-lo: #87693a;
  --madder: #8b2e23;
  --madder-hi: #b2493a;

  --rule: rgb(24 22 15 / 0.14);
  --rule-strong: rgb(24 22 15 / 0.28);
  --rule-night: rgb(243 237 226 / 0.14);

  --f-display: 'Cormorant Garamond', 'Cormorant', 'EB Garamond', Garamond, 'Times New Roman', serif;
  --f-text: 'EB Garamond', Garamond, 'Iowan Old Style', Georgia, serif;
  --f-ui: 'Jost', 'Futura', 'Avenir Next', 'Helvetica Neue', system-ui, sans-serif;

  --step--2: clamp(0.68rem, 0.66rem + 0.1vw, 0.74rem);
  --step--1: clamp(0.86rem, 0.82rem + 0.18vw, 0.95rem);
  --step-0: clamp(1.13rem, 1.06rem + 0.32vw, 1.32rem);
  --step-1: clamp(1.38rem, 1.22rem + 0.72vw, 1.8rem);
  --step-2: clamp(1.72rem, 1.4rem + 1.45vw, 2.6rem);
  --step-3: clamp(2.2rem, 1.6rem + 2.9vw, 4.1rem);
  --step-4: clamp(2.8rem, 1.7rem + 5vw, 6.4rem);
  --step-5: clamp(4.4rem, 1.4rem + 12vw, 13rem);

  --gutter: clamp(1.25rem, 4.2vw, 4rem);
  --measure: 36rem;
  --wide: 76rem;
  --header-h: 4.5rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-soft: cubic-bezier(0.33, 0, 0.2, 1);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .08  0 0 0 0 .05  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  color-scheme: light;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  background: var(--night);
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: var(--step-0);
  line-height: 1.62;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
button { font: inherit; color: inherit; }
p { margin: 0 0 1.05em; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
figure { margin: 0; }
blockquote { margin: 0; }
::selection { background: var(--gilt-hi); color: var(--night); }
:focus-visible { outline: 1.5px solid var(--gilt); outline-offset: 4px; border-radius: 2px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 1rem; top: 1rem; z-index: 100; padding: 0.7rem 1rem;
  background: var(--parchment); color: var(--ink); font-family: var(--f-ui);
  font-size: var(--step--1); letter-spacing: 0.08em; transform: translateY(-200%);
  transition: transform 0.3s var(--ease-out);
}
.skip-link:focus { transform: none; }

/* 4. Typography utilities -------------------------------------------------- */
.kicker {
  font-family: var(--f-ui);
  font-size: var(--step--2);
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  line-height: 1.5;
  margin: 0;
}
.display {
  font-family: var(--f-display);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.smallcaps { font-variant-caps: all-small-caps; letter-spacing: 0.05em; font-variant-numeric: oldstyle-nums; }
.lining { font-variant-numeric: lining-nums tabular-nums; }
.italic { font-style: italic; }
.muted { color: var(--ink-3); }
.gilt { color: var(--gilt-lo); }
.ornament {
  display: flex; align-items: center; justify-content: center; gap: 1.1rem;
  color: var(--gilt); margin: 0 auto;
}
.ornament::before, .ornament::after {
  content: ''; height: 1px; width: min(7rem, 18vw);
  background: linear-gradient(90deg, transparent, currentColor);
}
.ornament::after { transform: scaleX(-1); }
.ornament svg { width: 0.9rem; height: 0.9rem; flex: none; }

/* Underlined links with a drawn gilt line */
.link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat,
              linear-gradient(var(--gilt), var(--gilt)) 0 100% / 0 1px no-repeat;
  transition: background-size 0.6s var(--ease-out), color 0.3s;
  padding-bottom: 0.08em;
}
.link:hover { background-size: 100% 1px, 100% 1px; color: var(--gilt-lo); }
.theme-night .link:hover { color: var(--gilt-hi); }

/* 5. Layout ---------------------------------------------------------------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2 * var(--gutter), 52rem); margin-inline: auto; }
.section { position: relative; padding-block: clamp(5rem, 12vw, 11rem); }
.section--tight { padding-block: clamp(3.5rem, 8vw, 7rem); }

.theme-night {
  --rule: var(--rule-night);
  background: var(--night);
  color: rgb(243 237 226 / 0.86);
  color-scheme: dark;
}
.theme-night .muted { color: var(--stone-2); }
.theme-night .gilt { color: var(--gilt-hi); }
.theme-vellum { background: var(--parchment-2); }

.grain { isolation: isolate; }
.grain::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--grain); opacity: 0.05; mix-blend-mode: multiply;
}
.theme-night.grain::before { mix-blend-mode: screen; opacity: 0.045; filter: invert(1); }

/* 6. Header, navigation, progress ------------------------------------------ */
.progress {
  position: fixed; inset: 0 0 auto; height: 2px; z-index: 70; pointer-events: none;
  background: linear-gradient(90deg, var(--gilt-lo), var(--gilt-hi) 60%, var(--madder-hi));
  transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
}

.site-header {
  position: fixed; inset: 0 0 auto; z-index: 60;
  height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-inline: var(--gutter);
  color: var(--parchment);
  transition: background-color 0.6s var(--ease-soft), color 0.6s var(--ease-soft),
              box-shadow 0.6s var(--ease-soft), backdrop-filter 0.6s, transform 0.6s var(--ease-out);
}
.site-header::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgb(8 11 9 / 0.5), transparent);
  transition: opacity 0.6s;
}
.site-header.is-solid {
  background-color: rgb(243 237 226 / 0.86);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--rule);
}
.site-header.is-solid::after { opacity: 0; }
.site-header.is-solid[data-over="night"] {
  background-color: rgb(13 18 15 / 0.82);
  color: var(--parchment);
  box-shadow: 0 1px 0 var(--rule-night);
}
.site-header.is-hidden { transform: translateY(-100%); }

.brand {
  display: inline-flex; align-items: center; gap: 0.85rem; text-decoration: none;
  justify-self: start; min-width: 0;
}
.brand__mark { width: 2.6rem; height: auto; color: var(--gilt-hi); flex: none; }
.site-header.is-solid:not([data-over="night"]) .brand__mark { color: var(--gilt); }
.brand__name {
  font-family: var(--f-display); font-size: 1.22rem; font-weight: 500; letter-spacing: 0.02em;
  white-space: nowrap; line-height: 1;
}
.brand__name em { font-weight: 400; }

.nav { justify-self: center; }
.nav ul { display: flex; gap: clamp(1.1rem, 2.1vw, 2.4rem); list-style: none; margin: 0; padding: 0; }
.nav a {
  position: relative; display: inline-block; padding: 0.5rem 0;
  font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.24em; text-transform: uppercase;
  text-decoration: none; opacity: 0.8; transition: opacity 0.3s;
}
.nav a::after {
  content: ''; position: absolute; left: 50%; bottom: 0.05rem; width: 4px; height: 4px;
  border-radius: 50%; background: var(--gilt); transform: translateX(-50%) scale(0);
  transition: transform 0.4s var(--ease-out);
}
.nav a:hover, .nav a[aria-current="true"] { opacity: 1; }
.nav a[aria-current="true"]::after { transform: translateX(-50%) scale(1); }

.header-tools { justify-self: end; display: flex; align-items: center; gap: 1.4rem; }
.lang-switch { display: flex; align-items: center; gap: 0.15rem; font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.2em; text-transform: uppercase; }
.lang-switch a, .lang-switch .is-current { padding: 0.5rem 0.4rem; }
.lang-switch a { color: inherit; text-decoration: none; opacity: 0.55; transition: opacity 0.3s; }
.lang-switch a:hover, .lang-switch a:focus-visible { opacity: 1; }
.lang-switch .is-current { text-decoration: underline; text-decoration-color: var(--gilt); text-underline-offset: 0.5em; }
.lang-switch .sep { opacity: 0.4; }

.menu-btn {
  display: none; background: none; border: 0; padding: 0.6rem 0; cursor: pointer;
  align-items: center; gap: 0.7rem; font-family: var(--f-ui); font-size: var(--step--2);
  letter-spacing: 0.24em; text-transform: uppercase;
}
.menu-btn__lines { display: grid; gap: 5px; width: 22px; }
.menu-btn__lines i { display: block; height: 1px; background: currentColor; transition: transform 0.5s var(--ease-out); }
.menu-btn__lines i:last-child { width: 70%; justify-self: end; }

@media (max-width: 1080px) {
  .site-header { grid-template-columns: 1fr auto; }
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 520px) {
  .brand__name { font-size: 1.05rem; }
  .brand__mark { width: 2.1rem; }
  .menu-btn__label { display: none; }
  .header-tools { gap: 0.9rem; }
}

/* Full-screen menu (mobile & tablet) */
.menu {
  position: fixed; inset: 0; z-index: 80; margin: 0; padding: 0; border: 0;
  width: 100%; max-width: none; height: 100%; max-height: none;
  background: var(--night); color: var(--parchment);
  opacity: 0; transition: opacity 0.5s var(--ease-out), overlay 0.5s allow-discrete, display 0.5s allow-discrete;
}
/* Closed, a dialog must stay display:none, or it covers the page invisibly. */
.menu[open] { opacity: 1; display: grid; grid-template-rows: auto 1fr auto; }
@starting-style { .menu[open] { opacity: 0; } }
.menu::backdrop { background: transparent; }
.menu__top { display: flex; justify-content: space-between; align-items: center; height: var(--header-h); padding-inline: var(--gutter); }
.menu__close { background: none; border: 0; cursor: pointer; font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.24em; text-transform: uppercase; padding: 0.6rem 0; }
.menu__list { list-style: none; margin: 0; padding: 2rem var(--gutter); align-self: center; counter-reset: m; }
.menu__list li { border-top: 1px solid var(--rule-night); }
.menu__list li:last-child { border-bottom: 1px solid var(--rule-night); }
.menu__list a {
  display: flex; align-items: baseline; gap: 1.2rem; padding: 0.85rem 0; text-decoration: none;
  font-family: var(--f-display); font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 300; line-height: 1.1;
}
.menu__list a .menu__num { font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.2em; color: var(--gilt-hi); min-width: 2.2rem; }
.menu__foot { padding: 1.5rem var(--gutter) 2rem; color: var(--stone-2); font-size: var(--step--1); }
.menu[open] .menu__list li { animation: rise 0.8s var(--ease-out) both; }
.menu[open] .menu__list li:nth-child(2) { animation-delay: 0.05s; }
.menu[open] .menu__list li:nth-child(3) { animation-delay: 0.1s; }
.menu[open] .menu__list li:nth-child(4) { animation-delay: 0.15s; }
.menu[open] .menu__list li:nth-child(5) { animation-delay: 0.2s; }
.menu[open] .menu__list li:nth-child(6) { animation-delay: 0.25s; }
.menu[open] .menu__list li:nth-child(7) { animation-delay: 0.3s; }
.menu[open] .menu__list li:nth-child(8) { animation-delay: 0.35s; }

/* 7. Hero ------------------------------------------------------------------ */
.hero {
  position: relative; height: 100vh; height: 100svh; min-height: 38rem; overflow: hidden;
  background: var(--night); color: var(--parchment); isolation: isolate;
}
.hero__media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%;
  filter: saturate(0.88) contrast(1.06) brightness(0.9);
  transform: scale(1.14); opacity: 0;
  animation: hero-in 3.2s var(--ease-out) 0.1s forwards;
}
.hero__media picture { position: absolute; inset: 0; }
@media (max-aspect-ratio: 4/5) { .hero__media img { object-position: 6% 40%; } }
.hero__veil {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgb(8 11 9 / 0.6) 0%, rgb(8 11 9 / 0) 20%, rgb(8 11 9 / 0) 34%, rgb(8 11 9 / 0.42) 52%, rgb(8 11 9 / 0.8) 72%, rgb(8 11 9 / 0.94) 100%),
    radial-gradient(120% 80% at 50% 40%, transparent 55%, rgb(8 11 9 / 0.5) 100%);
}
.hero__content {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: clamp(7rem, 15vh, 10rem);
  display: grid; gap: 1.4rem;
}
.hero__kicker { display: flex; align-items: center; gap: 1rem; color: var(--gilt-hi); }
.hero__kicker::before { content: ''; width: 3rem; height: 1px; background: currentColor; transform-origin: 0 50%; animation: draw 1.6s var(--ease-out) 1.2s both; }
.hero__title { font-family: var(--f-display); font-weight: 300; line-height: 0.8; margin: 0; text-shadow: 0 2px 40px rgb(8 11 9 / 0.45); }
.hero__kicker, .hero__sub { text-shadow: 0 1px 18px rgb(8 11 9 / 0.7); }
.hero__pre {
  display: block; font-style: italic; font-size: var(--step-2); letter-spacing: 0.01em;
  margin: 0 0 0.25em 0.06em; color: rgb(243 237 226 / 0.85);
}
.hero__name { display: block; font-size: var(--step-5); letter-spacing: -0.025em; margin-left: -0.04em; }
.hero__name .ch { display: inline-block; animation: letter-in 1.9s var(--ease-out) both; }
.hero__sub {
  max-width: 34rem; font-size: var(--step-1); font-style: italic; line-height: 1.35;
  color: rgb(243 237 226 / 0.82); margin: 0; text-wrap: balance;
}
.hero__aside {
  position: absolute; right: var(--gutter); bottom: clamp(7rem, 15vh, 10rem);
  display: grid; justify-items: end; gap: 0.9rem; text-align: right;
}
.seal {
  width: 7rem; height: 7rem; color: var(--gilt-hi);
  animation: spin 60s linear infinite;
}
.hero__aside .kicker { color: rgb(243 237 226 / 0.7); }
.hero__scroll {
  position: absolute; left: 50%; bottom: 1.6rem; transform: translateX(-50%);
  display: grid; justify-items: center; gap: 0.8rem; text-decoration: none;
  color: rgb(243 237 226 / 0.75);
}
.hero__scroll i { display: block; width: 1px; height: 2.6rem; background: linear-gradient(rgb(243 237 226 / 0.15), rgb(243 237 226 / 0.15)); position: relative; overflow: hidden; }
.hero__scroll i::after { content: ''; position: absolute; inset: 0; background: var(--gilt-hi); transform: translateY(-100%); animation: scrollcue 2.6s var(--ease-io) 2s infinite; }
.hero [data-in] { animation: rise 1.6s var(--ease-out) both; }
@media (max-width: 760px) {
  .hero__aside { display: none; }
  .hero__content { bottom: 6.8rem; }
}

/* 8. Prologue -------------------------------------------------------------- */
.epigraph { text-align: center; max-width: 54rem; margin-inline: auto; }
.epigraph__quote {
  font-family: var(--f-display); font-style: italic; font-weight: 300;
  font-size: var(--step-3); line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance;
  margin: 2.2rem 0 1.4rem;
}
.epigraph__quote .q { color: var(--gilt); font-style: normal; }
.epigraph__translation { font-style: italic; color: var(--ink-3); font-size: var(--step-1); line-height: 1.4; margin: 0 auto 1.4rem; max-width: 40rem; text-wrap: balance; }
.epigraph__cite { font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-3); }

.lede {
  font-family: var(--f-display); font-weight: 400; font-size: var(--step-2); line-height: 1.32;
  max-width: 46rem; margin: clamp(4rem, 9vw, 7rem) auto 0; text-wrap: pretty; color: var(--ink-2);
}
.lede::first-line { color: var(--ink); }
@media (max-width: 640px) { .lede { font-size: var(--step-1); line-height: 1.4; } }

.keydates {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(4rem, 9vw, 7rem);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.keydate { padding: 2.2rem 1.6rem 2.4rem; border-left: 1px solid var(--rule); }
.keydate:first-child { border-left: 0; }
.keydate__n {
  display: block; font-family: var(--f-display); font-weight: 300; font-size: var(--step-4);
  line-height: 1; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: lining-nums;
}
.keydate__n sup { font-size: 0.38em; vertical-align: 0.95em; margin-left: 0.04em; letter-spacing: 0; }
.keydate__l { display: block; margin-top: 1rem; font-size: var(--step--1); line-height: 1.5; color: var(--ink-3); max-width: 15rem; }
@media (max-width: 900px) {
  .keydates { grid-template-columns: repeat(2, 1fr); }
  .keydate:nth-child(3) { border-left: 0; }
  .keydate:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}

/* 9. Chapter openers ------------------------------------------------------- */
.chapter-head {
  display: grid; grid-template-columns: auto 1fr; column-gap: clamp(1.5rem, 4vw, 4rem); align-items: end;
  margin-bottom: clamp(3.5rem, 8vw, 6.5rem);
}
.chapter-head__num {
  font-family: var(--f-display); font-weight: 300; font-size: clamp(5.5rem, 15vw, 13rem); line-height: 0.72;
  color: transparent; -webkit-text-stroke: 1px var(--gilt); letter-spacing: -0.02em;
  font-variant-numeric: lining-nums; user-select: none;
}
.chapter-head__text { display: grid; gap: 1.1rem; padding-bottom: 0.3rem; }
.chapter-head__title { font-family: var(--f-display); font-weight: 300; font-size: var(--step-4); line-height: 0.98; letter-spacing: -0.015em; text-wrap: balance; }
.chapter-head__title em { color: var(--gilt-lo); }
.theme-night .chapter-head__title em { color: var(--gilt-hi); }
.chapter-head__kicker { color: var(--gilt-lo); }
.theme-night .chapter-head__kicker { color: var(--gilt-hi); }
@media (max-width: 640px) {
  .chapter-head { grid-template-columns: 1fr; row-gap: 1rem; }
  .chapter-head__num { font-size: 5.5rem; }
}

/* 10. Prose, sidenotes, quotes -------------------------------------------- */
.prose {
  --side: 15.5rem;
  max-width: var(--measure);
  margin-left: max(0px, calc(50% - (var(--measure) + var(--side) + 3rem) / 2));
  text-wrap: pretty;
  hanging-punctuation: first;
}
.prose > * + h3 { margin-top: 2.6em; }
.prose h3 {
  font-family: var(--f-display); font-weight: 500; font-size: var(--step-1); line-height: 1.2;
  margin-bottom: 0.7em; letter-spacing: 0.005em;
}
.prose h3 .kicker { display: block; margin-bottom: 0.9rem; color: var(--gilt-lo); }
.theme-night .prose h3 .kicker { color: var(--gilt-hi); }
.prose em { font-style: italic; }
.prose strong { font-weight: 600; }
.theme-night .prose p { color: rgb(243 237 226 / 0.84); }

.dropcap::first-letter {
  float: left; font-family: var(--f-display); font-weight: 400; font-style: normal;
  font-size: 4.6em; line-height: 0.82; padding: 0.06em 0.09em 0 0; margin-top: 0.04em;
  color: var(--gilt-lo);
}
.theme-night .dropcap::first-letter { color: var(--gilt-hi); }

/* Tufte-style sidenotes: in the margin on wide screens, toggled inline on small ones */
.sn-ref {
  counter-increment: sidenote;
  cursor: pointer;
}
.section { counter-reset: sidenote; }
.sn-ref::after {
  content: counter(sidenote);
  font-family: var(--f-ui); font-size: 0.62em; font-weight: 500; vertical-align: 0.55em; line-height: 0;
  color: var(--gilt-lo); padding-left: 0.12em;
}
.theme-night .sn-ref::after { color: var(--gilt-hi); }
.sn-toggle { display: none; }
.sidenote {
  float: right; clear: right;
  width: var(--side); margin-right: calc(-1 * (var(--side) + 3rem)); margin-top: 0.3rem; margin-bottom: 1rem;
  font-size: var(--step--1); line-height: 1.5; color: var(--ink-3); position: relative;
  font-style: normal;
}
.theme-night .sidenote { color: var(--stone-2); }
.sidenote::before {
  content: counter(sidenote) '. ';
  font-family: var(--f-ui); font-size: 0.8em; font-weight: 500; color: var(--gilt-lo);
}
.theme-night .sidenote::before { color: var(--gilt-hi); }
.sidenote a { color: inherit; }
.split .sidenote, .moment .sidenote, .witness .sidenote, .architect .sidenote {
  display: none; float: none; width: auto; margin: 0.8rem 0 1rem; padding: 0.8rem 1rem;
  border-left: 1px solid var(--gilt); background: rgb(176 143 85 / 0.07);
}
.split .sn-toggle:checked + .sidenote, .moment .sn-toggle:checked + .sidenote,
.witness .sn-toggle:checked + .sidenote,
.architect .sn-toggle:checked + .sidenote { display: block; }
.sn-ref:hover::after, .sn-ref:focus-visible::after { color: var(--madder); }
.theme-night .sn-ref:hover::after { color: var(--parchment); }
@media (max-width: 1180px) {
  .prose { margin-inline: auto; }
  .sidenote {
    display: none; float: none; width: auto; margin: 0.8rem 0 1rem; padding: 0.8rem 1rem;
    border-left: 1px solid var(--gilt); background: rgb(176 143 85 / 0.07);
  }
  .sn-toggle:checked + .sidenote { display: block; }
}

.pullquote {
  position: relative; margin: clamp(3rem, 7vw, 5rem) 0; padding: 0;
  font-family: var(--f-display); font-style: italic; font-weight: 300;
  font-size: var(--step-2); line-height: 1.2; text-wrap: balance; color: var(--ink);
}
.theme-night .pullquote { color: var(--parchment); }
.pullquote::before {
  content: '“'; position: absolute; left: -0.55em; top: -0.12em; font-size: 2.4em; line-height: 1;
  color: var(--gilt); font-style: normal; opacity: 0.85;
}
.pullquote footer { margin-top: 1rem; font-family: var(--f-ui); font-style: normal; font-size: var(--step--2); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3); }
.theme-night .pullquote footer { color: var(--stone-2); }
@media (max-width: 760px) { .pullquote::before { position: static; display: block; height: 0.5em; } }

/* 11. Figures -------------------------------------------------------------- */
.lqip { background-size: cover; background-position: center; }
.lqip img { transition: opacity 0.9s var(--ease-soft); }
.lqip img.is-loading { opacity: 0; }

.fig { position: relative; margin-block: clamp(3rem, 7vw, 6rem); }
.fig__frame { position: relative; overflow: hidden; background-color: var(--vellum); }
.theme-night .fig__frame { background-color: var(--night-3); }
.fig__frame img { width: 100%; height: 100%; object-fit: cover; }
.fig figcaption, .fig__cap {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.4rem 2rem;
  margin-top: 1rem; font-size: var(--step--1); line-height: 1.45; color: var(--ink-3);
}
.theme-night .fig figcaption { color: var(--stone-2); }
.fig__caption { font-style: italic; max-width: 40rem; }
.fig__caption b { font-style: normal; font-family: var(--f-ui); font-weight: 400; font-size: 0.78em; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gilt-lo); margin-right: 0.6rem; }
.theme-night .fig__caption b { color: var(--gilt-hi); }
.fig__credit { font-family: var(--f-ui); font-size: 0.72em; letter-spacing: 0.06em; opacity: 0.85; }
.fig__credit a { text-decoration: none; }
.fig__credit a:hover { text-decoration: underline; }

.fig--bleed { margin-inline: calc(50% - 50vw); }
.fig--bleed figcaption { padding-inline: var(--gutter); }
.fig--bleed .fig__frame { aspect-ratio: 21 / 9; }
@media (max-width: 760px) { .fig--bleed .fig__frame { aspect-ratio: 4 / 3; } }

.fig--wide { width: min(100vw - 2 * var(--gutter), var(--wide)); margin-inline: auto; }

.fig--plate .fig__frame {
  padding: clamp(0.8rem, 2vw, 1.4rem); background: var(--parchment-2);
  box-shadow: 0 1px 0 var(--rule), 0 30px 60px -30px rgb(24 22 15 / 0.35);
}
.fig--plate .fig__frame img { height: auto; }

/* Archival print, mounted on card */
.fig--print .fig__frame { background: transparent; overflow: visible; }
.fig--print .fig__frame img {
  box-shadow: 0 2px 3px rgb(0 0 0 / 0.18), 0 35px 70px -25px rgb(0 0 0 / 0.55);
  transform: rotate(-0.6deg);
}

.diptych { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.diptych > :nth-child(2) { margin-top: clamp(3rem, 10vw, 9rem); }
@media (max-width: 760px) { .diptych { grid-template-columns: 1fr; } .diptych > :nth-child(2) { margin-top: 0; } }

/* Split: text + image side by side, used for features */
.split { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: center; }
.split__media { grid-column: 1 / span 6; }
.split__text { grid-column: 8 / span 5; }
.split--rev .split__media { grid-column: 7 / span 6; order: 2; }
.split--rev .split__text { grid-column: 1 / span 5; order: 1; }
@media (max-width: 900px) {
  .split, .split--rev { grid-template-columns: 1fr; }
  .split__media, .split__text, .split--rev .split__media, .split--rev .split__text { grid-column: 1; order: initial; }
}

/* 12. "Moment" — a dated scene set large ------------------------------------ */
.moment {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(2rem, 6vw, 6rem);
  align-items: center; padding-block: clamp(3rem, 7vw, 6rem); margin-block: clamp(3rem, 7vw, 6rem);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.moment__date {
  font-family: var(--f-display); font-weight: 300; font-size: clamp(5rem, 13vw, 11.5rem); line-height: 0.8;
  letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: lining-nums;
}
.theme-night .moment__date { color: var(--parchment); }
.moment__date small { display: block; font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.28em; text-transform: uppercase; color: var(--gilt-lo); margin-bottom: 1.4rem; }
.theme-night .moment__date small { color: var(--gilt-hi); }
.moment__title { font-family: var(--f-display); font-size: var(--step-2); font-weight: 400; line-height: 1.12; margin-bottom: 1rem; text-wrap: balance; }
.moment__text p:last-child { margin-bottom: 0; }
@media (max-width: 760px) { .moment { grid-template-columns: 1fr; } }

/* 13. Lineage (genealogy) -------------------------------------------------- */
.lineage {
  list-style: none; padding: 0; position: relative; max-width: 50rem;
  margin: clamp(2rem, 4vw, 3rem) 0 0 max(0px, calc(50% - (var(--measure) + 15.5rem + 3rem) / 2));
}
@media (max-width: 1180px) { .lineage { margin-inline: auto; } }
.lineage::before {
  content: ''; position: absolute; left: 1.45rem; top: 1.5rem; bottom: 1.5rem; width: 1px;
  background: linear-gradient(var(--gilt), rgb(176 143 85 / 0.25));
}
.gen { position: relative; display: grid; grid-template-columns: 3rem 1fr; gap: 1.6rem; padding: 1.25rem 0; }
.gen__num {
  position: relative; z-index: 1; width: 2.9rem; height: 2.9rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--parchment); border: 1px solid var(--gilt);
  font-family: var(--f-display); font-size: 1rem; font-weight: 500; color: var(--gilt-lo); font-variant-numeric: lining-nums;
}
.theme-vellum .gen__num { background: var(--parchment-2); }
.gen--key .gen__num { background: var(--gilt); color: var(--parchment); }
.gen__name { font-family: var(--f-display); font-size: var(--step-1); font-weight: 500; line-height: 1.15; }
.gen__dates { font-size: var(--step--1); color: var(--gilt-lo); margin-left: 0.4rem; white-space: nowrap; }
.gen__role { margin: 0.35rem 0 0; font-size: var(--step--1); color: var(--ink-3); line-height: 1.55; max-width: 42rem; }
.gen__role em { color: var(--ink-2); }

/* 14. Duban feature -------------------------------------------------------- */
.architect {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 6rem); align-items: start;
}
.architect__portrait { position: sticky; top: calc(var(--header-h) + 2rem); }
.architect__portrait .fig__frame { aspect-ratio: 4 / 5; }
.architect__elev { width: 100%; height: auto; color: var(--gilt-hi); opacity: 0.9; }
.architect__name { font-family: var(--f-display); font-weight: 300; font-size: var(--step-4); line-height: 0.95; letter-spacing: -0.015em; margin: 0.6rem 0 1.6rem; }
.architect__name span { display: block; font-size: 0.42em; font-style: italic; letter-spacing: 0; color: var(--gilt-hi); margin-top: 0.8rem; }
.facts { list-style: none; margin: 2rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.facts li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1.4rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); font-size: var(--step--1); line-height: 1.5; }
.facts b { font-family: var(--f-ui); font-weight: 400; font-size: 0.82em; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gilt-hi); padding-top: 0.15rem; font-variant-numeric: lining-nums; }
.theme-parchment .facts b, .section:not(.theme-night) .facts b { color: var(--gilt-lo); }
@media (max-width: 900px) {
  .architect { grid-template-columns: 1fr; }
  .architect__portrait { position: static; max-width: 26rem; }
}

.works { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-top: clamp(3rem, 7vw, 5rem); }
.work { background: var(--night); padding: 1.6rem 1.5rem 1.8rem; display: grid; align-content: start; gap: 0.6rem; }
.section:not(.theme-night) .work { background: var(--parchment); }
.work__year { font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.22em; color: var(--gilt-hi); font-variant-numeric: lining-nums; }
.section:not(.theme-night) .work__year { color: var(--gilt-lo); }
.work__title { font-family: var(--f-display); font-size: var(--step-1); line-height: 1.15; font-weight: 500; }
.work p { margin: 0; font-size: var(--step--1); line-height: 1.5; color: var(--stone-2); }
.section:not(.theme-night) .work p { color: var(--ink-3); }

/* Process strip: the commission year by year */
.process { list-style: none; margin: clamp(3rem, 7vw, 5rem) 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); position: relative; }
.process::before { content: ''; position: absolute; left: 0; right: 0; top: 0.42rem; height: 1px; background: var(--rule-strong); }
.theme-night .process::before { background: rgb(243 237 226 / 0.25); }
.process li { position: relative; padding: 2rem 1.4rem 0 0; }
.process li::before { content: ''; position: absolute; top: 0; left: 0; width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--night); border: 1px solid var(--gilt-hi); }
.section:not(.theme-night) .process li::before { background: var(--parchment); border-color: var(--gilt); }
.process li.is-key::before { background: var(--madder-hi); border-color: var(--madder-hi); }
.process__year { display: block; font-family: var(--f-display); font-size: var(--step-2); font-weight: 300; line-height: 1; font-variant-numeric: lining-nums; margin-bottom: 0.7rem; }
.process p { margin: 0; font-size: var(--step--1); line-height: 1.5; }
@media (max-width: 900px) {
  .process { grid-template-columns: 1fr; padding-left: 1.6rem; }
  .process::before { left: 0.42rem; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .process li { padding: 0 0 2rem 1.2rem; }
  .process li::before { left: -1.6rem; top: 0.45rem; }
}

/* Annotated façade with hotspots */
.annotated { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; margin-block: clamp(3rem, 7vw, 6rem); }
.annotated__media { position: relative; }
.annotated__media .fig__frame { aspect-ratio: auto; }
.hotspot {
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  width: 2.1rem; height: 2.1rem; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid rgb(243 237 226 / 0.9); background: rgb(13 18 15 / 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  color: var(--parchment); font-family: var(--f-ui); font-size: 0.74rem; font-weight: 500;
  display: grid; place-items: center; transition: background 0.3s, transform 0.4s var(--ease-out), border-color 0.3s;
}
.hotspot::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgb(243 237 226 / 0.45);
  animation: pulse 2.8s var(--ease-out) infinite;
}
.hotspot:hover, .hotspot.is-active { background: var(--madder); border-color: var(--madder-hi); transform: translate(-50%, -50%) scale(1.12); }
.notes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); counter-reset: note; }
.note { border-bottom: 1px solid var(--rule); }
.note button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  display: grid; grid-template-columns: 2rem 1fr; gap: 0.9rem; padding: 1.05rem 0; align-items: baseline;
}
.note__n { font-family: var(--f-ui); font-size: 0.74rem; color: var(--gilt-hi); letter-spacing: 0.1em; }
.section:not(.theme-night) .note__n { color: var(--gilt-lo); }
.note__t { font-family: var(--f-display); font-size: var(--step-1); font-weight: 500; line-height: 1.15; }
.note__d { grid-column: 2; display: block; font-size: var(--step--1); line-height: 1.5; color: var(--stone-2); max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.6s var(--ease-out), opacity 0.4s, margin 0.4s; }
.section:not(.theme-night) .note__d { color: var(--ink-3); }
.note.is-active .note__d { max-height: 14rem; opacity: 1; margin-top: 0.5rem; }
.note.is-active .note__t { color: var(--gilt-hi); }
.section:not(.theme-night) .note.is-active .note__t { color: var(--madder); }
@media (max-width: 900px) { .annotated { grid-template-columns: 1fr; } .hotspot { width: 1.8rem; height: 1.8rem; } }

/* Then → now: the apartments transformed into a reception suite */
.transform { margin-block: clamp(3rem, 7vw, 5rem); display: grid; grid-template-columns: 1fr auto 1fr; gap: 0 clamp(1rem, 3vw, 2.5rem); align-items: stretch; }
.transform__col h4 { font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.26em; text-transform: uppercase; color: var(--gilt-hi); margin-bottom: 1.2rem; font-weight: 400; }
.section:not(.theme-night) .transform__col h4 { color: var(--gilt-lo); }
.transform__col ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.transform__col li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); font-family: var(--f-display); font-size: var(--step-1); line-height: 1.15; }
.transform__col--before li { color: var(--stone-2); text-decoration: line-through; text-decoration-color: rgb(178 73 58 / 0.55); text-decoration-thickness: 1px; }
.section:not(.theme-night) .transform__col--before li { color: var(--ink-3); }
.transform__arrow { display: grid; place-items: center; color: var(--gilt-hi); padding-top: 2.4rem; }
.transform__arrow svg { width: 3.2rem; }
@media (max-width: 640px) {
  .transform { grid-template-columns: 1fr; }
  .transform__arrow { padding: 1.2rem 0; transform: rotate(90deg); }
}

/* Makers */
.makers { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); margin-top: clamp(2.5rem, 5vw, 4rem); }
.maker { border-top: 1px solid var(--gilt); padding-top: 1.2rem; }
.maker__role { font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gilt-hi); }
.section:not(.theme-night) .maker__role { color: var(--gilt-lo); }
.maker__name { font-family: var(--f-display); font-size: var(--step-1); font-weight: 500; line-height: 1.15; margin: 0.5rem 0 0.5rem; }
.maker p { margin: 0; font-size: var(--step--1); line-height: 1.55; color: var(--stone-2); }
.section:not(.theme-night) .maker p { color: var(--ink-3); }

/* Protection: the seal */
.protect { display: grid; grid-template-columns: auto 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.protect__seal { width: clamp(9rem, 18vw, 14rem); color: var(--madder); }
.protect__list { list-style: none; margin: 1.8rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.protect__list li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1.2rem; padding: 1.05rem 0; border-bottom: 1px solid var(--rule); font-size: var(--step--1); line-height: 1.5; }
.protect__list b { font-family: var(--f-display); font-size: var(--step-1); font-weight: 400; line-height: 1; font-variant-numeric: lining-nums; color: var(--madder); }
@media (max-width: 760px) { .protect { grid-template-columns: 1fr; } .protect__list li { grid-template-columns: 1fr; gap: 0.3rem; } }

/* 16. Chronology ----------------------------------------------------------- */
.chrono-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 clamp(2.5rem, 6vw, 4.5rem); }
.chip {
  background: none; border: 1px solid var(--rule-strong); border-radius: 999px; cursor: pointer;
  padding: 0.55rem 1.1rem; font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.18em; text-transform: uppercase;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.theme-night .chip { border-color: rgb(243 237 226 / 0.25); }
.chip:hover { border-color: var(--gilt); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.theme-night .chip[aria-pressed="true"] { background: var(--parchment); color: var(--night); border-color: var(--parchment); }

.chrono { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(0, 3fr); gap: clamp(1.5rem, 5vw, 5rem); }
.chrono__century { position: sticky; top: calc(var(--header-h) + 2.5rem); align-self: start; }
.chrono__century b {
  display: block; font-family: var(--f-display); font-weight: 300; font-size: clamp(4.5rem, 10vw, 9.5rem); line-height: 0.85;
  color: transparent; -webkit-text-stroke: 1px var(--gilt); letter-spacing: -0.02em; font-variant-numeric: lining-nums;
  transition: opacity 0.4s;
}
.chrono__century b sup { font-size: 0.35em; vertical-align: 1.3em; -webkit-text-stroke: 0.6px var(--gilt); }
.chrono__sub { display: block; margin-top: 1rem; }
.chrono__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.event { display: grid; grid-template-columns: 9rem 1fr; gap: 1.6rem; padding: 1.7rem 0 1.8rem; border-bottom: 1px solid var(--rule); }
.event__year { font-family: var(--f-display); font-weight: 400; font-size: var(--step-2); line-height: 1; color: var(--gilt-lo); font-variant-numeric: lining-nums; }
.theme-night .event__year { color: var(--gilt-hi); }
.event__year small { display: block; font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.16em; text-transform: uppercase; margin-top: 0.5rem; color: var(--ink-3); }
.theme-night .event__year small { color: var(--stone-2); }
.event__title { font-family: var(--f-display); font-size: var(--step-1); font-weight: 500; line-height: 1.2; margin-bottom: 0.45rem; }
.event p { margin: 0; font-size: var(--step--1); line-height: 1.6; color: var(--ink-3); max-width: 40rem; }
.theme-night .event p { color: var(--stone); }
.event__tag { display: inline-block; margin-top: 0.7rem; font-family: var(--f-ui); font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--rule-strong); padding: 0.2rem 0.5rem; }
.theme-night .event__tag { color: var(--stone-2); border-color: rgb(243 237 226 / 0.2); }
.event--key .event__title { color: var(--madder); }
.theme-night .event--key .event__title { color: var(--gilt-hi); }
.event.is-filtered { display: none; }
@media (max-width: 860px) {
  .chrono { grid-template-columns: 1fr; }
  .chrono__century { display: none; }
  .event { grid-template-columns: 1fr; gap: 0.6rem; }
}

/* 17. Gallery & lightbox --------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: clamp(9rem, 15vw, 15rem); grid-auto-flow: dense; gap: clamp(0.6rem, 1.2vw, 1.1rem); }
.tile { position: relative; grid-column: span 4; grid-row: span 2; overflow: hidden; background: var(--night-3); cursor: zoom-in; border: 0; padding: 0; display: block; text-align: left; }
.tile--wide { grid-column: span 8; }
.tile--tall { grid-row: span 3; }
.tile--full { grid-column: 1 / -1; grid-row: span 3; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease-out), filter 0.8s; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.045); }
.tile__cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.5rem 1.1rem 0.95rem;
  background: linear-gradient(transparent, rgb(8 11 9 / 0.78)); color: var(--parchment);
  font-size: var(--step--1); line-height: 1.35; font-style: italic;
  transform: translateY(0.6rem); opacity: 0; transition: transform 0.6s var(--ease-out), opacity 0.5s;
}
.tile__cap b { display: block; font-style: normal; font-family: var(--f-ui); font-weight: 400; font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gilt-hi); margin-bottom: 0.3rem; }
.tile:hover .tile__cap, .tile:focus-visible .tile__cap { transform: none; opacity: 1; }
@media (hover: none) { .tile__cap { transform: none; opacity: 1; } }
@media (max-width: 760px) {
  .gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 42vw; }
  .tile, .tile--wide { grid-column: span 2; grid-row: span 1; }
  .tile--tall { grid-column: span 1; grid-row: span 2; }
}

.lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(8 11 9 / 0.97); color: var(--parchment);
  opacity: 0; transition: opacity 0.45s var(--ease-out), overlay 0.45s allow-discrete, display 0.45s allow-discrete;
}
.lightbox[open] { opacity: 1; display: grid; grid-template-rows: auto 1fr auto; }
@starting-style { .lightbox[open] { opacity: 0; } }
.lightbox::backdrop { background: transparent; }
.lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem var(--gutter); font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.22em; text-transform: uppercase; }
.lightbox__bar button { background: none; border: 0; cursor: pointer; letter-spacing: inherit; text-transform: inherit; padding: 0.5rem 0; }
.lightbox__stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 clamp(0.5rem, 6vw, 6rem); }
.lightbox__stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 40px 80px -30px rgb(0 0 0 / 0.8); transition: opacity 0.35s; }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: 1px solid rgb(243 237 226 / 0.25); border-radius: 50%; width: 3.2rem; height: 3.2rem; cursor: pointer; display: grid; place-items: center; transition: border-color 0.3s, background 0.3s; }
.lightbox__nav:hover { border-color: var(--gilt-hi); background: rgb(243 237 226 / 0.05); }
.lightbox__nav svg { width: 1.1rem; }
.lightbox__prev { left: clamp(0.5rem, 2vw, 1.6rem); }
.lightbox__next { right: clamp(0.5rem, 2vw, 1.6rem); }
.lightbox__foot { padding: 1.2rem var(--gutter) 1.6rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; align-items: baseline; }
.lightbox__cap { font-style: italic; font-size: var(--step-0); max-width: 52rem; }
.lightbox__credit { font-family: var(--f-ui); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--stone-2); }
.lightbox__credit a { color: inherit; }
@media (max-width: 760px) { .lightbox__nav { display: none; } }

/* 18. Sources & contribution ---------------------------------------------- */
.sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2.5rem, 6vw, 6rem); }
.sources h3 { font-family: var(--f-ui); font-size: var(--step--2); font-weight: 400; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gilt-lo); padding-bottom: 1rem; border-bottom: 1px solid var(--rule-strong); }
.biblio { list-style: none; margin: 0 0 3rem; padding: 0; }
.biblio li { padding: 1.05rem 0; border-bottom: 1px solid var(--rule); font-size: var(--step--1); line-height: 1.55; color: var(--ink-2); padding-left: 1.6rem; text-indent: -1.6rem; }
.biblio li a { text-decoration-color: var(--gilt); }
.biblio .smallcaps { color: var(--ink); }
@media (max-width: 860px) { .sources { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; gap: 0.9rem; margin-top: 1.8rem; padding: 1.05rem 1.9rem;
  font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.26em; text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--gilt-hi); color: var(--parchment); position: relative; overflow: hidden; isolation: isolate;
  transition: color 0.5s var(--ease-out);
}
.btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--gilt-hi); transform: scaleY(0); transform-origin: 50% 100%; transition: transform 0.6s var(--ease-out); }
.btn:hover { color: var(--night); }
.btn:hover::before { transform: scaleY(1); }
.btn svg { width: 1rem; }

/* 19. Footer --------------------------------------------------------------- */
.site-footer { position: relative; background: var(--night); color: var(--stone); padding: clamp(5rem, 10vw, 8rem) 0 2rem; overflow: hidden; }
.footer__word {
  font-family: var(--f-display); font-weight: 300; font-size: clamp(5rem, 24vw, 24rem); line-height: 0.75; letter-spacing: -0.04em;
  color: transparent; -webkit-text-stroke: 1px rgb(205 176 122 / 0.35); text-align: center; margin: 0 0 clamp(3rem, 7vw, 5rem);
  user-select: none; white-space: nowrap;
}
.footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 2.5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule-night); font-size: var(--step--1); line-height: 1.6; }
.footer__grid h4 { font-family: var(--f-ui); font-size: var(--step--2); font-weight: 400; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gilt-hi); margin-bottom: 0.9rem; }
.footer__grid p { margin: 0 0 0.6rem; }
.footer__grid a { text-decoration-color: rgb(205 176 122 / 0.5); }
.footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule-night); font-family: var(--f-ui); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--stone-2); }
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr; } }

/* 20. Motion ---------------------------------------------------------------- */
@keyframes hero-in { to { transform: scale(1); opacity: 1; } }
@keyframes letter-in { from { opacity: 0; transform: translateY(0.35em); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(1.4rem); } to { opacity: 1; transform: none; } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scrollcue { 0% { transform: translateY(-100%); } 55% { transform: translateY(0); } 100% { transform: translateY(100%); } }
@keyframes pulse { 0% { transform: scale(0.85); opacity: 0.9; } 70%, 100% { transform: scale(1.5); opacity: 0; } }

/* Reveal on scroll (classes added by JS; content is visible without JS) */
.js [data-reveal] { opacity: 0; transform: translateY(1.8rem); transition: opacity 1.3s var(--ease-out), transform 1.3s var(--ease-out); transition-delay: var(--d, 0s); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="curtain"] { opacity: 1; transform: none; clip-path: inset(0 0 100% 0); transition: clip-path 1.6s var(--ease-io); transition-delay: var(--d, 0s); }
.js [data-reveal="curtain"].is-in { clip-path: inset(0 0 0 0); }
.js [data-reveal="curtain"] img { transform: scale(1.12); transition: transform 2.4s var(--ease-out); transition-delay: var(--d, 0s); }
.js [data-reveal="curtain"].is-in img { transform: none; }

/* Scroll-linked effects where the browser supports them */
@supports (animation-timeline: view()) {
  .parallax img { animation: parallax linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  @keyframes parallax { from { transform: translateY(-6%) scale(1.12); } to { transform: translateY(6%) scale(1.12); } }
  .hero__content, .hero__aside { animation: hero-out linear both; animation-timeline: scroll(root); animation-range: 0 90vh; }
  @keyframes hero-out { to { opacity: 0; transform: translateY(-12vh); } }
  .hero__media { animation: hero-sink linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  @keyframes hero-sink { to { transform: translateY(22vh); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .js [data-reveal], .js [data-reveal="curtain"] { opacity: 1; transform: none; clip-path: none; }
  .hero__media img { transform: none; opacity: 1; }
  .parallax img, .hero__content, .hero__aside, .hero__media { animation: none !important; }
}

/* View transitions (chronology filters) */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.45s; animation-timing-function: var(--ease-soft); }

/* 21. Print ------------------------------------------------------------------ */
@media print {
  .site-header, .progress, .menu, .hero__scroll, .chrono-filters, .lightbox, .hotspot, .lang-switch { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .theme-night { background: #fff !important; color: #000 !important; }
  .hero { height: auto; min-height: 0; }
  .hero__media { position: relative; height: 12cm; }
  .hero__content { position: relative; color: #000; left: 0; bottom: 0; padding: 1cm 0; }
  .section { padding-block: 1cm; break-inside: avoid-page; }
  .sidenote { display: block !important; float: none; width: auto; margin: 0.3cm 0; font-size: 9pt; }
  .js [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}

/* Plates: period images mounted like museum prints */
.diptych--plates { margin-block: clamp(3rem, 7vw, 6rem); align-items: end; }
.diptych--plates > :nth-child(2) { margin-top: 0; }
.diptych--plates .fig { margin-block: 0; }
.diptych--wide-first { grid-template-columns: 1.6fr 1fr; }
.diptych--plates .fig__frame { box-shadow: 0 1px 0 var(--rule), 0 30px 60px -32px rgb(24 22 15 / 0.4); }
.theme-vellum .fig--plate .fig__frame { background: var(--parchment); }
@media (max-width: 760px) { .diptych--wide-first { grid-template-columns: 1fr; } }

/* Duban's works */
.works-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2rem); margin-top: clamp(3rem, 7vw, 5.5rem); }
.works-gallery .fig { margin-block: 0; }
@media (max-width: 760px) { .works-gallery { grid-template-columns: 1fr; } }
.architect__portrait .fig { margin-block: 0; }
.architect__portrait .fig--print .fig__frame img { transform: rotate(0.5deg); }

/* Museum-label inventory of the classified furniture */
.inventory { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-top: clamp(2rem, 4vw, 3rem); }
.inv { background: var(--night-2); padding: 1.6rem 1.5rem 1.8rem; }
.section:not(.theme-night) .inv { background: var(--parchment); }
.inv__meta { display: flex; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; font-family: var(--f-ui); font-size: var(--step--2); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gilt-hi); font-variant-numeric: lining-nums; }
.inv__title { font-family: var(--f-display); font-size: var(--step-1); font-weight: 500; line-height: 1.15; margin-bottom: 0.6rem; color: var(--parchment); }
.inv p:not(.inv__meta) { margin: 0; font-size: var(--step--1); line-height: 1.55; color: var(--stone); }
.pullquote__tr { font-size: 0.6em; color: var(--stone-2); margin-top: 0.6rem; font-style: italic; }

/* Lineage: a collateral branch, drawn off the main line */
.gen--branch { margin-left: 2.2rem; }
.gen--branch .gen__num { background: transparent; border-style: dashed; color: var(--ink-3); width: 2.4rem; height: 2.4rem; }
.gen--branch .gen__name { font-style: italic; font-size: 1.15em; }
.lineage__note { max-width: 46rem; margin: 1.5rem 0 0 max(0px, calc(50% - (var(--measure) + 15.5rem + 3rem) / 2)); color: var(--ink-3); }
@media (max-width: 1180px) { .lineage__note { margin-inline: auto; } }

/* The 1861 eyewitness: before / after, in Magen's words */
.witness { margin-block: clamp(3.5rem, 8vw, 6rem); padding-block: clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.witness__intro { max-width: 44rem; margin: 1.2rem 0 2.4rem; color: var(--stone); }
.witness__cols { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 5vw, 5rem); }
.witness__q { margin: 0; position: relative; padding-left: 1.6rem; border-left: 1px solid var(--gilt); }
.witness__q:last-child { border-left-color: var(--madder-hi); }
.witness__q figcaption { color: var(--gilt-hi); margin-bottom: 1rem; }
.witness__q:last-child figcaption { color: var(--madder-hi); }
.witness__q blockquote { font-family: var(--f-display); font-style: italic; font-weight: 400; font-size: var(--step-1); line-height: 1.35; color: var(--parchment); margin: 0; }
.witness__tr { margin: 1rem 0 0; font-size: var(--step--1); line-height: 1.55; color: var(--stone-2); }
@media (max-width: 760px) { .witness__cols { grid-template-columns: 1fr; } }

/* Then & now */
.thennow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2.5rem); margin-top: clamp(3.5rem, 8vw, 6rem); }
.thennow .fig { margin-block: 0; }
.thennow .fig:first-child .fig__frame img { filter: sepia(0.25) contrast(1.02); }
@media (max-width: 760px) { .thennow { grid-template-columns: 1fr; } }

/* Old maps of the country around the château */
.maps { margin-top: clamp(4rem, 9vw, 7rem); }
.maps__title { font-family: var(--f-display); font-weight: 400; font-size: var(--step-2); line-height: 1.1; margin-top: 0.8rem; }
.maps .diptych--plates { margin-top: clamp(2rem, 4vw, 3rem); margin-bottom: 0; }

/* A plain statement that the house is private */
.prose p.private-note {
  margin-top: 2.2rem; padding: 1.1rem 0 0; border-top: 1px solid var(--rule);
  font-family: var(--f-ui); font-size: var(--step--1); letter-spacing: 0.02em; line-height: 1.6; color: var(--ink-3);
}

/* Contribution line under the sources */
.prose p.contrib { margin-top: 1.8rem; padding-left: 1.2rem; border-left: 1px solid var(--gilt); color: var(--ink-2); }
.contrib a { white-space: nowrap; }

/* Superscripts keep their case inside uppercase labels ("XXe siècle", not "XXE"). */
sup { text-transform: none; }
