@import url('https://fonts.googleapis.com/css2?family=Libre+Caslon+Display&family=Open+Sans:wght@400;600;700&display=swap');

:root {
  --bg-darker: #18211b;
  --color-accent: #e6d36a;
  --color-text: #f2efe8;
  --border-light: rgba(242, 239, 232, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  font-size: clamp(100%, 1.5vw + 0.5rem, 150%);
}

body {
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  background: #1c261f;
  color: #f2efe8;
  overflow-x: hidden;
}

section, nav {
  border-bottom: 1px solid rgba(242,239,232,0.18);
}

/* LOADER */
#loader {
  position: fixed;
  inset: 0;
  background: #18211b;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.9s ease;
}
#loader.hide {
  opacity: 0;
  pointer-events: none;
}
.loader-box {
  text-align: center;
  padding: 2.5rem 3.5rem;
  border: 2px solid rgba(242,239,232,0.4);
}
.loader-box h1 {
  font-family: 'Libre Caslon Display', serif;
  letter-spacing: 0.14em;
  margin-bottom: 1.2rem;
}
.bar {
  /* FIX: was width:500px — overflows on mobile. now fluid with a max */
  width: min(500px, 80vw);
  height: 12px;
  border: 1px solid rgba(242,239,232,0.6);
}
.bar span {
  height: 100%;
  display: block;
  width: 0;
  background: #e6d36a;
}
#load-percent {
  margin-top: 0.8rem;
  font-weight: 600;
}

/* NAV */
.topbar {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1.6rem 3rem;
  background: rgba(28,38,31,0.75);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  z-index: 20;
  border-bottom: 1px solid rgba(230,211,106,0);
  transition: background 0.4s ease, backdrop-filter 0.4s ease, border-color 0.4s ease;
}
/* Scrolled state — added via JS */
.topbar.scrolled {
  background: rgba(24,33,27,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: rgba(230,211,106,0.12);
}
.topbar .logo {
  font-family: 'Libre Caslon Display', serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e6d36a;
  transition: letter-spacing 0.3s ease;
}
.topbar ul {
  list-style: none;
  display: flex;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}
.topbar a {
  color: #f2efe8;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
/* Remove old underline pseudo-element */
.topbar a::after { display: none; }
.topbar a:hover {
  background: rgba(230,211,106,0.08);
  border-color: rgba(230,211,106,0.2);
  color: #e6d36a;
  letter-spacing: 0.06em;
}
/* Active page link — add class="active" to the <a> on each page */
.topbar a.active {
  background: rgba(230,211,106,0.12);
  border-color: rgba(230,211,106,0.35);
  color: #e6d36a;
}

/* Mobile hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #f2efe8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

/* WIP badge on cards */
.wip {
  display: block;
  font-size: 0.55em;
  opacity: 0.6;
  letter-spacing: 0.06em;
}

/* LEAVES */
#leaves {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* HERO / CAROUSEL */
.hero {
  height: 100vh;
  margin-top: 90px;
}
.carousel {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s ease;
  z-index: 0;
}
.slide.active {
  opacity: 1;
}
.carousel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(28,38,31,0.55), rgba(28,38,31,0.85));
  z-index: 1;
}
.carousel-text {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Libre Caslon Display', serif;
  font-size: 3rem;
  max-width: 900px;
  text-align: center;
  line-height: 1.25;
  z-index: 2;
}

/* HERO TEXT BLOCK */
.hero-text-block {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

/* Chapter label */
.chapter-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #e6d36a;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.chapter-label.visible {
  opacity: 0.85;
  transform: translateY(0);
}

/* Gold divider line between label and title */
.chapter-label::after {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: rgba(230,211,106,0.45);
  margin: 8px auto 0;
}

/* Main title */
.carousel-text {
  font-family: 'Libre Caslon Display', serif;
  font-size: 3rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  margin: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.carousel-text.visible {
  opacity: 1;
}

/* Tagline */
.hero-tagline {
  font-size: 0.72rem;
  font-style: italic;
  color: rgba(242,239,232,0.65);
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease 0.1s, transform 0.8s ease 0.1s;
}
.hero-tagline.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll cue */
.hero-scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 1rem;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.hero-scroll-cue.visible {
  opacity: 1;
}
.scroll-line {
  display: block;
  width: 1px;
  height: 28px;
  background: rgba(230,211,106,0.4);
  animation: scrollPulse 1.8s ease-in-out infinite;
}
.scroll-word {
  font-size: 0.5rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(230,211,106,0.55);
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.15); }
}

/* CONTENT */
.content {
  padding: 7rem 18%;
  line-height: 1.8;
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1s ease, transform 1s ease;
}
.content.active {
  opacity: 1;
  transform: translateY(0);
}
.content-container {
  display: flex;
  gap: 4rem;
  align-items: flex-start;
}
.content-container .text { flex: 1; }

/* Pull quote */
.pull-quote {
  border-left: 2px solid #e6d36a;
  padding: 0.4rem 1.2rem;
  margin: 0 0 2rem 0;
}
.pull-quote p {
  font-family: 'Libre Caslon Display', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: #e6d36a;
  line-height: 1.55;
  margin: 0 0 0.4rem 0;
}
.pull-quote cite {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.5;
  font-style: normal;
}

/* Drop cap on first paragraph */
.content-body > p:first-child::first-letter {
  font-family: 'Libre Caslon Display', serif;
  font-size: 3.8rem;
  line-height: 0.75;
  float: left;
  margin-right: 0.12em;
  margin-top: 0.08em;
  color: #e6d36a;
}

/* CARDS */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 3rem;
  padding: 6rem 12%;
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 1s ease, transform 1s ease;
}
.cards.active { opacity: 1; transform: translateY(0); }

.cards a {
  color: inherit;
  text-decoration: none;
  display: block;
  position: relative;
}
/* Remove old sparkle pseudo-element */
.cards a::after { display: none; }

.card {
  padding: 3rem 2.5rem;
  background: #202c24;
  border: 1px solid rgba(242,239,232,0.18);
  border-top: 2px solid #e6d36a;
  border-radius: 4px;
  text-align: center;
  position: relative;
  transition: transform 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
  overflow: hidden;
}
/* WIP cards — muted top border */
.card.wip-card {
  border-top-color: rgba(242,239,232,0.2);
  opacity: 0.65;
}
.card.wip-card:hover {
  opacity: 0.75;
}
/* Coming Soon badge */
.card .soon-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(242,239,232,0.08);
  color: rgba(242,239,232,0.5);
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid rgba(242,239,232,0.15);
}
.card img {
  width: 88px;
  margin-bottom: 1.4rem;
  transition: transform 0.6s ease;
}
.card h3, .card h4, .card h5 {
  font-family: 'Libre Caslon Display', serif;
  letter-spacing: 0.1em;
  text-transform: none;
  text-align: center;
  margin: 0;
  color: #f2efe8;
}
.card:hover {
  background: #26352b;
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.card:hover img {
  transform: rotate(360deg);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb {
  background: #e6d36a;
  border-radius: 6px;
}

/* FOOTER — FIX: was using undefined CSS variables; now uses :root vars defined above */
.site-footer {
  background-color: var(--bg-darker);
  color: var(--color-text);
  padding: 2rem 4%;
  font-size: 0.9rem;
  border-top: 1px solid var(--border-light);
  text-align: center;
}
.site-footer a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.3s ease;
}
.site-footer a:hover { color: #fff; }
.footer-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.footer-content .sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-content .sources li {
  margin: 0.4rem 0;
  line-height: 1.4;
}
.footer-copy {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* RHYTHM GAME */
#rhythm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,33,27,0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow: hidden;
}
#rhythm-game {
  width: 88%;
  max-width: 1100px;
  height: 82%;
  background: linear-gradient(#202c24, #18211b);
  border: 2px solid rgba(242,239,232,0.35);
  position: relative;
  padding: 2rem;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(230,211,106,0.3);
}
#rhythm-close {
  position: absolute;
  top: 1.2rem;
  right: 1.4rem;
  background: none;
  border: none;
  color: #f2efe8;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.2s;
}
#rhythm-close:hover { transform: scale(1.2); }

#hud {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #e6d36a;
  text-shadow: 0 0 4px rgba(230,211,106,0.7);
  font-family: 'Libre Caslon Display', serif;
  font-size: 1.2rem;
  position: relative;
}
#feedback {
  position: absolute;
  top: 6rem;
  left: 50%;
  transform: translateX(-50%) scale(1);
  font-family: 'Libre Caslon Display', serif;
  font-size: 1.8rem;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  text-shadow: 0 0 12px rgba(230,211,106,0.7);
}
#feedback.show {
  opacity: 1;
  transform: translateX(-50%) scale(1.3);
}
#tutorial {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28,38,31,0.7);
  backdrop-filter: blur(4px);
  z-index: 20;
}
#tutorial-box {
  background: rgba(30,42,33,0.95);
  border: 2px solid #e6d36a;
  padding: 2rem 3rem;
  border-radius: 14px;
  text-align: center;
  animation: pulse 2s infinite;
}
#tutorial h2 {
  font-family: 'Libre Caslon Display', serif;
  letter-spacing: 0.14em;
  margin-bottom: 0.5rem;
  color: white;
}
#tutorial p {
  margin: 0.4rem 0;
  font-family: 'Libre Caslon Display', serif;
  color: white;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(230,211,106,0.2); }
  50%       { box-shadow: 0 0 24px rgba(230,211,106,0.6); }
}

#lanes {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2.5rem;
}
.lane {
  width: 110px;
  height: 360px;
  position: relative;
  border: 1px solid rgba(242,239,232,0.2);
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.receptor {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 80px;
  border-top: 2px solid #e6d36a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #f2efe8;
  opacity: 0.9;
  text-shadow: 0 0 6px rgba(230,211,106,0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}
.lane.hit .receptor { transform: scale(1.15); box-shadow: 0 0 18px #e6d36a; }
.lane.miss .receptor { transform: scale(1.1); box-shadow: 0 0 18px #b14a4a; }

.note {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.2rem;
  animation: sway 1.6s infinite ease-in-out;
}
@keyframes sway {
  0%   { transform: translateX(-50%) rotate(-6deg); }
  50%  { transform: translateX(-50%) rotate(6deg); }
  100% { transform: translateX(-50%) rotate(-6deg); }
}

#rhythm-trigger-container {
  position: absolute;
  top: calc(18% + 3.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}
#rhythm-trigger-container img {
  width: 45px;
  height: 45px;
  cursor: pointer;
  /* FIX: removed redundant translateX(-50%) from hover — parent already centers */
  transition: transform 0.3s ease;
}
#rhythm-trigger-container img:hover {
  transform: scale(1.2);
}

/* =============================================
   MOBILE RESPONSIVE STYLES
   ============================================= */
@media (max-width: 768px) {
  /* Nav: hide list, show hamburger */
  .topbar {
    padding: 1rem 1.5rem;
  }
  .topbar ul {
    display: none;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(28,38,31,0.97);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(242,239,232,0.18);
  }
  .topbar ul.open {
    display: flex;
  }
  .nav-toggle {
    display: block;
  }

  /* Content section: reduce huge padding */
  .content {
    padding: 4rem 6%;
  }
  .content-container {
    flex-direction: column;
    gap: 2rem;
  }
  .content-container right img {
    width: 100% !important;
    height: auto !important;
  }

  /* Cards: tighter padding */
  .cards {
    padding: 3rem 6%;
    gap: 1.5rem;
  }

  /* Carousel text: smaller on phones */
  .carousel-text {
    font-size: 1.8rem;
    width: 90%;
  }

  /* Rhythm game lanes: narrower on small screens */
  .lane {
    width: 70px;
  }
  #lanes {
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .carousel-text {
    font-size: 1.4rem;
  }
  .loader-box {
    padding: 2rem 1.5rem;
  }
}
