/* ===================================================
   Famiglia Monarca — Foglio di stile principale
   =================================================== */

:root {
  --bg:           #f5efe1;
  --bg-alt:       #ebe2c9;
  --bg-card:      #faf5e6;
  --text:         #2d231a;
  --text-soft:    #6a5a47;
  --heading:      #1a120c;
  --accent:       #7a2828;
  --gold:         #a08545;
  --border:       #d6c8a9;
  --border-soft:  #e7dcc1;

  --font-display: 'Cormorant Garamond', 'Garamond', 'Times New Roman', serif;
  --font-body:    'EB Garamond', Georgia, 'Times New Roman', serif;

  --max-width:     1100px;
  --content-width: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 19px;
  line-height: 1.7;
  font-feature-settings: "kern", "liga", "calt", "onum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--heading); }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ---------- Top bar ---------- */
.top-bar { background: var(--heading); color: var(--bg); padding: 10px 0; }
.top-bar .container { display: flex; justify-content: space-between; align-items: center; }
.top-bar__brand {
  font-family: var(--font-display); font-weight: 500; font-size: 13px;
  letter-spacing: 0.25em; text-transform: uppercase; color: var(--bg); opacity: 0.85;
}
.lang-switch {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 13px;
  letter-spacing: 0.15em; text-transform: uppercase;
}
.lang-switch a { color: var(--bg); opacity: 0.55; padding: 2px 0; }
.lang-switch a.active { opacity: 1; border-bottom: 1px solid var(--gold); }
.lang-switch a:hover { opacity: 1; color: var(--bg); }
.lang-switch .sep { opacity: 0.3; }

/* ---------- Header ---------- */
.site-header { text-align: center; padding: 56px 24px 24px; background: var(--bg); }
.site-header__eyebrow {
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--gold); margin: 0 0 18px;
}
.site-header h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(40px, 6.5vw, 72px); line-height: 1;
  letter-spacing: 0.01em; color: var(--heading); margin: 0 0 14px;
}
.site-header__sub {
  font-style: italic; color: var(--text-soft);
  font-size: clamp(17px, 2vw, 21px); margin: 0;
}
.site-header__ornament {
  margin: 28px auto 0; color: var(--gold); font-size: 22px;
  letter-spacing: 1em; padding-left: 1em;
}

/* ---------- Nav ---------- */
.main-nav {
  background: var(--bg); border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.nav-toggle {
  display: none; width: 100%; background: none; border: none; padding: 16px 24px;
  font-family: var(--font-display); font-size: 14px; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--heading); text-align: left; cursor: pointer;
}
.nav-toggle::after { content: '+'; float: right; font-size: 18px; color: var(--gold); }
.nav-toggle[aria-expanded="true"]::after { content: '\2212'; }

.nav-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; justify-content: center; flex-wrap: wrap;
}
.nav-list a {
  display: block; padding: 16px 13px; color: var(--heading);
  font-family: var(--font-display); font-weight: 500; font-size: 15.5px;
  letter-spacing: 0.04em; position: relative;
}
.nav-list a:hover { color: var(--accent); }
.nav-list a.current { color: var(--accent); }
.nav-list a.current::after {
  content: ''; position: absolute; left: 13px; right: 13px;
  bottom: 8px; height: 1px; background: var(--gold);
}

/* ---------- Hero figure ---------- */
.hero-figure { max-width: var(--max-width); margin: 32px auto 0; padding: 0 24px; }
.hero-figure img {
  width: 100%; border: 1px solid var(--border);
  box-shadow: 0 1px 0 #fff inset, 0 4px 24px rgba(40, 30, 20, 0.12);
}
.hero-figure figcaption {
  font-style: italic; color: var(--text-soft); font-size: 15px;
  text-align: center; margin-top: 12px; letter-spacing: 0.02em;
}

/* ---------- Prose ---------- */
.prose { max-width: var(--content-width); margin: 0 auto; padding: 64px 24px 40px; }
.prose h2 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(30px, 4vw, 40px); line-height: 1.15;
  color: var(--heading); text-align: center; margin: 0 0 32px;
}
.prose h3 {
  font-family: var(--font-display); font-weight: 500; font-style: italic;
  font-size: clamp(22px, 3vw, 28px); line-height: 1.2;
  color: var(--heading); margin: 56px 0 18px;
}
.prose p { margin: 0 0 20px; text-align: justify; hyphens: auto; }
.prose em { font-style: italic; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 1.4em; }
.prose li { margin: 0 0 10px; }

.lead { font-size: clamp(20px, 2.3vw, 23px); line-height: 1.55; color: var(--text); }

.drop-cap {
  float: left; font-family: var(--font-display); font-weight: 500;
  font-size: 84px; line-height: 0.85; padding: 8px 14px 0 0; color: var(--accent);
}

.ornament-rule {
  text-align: center; margin: 48px 0; color: var(--gold);
  font-size: 18px; letter-spacing: 1.2em; padding-left: 1.2em;
}

/* ---------- Inline figure ---------- */
.inline-figure { float: right; width: 260px; margin: 6px 0 16px 28px; }
.inline-figure img { border: 1px solid var(--border); padding: 6px; background: #fff; }
.inline-figure figcaption {
  font-style: italic; color: var(--text-soft); font-size: 13px;
  text-align: center; margin-top: 8px; letter-spacing: 0.02em;
}
.inline-figure--left { float: left; margin: 6px 28px 16px 0; }

/* ---------- Figure pair (two images side by side) ---------- */
.figure-pair {
  display: flex; gap: 24px; margin: 40px 0; flex-wrap: wrap;
}
.figure-pair figure { flex: 1; min-width: 220px; margin: 0; }
.figure-pair img { width: 100%; border: 1px solid var(--border); }
.figure-pair figcaption {
  font-style: italic; color: var(--text-soft); font-size: 14px;
  text-align: center; margin-top: 10px;
}

/* ---------- Full-width figure ---------- */
.figure-full { margin: 40px 0; }
.figure-full img { width: 100%; border: 1px solid var(--border); }
.figure-full figcaption {
  font-style: italic; color: var(--text-soft); font-size: 14px;
  text-align: center; margin-top: 10px;
}

/* ---------- Tree diagram (zoomable) ---------- */
.tree-figure { margin: 40px 0; text-align: center; }
.tree-figure img {
  width: 100%; max-width: 960px; margin: 0 auto;
  border: 1px solid var(--border); background: #fff; padding: 8px;
}
.tree-figure figcaption {
  font-style: italic; color: var(--text-soft); font-size: 14px; margin-top: 12px;
}
.tree-figure a.zoom-hint { font-size: 14px; }

/* ---------- Origins list ---------- */
.origins {
  list-style: none; margin: 32px 0 8px; padding: 28px 32px;
  background: var(--bg-card); border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}
.origins li {
  display: flex; align-items: baseline; gap: 24px;
  padding: 14px 0; border-bottom: 1px solid var(--border-soft);
}
.origins li:last-child { border-bottom: none; }
.origins .roman {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 26px; color: var(--accent); min-width: 48px; text-align: center; flex-shrink: 0;
}
.origins .place {
  font-family: var(--font-display); font-weight: 600; font-size: 21px;
  color: var(--heading); letter-spacing: 0.01em;
}
.origins .prov {
  display: block; font-style: italic; font-size: 15px;
  color: var(--text-soft); margin-top: 2px;
}

/* ---------- Honours panels ---------- */
.honour-block {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 24px 32px; margin: 24px 0;
}
.honour-block h4 {
  font-family: var(--font-display); font-weight: 600; font-size: 20px;
  color: var(--accent); margin: 0 0 14px; letter-spacing: 0.02em;
}
.honour-block ul { list-style: none; margin: 0; padding: 0; }
.honour-block li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 0; border-bottom: 1px dotted var(--border);
}
.honour-block li:last-child { border-bottom: none; }
.honour-block .count { font-weight: 600; color: var(--heading); }

/* ---------- Research cards ---------- */
.research-card {
  background: var(--bg-card); border-left: 3px solid var(--gold);
  padding: 20px 28px; margin: 28px 0;
}
.research-card h3 { margin-top: 0; }
.research-card .updated {
  font-size: 14px; color: var(--text-soft); font-style: italic; margin: 0 0 16px;
}

/* ---------- Notes ---------- */
.notes {
  max-width: var(--content-width); margin: 0 auto;
  padding: 36px 24px 24px; border-top: 1px solid var(--border);
}
.notes p { font-size: 16px; color: var(--text-soft); margin: 0 0 12px; line-height: 1.6; }
.notes .sources { font-size: 14px; margin-top: 20px; }
.notes ol { font-size: 14px; color: var(--text-soft); padding-left: 1.2em; }
.notes ol li { margin-bottom: 8px; }

/* ---------- Callout ---------- */
.callout {
  text-align: center; font-family: var(--font-display); font-style: italic;
  font-size: 22px; color: var(--accent); margin: 40px 0; line-height: 1.4;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--heading); color: var(--bg);
  padding: 56px 24px 40px; text-align: center; margin-top: 64px;
}
.site-footer__brand {
  font-family: var(--font-display); font-size: 18px; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--gold); margin: 0 0 16px;
}
.site-footer p { margin: 0 0 8px; }
.site-footer a { color: var(--bg); border-bottom: 1px solid rgba(245, 239, 225, 0.4); }
.site-footer a:hover { border-bottom-color: var(--gold); color: var(--bg); }
.site-footer__copy {
  margin-top: 24px; font-size: 13px; color: rgba(245, 239, 225, 0.55); letter-spacing: 0.05em;
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  body { font-size: 18px; }
  .site-header { padding: 40px 24px 18px; }

  .nav-toggle { display: block; }
  .nav-list { display: none; flex-direction: column; border-top: 1px solid var(--border-soft); }
  .nav-list.open { display: flex; }
  .nav-list li { border-bottom: 1px solid var(--border-soft); }
  .nav-list li:last-child { border-bottom: none; }
  .nav-list a { padding: 14px 24px; width: 100%; }
  .nav-list a.current::after { display: none; }

  .prose { padding: 40px 24px 24px; }
  .prose h3 { margin-top: 40px; }

  .drop-cap { font-size: 64px; padding-right: 10px; }

  .inline-figure, .inline-figure--left {
    float: none; width: 100%; max-width: 320px; margin: 16px auto 24px;
  }

  .figure-pair { flex-direction: column; gap: 28px; }

  .origins { padding: 18px 18px; }
  .origins li { padding: 10px 0; gap: 16px; }
  .origins .roman { font-size: 22px; min-width: 36px; }
  .origins .place { font-size: 18px; }

  .honour-block { padding: 18px 20px; }
  .honour-block li { flex-direction: column; gap: 2px; }
}
