:root {
  color-scheme: light dark;
  --background: #f4f1e8;
  --surface: #fffdf8;
  --surface-soft: #e8ede6;
  --primary: #294936;
  --primary-light: #3f6a50;
  --accent: #b27b48;
  --text: #1f2a24;
  --muted: #667169;
  --line: #9caf9d;
  --border: #d6ddd4;
  --warning: #8b5a20;
  --danger: #8b4339;
  --focus: #1c6db2;
  --radius: 1.25rem;
  --radius-small: .7rem;
  --shadow: 0 1rem 2.5rem rgba(31, 42, 36, .11);
  --page: 76rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 20rem; overflow-x: hidden; background: var(--background); color: var(--text); font: 1rem/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary-light); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
img { display: block; max-width: 100%; }
.page-width { width: min(calc(100% - 2rem), var(--page)); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: .7rem; left: .7rem; padding: .7rem 1rem; transform: translateY(-180%); border-radius: .5rem; background: var(--surface); color: var(--text); }
.skip-link:focus { transform: none; }
.scroll-progress { position: fixed; z-index: 90; inset: 0 0 auto; height: 4px; background: transparent; }
.scroll-progress span { display: block; width: 0; height: 100%; background: var(--accent); }

.hero { min-height: 43rem; display: grid; place-items: center; position: relative; overflow: hidden; background: linear-gradient(145deg, rgba(23, 52, 37, .94), rgba(43, 77, 57, .86)), radial-gradient(circle at 70% 20%, #799270, transparent 45%); color: #fffdf8; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.13); }
.hero::before { width: 34rem; height: 34rem; right: -12rem; top: -12rem; }
.hero::after { width: 22rem; height: 22rem; left: -10rem; bottom: -12rem; }
.hero__content { position: relative; z-index: 1; padding-block: 6rem 4rem; text-align: center; }
.eyebrow { margin: 0 0 .45rem; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero .eyebrow { color: #e6bb87; }
h1, h2, h3 { margin-top: 0; line-height: 1.15; text-wrap: balance; }
h1 { max-width: 12ch; margin-inline: auto; margin-bottom: 1rem; font-family: Georgia, serif; font-size: clamp(3rem, 9vw, 6.8rem); font-weight: 500; letter-spacing: -.045em; }
.hero__subtitle { margin: 0 auto 1rem; font-size: clamp(1.15rem, 2.4vw, 1.55rem); font-weight: 650; }
.hero__intro { max-width: 43rem; margin: 0 auto; color: #e5ebe5; font-size: 1.08rem; }
.scroll-cue { display: inline-flex; flex-direction: column; align-items: center; gap: .25rem; margin-top: 3.5rem; color: inherit; font-size: .85rem; text-decoration: none; }
.scroll-cue span:last-child { font-size: 1.5rem; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(.45rem); } }

.overview { padding-block: 5rem 2.5rem; }
.section-heading { max-width: 40rem; }
.section-heading h2, .controls h2 { margin-bottom: 1.5rem; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.3rem); font-weight: 500; }
.statistics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.stat { padding: 1.35rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 .5rem 1.5rem rgba(31,42,36,.05); }
.stat__value { display: block; color: var(--primary); font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.65rem); line-height: 1.1; }
.stat__label { display: block; margin-top: .45rem; color: var(--muted); font-size: .85rem; }

.controls { position: relative; z-index: 5; padding-block: 2.5rem; }
.controls__top { display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.year-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.year-nav button { min-width: 4.5rem; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: 2rem; background: var(--surface); color: var(--primary); cursor: pointer; font-weight: 750; }
.year-nav button:hover { border-color: var(--primary); }
.filter-form { display: grid; grid-template-columns: minmax(13rem, 2fr) repeat(4, minmax(8rem, 1fr)) auto; align-items: end; gap: .8rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.field { display: grid; gap: .35rem; min-width: 0; }
.field span { color: var(--muted); font-size: .78rem; font-weight: 750; }
.field input, .field select { width: 100%; min-height: 2.8rem; border: 1px solid var(--border); border-radius: var(--radius-small); padding: .6rem .7rem; background: var(--background); color: var(--text); }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 2.8rem; padding: .65rem 1rem; border: 0; border-radius: var(--radius-small); background: var(--primary); color: #fff; cursor: pointer; font-weight: 750; text-decoration: none; }
.button:hover { background: var(--primary-light); }
.button--quiet { border: 1px solid var(--border); background: transparent; color: var(--primary); white-space: nowrap; }
.button--quiet:hover { background: var(--surface-soft); }
.results-status { min-height: 1.6rem; margin: .7rem 0 0; color: var(--muted); font-size: .9rem; }

.timeline-section { padding-block: 2rem 6rem; }
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; top: 3.7rem; bottom: 1rem; left: 50%; width: 2px; transform: translateX(-50%); background: linear-gradient(var(--accent), var(--line) 15%, var(--line) 85%, transparent); }
.year-section { scroll-margin-top: 3rem; }
.year-heading { position: relative; z-index: 2; width: max-content; margin: 3rem auto 2rem; padding: .5rem 1.4rem; border-radius: 3rem; background: var(--primary); color: #fff; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; box-shadow: 0 .5rem 1.5rem rgba(31,42,36,.16); }
.timeline-item { position: relative; width: 50%; padding: 0 3.4rem 2.6rem 0; }
.timeline-item:nth-child(odd) { margin-left: 50%; padding: 0 0 2.6rem 3.4rem; }
.timeline-item::before { content: ""; position: absolute; z-index: 2; top: 2.2rem; right: -.55rem; width: .85rem; height: .85rem; border: 4px solid var(--background); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.timeline-item:nth-child(odd)::before { right: auto; left: -.55rem; }
.timeline-item::after { content: ""; position: absolute; top: 2.65rem; right: 0; width: 3.4rem; height: 1px; background: var(--line); }
.timeline-item:nth-child(odd)::after { right: auto; left: 0; }
.stay-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); opacity: 0; transform: translateY(1.5rem); transition: opacity .55s ease, transform .55s ease, box-shadow .25s ease; }
.stay-card.is-visible { opacity: 1; transform: none; }
.stay-card.is-highlighted { animation: highlight 1.8s ease; }
@keyframes highlight { 25%, 65% { box-shadow: 0 0 0 5px rgba(178,123,72,.45), var(--shadow); } }
.stay-card__image-wrap { position: relative; aspect-ratio: 16 / 8; overflow: hidden; background: var(--surface-soft); }
.stay-card__image { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.stay-card:hover .stay-card__image { transform: scale(1.025); }
.stay-card__body { padding: 1.35rem; }
.stay-card__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem .8rem; margin-bottom: .7rem; color: var(--muted); font-size: .85rem; font-weight: 700; }
.stay-card h3 { margin-bottom: .3rem; color: var(--primary); font-family: Georgia, serif; font-size: 1.65rem; font-weight: 500; }
.location { margin: 0 0 .8rem; color: var(--muted); }
.description { margin: .8rem 0; }
.status-row, .tags, .card-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.badge, .tag { display: inline-flex; align-items: center; min-height: 1.75rem; padding: .2rem .65rem; border-radius: 2rem; font-size: .75rem; font-weight: 750; }
.tag { background: var(--surface-soft); color: var(--primary); }
.badge--incomplete { background: #f5e6c8; color: var(--warning); }
.badge--unknown { background: #f2deda; color: var(--danger); }
.badge--repeat { background: #dce8dd; color: var(--primary); }
.tags { margin-top: .9rem; }
.card-actions { align-items: center; margin-top: 1.1rem; }
.card-actions a { padding: .45rem .2rem; font-size: .85rem; font-weight: 700; }
.state-panel { margin: 2rem auto; padding: 2.5rem; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; }
.loader { display: inline-block; width: 1rem; height: 1rem; margin-right: .5rem; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(14,25,18,.75); backdrop-filter: blur(4px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(100%, 48rem); max-height: calc(100dvh - 2rem); overflow-y: auto; border-radius: var(--radius); background: var(--surface); box-shadow: 0 2rem 5rem rgba(0,0,0,.35); }
.modal__close { position: sticky; z-index: 2; float: right; top: 1rem; right: 1rem; width: 2.8rem; height: 2.8rem; margin: 1rem 1rem -3.8rem 0; border: 0; border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: 0 .25rem 1rem rgba(0,0,0,.18); cursor: pointer; font-size: 1.7rem; }
.modal__image { width: 100%; max-height: 24rem; aspect-ratio: 16 / 8; object-fit: cover; background: var(--surface-soft); }
.modal__body { padding: clamp(1.3rem, 4vw, 2.5rem); }
.modal__body h2 { padding-right: 2rem; margin-bottom: .35rem; color: var(--primary); font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3rem); font-weight: 500; }
.modal__facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin: 1.5rem 0; }
.modal__fact { padding: .8rem; border-radius: .7rem; background: var(--surface-soft); }
.modal__fact dt { color: var(--muted); font-size: .75rem; font-weight: 750; }
.modal__fact dd { margin: .15rem 0 0; font-weight: 650; }
.modal__section { margin-top: 1.5rem; }
.modal__section h3 { margin-bottom: .4rem; font-size: 1.05rem; }
.other-visits { margin: .5rem 0 0; padding-left: 1.25rem; }
.other-visits button { border: 0; padding: .25rem 0; background: transparent; color: var(--primary-light); cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }

.back-to-top { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; display: flex; gap: .4rem; align-items: center; min-height: 3rem; padding: .65rem 1rem; border: 0; border-radius: 3rem; background: var(--primary); color: #fff; box-shadow: var(--shadow); cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(1rem); transition: .25s ease; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.footer { padding-block: 2.3rem; background: var(--primary); color: #e8eee9; }
.footer .page-width { display: flex; justify-content: space-between; gap: 1rem; }
.footer p { margin: 0; }
.footer a { color: #fff; }

@media (max-width: 64rem) {
  .statistics { grid-template-columns: repeat(3, 1fr); }
  .filter-form { grid-template-columns: repeat(3, 1fr); }
  .field--search { grid-column: span 2; }
}
@media (max-width: 48rem) {
  .hero { min-height: 38rem; }
  .statistics { grid-template-columns: repeat(2, 1fr); }
  .controls__top { display: block; }
  .filter-form { grid-template-columns: repeat(2, 1fr); }
  .field--search { grid-column: 1 / -1; }
  .timeline::before { left: 1rem; }
  .year-heading { margin-left: 0; }
  .timeline-item, .timeline-item:nth-child(odd) { width: 100%; margin-left: 0; padding: 0 0 2rem 3rem; }
  .timeline-item::before, .timeline-item:nth-child(odd)::before { right: auto; left: .45rem; }
  .timeline-item::after, .timeline-item:nth-child(odd)::after { right: auto; left: 1rem; width: 2rem; }
}
@media (max-width: 34rem) {
  .page-width { width: min(calc(100% - 1rem), var(--page)); }
  .overview { padding-top: 3.5rem; }
  .statistics, .filter-form, .modal__facts { grid-template-columns: 1fr; }
  .field--search { grid-column: auto; }
  .filter-form { padding: .8rem; }
  .stay-card__body { padding: 1.05rem; }
  .stay-card__image-wrap { aspect-ratio: 16 / 9; }
  .back-to-top span { display: none; }
  .back-to-top { width: 3.2rem; justify-content: center; font-size: 1.2rem; }
  .footer .page-width { display: block; }
  .footer a { display: inline-block; margin-top: .5rem; }
}
@media (prefers-color-scheme: dark) {
  :root { --background: #17211b; --surface: #202d25; --surface-soft: #2b3a30; --primary: #b8d5bd; --primary-light: #d2e8d5; --accent: #d7a46f; --text: #edf2ed; --muted: #b6c1b8; --line: #617767; --border: #435348; --warning: #ffd596; --danger: #ffc1b7; --focus: #7cc4ff; --shadow: 0 1rem 2.5rem rgba(0,0,0,.3); }
  .badge--incomplete { background: #594421; }
  .badge--unknown { background: #593630; }
  .badge--repeat { background: #314b38; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .stay-card { opacity: 1; transform: none; }
}
@media print {
  .scroll-progress, .controls, .back-to-top, .card-actions, .scroll-cue { display: none !important; }
  .hero { min-height: auto; padding-block: 2rem; color: #000; background: none; }
  .stay-card { break-inside: avoid; box-shadow: none; opacity: 1; transform: none; }
}
