:root{
  --ink:#14171f;
  --ink-soft:#1d212c;
  --paper:#ece0be;
  --paper-dim:#ddd0ab;
  --text-on-paper:#241f16;
  --text-on-ink:#e9e4d6;
  --text-on-ink-dim:#9a9a8f;
  --rule:rgba(233,228,214,0.18);
  --accent:#b8873a;
  --accent-soft:#b8873a33;
  --radius-card:2px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*{ box-sizing:border-box; }

html{ scroll-behavior:smooth; }

body{
  margin:0;
  background:var(--ink);
  color:var(--text-on-ink);
  font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
  *{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
}

a{ color:inherit; }

:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:3px;
}

/* ---------- layout shell ---------- */

.wrap{
  max-width:1080px;
  margin:0 auto;
  padding:0 28px;
}

/* ---------- timeline ---------- */

nav.timeline-section{
  padding:36px 0 0;
}

.timeline{
  display:flex;
  list-style:none;
  margin:0 0 6px;
  padding:0;
  border-top:1px solid var(--rule);
  border-bottom:1px solid var(--rule);
}

.timeline li{
  flex:1 1 0;
  min-width:0;
}

.era-tab{
  width:100%;
  background:none;
  border:none;
  border-right:1px solid var(--rule);
  color:var(--text-on-ink-dim);
  font-family:var(--sans);
  padding:14px 10px 12px;
  text-align:left;
  cursor:pointer;
  position:relative;
  transition:color 0.15s ease, background 0.15s ease;
}

.timeline li:last-child .era-tab{ border-right:none; }

.era-tab .yrs{
  display:block;
  font-family:var(--mono);
  font-size:0.72rem;
  margin-bottom:4px;
  color:inherit;
  opacity:0.75;
}

.era-tab .nm{
  display:block;
  font-size:0.86rem;
  font-weight:600;
  color:var(--text-on-ink);
}

.era-tab::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-1px;
  height:3px;
  background:transparent;
  transition:background 0.2s ease;
}

.era-tab:hover{ background:var(--ink-soft); }

.era-tab[aria-selected="true"]::after{
  background:var(--accent-tab, var(--accent));
}

.era-tab[aria-selected="true"] .nm{
  color:var(--accent-tab, var(--accent));
}

/* ---------- era panels ---------- */

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

/* Every era is present in the HTML (good for crawlers); only the active one is
   shown. .is-active is toggled by app.js. */
.era-panel{
  display:none;
  padding:44px 0 20px;
}

.era-panel.is-active{
  display:block;
}

.era-heading{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:24px;
  flex-wrap:wrap;
  margin-bottom:6px;
}

.era-heading h2{
  font-family:var(--serif);
  font-weight:600;
  font-size:clamp(1.8rem, 4vw, 2.6rem);
  margin:0;
  color:var(--accent);
  transition:color 0.25s ease;
}

.era-periods{
  margin:8px 0 28px;
  color:var(--text-on-ink-dim);
  font-size:0.96rem;
  line-height:1.6;
  max-width:60ch;
}

.era-periods strong{
  color:var(--text-on-ink);
  font-weight:600;
}

/* ---------- card grid ---------- */

.card-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(230px, 1fr));
  gap:16px;
  padding-bottom:60px;
}

.term-card{
  background:var(--paper);
  color:var(--text-on-paper);
  border-radius:var(--radius-card);
  padding:16px 18px 15px;
  box-shadow:0 8px 18px -14px rgba(0,0,0,0.7);
  transition:transform 0.15s ease, box-shadow 0.15s ease;
}

.term-card:nth-child(3n+1){ transform:rotate(-0.4deg); }
.term-card:nth-child(3n+2){ transform:rotate(0.5deg); }
.term-card:nth-child(3n){ transform:rotate(-0.2deg); }

.term-card:hover{
  box-shadow:0 12px 24px -14px rgba(0,0,0,0.8);
  transform:translateY(-3px) rotate(0deg);
}

.term-card .word{
  font-family:var(--mono);
  font-weight:700;
  font-size:1.02rem;
  color:var(--accent);
  margin:0 0 6px;
  transition:color 0.25s ease;
}

.term-card .def{
  font-size:0.88rem;
  line-height:1.42;
  margin:0;
}

/* ---------- footer ---------- */

footer{
  border-top:1px solid var(--rule);
  padding:22px 0 50px;
  color:var(--text-on-ink-dim);
  font-size:0.82rem;
  line-height:1.6;
}

/* ---------- responsive ---------- */

@media (max-width: 720px){
  .timeline{ flex-wrap:wrap; }
  .timeline li{ flex:1 1 33%; }
  .era-tab{ border-bottom:1px solid var(--rule); }
}
