/* ======================================================
   Rugby's Roaming Gazette — Chronicle of the Material Plane
   Dark exploratory timeline with Gazette newspaper DNA
   ====================================================== */

:root {
  --bg:           #0c0905;
  --bg-card:      #18130a;
  --bg-card-h:    #211a0e;
  --parchment:    #f0e2c0;
  --parchment-dk: #c8ab78;
  --gold:         #c9a84c;
  --gold-light:   #e8cb7a;
  --gold-dim:     #5a4418;
  --gold-glow:    rgba(201,168,76,.22);
  --text:         #e8d5a3;
  --text-muted:   #8a7248;
  --text-faint:   #3e2e14;
  --red:          #8b1a1a;
  --red-light:    #c0392b;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IM Fell English', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

/* ── Starfield ── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
header, section, footer, .modal-overlay { position: relative; z-index: 1; }

/* ── Shared rules (gazette-style) ── */
.hdr-rule {
  border: none;
  display: block;
  width: 100%;
}
.hdr-rule.dbl { border-top: 3px double var(--gold-dim); margin: 3px 0; }
.hdr-rule.sm  { border-top: 1px solid var(--gold-dim);  margin: 2px 0; }

/* ── Header ── */
.site-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 32px 0;
  text-align: center;
}

.hdr-strip {
  display: flex;
  justify-content: space-between;
  font-family: 'IM Fell English SC', serif;
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0 6px;
}

.gazette-name {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: clamp(2.4rem, 7.5vw, 5.6rem);
  font-weight: normal;
  color: var(--parchment);
  line-height: 1.05;
  padding: 12px 0 10px;
  text-shadow: 0 0 50px rgba(201,168,76,.35), 0 2px 4px rgba(0,0,0,.8);
}

.hdr-tagline {
  font-family: 'IM Fell English SC', serif;
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 5px 0;
}

.hdr-info {
  display: flex;
  justify-content: space-between;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: .75rem;
  color: var(--text-muted);
  padding: 5px 0 8px;
}

/* ── Timeline section ── */
.timeline-section {
  padding: 80px 24px;
  max-width: 1120px;
  margin: 0 auto;
}

/* Spine */
.timeline {
  position: relative;
  padding: 10px 0 40px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom,
    transparent 0%,
    var(--gold-dim) 4%,
    var(--gold-dim) 96%,
    transparent 100%);
  transform: translateX(-50%);
}

/* ── Event entries ── */
.t-event {
  position: relative;
  width: 46%;
  padding-bottom: 60px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .65s ease, transform .65s ease;
}
.t-event.visible { opacity: 1; transform: translateY(0); }

.t-event:nth-child(odd)  { margin-left: 0;   text-align: right; padding-right: 56px; }
.t-event:nth-child(even) { margin-left: 54%; text-align: left;  padding-left: 56px; }

/* Gazette-ornament marker on spine */
.t-event::before {
  content: '◆';
  position: absolute;
  top: 20px;
  font-size: .85rem;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 10px rgba(201,168,76,.5);
}
.t-event:nth-child(odd)::before  { right: -11px; }
.t-event:nth-child(even)::before { left:  -11px; }

.t-event.t-apocalypse::before {
  color: var(--red-light);
  animation: pulse-mark 2.4s ease-in-out infinite;
}
@keyframes pulse-mark {
  0%,100% { text-shadow: 0 0 8px rgba(192,57,43,.5); }
  50%      { text-shadow: 0 0 20px rgba(192,57,43,1), 0 0 40px rgba(192,57,43,.3); }
}

/* ── Card ── */
.e-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: inherit;
  font-family: inherit;
  color: inherit;
  transition: border-color .3s, transform .25s, box-shadow .3s, background .3s;
  overflow: hidden;
}
.e-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 10px 40px var(--gold-glow);
  background: var(--bg-card-h);
}
.e-card.card-apocalypse        { border-color: var(--red); }
.e-card.card-apocalypse:hover  { border-color: var(--red-light); box-shadow: 0 10px 40px rgba(139,26,26,.35); }

/* Top double rule — Gazette signature */
.card-top-rule {
  display: block;
  border: none;
  border-top: 3px double var(--gold-dim);
  transition: border-color .3s;
}
.e-card:hover .card-top-rule { border-color: var(--gold); }
.card-apocalypse .card-top-rule { border-color: var(--red); }

/* Meta bar (date + tag) */
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 13px 6px;
  border-bottom: 1px solid var(--gold-dim);
  gap: 8px;
}
.t-event:nth-child(odd) .card-meta { flex-direction: row-reverse; }

.card-date {
  font-family: 'IM Fell English SC', serif;
  font-size: .62rem;
  letter-spacing: .15em;
  color: var(--gold);
  text-transform: uppercase;
  white-space: nowrap;
}

.card-tag {
  font-family: 'IM Fell English SC', serif;
  font-size: .58rem;
  letter-spacing: .1em;
  padding: 1px 8px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid var(--gold-dim);
  color: var(--text-muted);
}
.tag-war      { border-color: var(--red);  color: var(--red-light); }
.tag-endtimes { background: var(--red); border-color: var(--red); color: var(--parchment);
                animation: pulse-tag 2s ease-in-out infinite; }
@keyframes pulse-tag { 0%,100%{background:var(--red)} 50%{background:#5a0808} }

/* Card body */
.card-body { padding: 14px 15px 12px; }

.card-headline {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(.85rem, 1.4vw, 1.05rem);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--parchment);
  line-height: 1.2;
  margin-bottom: 4px;
}

.card-subhead {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: .85rem;
  color: var(--gold-dim);
  margin-bottom: 9px;
  line-height: 1.3;
}

.card-teaser {
  font-family: 'IM Fell English', serif;
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Bottom rule + CTA — Gazette footer strip style */
.card-bottom {
  border-top: 3px double var(--gold-dim);
  padding: 7px 13px 6px;
  transition: border-color .3s;
}
.e-card:hover .card-bottom { border-color: var(--gold); }
.card-apocalypse .card-bottom { border-color: var(--red); }

.card-cta {
  font-family: 'IM Fell English SC', serif;
  font-size: .6rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  transition: color .2s;
}
.e-card:hover .card-cta { color: var(--gold-light); }

/* ── Archive ── */
.archive-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.archive-hdr { text-align: center; margin-bottom: 30px; }

.archive-title {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(1.3rem, 3vw, 2rem);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--parchment);
  padding: 14px 0 5px;
}

.archive-sub {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: .9rem;
  color: var(--text-muted);
  padding-bottom: 10px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.a-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-top: 3px double var(--gold-dim);
  padding: 16px 14px 14px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color .3s, transform .2s, background .3s;
}
.a-card:hover { border-color: var(--gold); border-top-color: var(--gold); transform: translateY(-2px); background: var(--bg-card-h); }
.a-card.a-dupe { opacity: .45; border-style: dashed; border-top-style: dashed; }
.a-card.a-dupe:hover { opacity: .65; }

.a-icon  { font-size: 1.7rem; color: var(--gold-dim); margin-bottom: 3px; }
.a-issue { font-family: 'IM Fell English SC', serif; font-size: .6rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); }
.a-hed   { font-family: 'Playfair Display', serif; font-weight: 700; font-size: .8rem; line-height: 1.25; color: var(--parchment); margin: 3px 0; }
.a-date  { font-family: 'IM Fell English', serif; font-style: italic; font-size: .78rem; color: var(--text-muted); }
.a-open  { margin-top: 9px; font-family: 'IM Fell English SC', serif; font-size: .58rem; letter-spacing: .14em; text-transform: uppercase;
           border: 1px solid var(--gold-dim); padding: 4px 12px; color: var(--gold); transition: background .2s, color .2s; }
.a-card:hover .a-open { background: var(--gold-dim); color: var(--parchment); }

/* ── Footer ── */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 20px 48px;
  background: var(--bg-card);
  border-top: 3px double var(--gold-dim);
  text-align: center;
}
.footer-name {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: 1.9rem;
  font-weight: normal;
  color: var(--parchment);
}
.footer-sub {
  font-family: 'IM Fell English SC', serif;
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,5,2,.88);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-top: 4px double var(--gold);
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  transform: translateY(10px);
  transition: transform .25s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none; border: none;
  font-size: 1.9rem; line-height: 1;
  color: var(--gold); cursor: pointer; z-index: 10;
  transition: color .2s;
}
.modal-close:hover { color: var(--parchment); }

/* Modal masthead */
.modal-mast {
  padding: 12px 20px 0;
  flex-shrink: 0;
}
.modal-mast-strip {
  display: flex;
  justify-content: space-between;
  font-family: 'IM Fell English SC', serif;
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 2px 0 5px;
}
.modal-mast-name {
  font-family: 'UnifrakturMaguntia', cursive;
  font-size: clamp(1.6rem, 4.5vw, 2.9rem);
  font-weight: normal;
  text-align: center;
  color: var(--parchment);
  padding: 6px 0 8px;
  text-shadow: 0 0 30px rgba(201,168,76,.25);
}

/* Modal body grid */
.modal-body {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 3px double var(--gold-dim);
}

.m-info {
  padding: 24px 24px 20px;
  border-right: 1px solid var(--gold-dim);
  overflow-y: auto;
}

.m-date {
  font-family: 'IM Fell English SC', serif;
  font-size: .65rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 5px;
}
.m-headline {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(1.1rem, 2.5vw, 1.65rem);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--parchment);
  line-height: 1.15;
  margin-bottom: 5px;
}
.m-headline.m-apocalypse { color: var(--red-light); }
.m-subhead {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--gold-dim);
  font-size: .95rem;
  margin-bottom: 14px;
}
.m-rule { border: none; border-top: 1px solid var(--gold-dim); margin-bottom: 14px; }
.m-summary {
  font-family: 'IM Fell English', serif;
  font-size: .92rem;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-line;
}

/* PDF pane */
.m-pdf {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
}
.m-pdf-label {
  font-family: 'IM Fell English SC', serif;
  font-size: .6rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.m-pdf-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pdf-tab {
  font-family: 'IM Fell English SC', serif;
  font-size: .6rem; letter-spacing: .1em; padding: 4px 12px;
  border: 1px solid var(--gold-dim); background: none;
  color: var(--text-muted); cursor: pointer; text-transform: uppercase; transition: all .18s;
}
.pdf-tab:hover, .pdf-tab.active { background: var(--gold-dim); color: var(--parchment); border-color: var(--gold-dim); }

.pdf-frame {
  flex: 1;
  border: 1px solid var(--gold-dim);
  background: #111;
  min-height: 360px;
}
.pdf-frame iframe { width: 100%; height: 100%; min-height: 360px; border: none; display: block; }

.m-open-link {
  display: block; text-align: center; margin-top: 10px;
  font-family: 'IM Fell English SC', serif;
  font-size: .6rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); text-decoration: none;
  border: 3px double var(--gold-dim); padding: 7px;
  transition: background .2s, color .2s;
}
.m-open-link:hover { background: var(--gold-dim); color: var(--parchment); }

/* ── Responsive ── */
@media (max-width: 760px) {
  .timeline::before  { left: 18px; }
  .t-event, .t-event:nth-child(odd), .t-event:nth-child(even) {
    width: 100%; margin-left: 0; text-align: left; padding-left: 50px; padding-right: 0;
  }
  .t-event:nth-child(odd)::before, .t-event:nth-child(even)::before { left: 10px; right: auto; }
  .t-event:nth-child(odd) .card-meta { flex-direction: row; }
  .modal-body { grid-template-columns: 1fr; }
  .m-info { border-right: none; border-bottom: 1px solid var(--gold-dim); }
  .hdr-info { flex-direction: column; gap: 2px; text-align: center; }
  .gazette-name { font-size: 2.4rem; }
}
@media (max-width: 480px) {
  .archive-grid { grid-template-columns: 1fr 1fr; }
  .hdr-strip { font-size: .56rem; }
}
