:root {
  --ink: #1a2421;
  --ink-soft: #3d4a45;
  --paper: #f7f4ef;
  --paper-deep: #ebe6dc;
  --gold: #b8860b;
  --gold-light: #d4a84b;
  --vermillion: #8b3a3a;
  --line: rgba(26, 36, 33, 0.12);
  --shadow: 0 24px 48px rgba(26, 36, 33, 0.08);
  --font-display: "Ma Shan Zheng", "Noto Serif SC", serif;
  --font-body: "Noto Serif SC", "Songti SC", serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(184, 134, 11, 0.08), transparent 55%),
    linear-gradient(180deg, var(--paper) 0%, #f0ebe3 100%);
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

code {
  font-size: 0.9em;
  padding: 0.15em 0.4em;
  background: var(--paper-deep);
  border-radius: 4px;
}

/* Header & hero */
.site-header {
  position: relative;
  overflow: hidden;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  position: relative;
  z-index: 2;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.25s var(--ease-out);
}

.nav-links a:hover {
  color: var(--gold);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1fr 1.1fr;
    align-items: center;
    min-height: min(72vh, 640px);
    padding-bottom: 5rem;
  }
}

.hero-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 5.5rem);
  font-weight: 400;
  line-height: 1.05;
  color: var(--ink);
}

.hero-lead {
  margin: 0 0 2rem;
  max-width: 28em;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 2px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border: 2px solid var(--ink);
}

.btn-primary:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.hero-visual {
  position: relative;
  min-height: 280px;
}

@media (min-width: 900px) {
  .hero-visual {
    min-height: 420px;
  }
}

.hero-visual-frame {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(26, 36, 33, 0.75), rgba(139, 58, 58, 0.35)),
    url("https://images.unsplash.com/photo-1528164344705-47542687000d?w=1200&q=80") center / cover no-repeat;
  animation: heroReveal 1.2s var(--ease-out) both;
}

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.hero-inner {
  animation: fadeUp 0.9s var(--ease-out) 0.15s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Filters */
.filters {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.filters-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 720px) {
  .filters-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-wrap input {
  width: 100%;
  min-width: 200px;
  max-width: 320px;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
}

.search-wrap input:focus {
  outline: 2px solid var(--gold-light);
  outline-offset: 1px;
}

.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.type-tab {
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.type-tab:hover {
  color: var(--ink);
  border-color: var(--line);
}

.type-tab.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Timeline */
.timeline-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.result-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--gold-light), var(--line));
}

@media (min-width: 640px) {
  .timeline::before {
    left: 119px;
  }
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 2.5rem;
  animation: fadeUp 0.5s var(--ease-out) both;
}

@media (min-width: 640px) {
  .timeline-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1.5rem;
    padding-left: 0;
  }
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--paper);
}

@media (min-width: 640px) {
  .timeline-item::before {
    left: 115px;
  }
}

.timeline-date {
  margin: 0;
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
}

.timeline-card {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  color: inherit;
}

.timeline-card-inner {
  padding: 1.25rem 1.5rem;
  background: rgba(255, 255, 255, 0.65);
  border-left: 3px solid var(--gold-light);
  transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.timeline-card:hover .timeline-card-inner,
.timeline-card:focus-visible .timeline-card-inner {
  box-shadow: var(--shadow);
  transform: translateX(4px);
}

.timeline-card:focus-visible {
  outline: none;
}

.timeline-type {
  display: inline-block;
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--vermillion);
}

.timeline-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.timeline-summary {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.timeline-members {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 2rem;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem 2.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0.35rem 0;
}

.footer-icp a {
  color: var(--ink-soft);
  text-decoration: none;
}

.footer-icp a:hover {
  color: var(--gold);
}

/* Dialog */
.event-dialog {
  border: none;
  padding: 0;
  max-width: min(560px, calc(100vw - 2rem));
  background: transparent;
}

.event-dialog::backdrop {
  background: rgba(26, 36, 33, 0.55);
  backdrop-filter: blur(4px);
}

.dialog-card {
  position: relative;
  padding: 2rem 1.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: fadeUp 0.35s var(--ease-out);
}

.dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}

.dialog-close:hover {
  color: var(--ink);
}

.dialog-meta {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--gold);
}

#dialog-title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
}

.dialog-facts {
  margin: 0 0 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.dialog-facts div {
  display: grid;
  grid-template-columns: 4.5em 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.dialog-facts dt {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 400;
}

.dialog-facts dd {
  margin: 0;
}

.dialog-body {
  font-size: 0.95rem;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.dialog-body p {
  margin: 0 0 1em;
}

.dialog-body p:last-child {
  margin-bottom: 0;
}
