:root {
  --paper: #f5f1e8;
  --paper-2: #ebe4d6;
  --ink: #20201d;
  --muted: #6b675f;
  --line: #d5ccbb;
  --accent: #6f2d2d;
  --accent-dark: #4f1f1f;
  --card: rgba(255, 253, 248, .86);
  --shadow: 0 18px 50px rgba(37, 31, 22, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 2%, rgba(111,45,45,.08), transparent 30rem),
    linear-gradient(180deg, #f9f6ef 0%, var(--paper) 42%, #efe9dd 100%);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.67;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(249, 246, 239, .9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  min-height: 106px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 14px 0;
}
.brand { display: grid; gap: 1px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-kicker {
  color: var(--accent);
  font: 700 .72rem/1.2 system-ui, sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.brand-title { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.1; letter-spacing: -.02em; }
.brand-tagline { color: var(--muted); font: .88rem/1.35 system-ui, sans-serif; }
.language-switcher { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; font: 600 .78rem/1 system-ui, sans-serif; }
.language-switcher a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 10px;
}
.language-switcher a:hover { border-color: var(--line); color: var(--ink); }
.language-switcher a.active { background: var(--ink); color: #fff; }

.home-main { padding: 56px 0 72px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 40px;
  align-items: stretch;
}
.hero-copy, .manuscript-card, .sidebar, .article-card {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.hero-copy { padding: clamp(28px, 5vw, 58px); }
.eyebrow { margin: 0 0 12px; color: var(--accent); font: 700 .78rem/1.2 system-ui, sans-serif; letter-spacing: .13em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(2.7rem, 7vw, 5.8rem); line-height: .94; letter-spacing: -.045em; font-weight: 500; }
.hero-lead { max-width: 760px; margin: 24px 0 0; color: #4e4a44; font-size: clamp(1.08rem, 2vw, 1.3rem); }
.hero-quote { margin: 30px 0 0; padding: 20px 0 0 22px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.manuscript-card { overflow: hidden; min-height: 420px; position: relative; background: #d9d4cb; }
.manuscript-card img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.1) contrast(1.04); }
.manuscript-caption {
  position: absolute; inset: auto 14px 14px 14px;
  background: rgba(24,22,19,.78); color: white; border-radius: 12px; padding: 10px 13px;
  font: .78rem/1.35 system-ui, sans-serif;
}

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.home-panel { border: 1px solid var(--line); background: rgba(255,253,248,.7); border-radius: var(--radius); padding: 28px; }
.home-panel h2 { margin-top: 0; font-size: 1.45rem; }
.home-panel p:last-child { margin-bottom: 0; }

.page-main { padding: 42px 0 72px; }
.content-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 34px; align-items: start; }
.sidebar { padding: 16px; position: sticky; top: 132px; }
.archive-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.archive-nav a {
  display: block; padding: 10px 12px; border-radius: 10px; color: #413d37;
  text-decoration: none; font: 600 .9rem/1.3 system-ui, sans-serif;
}
.archive-nav a:hover { background: var(--paper-2); color: var(--ink); }
.archive-nav a.active { background: var(--ink); color: white; }
.sidebar-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
.sidebar-section h2 { margin: 0 0 10px; color: var(--muted); font: 700 .72rem/1.3 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .09em; }
.resource-card {
  display: grid; gap: 5px; padding: 11px 12px; margin: 0 -4px 5px; border-radius: 10px;
  color: var(--ink); text-decoration: none;
}
.resource-card:hover { background: var(--paper-2); }
.resource-card strong { font-size: .93rem; line-height: 1.35; }
.resource-card span { color: var(--accent); font: 700 .68rem/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.external-link { font: 600 .9rem/1.3 system-ui, sans-serif; text-decoration: none; }

.article-card { padding: clamp(26px, 5vw, 56px); overflow: hidden; }
.article-card h1 { margin: 0 0 26px; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; font-weight: 500; letter-spacing: -.035em; }
.article-card h2 { margin: 2.2rem 0 .8rem; font-size: clamp(1.35rem, 2.6vw, 2rem); line-height: 1.15; color: #34312c; }
.article-card h3 { font-size: 1.15rem; }
.archive-text { font-size: 1.04rem; }
.archive-text ul, .archive-text ol { padding-left: 1.35rem; }
.archive-text li { margin: .45rem 0; }
.archive-resource { margin: .9rem 0; }
.archive-resource a {
  display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  background: #fffdf8; text-decoration: none; font-weight: 700;
}
.notice { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font: .82rem/1.4 system-ui, sans-serif; }
.footer-inner { min-height: 84px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.footer-inner a { color: inherit; }

/* Dupuy biography */
.dupuy-hero { display: grid; grid-template-columns: 134px 1fr; gap: 24px; align-items: center; margin-bottom: 30px; }
.dupuy-portrait { border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 10px 24px rgba(0,0,0,.09); }
.dupuy-chapters { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.dupuy-chapters a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf8; text-decoration: none; }

@media (max-width: 860px) {
  .site-header { position: static; }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 12px; }
  .language-switcher { justify-content: flex-start; }
  .hero, .home-grid, .content-grid { grid-template-columns: 1fr; }
  .manuscript-card { min-height: 360px; }
  .sidebar { position: static; }
  .dupuy-chapters { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 24px, 1180px); }
  .home-main, .page-main { padding-top: 24px; }
  .hero-copy, .article-card { padding: 24px; }
  .home-panel { padding: 22px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; }
  .dupuy-hero { grid-template-columns: 90px 1fr; gap: 16px; }
}

/* Embedded archive PDFs */
.pdf-article { padding: clamp(20px, 3vw, 34px); }
.pdf-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 20px;
}
.pdf-heading h1 { margin-bottom: 10px; font-size: clamp(1.8rem, 4vw, 3.1rem); }
.pdf-note { margin: 0; color: var(--muted); font-size: .95rem; }
.pdf-open {
  flex: 0 0 auto;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  background: #fffdf8;
  text-decoration: none;
  font: 700 .82rem/1.2 system-ui, sans-serif;
}
.pdf-frame {
  display: block;
  width: 100%;
  height: min(78vh, 1050px);
  min-height: 680px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.pdf-fallback { padding: 30px; }

@media (max-width: 720px) {
  .pdf-heading { align-items: flex-start; flex-direction: column; }
  .pdf-frame { min-height: 560px; height: 72vh; }
}

/* Historical letters */
.letters-intro { color: var(--muted); max-width: 70ch; margin-bottom: 32px; }
.letter-section + .letter-section { margin-top: 42px; }
.letter-section h2 { margin-bottom: 14px; }
.letter-list { display: grid; gap: 8px; }
.letter-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px;
  background: #fffdf8; text-decoration: none;
}
.letter-card:hover { transform: translateX(2px); }
.letter-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.letter-column { min-width: 0; }
.letter-column h2 { position: sticky; top: 0; padding: 10px 0; background: var(--paper, #f5f0e8); z-index: 1; }
.letter-column p { line-height: 1.72; }
.letter-column.translation { border-left: 1px solid var(--line); padding-left: 28px; }
.translated-paragraph small { display: block; margin-top: -8px; margin-bottom: 18px; color: var(--muted); font: 600 .72rem/1.3 system-ui, sans-serif; }
.translation-missing { color: var(--muted); min-height: 1.72em; }
.letter-reader .eyebrow a { text-decoration: none; }
.pdf-fallback-link { margin: 12px 0 0; font-size: .9rem; }
@media (max-width: 900px) {
  .letter-columns { grid-template-columns: 1fr; }
  .letter-column.translation { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 22px; }
  .letter-column h2 { position: static; }
}

.raspail-lead {
  font-size: 1.02rem;
  line-height: 1.75;
  color: #344050;
}

.stats-strip {
  display: flex;
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}

.stats-strip > div {
  min-width: 14rem;
  background: #f3f0e8;
  border: 1px solid #ded6c7;
  border-radius: 16px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stats-strip strong {
  font-size: 1.85rem;
  line-height: 1;
  color: #263245;
}

.stats-strip span {
  color: #5c6675;
  font-size: 0.96rem;
}

.raspail-gallery-section {
  margin-top: 2rem;
}

.raspail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.raspail-figure {
  margin: 0;
  background: #faf8f3;
  border: 1px solid #e4ddcf;
  border-radius: 18px;
  padding: 0.75rem;
  box-shadow: 0 8px 20px rgba(20, 32, 44, 0.05);
}

.raspail-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #e8e3d8;
}

.raspail-figure figcaption {
  margin-top: 0.6rem;
  color: #495468;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

/* Raspail facsimile reader */
.raspail-book-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin: 1.2rem 0 1.5rem;
}

.raspail-book-tabs a {
  display: inline-flex;
  align-items: center;
  padding: .65rem 1rem;
  border: 1px solid #d8d0c0;
  border-radius: 999px;
  background: #f7f4ed;
  color: #2e3a4b;
  text-decoration: none;
  font-weight: 600;
}

.raspail-book-tabs a.active,
.raspail-book-tabs a:hover {
  background: #29384d;
  color: #fff;
  border-color: #29384d;
}

.raspail-reader {
  margin-top: 1rem;
}

.raspail-reader-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.raspail-reader-toolbar > :last-child {
  justify-self: end;
}

.raspail-nav-button {
  display: inline-flex;
  width: fit-content;
  padding: .65rem .9rem;
  border-radius: 10px;
  border: 1px solid #d7cfbf;
  background: #f7f4ed;
  color: #26364a;
  text-decoration: none;
  font-weight: 600;
}

.raspail-nav-button:hover {
  background: #eee8dc;
}

.raspail-nav-button.disabled {
  opacity: .38;
  cursor: default;
}

.raspail-page-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  color: #4f5a69;
}

.raspail-page-jump label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.raspail-page-jump input {
  width: 5.4rem;
  padding: .48rem .55rem;
  border: 1px solid #cbc3b3;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.raspail-page-jump button {
  padding: .5rem .7rem;
  border: 0;
  border-radius: 8px;
  background: #29384d;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.raspail-page-view {
  margin: 0;
  padding: 1rem;
  border: 1px solid #ded7c9;
  border-radius: 18px;
  background: #ece8df;
  text-align: center;
}

.raspail-page-view img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(20, 27, 38, .16);
  background: #fff;
}

.raspail-page-view figcaption {
  margin-top: .8rem;
  color: #576170;
  font-size: .92rem;
  line-height: 1.55;
}

.raspail-reader-toolbar.bottom {
  margin-top: 1.2rem;
}

.raspail-page-counter {
  justify-self: center;
  color: #596474;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .raspail-reader-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .raspail-page-jump {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
  }

  .raspail-reader-toolbar.bottom {
    grid-template-columns: 1fr auto 1fr;
  }

  .raspail-nav-button {
    font-size: .9rem;
  }
}
