/* ====================================
   THE IMMORTALITY ARCHIVE — GLOBAL CSS
   ==================================== */

/* ── RESET & VARIABLES ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #08080a;
  --bg-raised: #0f0f12;
  --bg-hover: #16161a;
  --text: #a8a4a0;
  --text-dim: #55524e;
  --text-bright: #ece8e1;
  --red: #c0392b;
  --red-dim: #7a2419;
  --red-glow: rgba(192, 57, 43, 0.15);
  --amber: #d4a24e;
  --amber-dim: #8a6a30;
  --border: #1e1d20;
  --display: 'Playfair Display', Georgia, serif;
  --mono: 'IBM Plex Mono', monospace;
  --body: 'Outfit', sans-serif;
}

html { background: var(--bg); color: var(--text); scroll-behavior: smooth; }

body {
  font-family: var(--body);
  font-weight: 300;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── GRAIN OVERLAY ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 10000;
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ====================================
   INDEX / LANDING PAGE
   ==================================== */

/* ── LANDING NAV ── */
.landing-nav {
  position: absolute;
  top: 2rem;
  left: 2rem;
  right: 2rem;
  display: flex;
  justify-content: space-between;
}

.landing-nav a {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #6b6762;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
  transition: color 0.3s, border-color 0.3s;
}

.landing-nav a:visited {
  color: #6b6762;
}

.landing-nav a:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ── LOGO BRANDING ── */
.site-logo {
  margin-bottom: 2rem;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  animation: fadeIn 1s ease 0.1s forwards;
  user-select: none;
  -webkit-user-drag: none;
  background: none;
  border: 0;
  padding: 0;
  appearance: none;
  color: inherit;
}

.site-logo svg {
  width: 44px;
  height: 44px;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-logo:focus-visible {
  outline: 1px solid var(--red);
  outline-offset: 6px;
}

.site-logo:hover svg {
  transform: rotate(180deg);
}

/* ── DRAMATIC TRANSMISSION OVERLAY ── */
#glitch-overlay {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
}

#glitch-symbol {
  width: 20vw;
  height: 20vw;
  max-width: 180px;
  display: none;
}

/* ── LANDING PAGE ── */
#landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
}

.landing-tagline {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #807b76;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeIn 1s ease 0.3s forwards;
}

.landing-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.8rem, 7vw, 6rem);
  color: var(--text-bright);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeIn 1s ease 0.6s forwards;
}

.landing-title em {
  font-style: italic;
  color: var(--red);
}

.landing-sub {
  font-size: 1rem;
  color: #807b76;
  max-width: 460px;
  margin-bottom: 3rem;
  line-height: 1.85;
  opacity: 0;
  animation: fadeIn 1s ease 0.9s forwards;
}

/* ── DEATH COUNTER ── */
.death-counter {
  margin-bottom: 4.5rem;
  opacity: 0;
  animation: fadeIn 1.2s ease 1.5s forwards;
}

.death-counter-number {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-bright);
  letter-spacing: 0.05em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.death-counter-label {
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── SHUFFLE BUTTON ── */
#shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border: 1px solid var(--red-dim);
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 1rem 2.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  animation: fadeIn 1s ease 1.4s forwards;
}

#shuffle-btn:hover {
  background: var(--red);
  color: var(--bg);
  box-shadow: 0 0 40px var(--red-glow);
}

#shuffle-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ── CTA GROUP ── */
.landing-ctas {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 4.5rem;
  opacity: 0;
  animation: fadeIn 1s ease 1.2s forwards;
}

.browse-link {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #807b76;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2rem;
  transition: color 0.3s, border-color 0.3s;
  -webkit-text-decoration: none;
}

.browse-link:visited {
  color: #807b76;
}

.browse-link:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* ── STATIC STATS ── */
.landing-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 480px;
  width: 100%;
  opacity: 0;
  animation: fadeIn 1s ease 1.8s forwards;
}

.landing-stat {
  text-align: center;
  padding: 0;
}

.landing-stat-number {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.landing-stat-label {
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.7;
}


/* ====================================
   ARCHIVE PAGE
   ==================================== */

#all-entries {
  max-width: 900px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

.entry-back {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 4rem;
  transition: color 0.3s;
  background: none;
  border: none;
  text-decoration: none;
}

.entry-back:hover { color: var(--red); }

.all-entries-title {
  font-family: var(--display);
  font-size: 1.8rem;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.all-entries-count {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 3rem;
}

/* ── CENTURY FILTER ── */
.century-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.5rem 0 0.5rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border);
}

.century-btn {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
  white-space: nowrap;
}

.century-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.century-btn.active {
  color: var(--red);
  border-color: var(--red-dim);
  background: var(--red-glow);
}

.filter-empty {
  display: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  padding: 3rem 0;
  text-align: center;
}

.entry-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}

.entry-card:hover {
  transform: translateX(0.5rem);
}

.entry-card:hover .entry-card-title { color: var(--red); }

.entry-card-year {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--red);
  letter-spacing: 0.1em;
  padding-top: 0.3rem;
}

.entry-card-title {
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--text-bright);
  transition: color 0.3s;
  margin-bottom: 0.3rem;
}

.entry-card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
}


/* ====================================
   POST / ENTRY PAGES
   ==================================== */

#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
  z-index: 9998;
  width: 0%;
}

#entry-view {
  min-height: 100vh;
  padding: 6rem 2rem 4rem;
  max-width: 720px;
  margin: 0 auto;
}

.top-nav {
  display: flex;
  justify-content: flex-start;
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.top-nav a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #807b76;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.3s;
}

.top-nav a:hover { color: var(--red); }

.entry-header { margin-bottom: 1.5rem; }

.entry-year-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.entry-title {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  color: var(--text-bright);
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.entry-oneliner {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--amber);
}

.fact-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  padding: 1.25rem 0;
  margin-bottom: 2.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.fact-strip-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.fact-strip-label {
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.fact-strip-value {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-bright);
  letter-spacing: 0.02em;
}

.visual-break {
  text-align: center;
  padding: 2.5rem 0;
  margin: 1rem 0;
}

.visual-break-number {
  font-family: var(--display);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 400;
  color: var(--text-bright);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.visual-break-caption {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.standalone {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-bright);
  text-align: center;
  padding: 2rem 0;
  margin: 1.5rem 0;
  line-height: 1.6;
}

.entry-content p {
  font-size: 1rem;
  margin-bottom: 1.4rem;
  color: var(--text);
  line-height: 1.85;
}

.entry-content p strong {
  color: var(--text-bright);
  font-weight: 400;
}

.entry-content img {
  max-width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: cover;
  display: block;
  margin: 0 auto 2rem auto;
}

.entry-content .callout {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-bright);
  line-height: 1.8;
  margin: 2.5rem 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--red-dim);
}

.entry-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.entry-nav a {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.3s;
  padding: 0.5rem 0;
}

.entry-nav a:hover { color: var(--red); }

.entry-nav .disabled {
  opacity: 0.2;
  pointer-events: none;
}

.entry-fade-in { animation: fadeIn 0.6s ease forwards; }


/* ====================================
   RESPONSIVE
   ==================================== */

@media (max-width: 640px) {
  .death-counter-number {
    font-size: 1.2rem;
  }

  .entry-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .entry-card:hover {
    transform: none;
  }

  .fact-strip { gap: 0.75rem 1.5rem; }

  .landing-stats {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .landing-stat-label {
    font-size: 0.52rem;
  }

  .century-filter {
    gap: 0.35rem;
  }

  .century-btn {
    font-size: 0.55rem;
    padding: 0.4rem 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .site-logo,
  .landing-tagline,
  .landing-title,
  .landing-sub,
  .landing-ctas,
  .death-counter,
  #shuffle-btn,
  .landing-stats {
    opacity: 1;
    animation: none !important;
  }

  body::after {
    opacity: 0.5;
  }
}
