:root {
  --app-bg: #f1ebdf;
  --app-surface: #fffaf1;
  --app-text: #292c26;
  --app-muted: #68695e;
  --app-line: #d8cfbd;
  --app-accent: #84432c;
  --app-accent-soft: #eee1d2;
  --app-radius: 24px;
  --app-font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--app-text); background: radial-gradient(ellipse at 90% 0, #e6d9c4, transparent 60%), var(--app-bg); font-family: var(--app-font); }
.app-shell { max-width: 1180px; margin: 0 auto; padding: 32px; }
.app-hero { padding: 34px 40px 42px; border-radius: var(--app-radius); background: linear-gradient(120deg, #303b34, #495346); color: #fffaf1; box-shadow: 0 18px 50px #303b3414; }
a { color: inherit; text-underline-offset: 4px; }
.back-link { display: inline-block; margin-bottom: 40px; color: #e4ddcd; font-size: .85rem; }
.eyebrow { margin: 0 0 14px; font-size: .73rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.app-hero .eyebrow { color: #ded1ac; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { margin: 0; font-size: clamp(3.5rem, 8vw, 6rem); line-height: 1.1; }
.lede { margin: 18px 0 26px; color: #e5e4d8; line-height: 1.6; }
.app-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: .78rem; }
.app-meta span { padding: 8px 12px; border: 1px solid #f4ead633; border-radius: 100px; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 16px; }
.view-tabs button { min-height: 46px; padding: 12px 18px; border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface); color: var(--app-text); font: 600 .88rem var(--app-font); cursor: pointer; }
.view-tabs button:hover { background: var(--app-accent-soft); }
.view-tabs button[aria-selected="true"] { background: var(--app-accent); border-color: var(--app-accent); color: #fffaf1; }
:focus-visible { outline: 3px solid #b57825; outline-offset: 4px; }
.analysis-card { min-height: 270px; padding: 38px 40px; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: var(--app-surface); }
.analysis-card .eyebrow { color: var(--app-accent); }
h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.empty-state { margin-top: 26px; color: var(--app-muted); line-height: 1.7; }
footer { padding: 24px 4px; color: var(--app-muted); font-size: .8rem; }
footer span { margin: 0 6px; }
@media (max-width: 600px) {
  .app-shell { padding: 16px; }
  .app-hero { padding: 24px; }
  .back-link { margin-bottom: 30px; }
  .analysis-card { padding: 28px 24px; min-height: 240px; }
  .view-tabs { gap: 7px; margin-top: 20px; }
  .view-tabs button { flex: 1 1 140px; padding: 12px; }
}

/* Shared chronology: culture-specific data and accents, one reusable layout. */
body { --culture-accent: #356056; --culture-soft: #e5ece5; }
body[data-culture="rom"] { --culture-accent: #874431; --culture-soft: #f0e4da; }
.app-shell { max-width: 1300px; }
.app-hero { position: relative; overflow: hidden; isolation: isolate; padding: 26px 40px 32px; background: #253c33; }
.app-hero::before { content: ""; position: absolute; inset: 0; z-index: -2; background-position: right 46%; background-size: cover; opacity: .6; }
body[data-culture="grekland"] .app-hero::before { background-image: url('./assets/watermarks/grekland.png'); }
body[data-culture="rom"] .app-hero::before { background-image: url('./assets/watermarks/rom.png'); }
body[data-culture="rom"] .app-hero { background-color: #30201f; }
.app-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #182a24f5 0%, #182a24dd 42%, #182a2400 80%); }
body[data-culture="rom"] .app-hero::after { background: linear-gradient(90deg, #30201ff5 0%, #30201fdd 42%, #30201f00 80%); }
.back-link { margin-bottom: 22px; }
h1 { font-size: clamp(3rem, 6vw, 4.8rem); }
.lede { max-width: 560px; margin: 12px 0 20px; text-wrap: balance; }
.view-tabs button[aria-selected="true"] { background: var(--culture-accent); border-color: var(--culture-accent); }
.chronology-panel { padding: 0; overflow: clip; }
.culture-intro { display: flex; justify-content: space-between; gap: 28px; padding: 34px 36px 28px; border-bottom: 1px solid var(--app-line); }
.culture-intro .eyebrow { color: var(--culture-accent); }
.culture-lede { max-width: 650px; font-size: .96rem; line-height: 1.7; margin: 12px 0 0; color: var(--app-muted); }
.range-label { flex-shrink: 0; padding-top: 6px; font-family: Georgia, serif; font-size: 1.35rem; color: var(--culture-accent); }
.range-label span { display: block; margin-top: 12px; font: .78rem var(--app-font); color: var(--app-muted); }
.chronology-controls { display: flex; align-items: end; gap: 16px; padding: 22px 36px; background: #ece6d940; border-bottom: 1px solid var(--app-line); }
.chronology-controls label { display: grid; gap: 7px; font-size: .76rem; font-weight: 600; }
.chronology-controls label:first-child { flex: 1; }
input, select { min-height: 44px; padding: 10px 12px; border: 1px solid #b9b3a4; border-radius: 8px; background: #fffdf7; color: var(--app-text); font: .88rem var(--app-font); width: 100%; }
select { min-width: 150px; }
button { font-family: var(--app-font); cursor: pointer; }
.reset-button, [data-reset], .error-state + button { min-height: 44px; background: transparent; border: 1px solid var(--app-line); border-radius: 8px; padding: 10px 14px; color: var(--app-text); }
.reset-button:hover, [data-reset]:hover { background: var(--culture-soft); }
.chronology-layout { display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: 36px; padding: 30px 36px 36px; align-items: start; }
.period-sidebar { position: sticky; top: 24px; }
.period-sidebar nav { display: grid; gap: 5px; }
.period-sidebar .eyebrow { color: var(--app-muted); margin-bottom: 10px; }
.period-sidebar button { position: relative; text-align: left; padding: 12px 14px; border: 1px solid transparent; border-radius: 9px; color: var(--app-text); background: transparent; font-size: .88rem; font-weight: 600; }
.period-sidebar button span { display: block; margin-top: 5px; font-size: .72rem; font-weight: 400; color: var(--app-muted); }
.period-sidebar button:hover { background: #ece6d9; }
.period-sidebar button[aria-pressed="true"] { border-color: var(--culture-accent); background: var(--culture-soft); color: var(--culture-accent); }
.reading-note { margin: 22px 14px; line-height: 1.7; color: var(--app-muted); font-size: .73rem; }
.timeline-topline { display: flex; justify-content: space-between; gap: 15px; align-items: baseline; padding-bottom: 22px; border-bottom: 1px solid var(--app-line); }
.timeline-topline .eyebrow { margin: 0; color: var(--app-muted); font-size: .67rem; }
.result-count { color: var(--app-muted); font-size: .76rem; white-space: nowrap; }
.period-heading { padding: 28px 0 22px; }
.period-heading .eyebrow { font-size: .68rem; color: var(--culture-accent); margin-bottom: 7px; }
h3, h4 { font-family: Georgia, serif; font-weight: 400; }
h3 { margin: 0; font-size: 1.7rem; }
.period-heading > p:last-child { color: var(--app-muted); font-size: .85rem; line-height: 1.6; margin: 8px 0 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-event { display: grid; grid-template-columns: 140px minmax(0, 1fr); position: relative; padding-bottom: 22px; }
.timeline-event::before { content: ""; position: absolute; top: 15px; bottom: -15px; left: 128px; width: 1px; background: var(--app-line); }
.timeline-event::after { content: ""; position: absolute; left: 123px; top: 15px; width: 11px; height: 11px; border-radius: 50%; background: var(--culture-accent); border: 3px solid var(--app-surface); box-shadow: 0 0 0 1px var(--culture-accent); }
.timeline-event:last-child::before { bottom: 20px; }
.event-date { padding: 12px 24px 0 0; color: var(--culture-accent); font-size: .78rem; line-height: 1.6; font-weight: 600; }
.event-card { padding: 17px 22px; margin-left: 12px; background: #fffcf6; border: 1px solid #e3dccc; border-radius: 12px; }
.theme-tag { font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--culture-accent); }
h4 { margin: 7px 0 9px; font-size: 1.3rem; line-height: 1.3; }
.event-card > p { font-size: .88rem; line-height: 1.75; margin: 0; color: #555b50; }
summary { cursor: pointer; }
.event-sources { margin-top: 15px; color: var(--app-muted); font-size: .73rem; line-height: 1.6; }
.event-sources summary:hover, .method-note summary:hover { color: var(--culture-accent); }
.event-sources p { margin-bottom: 8px; }
.source-links { display: grid; gap: 9px; overflow-wrap: anywhere; }
.source-links a { text-decoration-color: #b8b3a3; line-height: 1.6; }
.method-note { padding: 22px 36px; background: #ece6d940; border-top: 1px solid var(--app-line); font-size: .85rem; line-height: 1.8; color: var(--app-muted); }
.method-note summary { color: var(--app-text); font-weight: 600; }
.method-note .source-links { margin: 20px 0 8px; }
.timeline-results .empty-state { padding: 25px 0; }
.error-state, .loading-state { line-height: 1.7; }
.chronology-panel > .error-state { margin: 20px 36px; }
@media (max-width: 900px) {
  .culture-intro { flex-direction: column; gap: 15px; }
  .range-label { padding: 0; font-size: 1.1rem; }
  .range-label span { display: inline; margin-left: 18px; }
  .chronology-layout { grid-template-columns: 175px minmax(0, 1fr); gap: 22px; padding: 26px 24px; }
  .timeline-event { grid-template-columns: minmax(0, 1fr); padding-left: 20px; }
  .timeline-event::before { left: 1px; }
  .timeline-event::after { left: -4px; }
  .event-date { padding: 9px 0 12px; }
  .event-card { margin: 0; }
}
@media (max-width: 600px) {
  .app-shell { padding: 12px; }
  .app-hero { padding: 24px; }
  .app-hero::before { background-position: 70% center; opacity: .43; }
  .app-hero::after { background: linear-gradient(90deg, #182a24f5, #182a2488); }
  body[data-culture="rom"] .app-hero::after { background: linear-gradient(90deg, #30201ff5, #30201f88); }
  .lede { max-width: 90%; font-size: .9rem; }
  .app-meta { font-size: .7rem; }
  .view-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px 12px; margin-bottom: 6px; }
  .view-tabs button { flex: 0 0 auto; white-space: nowrap; font-size: .8rem; padding: 10px 14px; }
  .chronology-panel { padding: 0; }
  .culture-intro { padding: 26px 22px; }
  .culture-lede { font-size: .88rem; }
  .range-label span { display: block; margin: 8px 0 0; }
  .chronology-controls { padding: 18px 22px; flex-wrap: wrap; gap: 12px; }
  .chronology-controls label:first-child { flex-basis: 100%; }
  .chronology-controls label:nth-child(2) { flex: 1; }
  .reset-button { font-size: .75rem; }
  .chronology-layout { display: block; padding: 22px; }
  .period-sidebar { position: static; margin-bottom: 26px; }
  .period-sidebar nav { display: flex; overflow-x: auto; padding: 4px 1px 12px; gap: 7px; }
  .period-sidebar nav > .eyebrow, .reading-note { display: none; }
  .period-sidebar button { flex: 0 0 auto; border-color: var(--app-line); padding: 10px 12px; font-size: .78rem; }
  .period-sidebar button span { font-size: .64rem; }
  .timeline-topline { align-items: center; gap: 10px; }
  .timeline-topline .eyebrow { font-size: .58rem; letter-spacing: .1em; }
  .result-count { font-size: .68rem; }
  .event-card { padding: 16px; }
  h4 { font-size: 1.2rem; }
  .method-note { padding: 20px 22px; }
}
@media (prefers-reduced-motion: no-preference) {
  .view-tabs button, .period-sidebar button { transition: background-color .15s; }
}
@media (max-width: 600px) {
  .reading-note { display: block; margin: 6px 0 0; font-size: .7rem; }
  .reading-note br { display: none; }
}
