@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@300;400;500&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f8f6f1;
  --bg-card: #ffffff;
  --bg-card-hover: #fdfcfa;
  --navy: #14142a;
  --navy-light: #2a2a4a;
  --gold: #9a7b2d;
  --gold-light: #b8942f;
  --gold-dim: #7a6223;
  --green: #2d7a40;
  --green-light: #3a9952;
  --green-dim: #5a9a68;
  --text: #2c2c3a;
  --text-muted: #6e6d78;
  --border: #ddd9d0;
  --border-light: #eae7e0;
  --shadow: rgba(20, 20, 42, 0.08);
  --shadow-heavy: rgba(20, 20, 42, 0.15);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Typography ── */

h1, h2, h3, h4 {
  font-family: 'Cinzel', serif;
  color: var(--navy);
  font-weight: 600;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--gold-light);
}

/* ── Layout ── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Site Header ── */

.site-header {
  text-align: center;
  padding: 5rem 1.5rem 3rem;
  position: relative;
}

.site-header::after {
  content: '';
  display: block;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 2rem auto 0;
}

.site-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.site-header .subtitle {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 1.05rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.site-header .intro {
  max-width: 680px;
  margin: 2.5rem auto 0;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-muted);
  font-weight: 300;
}

/* ── Category Headers (Index Page) ── */

.category-section {
  margin-top: 3rem;
}

.category-section:first-child {
  margin-top: 0;
}

.category-header {
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.category-header.aliens {
  color: var(--green);
}

.category-header.ancient {
  color: var(--gold);
}

.category-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 680px;
}

/* ── Counterpoint Panel ── */

.counterpoint-panel {
  margin: 3rem 0;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 0 8px 8px 0;
  box-shadow: 0 1px 3px var(--shadow);
}

.counterpoint-inner {
  max-width: 680px;
}

.counterpoint-panel h3 {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.counterpoint-quote {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--navy);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.counterpoint-attribution {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.counterpoint-body {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.counterpoint-link {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.counterpoint-link:hover {
  background: rgba(154, 123, 45, 0.06);
  border-color: var(--gold-dim);
}

.counterpoint-panel.disclosure {
  border-left-color: #2d5a7a;
}

.counterpoint-panel.disclosure h3 {
  color: #2d5a7a;
}

.disclosure-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.disclosure-links .counterpoint-link {
  font-size: 0.8rem;
}

.source-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.source-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(45, 90, 122, 0.1);
  color: #2d5a7a;
  padding: 0.15em 0.45em;
  border-radius: 3px;
  margin-right: 0.3em;
  vertical-align: baseline;
}

/* ── Mystery Cards Grid (Index) ── */

.mystery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1rem 0 3rem;
}

.mystery-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: 0 1px 3px var(--shadow);
}

.mystery-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: 0 8px 24px var(--shadow-heavy);
}

.mystery-card.ancient:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 8px 24px var(--shadow-heavy);
}

.mystery-card a.card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.mystery-card .card-image,
.mystery-card .card-body {
  pointer-events: none;
}

.mystery-card .card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #0c1418 0%, #141e24 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Radar sweep effect */
.mystery-card .card-image::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 340deg,
    rgba(74, 205, 107, 0.06) 355deg,
    rgba(74, 205, 107, 0.12) 358deg,
    transparent 360deg
  );
  animation: radar-sweep 6s linear infinite;
  z-index: 0;
}

.mystery-card.ancient .card-image::before {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 340deg,
    rgba(201, 168, 76, 0.06) 355deg,
    rgba(201, 168, 76, 0.12) 358deg,
    transparent 360deg
  );
}

.mystery-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.mystery-card .card-image .placeholder-icon {
  font-size: 3rem;
  opacity: 0.15;
}

.mystery-card .card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mystery-card .card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.mystery-card.ancient .card-body h3 {
  color: var(--gold);
}

.mystery-card .card-body .tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.mystery-card .card-body .reference {
  font-size: 0.8rem;
  color: var(--green-dim);
  margin-top: auto;
  letter-spacing: 0.04em;
}

.mystery-card.ancient .card-body .reference {
  color: var(--gold-dim);
}

/* ── Detail Page ── */

.detail-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248, 246, 241, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--gold-dim);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.back-link:hover,
.back-link:active {
  background: rgba(154, 123, 45, 0.08);
  color: var(--gold-light);
  border-color: var(--gold-dim);
}

.detail-hero {
  width: 100%;
  max-height: 480px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0c1418 0%, #141e24 100%);
  position: relative;
}

/* Gradient fade at bottom of hero image */
.detail-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 160px;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero .placeholder-hero {
  padding: 6rem 0;
  font-size: 5rem;
  opacity: 0.15;
}

.detail-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 1.5rem 3rem;
}

.detail-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.25rem;
}

.detail-content .mystery-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

/* ── Quick Facts Sidebar (Alien pages) ── */

.quick-facts {
  float: right;
  width: 260px;
  margin: 0 0 1.5rem 2rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
}

.quick-facts h3 {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.quick-facts dl {
  list-style: none;
}

.quick-facts dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

.quick-facts dt:first-child {
  margin-top: 0;
}

.quick-facts dd {
  font-size: 0.85rem;
  color: var(--text);
  margin: 0.15rem 0 0 0;
}

/* ── Evidence/Passage Section ── */

.evidence {
  margin: 2.5rem 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.evidence:first-of-type {
  border-top: none;
  padding-top: 0;
}

.evidence h2 {
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
  color: var(--navy);
}

.evidence .scene-image {
  width: 100%;
  max-width: 420px;
  float: right;
  margin: 0 0 1rem 1.5rem;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 20px var(--shadow-heavy);
}

.evidence .scene-image img {
  width: 100%;
  height: auto;
  display: block;
}

.evidence .quote-block {
  border-left: 3px solid var(--green-dim);
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.5rem;
  background: rgba(45, 122, 64, 0.04);
  border-radius: 0 6px 6px 0;
}

.evidence .quote-block.gold {
  border-left-color: var(--gold);
  background: rgba(154, 123, 45, 0.04);
}

.evidence .quote-block p {
  font-style: italic;
  line-height: 1.8;
  color: var(--text);
}

.evidence .quote-block cite {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--green-dim);
  font-style: normal;
}

.evidence .quote-block.gold cite {
  color: var(--gold-dim);
}

.evidence::after {
  content: '';
  display: table;
  clear: both;
}

/* ── Further Reading ── */

.further-reading {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.further-reading h3 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.further-reading ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.further-reading li {
  font-size: 0.85rem;
  color: var(--text);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.03em;
}

.further-reading a {
  color: #5a4a1a;
  text-decoration: underline;
  text-decoration-color: rgba(90, 74, 26, 0.3);
  text-underline-offset: 2px;
}

.further-reading a:hover {
  color: var(--navy);
  text-decoration-color: var(--navy);
}

.detail-content .description {
  margin: 2rem 0;
  line-height: 1.85;
  color: var(--text);
}

.detail-content .description p + p {
  margin-top: 1rem;
}

/* ── Prev/Next Navigation ── */

.mystery-nav {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
}

.mystery-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.3s ease, background 0.3s ease;
  min-width: 0;
  flex: 1;
}

.mystery-nav a:hover,
.mystery-nav a:active {
  border-color: var(--gold-dim);
  background: rgba(154, 123, 45, 0.04);
}

.mystery-nav a.next {
  text-align: right;
  align-items: flex-end;
}

.mystery-nav .nav-direction {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mystery-nav .nav-category {
  font-size: 0.65rem;
  color: var(--gold-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mystery-nav .nav-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--navy);
}

/* ── Footer ── */

.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer .footer-nav {
  margin-bottom: 1rem;
}

.site-footer .footer-nav a {
  color: var(--gold-dim);
  padding: 0.25rem 0.5rem;
  transition: color 0.3s ease;
}

.site-footer .footer-nav a:hover {
  color: var(--gold-light);
}

.site-footer .footer-nav .sep {
  color: var(--border);
  margin: 0 0.25rem;
}

/* ── Animations ── */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes radar-sweep {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.mystery-card {
  animation: fadeInUp 0.6s ease both;
}

.detail-content {
  animation: fadeInUp 0.5s ease both;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .mystery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mystery-nav .nav-name {
    font-size: 0.85rem;
  }

  .quick-facts {
    float: none;
    width: 100%;
    margin: 0 0 2rem 0;
  }
}

@media (max-width: 768px) {
  .evidence .scene-image {
    float: none;
    max-width: 100%;
    margin: 0 0 1.25rem 0;
  }
}

@media (max-width: 640px) {
  .mystery-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding: 3rem 1.5rem 2rem;
  }

  .site-header .intro {
    font-size: 0.9rem;
  }

  .mystery-nav {
    flex-direction: column;
  }

  .mystery-nav a.next {
    text-align: left;
    align-items: flex-start;
  }

  .detail-hero {
    max-height: 300px;
  }
}
