/* =========================================================================
   HISTORY — "Antique chronicle"
   Sepia & parchment historical narrative. Illuminated-archive feel.
   Scope: .hi-
   ========================================================================= */

body[data-page="history"] {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(194,146,47,.06), transparent 60%),
    var(--snow);
}

/* -------------------------------------------------------------------------
   HERO — vintage map with warm scrim
   ------------------------------------------------------------------------- */
.hi-hero {
  position: relative;
  min-height: clamp(64vh, 60vh + 8rem, 92vh);
  display: flex;
  align-items: flex-end;
  padding-block: calc(var(--header-h) + 3rem) clamp(3rem, 7vw, 6rem);
  overflow: hidden;
  isolation: isolate;
}
.hi-hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover;
  background-position: center;
  filter: sepia(.28) saturate(.9) contrast(1.02);
  transform: scale(1.04);
}
.hi-hero-scrim {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, rgba(22,16,11,.92) 0%, rgba(42,29,21,.55) 42%, rgba(58,29,34,.35) 100%),
    radial-gradient(120% 100% at 50% 120%, rgba(184,71,46,.28), transparent 60%);
}
.hi-hero-inner { position: relative; max-width: 50rem; color: var(--snow); }
.hi-hero-kicker { color: var(--gold); margin-bottom: 1.1rem; }
.hi-hero-title {
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 1.4rem + 5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -.01em;
  text-shadow: 0 2px 24px rgba(0,0,0,.4);
}
.hi-hero-sub {
  margin-top: 1.4rem;
  max-width: 46ch;
  font-family: var(--f-cormorant);
  font-style: italic;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem);
  line-height: 1.45;
  color: rgba(255,255,255,.9);
}
.hi-hero-rule {
  position: absolute; inset-block-end: 0; inset-inline: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--sun) 50%, var(--gold) 82%, transparent);
  opacity: .85;
}

/* -------------------------------------------------------------------------
   CHRONICLE — alternating narrative chapters on parchment
   ------------------------------------------------------------------------- */
.hi-chronicle {
  position: relative;
  padding-block: clamp(3.5rem, 8vw, 7rem);
  background:
    linear-gradient(rgba(250,243,230,.86), rgba(250,243,230,.92)),
    url('../img/gen/texture.jpg');
  background-size: auto, 520px;
  background-blend-mode: normal, multiply;
}
.hi-chronicle::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(194,146,47,.6), transparent);
}

.hi-chapter {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(1.8rem, 4vw, 4.5rem);
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
  border-bottom: 1px solid rgba(42,29,21,.12);
}
.hi-chapter:last-child { border-bottom: 0; }
.hi-reverse .hi-chapter-text { order: 2; }
.hi-reverse .hi-chapter-fig { order: 1; }

.hi-chapter-text { position: relative; max-width: 56ch; }
.hi-chapter-no {
  display: block;
  font-family: var(--f-serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 2rem + 3vw, 4.5rem);
  line-height: 1;
  color: var(--gold);
  opacity: .42;
  margin-bottom: .35rem;
  letter-spacing: .02em;
}
.hi-chapter-title {
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.8rem);
  line-height: 1.06;
  color: var(--deep);
  margin-bottom: 1rem;
}
.hi-chapter-title::after {
  content: ""; display: block; width: 3.2rem; height: 2px; margin-top: .9rem;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.hi-lead {
  font-family: var(--f-serif);
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--ink);
}

/* drop-cap on the first chapter's lead */
.hi-dropcap::first-letter {
  float: inline-start;
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: 4.1em;
  line-height: .72;
  margin-inline-end: .12em;
  margin-block-start: .08em;
  color: var(--sun);
}
[dir="rtl"] .hi-dropcap::first-letter { float: right; }

/* golden-age chapter — cormorant italic pull treatment */
.hi-golden .hi-chapter-text {
  border-inline-start: 2px solid var(--gold);
  padding-inline-start: clamp(1.1rem, 2vw, 2rem);
}
.hi-pull {
  font-family: var(--f-cormorant);
  font-style: italic;
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.85rem);
  line-height: 1.5;
  color: var(--deep);
}

.hi-chapter-fig {
  position: relative;
  margin: 0;
}
.hi-chapter-fig::before {
  content: ""; position: absolute; inset: -10px;
  border: 1px solid rgba(194,146,47,.45);
  z-index: -1;
}
.hi-chapter-fig img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: sepia(.22) saturate(.92);
  box-shadow: 0 24px 50px -24px rgba(42,29,21,.55);
}

/* -------------------------------------------------------------------------
   MILESTONES — antique-gold dated timeline
   ------------------------------------------------------------------------- */
.hi-timeline {
  position: relative;
  padding-block: clamp(3.5rem, 8vw, 7rem);
  background: var(--deep);
  color: var(--paper);
  overflow: hidden;
}
.hi-timeline::before {
  content: ""; position: absolute; inset: 0; opacity: .08;
  background: url('../img/gen/texture.jpg'); background-size: 480px;
  mix-blend-mode: screen; pointer-events: none;
}
.hi-tl-title {
  position: relative;
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.2rem);
  text-align: center;
  color: var(--ice-soft);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.hi-tl-title::after {
  content: ""; display: block; width: 4rem; height: 2px; margin: 1rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.hi-tl-list {
  position: relative;
  list-style: none;
  padding: 0;
  max-width: 760px;
  margin-inline: auto;
}
/* connecting line (vertical on mobile/tablet) */
.hi-tl-list::before {
  content: ""; position: absolute;
  inset-block: .6rem;
  inset-inline-start: clamp(5.5rem, 16vw, 7.5rem);
  width: 2px;
  background: linear-gradient(var(--gold), rgba(194,146,47,.25));
}
.hi-tl-item {
  position: relative;
  display: grid;
  grid-template-columns: clamp(5rem, 15vw, 7rem) 1fr;
  column-gap: clamp(1.4rem, 4vw, 2.6rem);
  align-items: baseline;
  padding-block: clamp(1.1rem, 2.5vw, 1.8rem);
}
.hi-tl-year {
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: clamp(1.3rem, 1rem + 1.4vw, 2rem);
  line-height: 1;
  color: var(--gold);
  text-align: end;
  white-space: nowrap;
}
.hi-tl-dot {
  position: absolute;
  inset-inline-start: clamp(5.5rem, 16vw, 7.5rem);
  inset-block-start: clamp(1.5rem, 3vw, 2.2rem);
  width: 13px; height: 13px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(58,29,34,1), 0 0 0 6px rgba(194,146,47,.4);
}
[dir="rtl"] .hi-tl-dot { transform: translateX(50%) rotate(45deg); }
.hi-tl-text {
  font-family: var(--f-cormorant);
  font-style: italic;
  font-size: clamp(1.1rem, .95rem + .7vw, 1.45rem);
  line-height: 1.5;
  color: rgba(243,232,210,.92);
  padding-inline-start: clamp(.8rem, 2vw, 1.4rem);
}

/* -------------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* horizontal timeline on desktop */
  .hi-tl-list { max-width: none; }
  .hi-tl-list::before {
    inset: auto; inset-block-start: 2.85rem; inset-inline: 5%;
    width: auto; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold) 12%, var(--gold) 88%, transparent);
  }
  .hi-tl-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
  }
  .hi-tl-item {
    display: block;
    grid-template-columns: none;
    text-align: center;
    padding-block: 0;
    padding-inline: .5rem;
  }
  .hi-tl-year { text-align: center; font-size: clamp(1.5rem, 1rem + 1vw, 2rem); }
  .hi-tl-dot {
    position: static;
    display: block;
    margin: 1.1rem auto;
    transform: rotate(45deg);
  }
  [dir="rtl"] .hi-tl-dot { transform: rotate(45deg); }
  .hi-tl-text { text-align: center; padding-inline: 0; }
}

@media (max-width: 920px) {
  .hi-chapter {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
  .hi-reverse .hi-chapter-text { order: 1; }
  .hi-reverse .hi-chapter-fig { order: 2; }
  .hi-chapter-fig { max-width: 560px; }
}

@media (max-width: 560px) {
  .hi-hero { min-height: 78vh; }
  .hi-chapter-fig::before { inset: -6px; }
  .hi-tl-list::before { inset-inline-start: 4.6rem; }
  .hi-tl-item {
    grid-template-columns: 4.2rem 1fr;
    column-gap: 1.2rem;
  }
  .hi-tl-dot { inset-inline-start: 4.6rem; }
  .hi-dropcap::first-letter { font-size: 3.4em; }
}
