/* Elites, Technology, and Asset Prices — "Republic" design
   Venetian lagoon, gilt, vellum and red rubrics, after the book's cover. */

/* ---------- Fonts (self-hosted, SIL OFL; see assets/fonts/LICENSE.txt) ---------- */

@font-face {
  font-family: "EB Garamond"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/eb-garamond.woff2") format("woff2");
}
@font-face {
  font-family: "EB Garamond"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/eb-garamond-italic.woff2") format("woff2");
}
@font-face {
  font-family: "IM Fell English"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/im-fell-english.woff2") format("woff2");
}
@font-face {
  font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/im-fell-english-italic.woff2") format("woff2");
}
@font-face {
  font-family: "IM Fell English SC"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/im-fell-english-sc.woff2") format("woff2");
}

/* ---------- Tokens ---------- */

:root {
  --lagoon: #0f1f21;
  --lagoon-2: #173033;
  --vellum: #e9dfc9;
  --ink: #231a12;
  --ink-2: #4e4032;
  --rubric: #9a2416;
  --gold: #c19a4b;
  --gold-soft: #d9bf86;
  --cream: #f3ead6;
  --body: "EB Garamond", Garamond, "Times New Roman", serif;
  --fell: "IM Fell English", "EB Garamond", Garamond, serif;
  --fell-sc: "IM Fell English SC", "EB Garamond", Garamond, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); font-family: var(--body); font-size: 1.2rem; line-height: 1.55;
  background-color: var(--vellum);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--rubric); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
section[id] { scroll-margin-top: 20px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--lagoon); color: var(--cream); padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

.measure { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.wide { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.fleuron { text-align: center; color: var(--rubric); font-size: 1.6rem; line-height: 1; margin: 34px 0; letter-spacing: .6em; padding-left: .6em; }

/* ---------- Frontispiece ---------- */

.front {
  background: radial-gradient(900px 500px at 50% 0%, var(--lagoon-2), var(--lagoon) 70%);
  color: var(--vellum); padding: 26px 16px 70px; text-align: center;
}
.topnav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 26px; font-family: var(--fell-sc); font-size: 1rem; letter-spacing: .08em; }
.topnav a { color: var(--gold-soft); text-decoration: none; }
.topnav a:hover { color: var(--vellum); }
.frame {
  max-width: 960px; margin: 34px auto 0; padding: clamp(26px, 5vw, 56px) clamp(16px, 4vw, 48px);
  border: 1px solid rgba(193,154,75,.55); outline: 1px solid rgba(193,154,75,.3); outline-offset: 7px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(26px, 5vw, 60px); align-items: center;
}
.front .author { font-family: var(--fell-sc); letter-spacing: .22em; font-size: 1.05rem; color: var(--gold); margin: 0 0 18px; }
.front h1 { font-family: var(--fell); font-weight: 400; font-size: clamp(2.5rem, 5.6vw, 4.6rem); line-height: 1.02; margin: 0; color: var(--cream); }
.front h1 em { font-style: italic; color: var(--gold-soft); }
.front .sub { font-family: var(--fell); font-style: italic; font-size: clamp(1.2rem, 2vw, 1.5rem); color: var(--gold-soft); margin: 16px 0 0; }
.rule-orn { display: flex; align-items: center; gap: 14px; justify-content: center; color: var(--gold); margin: 26px auto; max-width: 340px; }
.rule-orn::before, .rule-orn::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--gold)); }
.rule-orn::after { background: linear-gradient(90deg, var(--gold), transparent); }
.front .hook { font-size: 1.22rem; line-height: 1.55; color: #e2d7bf; max-width: 30em; margin: 0 auto 28px; }
.btn {
  display: inline-block; font-family: var(--fell-sc); letter-spacing: .14em; font-size: 1.05rem; text-decoration: none;
  padding: 12px 26px; border: 1px solid var(--gold); color: var(--lagoon); background: var(--gold);
}
.btn:hover { background: var(--gold-soft); border-color: var(--gold-soft); color: var(--lagoon); }
.btn.ghost { background: transparent; color: var(--gold-soft); margin-left: 8px; }
.btn.ghost:hover { color: var(--vellum); border-color: var(--vellum); background: transparent; }
.gilt { padding: 10px; border: 1px solid var(--gold); background: rgba(193,154,75,.08); justify-self: center; max-width: 330px; }
.gilt img { box-shadow: 0 0 0 1px rgba(0,0,0,.5); }

/* ---------- Chapters ---------- */

.chapter { padding: 64px 0 20px; }
.liber { text-align: center; font-family: var(--fell-sc); letter-spacing: .26em; color: var(--rubric); font-size: 1rem; margin: 0 0 6px; }
h2 { font-family: var(--fell); font-weight: 400; text-align: center; font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.08; margin: 0 0 30px; padding: 0 16px; text-wrap: balance; }
.prose p { margin: 0 0 1em; text-align: justify; hyphens: auto; }
.prose p + p { text-indent: 1.5em; margin-top: -0.4em; }
.initial::first-letter { float: left; font-family: var(--fell); color: var(--rubric); font-size: 4.4em; line-height: .78; padding: 6px 10px 0 0; }
.rubric { color: var(--rubric); }
.pilcrow::before { content: "¶ "; color: var(--rubric); }

/* Marginalia */
.with-margin { display: grid; grid-template-columns: 180px minmax(0, 680px) 180px; gap: 36px; justify-content: center; padding: 0 20px; }
.margin-note { font-style: italic; font-size: .95rem; line-height: 1.4; color: var(--ink-2); text-align: right; padding-top: 6px; border-top: 1px solid var(--rubric); align-self: start; }
.margin-note span { display: block; font-family: var(--fell-sc); font-style: normal; color: var(--rubric); letter-spacing: .12em; font-size: .85rem; margin-bottom: 4px; }

/* Ages */
.ages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; text-align: center; }
.age { padding: 0 26px; }
.age + .age { border-left: 1px solid rgba(154,36,22,.35); }
.age .numeral { font-family: var(--fell); color: var(--rubric); font-size: 4.2rem; line-height: 1; margin: 0; }
.age .when { font-family: var(--fell-sc); letter-spacing: .18em; font-size: .95rem; color: var(--ink-2); margin: 4px 0 10px; }
.age h3 { font-family: var(--fell); font-weight: 400; font-style: italic; font-size: 1.6rem; line-height: 1.15; margin: 0 0 10px; }
.age p { margin: 0 0 14px; font-size: 1.08rem; color: var(--ink-2); }
.age dl { margin: 0; font-size: 1rem; }
.age dt { font-family: var(--fell-sc); letter-spacing: .14em; font-size: .82rem; color: var(--rubric); margin-top: 8px; }
.age dd { margin: 0; }

/* Questions */
.questions { list-style: none; padding: 0; margin: 0; counter-reset: q; }
.questions li { counter-increment: q; display: grid; grid-template-columns: 54px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid rgba(35,26,18,.2); }
.questions li:last-child { border-bottom: 1px solid rgba(35,26,18,.2); }
.questions li::before { content: counter(q, upper-roman) "."; font-family: var(--fell); color: var(--rubric); font-size: 1.6rem; line-height: 1.1; }
.questions h3 { font-family: var(--fell); font-weight: 400; font-size: 1.45rem; margin: 0 0 2px; line-height: 1.2; }
.questions p { margin: 0; color: var(--ink-2); }

/* Where to buy */
.had { background: var(--lagoon); color: var(--vellum); padding: 64px 0; margin-top: 64px; }
.had .liber { color: var(--gold); }
.had h2 { color: var(--cream); }
.leaders { list-style: none; margin: 0 auto; padding: 0; max-width: 620px; }
.leaders li { display: flex; align-items: baseline; gap: 10px; padding: 12px 0; font-size: 1.35rem; font-family: var(--fell); }
.leaders .dots { flex: 1; border-bottom: 2px dotted rgba(193,154,75,.55); transform: translateY(-6px); min-width: 20px; }
.leaders small { font-family: var(--body); font-style: italic; font-size: 1rem; color: var(--gold-soft); margin-left: 6px; }
.leaders a { font-family: var(--fell-sc); letter-spacing: .12em; color: var(--gold); text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.leaders a:hover { color: var(--vellum); }
.had .note { text-align: center; font-style: italic; color: var(--gold-soft); font-size: 1rem; margin: 22px 0 0; }

/* Author */
.cameo { width: 230px; aspect-ratio: 4 / 5; margin: 0 auto 26px; border-radius: 50%; padding: 6px; border: 1px solid var(--rubric); outline: 1px solid rgba(154,36,22,.35); outline-offset: 5px; }
.cameo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; filter: sepia(.25) saturate(.85); }
.epigraph { text-align: center; font-style: italic; font-size: 1.3rem; line-height: 1.45; color: var(--ink-2); max-width: 30em; margin: 0 auto 30px; }

/* Colophon */
.colophon { text-align: center; padding: 50px 20px 60px; }
.colophon .press { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 30px; margin: 0 0 30px; font-family: var(--fell-sc); letter-spacing: .12em; font-size: 1rem; }
.colophon table { margin: 0 auto 30px; border-collapse: collapse; font-size: 1.02rem; text-align: left; }
.colophon th { font-family: var(--fell-sc); letter-spacing: .14em; font-weight: 400; color: var(--rubric); padding: 4px 18px 4px 0; font-size: .9rem; vertical-align: top; text-align: right; }
.colophon td { padding: 4px 0; }
.colophon .fine { font-size: .92rem; color: var(--ink-2); font-style: italic; margin: 0; }

/* ---------- Inner pages (privacy, 404) ---------- */

.front.slim { padding: 22px 16px 44px; }
.front.slim .title-link { display: inline-block; margin-top: 22px; font-family: var(--fell); font-size: clamp(1.5rem, 3vw, 2rem); color: var(--cream); text-decoration: none; line-height: 1.1; }
.front.slim .title-link em { color: var(--gold-soft); }
.legal { padding: 56px 0 30px; }
.legal .updated { text-align: center; font-style: italic; color: var(--ink-2); margin: -18px 0 36px; }
.legal h3 { font-family: var(--fell); font-weight: 400; font-size: 1.5rem; margin: 34px 0 8px; color: var(--ink); }
.legal h3::before { content: "¶ "; color: var(--rubric); }
.legal .prose p, .legal li { text-align: left; }
.legal .prose p + p { text-indent: 0; margin-top: 0; }
.legal ul { padding-left: 1.2em; margin: 0 0 1em; }
.legal li { margin: 0 0 .4em; }
.back { text-align: center; font-family: var(--fell-sc); letter-spacing: .12em; margin-top: 40px; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .with-margin { grid-template-columns: minmax(0, 680px); }
  .margin-note { text-align: left; max-width: 680px; margin: 0 0 10px; }
  .margin-note.right { display: none; }
}
@media (max-width: 820px) {
  body { font-size: 1.12rem; }
  .frame { grid-template-columns: 1fr; }
  .gilt { order: -1; max-width: 240px; }
  .ages { grid-template-columns: 1fr; gap: 34px; }
  .age + .age { border-left: 0; border-top: 1px solid rgba(154,36,22,.35); padding-top: 30px; }
  .btn.ghost { margin: 10px 0 0; }
}
@media (max-width: 420px) {
  .leaders li { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
