/* The American Old West — timeline infographic. Parchment / dusk-frontier theme. */
:root {
  --paper:  #e9dcc0;
  --paper2: #f4ebd7;
  --card:   #f6eedb;
  --ink:    #2a211a;
  --ink2:   #584a3a;
  --faint:  rgba(42,33,26,.55);
  --line:   rgba(74,58,42,.20);
  --rust:   #a8322b;
  --gold:   #c2922b;
  --wood:   #6b4a2e;
  --night:  #201812;
  --maxw:   940px;
  --shadow: 0 2px 4px rgba(40,28,16,.08), 0 8px 24px rgba(40,28,16,.10);
  --serif:  'Spectral', Georgia, 'Times New Roman', serif;
  --cond:   'Oswald', 'Arial Narrow', system-ui, sans-serif;
  --west:   'Rye', 'Oswald', serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(107,74,46,.06), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(168,50,43,.05), transparent 45%);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--rust); }

/* ─────────────────────────  HERO  ───────────────────────── */
.hero {
  position: relative;
  min-height: 66vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 80px);
  overflow: hidden;
  color: #f3e7cf;
  /* Monument Valley panorama (CC0, Wikimedia Commons) under a legibility scrim */
  background:
    linear-gradient(90deg, rgba(20,13,8,.68) 0%, rgba(20,13,8,.34) 52%, rgba(20,13,8,.10) 100%),
    linear-gradient(180deg, rgba(20,13,8,.15) 0%, rgba(20,13,8,0) 32%, rgba(20,13,8,.48) 100%),
    url('hero.jpg') center/cover no-repeat;
  background-color: #241a13;
  isolation: isolate;
}
.hero-tex, .hero-sun, .hero-ridge { display: none !important; }
.hero-sun {
  position: absolute; left: 50%; bottom: 20%;
  width: 46vmin; height: 46vmin; transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe7a8 0%, #ffcf6b 42%, rgba(255,193,92,.35) 62%, transparent 72%);
  z-index: -2;
}
.hero-ridge {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30%;
  z-index: -1;
  background: #241a13;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' preserveAspectRatio='none' viewBox='0 0 1200 200'%3E%3Cpath d='M0 200V96l70-14 60 30 90-52 80 26 70-44 120 40 90-60 110 48 90-30 80 34 70-24 90 40V200z' fill='%23000'/%3E%3C/svg%3E") bottom/100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='200' preserveAspectRatio='none' viewBox='0 0 1200 200'%3E%3Cpath d='M0 200V96l70-14 60 30 90-52 80 26 70-44 120 40 90-60 110 48 90-30 80 34 70-24 90 40V200z' fill='%23000'/%3E%3C/svg%3E") bottom/100% 100% no-repeat;
}
.hero-tex {
  position: absolute; inset: 0; z-index: -1; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
.home-link {
  position: absolute; top: 18px; left: clamp(20px, 5vw, 60px);
  font-family: var(--cond); font-size: .82rem; letter-spacing: .04em;
  color: rgba(243,231,207,.82); z-index: 2;
}
.home-link a { color: inherit; text-decoration: none; }
.home-link a:hover { color: #fff; }
.home-link .sep { opacity: .5; padding: 0 7px; }
.home-link .crumb { opacity: .9; }
.hero-inner { position: relative; max-width: var(--maxw); z-index: 2; }
.kicker {
  font-family: var(--cond); text-transform: uppercase; letter-spacing: .42em;
  font-size: clamp(.7rem, 1.6vw, .9rem); font-weight: 500;
  color: #ffdf9b; margin: 0 0 .6em; padding-left: .3em;
}
.hero h1 {
  font-family: var(--west); font-weight: 400;
  font-size: clamp(2.7rem, 10vw, 6.4rem); line-height: .96; margin: 0;
  color: #fbeccb;
  text-shadow: 0 2px 0 rgba(90,40,20,.45), 0 10px 30px rgba(0,0,0,.35);
}
.lede {
  font-size: clamp(1.05rem, 2.3vw, 1.4rem); max-width: 40ch;
  margin: .9em 0 0; color: #f6e8cd; font-weight: 400;
}
.lede #evcount { font-family: var(--cond); font-weight: 600; color: #ffdf9b; }
.scrollcue {
  margin-top: 2.4em; font-family: var(--cond); text-transform: uppercase;
  letter-spacing: .3em; font-size: .72rem; color: rgba(246,232,205,.8);
}
.scrollcue .arrow {
  width: 11px; height: 11px; margin: 10px 0 0 6px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: rotate(45deg) translate(0,0); } 50% { transform: rotate(45deg) translate(4px,4px); } }

/* ─────────────────────────  TABS  ───────────────────────── */
.tabs {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 8px; justify-content: center;
  padding: 12px; background: rgba(32,24,18,.96);
  box-shadow: 0 2px 14px rgba(0,0,0,.25);
}
.tab {
  font-family: var(--cond); font-size: .9rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em;
  color: #e9d7ae; background: transparent; cursor: pointer;
  border: 1px solid rgba(233,215,174,.3); border-radius: 3px; padding: 8px 20px;
  transition: background .15s, color .15s, border-color .15s;
}
.tab:hover { border-color: var(--gold); color: #fff; }
.tab.active { background: var(--gold); border-color: var(--gold); color: #241812; }

/* ─────────────────────────  LEGEND  ───────────────────────── */
.legend {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
  max-width: var(--maxw); margin: 26px auto 0; padding: 0 20px;
  font-family: var(--cond); font-size: .82rem; letter-spacing: .03em; color: var(--ink2);
}
.lg { display: inline-flex; align-items: center; gap: 7px; }
.lg i { width: 13px; height: 13px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }

/* ─────────────────────────  LAYOUT  ───────────────────────── */
.view { max-width: var(--maxw); margin: 0 auto; padding: 10px clamp(16px, 4vw, 34px) 60px; }

/* era banner */
.era { margin: 64px 0 10px; padding-top: 18px; border-top: 3px double var(--wood); }
.era-range { font-family: var(--cond); text-transform: uppercase; letter-spacing: .22em; font-size: .78rem; color: var(--rust); margin: 0 0 .2em; }
.era-t { font-family: var(--west); font-weight: 400; font-size: clamp(1.7rem, 4.5vw, 2.7rem); line-height: 1.05; margin: 0; color: var(--ink); }
.era-s { font-size: 1.04rem; color: var(--ink2); margin: .7em 0 0; max-width: 62ch; }

/* event spine + cards (era view) */
.elist { position: relative; margin: 26px 0 0; padding-left: 34px; }
.elist::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--wood), rgba(107,74,46,.25)); }
.node { position: relative; margin: 0 0 18px; }
.node .dot {
  position: absolute; left: -34px; top: 7px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--cat, var(--wood)); border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--cat, var(--wood));
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--cat, var(--wood)); border-radius: 5px;
  padding: 14px 18px; box-shadow: var(--shadow);
}
.card-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.ev-date { font-family: var(--cond); font-weight: 600; letter-spacing: .04em; color: var(--rust); font-size: .95rem; }
.ev-cat, .tl-cat {
  font-family: var(--cond); text-transform: uppercase; letter-spacing: .08em; font-size: .64rem;
  color: #fff; background: var(--cat, var(--wood)); padding: 2px 8px; border-radius: 20px; white-space: nowrap;
}
.ev-title { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; line-height: 1.3; margin: 2px 0 0; color: var(--ink); }
.ev-desc { margin: .5em 0 0; color: var(--ink2); font-size: .97rem; }
.ev-media { margin-top: 10px; }
.ev-img { max-width: 100%; border-radius: 4px; border: 1px solid var(--line); }
.wlink {
  display: inline-block; margin-top: 10px; font-family: var(--cond); letter-spacing: .04em;
  font-size: .82rem; color: var(--rust); text-decoration: none;
}
.wlink:hover { text-decoration: underline; }
.loaderr { color: var(--rust); font-family: var(--cond); }

/* ─────────────────────────  FULL TIMELINE  ───────────────────────── */
.tl-head { text-align: center; margin: 24px 0 8px; }
.map-title { font-family: var(--west); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0; color: var(--ink); }
.map-sub { font-size: 1rem; color: var(--ink2); margin: .5em auto 0; max-width: 54ch; }
#timeline { position: relative; margin: 30px 0 0; padding-left: 30px; }
#timeline::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--wood), rgba(107,74,46,.2)); }
.tl-decade {
  position: relative; font-family: var(--west); font-weight: 400; font-size: 1.5rem; color: var(--wood);
  margin: 34px 0 14px -30px; padding: 2px 0 2px 30px;
}
.tl-decade::before {
  content: ""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%; background: var(--wood); border: 3px solid var(--paper);
}
.tl-item { position: relative; margin: 0 0 11px; }
.tl-dot { position: absolute; left: -30px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--cat, var(--wood)); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--cat, var(--wood)); }
.tl-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--cat, var(--wood)); border-radius: 4px; padding: 10px 14px; box-shadow: 0 1px 2px rgba(40,28,16,.06); }
.tl-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-date { font-family: var(--cond); font-weight: 600; color: var(--rust); font-size: .86rem; letter-spacing: .03em; }
.tl-name { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.32; margin: 3px 0 0; color: var(--ink); }
.tl-desc { font-size: .92rem; color: var(--ink2); margin: .35em 0 0; }
.tl-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px; font-family: var(--cond); font-size: .72rem; letter-spacing: .04em; color: var(--faint); }
.tl-fam { color: var(--faint); text-decoration: none; }
.tl-wiki { color: var(--rust); }
.tl-wiki:hover { text-decoration: underline; }

/* ─────────────────────────  FOOTER  ───────────────────────── */
.foot {
  max-width: var(--maxw); margin: 0 auto; padding: 30px clamp(16px,4vw,34px) 70px;
  border-top: 3px double var(--wood); color: var(--ink2);
  font-size: .9rem; text-align: center;
}
.foot a { color: var(--rust); }
.foot-stamp { font-family: var(--cond); font-size: .78rem; color: var(--faint); margin-top: .4em; }

/* ─────────────────────────  REVEAL  ───────────────────────── */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .scrollcue .arrow { animation: none; }
  html { scroll-behavior: auto; }
}

/* ─────────────────────────  RESPONSIVE  ───────────────────────── */
@media (max-width: 560px) {
  .elist, #timeline { padding-left: 24px; }
  .node .dot { left: -24px; width: 12px; height: 12px; }
  .tl-dot { left: -24px; }
  .tl-decade { margin-left: -24px; padding-left: 24px; }
  .card, .tl-card { padding: 12px 14px; }
}
