@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/cormorant-garamond-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/cormorant-garamond-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url("fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url("fonts/cormorant-garamond-latin-ext-500-italic.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/literata-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/literata-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/literata-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/literata-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --bg: #f4f1e8; --surface: #fbf9f3; --ink: #23271f; --muted: #5c6154; --line: #d9d4c4; --water: #cfdde3;
  --kingdom: #8a6010; --republic: #8c2f2f; --empire: #4b3f72; --home: #7a3b2e; --accent: var(--home); --accent-ink: #fff;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
  --col: 44rem; --wide: 70rem; color-scheme: light;
}
.theme-home { --accent: var(--home); }
.theme-kingdom { --accent: var(--kingdom); }
.theme-republic { --accent: var(--republic); }
.theme-empire { --accent: var(--empire); }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161914; --surface: #1d211a; --ink: #e9e7dc; --muted: #a6ab9b; --line: #333929; --water: #24323a;
    --kingdom: #e0b45c; --republic: #e08c85; --empire: #b3a6e6; --home: #e0a58a; --accent-ink: #14170f; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }
h1 { font-size: 2.5rem; margin: 0.2em 0 0.3em; }
h2 { font-size: 1.6rem; margin: 1.6em 0 0.4em; }
h3 { font-size: 1.2rem; margin: 0 0 0.3em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 0.5rem; top: 0.5rem; background: var(--surface); padding: 0.4rem 0.8rem; z-index: 1000; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; }

/* header */
.site-header { position: sticky; top: 0; z-index: 900; display: flex; align-items: baseline; gap: 1.2rem; flex-wrap: wrap; padding: 0.55rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .parent { font-size: 0.8rem; color: var(--muted); text-decoration: none; letter-spacing: 0.04em; }
.site-header .parent::after { content: "/"; margin-left: 0.5rem; opacity: 0.5; }
.site-header .brand { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.top-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: 0.9rem; }
.top-links a { text-decoration: none; color: var(--ink); padding: 0.1rem 0; border-bottom: 2px solid transparent; }
.top-links a:hover, .top-links a[aria-current] { border-bottom-color: var(--accent); }

/* page columns */
main { min-height: 60vh; }
.col { max-width: var(--col); margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.col.wide-col { max-width: 56rem; }
.wide { max-width: var(--wide); margin: 0 auto; padding: 1rem 1.2rem 3rem; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.eyebrow a { color: inherit; }
.lede { font-size: 1.15rem; color: var(--ink); }
.alt-name { font-family: var(--font-display); font-style: italic; font-size: 1.3rem; color: var(--muted); margin: -0.3rem 0 0.6rem; }
.count { font-size: 0.55em; color: var(--muted); font-weight: 500; }
.section-h { text-align: center; margin-top: 2.4rem; }

/* hero */
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--republic) 14%, var(--bg)), color-mix(in srgb, var(--empire) 14%, var(--bg))); border-bottom: 1px solid var(--line); }
.hero-in { max-width: 52rem; margin: 0 auto; padding: 3.5rem 1.2rem 3rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.cta { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.4rem; }
.button, button, select, input[type=search] { font: inherit; }
.button { display: inline-block; padding: 0.55rem 1.2rem; border-radius: 6px; background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.button.ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.button:hover { filter: brightness(1.08); }

/* era cards and cards */
.era-grid, .card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: 1.6rem; }
.era-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.2rem; }
.era-card { border-top: 5px solid var(--kingdom); }
.era-card.era-republic { border-top-color: var(--republic); } .era-card.era-empire { border-top-color: var(--empire); }
.era-card h2 { margin: 0.1em 0 0.3em; } .era-card h2 a { text-decoration: none; color: var(--ink); }
.era-dates { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
.era-counts { list-style: none; display: flex; gap: 0.3rem 1rem; flex-wrap: wrap; padding: 0; margin: 0.6rem 0; font-size: 0.9rem; color: var(--muted); }
.era-counts strong { color: var(--ink); }
.card { text-decoration: none; color: var(--ink); display: block; } .card:hover { border-color: var(--accent); } .card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* chips, facts */
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.6rem 0 1rem; }
.chip { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.6rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); }
.chip.era-kingdom { color: var(--kingdom); border-color: var(--kingdom); } .chip.era-republic { color: var(--republic); border-color: var(--republic); } .chip.era-empire { color: var(--empire); border-color: var(--empire); }
.chip.acc-uncertain { border-style: dashed; } .chip-legend { font-style: italic; }
.glance { display: grid; grid-template-columns: 8rem 1fr; gap: 0.3rem 1rem; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin: 1rem 0; }
.glance dt { color: var(--muted); font-size: 0.85rem; } .glance dd { margin: 0; }
.plain { list-style: none; padding: 0; } .plain li { margin: 0.25rem 0; } .when { display: inline-block; min-width: 5.5rem; color: var(--muted); font-size: 0.9rem; }
.waypoints { columns: 2; font-size: 0.95rem; }
.pager { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* lists and filters */
.filters { display: flex; gap: 0.8rem 1.2rem; flex-wrap: wrap; align-items: end; padding: 0.8rem 0 1rem; border-bottom: 1px solid var(--line); margin-bottom: 0.5rem; font-size: 0.9rem; }
.filters label { display: flex; flex-direction: column; gap: 0.2rem; color: var(--muted); }
select, input[type=search] { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 0.35rem 0.5rem; }
button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 0.35rem 0.8rem; cursor: pointer; }
button:hover { border-color: var(--accent); }
.rec-list .rec-sum a { font-size: 0.9rem; }
.rec-list { list-style: none; padding: 0; margin: 0; }
.rec-list li { padding: 0.7rem 0 0.7rem 0.9rem; border-bottom: 1px solid var(--line); border-left: 4px solid var(--kingdom); }
.rec-list li.era-republic { border-left-color: var(--republic); } .rec-list li.era-empire { border-left-color: var(--empire); }
.rec-title { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; text-decoration: none; }
.rec-meta { display: block; font-size: 0.8rem; color: var(--muted); } .rec-sum { display: block; font-size: 0.95rem; }
.search-form { display: flex; gap: 0.5rem; } .search-form input { flex: 1; }

/* timeline */
.jump { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin: 1rem 0 0.5rem; font-size: 0.9rem; }
.jump a { text-decoration: none; padding: 0.15rem 0.7rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
.period h2 { border-bottom: 3px solid var(--kingdom); padding-bottom: 0.2rem; } .period.era-republic h2 { border-color: var(--republic); } .period.era-empire h2 { border-color: var(--empire); }
.tl { list-style: none; padding: 0; margin: 0; } .tl li { padding: 0.45rem 0; border-bottom: 1px dotted var(--line); }
.tl-year { display: inline-block; min-width: 8.2rem; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-sum { display: block; margin-left: 8.2rem; font-size: 0.92rem; color: var(--muted); }
.chart-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.lifespans { width: 100%; min-width: 760px; height: auto; display: block; }
.lifespans .lbl { font-size: 11px; font-weight: 600; font-family: var(--font-body); } .lifespans .tick { font-size: 10px; fill: var(--muted); font-family: var(--font-body); } .lifespans .pl { font-size: 10px; fill: var(--ink); font-family: var(--font-body); } .lifespans .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.lifespans a:hover rect, .lifespans a:focus rect { stroke: var(--ink); stroke-width: 1.5; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 1.6rem 1.2rem 2.4rem; text-align: center; background: var(--surface); }
.footer-nav { display: flex; gap: 0.4rem 1.2rem; justify-content: center; flex-wrap: wrap; margin: 0.8rem 0; font-size: 0.9rem; }
.footer-search { max-width: 22rem; margin: 0.8rem auto; }
@media (max-width: 600px) { h1 { font-size: 2rem; } .glance { grid-template-columns: 1fr; } .tl-sum { margin-left: 0; } .tl-year { display: block; min-width: 0; margin-bottom: 0.1rem; } .waypoints { columns: 1; } .site-header { position: static; } }
@media print { .site-header, .site-footer, .filters, .jump { display: none; } body { background: #fff; color: #000; } }

/* Sources and identifiers on record pages */
.sources { padding-left: 1.2em; }
.sources li { margin: 0 0 .45em; }
.sources .locator { font-variant-numeric: tabular-nums; }
.ids .chip { margin-right: .35em; }

/* Editing area (/admin) */
.admin-bar { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; padding: 0.6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.admin-bar form { margin-left: auto; }
.admin-form { display: grid; gap: 0.9rem; max-width: 46rem; margin: 1rem 0; }
.admin-form label { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); font-size: 0.92rem; }
.admin-form label.check { flex-direction: row; align-items: center; gap: 0.6rem; }
.admin-form input[type=text], .admin-form input[type=password], .admin-form textarea, .admin-form select { width: 100%; box-sizing: border-box; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 0.45rem 0.6rem; font: inherit; }
.admin-form small { color: var(--muted); font-size: 0.82rem; }
.admin-form.danger { border-left: 4px solid #a33; padding-left: 0.8rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table .diff { margin: 0.3rem 0 0; font-size: 0.8rem; white-space: pre-wrap; color: var(--muted); }
form.inline { display: inline; margin: 0; }
a.button { display: inline-block; padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); text-decoration: none; }
.flash { margin: 0.8rem 1rem; padding: 0.6rem 0.9rem; border-radius: 5px; border: 1px solid var(--line); }
.flash-ok { border-left: 4px solid #3a7; } .flash-err { border-left: 4px solid #a33; }

/* Phones and narrow windows: the menu folds into a button on the title line. Without JavaScript the links stay visible. */
.nav-toggle { display: none; }
@media (max-width: 800px), (max-height: 500px) and (pointer: coarse) {
  .js .site-header { position: sticky; top: 0; flex-wrap: nowrap; align-items: center; gap: 0 0.7rem; padding: 0.35rem 0.8rem; }
  .js .site-header .brand { margin-right: 0; font-size: 1.3rem; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .js .nav-toggle { display: inline-flex; align-items: center; flex: 0 0 auto; padding: 0.4rem 0.9rem; font-size: 0.9rem; }
  .js .nav-toggle::after { content: ""; width: 0.42em; height: 0.42em; margin: -0.2em 0 0 0.55em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 0.15s; }
  .js .nav-toggle[aria-expanded="true"]::after { margin-top: 0.25em; transform: rotate(-135deg); }
  .js .site-header .top-links { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 1200; flex-direction: column; flex-wrap: nowrap; gap: 0; padding: 0.2rem 0.8rem 0.5rem; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25); overflow: visible; }
  .js .site-header.nav-open .top-links { display: flex; }
  .js .site-header .top-links a { padding: 0.75rem 0.2rem; font-size: 1rem; border-bottom: 1px solid var(--line); }
  .js .site-header .top-links a:last-child { border-bottom: 0; }
  .js .site-header .top-links a[aria-current] { color: var(--accent); font-weight: 600; }
}

/* glossary */
.gl-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; margin: 1rem 0 0.2rem; border-bottom: 1px solid var(--line); }
.gl-tabs a { text-decoration: none; padding: 0.45rem 1rem; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--surface); color: var(--muted); font-weight: 600; }
.gl-tabs a[aria-current="page"] { color: var(--ink); background: var(--bg, #fff); border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.gl-az { padding: 0.5rem 0; }
.gl-az a { padding: 0.1rem 0.55rem; }
.gl-letter { margin: 1.4rem 0 0.2rem; border-bottom: 3px solid var(--accent); padding-bottom: 0.1rem; scroll-margin-top: 4rem; }

/* Limes page */
.limes-list { list-style: none; padding-left: 1.2em; }
.limes-list.limes-root { padding-left: 0; }
.limes-list li { margin: 0.8em 0; }
.limes-list h2, .limes-list h3, .limes-list h4, .limes-list h5, .limes-list h6 { margin-bottom: 0.1em; }
.limes-list p { margin: 0.2em 0; }
.limes-list .lm-leaf { margin: 0.15em 0; font-size: 0.95em; }
.limes-list details > summary { cursor: pointer; }
.limes-list details > summary > h4, .limes-list details > summary > h5, .limes-list details > summary > h6 { display: inline; }
