/*
Theme Name: History Museum
Author: dev86
Description: Dark museum interface for structured history content.
Version: 1.0.0
Requires PHP: 8.1
*/

:root {
  --bg: #090b0f;
  --panel: #11151d;
  --panel-2: #171d27;
  --text: #f3efe6;
  --muted: #a8adba;
  --line: rgba(255, 255, 255, .12);
  --gold: #d8ad5f;
  --cyan: #6fc7d9;
  --green: #76c99b;
  --red: #da6c68;
  --violet: #9b8cff;
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  scroll-snap-type: y proximity;
}
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 8%, rgba(216, 173, 95, .16), transparent 32rem),
    radial-gradient(circle at 92% 22%, rgba(111, 199, 217, .13), transparent 28rem),
    linear-gradient(180deg, #07080b 0%, var(--bg) 44%, #0d1016 100%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.site-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 3rem);
  background: rgba(9, 11, 15, .78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.menu-toggle { display: none; }
.nav { display: flex; gap: .35rem; overflow-x: auto; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .5rem .8rem;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.nav a:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.05); }

.hero {
  min-height: 86vh;
  display: grid;
  align-items: end;
  padding: clamp(3rem, 8vw, 7rem) clamp(1rem, 5vw, 5rem) 3rem;
  position: relative;
  overflow: hidden;
}
.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9,11,15,.96), rgba(9,11,15,.58), rgba(9,11,15,.88)),
    url("assets/stone-texture.svg") center/cover;
  opacity: .96;
}
.hero-inner { position: relative; max-width: 980px; }
.eyebrow { color: var(--gold); font-size: .9rem; font-weight: 700; text-transform: uppercase; }
h1 {
  margin: .7rem 0 1rem;
  font-size: clamp(3.1rem, 9vw, 8rem);
  line-height: .9;
  max-width: 980px;
}
.hero p { color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.7; max-width: 720px; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.6rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.06);
  text-decoration: none;
  transition: transform .2s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.24); }
.btn.primary { background: var(--gold); color: #12100a; border-color: var(--gold); font-weight: 800; }

.section {
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 5vw, 5rem);
  scroll-snap-align: center;
  scroll-snap-stop: normal;
}
.section-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: end; margin-bottom: 1.5rem; }
.section h2 { margin: 0; font-size: clamp(2rem, 4vw, 4.5rem); line-height: 1; }
.section-lead { color: var(--muted); max-width: 560px; line-height: 1.7; }

.era-tabs {
  display: inline-flex;
  gap: .25rem;
  max-width: 100%;
  padding: .25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  overflow-x: auto;
  scrollbar-width: none;
}
.era-tabs::-webkit-scrollbar { display: none; }
.era-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: .65rem .95rem;
  white-space: nowrap;
  transition: color .2s, background .2s, border-color .2s;
}
.era-tab.active { color: #111; background: var(--gold); border-color: var(--gold); font-weight: 800; }

.event-card, .museum-card, .quiz-box, .map-stage {
  background: linear-gradient(180deg, rgba(23,29,39,.96), rgba(14,18,26,.94));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.timeline-showcase {
  position: relative;
  padding: 1rem 0 0;
}
.timeline-axis-wrap {
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 1rem .25rem 1.75rem;
  margin-bottom: 1.25rem;
}
.timeline-axis-wrap::-webkit-scrollbar { display: none; }
.timeline-axis {
  position: relative;
  min-width: max(100%, calc(var(--timeline-count, 1) * 150px));
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  overflow: hidden;
}
.timeline-line span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--cyan), var(--green));
  transition: width .4s ease;
}
.timeline-node {
  position: relative;
  z-index: 2;
  width: 132px;
  min-height: 92px;
  display: grid;
  place-items: center;
  gap: .35rem;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: center;
}
.timeline-node:before {
  content: "";
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(243,239,230,.72);
  background: var(--node-color, var(--gold));
  box-shadow: 0 0 0 8px rgba(255,255,255,.045);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.timeline-node:hover:before,
.timeline-node.active:before {
  transform: scale(1.35);
  border-color: var(--text);
  box-shadow: 0 0 0 10px rgba(216,173,95,.14), 0 0 32px rgba(216,173,95,.34);
}
.timeline-node-date {
  max-width: 128px;
  color: var(--text);
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.2;
}
.timeline-node-title {
  max-width: 128px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.25;
}
.timeline-node.active .timeline-node-date { color: var(--gold); }
.timeline-node.active .timeline-node-title { color: var(--text); }
.timeline-detail {
  position: relative;
  min-height: 340px;
}
.event-card {
  width: min(860px, 100%);
  min-height: 340px;
  margin: 0 auto;
  padding: 1.25rem;
  display: none;
  flex-direction: column;
  opacity: 1;
  transform: none;
  transition: border-color .24s, background .24s;
}
.event-card.active { display: flex; animation: timelineDetailIn .28s ease; }
.event-card.hidden { display: none; }
.event-card:hover { transform: translateY(-4px); border-color: rgba(216,173,95,.52); background: linear-gradient(180deg, rgba(31,38,50,.98), rgba(18,23,32,.96)); }
.event-date { color: var(--gold); font-weight: 800; }
.event-region { color: var(--cyan); margin-top: .5rem; font-size: .92rem; }
.event-card h3 { font-size: 1.35rem; margin: 1rem 0 .7rem; }
.event-card p { color: var(--muted); line-height: 1.65; margin: 0; }
.tag { margin-top: auto; color: var(--text); border-top: 1px solid var(--line); padding-top: 1rem; font-size: .88rem; }
.timeline-controls {
  display: flex;
  justify-content: center;
  gap: .65rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 .9rem;
}
.timeline-btn {
  min-height: 42px;
  padding: .65rem .95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.055);
  transition: transform .2s, background .2s, border-color .2s;
}
.timeline-btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.1); }
.timeline-btn.primary { color: #111; background: var(--gold); border-color: var(--gold); font-weight: 800; }
@keyframes timelineDetailIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.map-stage { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); overflow: hidden; }
.map-canvas { min-height: 520px; position: relative; background: linear-gradient(140deg, #101a22, #0c1118); }
.map-canvas svg { width: 100%; height: 100%; display: block; }
.map-point {
  cursor: pointer;
  transition: r .18s ease, stroke-width .18s ease, opacity .18s ease;
}
.map-point:hover {
  r: 10px;
  stroke-width: 3px;
  opacity: .95;
}
.map-panel { padding: 1.5rem; border-left: 1px solid var(--line); }
.map-panel h3 { margin: 0 0 .35rem; font-size: 1.6rem; }
.map-panel .meta { color: var(--gold); font-weight: 700; margin-bottom: 1rem; }
.map-panel p { color: var(--muted); line-height: 1.7; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.museum-card { overflow: hidden; transition: transform .22s, border-color .22s; }
.museum-card:hover { transform: translateY(-4px); border-color: rgba(111,199,217,.45); background: linear-gradient(180deg, rgba(31,38,50,.98), rgba(18,23,32,.96)); }
.museum-card button { width: 100%; text-align: left; border: 0; background: transparent; color: inherit; padding: 1.1rem; }
.card-kicker { color: var(--gold); font-weight: 800; font-size: 1.6rem; }
.museum-card h3 { margin: .7rem 0 .55rem; font-size: 1.25rem; }
.museum-card p, .card-detail { color: var(--muted); line-height: 1.65; }
.card-detail { display: none; padding-top: .75rem; border-top: 1px solid var(--line); }
.museum-card.open .card-detail { display: block; }

.quiz-box { max-width: 860px; padding: clamp(1rem, 3vw, 2rem); }
.quiz-progress { height: 5px; border-radius: 999px; background: rgba(255,255,255,.11); overflow: hidden; margin-bottom: 1.5rem; }
.quiz-progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.quiz-question { font-size: 1.45rem; line-height: 1.35; margin-bottom: 1rem; }
.quiz-options { display: grid; gap: .6rem; }
.quiz-options button {
  min-height: 48px;
  text-align: left;
  color: var(--text);
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem .9rem;
}
.quiz-options button.correct { border-color: var(--green); color: var(--green); }
.quiz-options button.wrong { border-color: var(--red); color: var(--red); }
.quiz-feedback { margin-top: 1rem; color: var(--muted); line-height: 1.6; }

.footer { padding: 2rem clamp(1rem, 5vw, 5rem); color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 840px) {
  .topbar { align-items: center; }
  .menu-toggle {
    display: inline-grid;
    grid-template-columns: 18px auto;
    align-items: center;
    gap: .55rem;
    min-height: 42px;
    padding: .55rem .75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255,255,255,.06);
  }
  .menu-toggle span {
    grid-column: 1;
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
    transition: transform .2s ease, opacity .2s ease;
  }
  .menu-toggle span + span { margin-top: -9px; }
  .menu-toggle b { grid-column: 2; grid-row: 1 / span 3; font-size: .9rem; }
  .topbar.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .topbar.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  .topbar.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + .6rem);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: .65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(14,18,26,.98);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease;
  }
  .topbar.menu-open .nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: var(--line);
    background: rgba(255,255,255,.045);
  }
  .hero { min-height: 78vh; }
  .section-head { display: block; }
  .map-stage { grid-template-columns: 1fr; }
  .map-panel { border-left: 0; border-top: 1px solid var(--line); }
  .map-canvas { min-height: 360px; }
  .timeline-axis { min-width: max(100%, calc(var(--timeline-count, 1) * 120px)); }
  .timeline-node { width: 112px; }
  .timeline-node-date, .timeline-node-title { max-width: 108px; }
  .timeline-detail { min-height: 380px; }
  .event-card { width: min(100%, 92vw); min-height: 380px; }
}

@media (max-height: 620px), (max-width: 700px) {
  html { scroll-snap-type: none; }
  .section { scroll-snap-align: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  *, *:before, *:after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
