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

:root {
  --orange:    #E07B39;
  --orange-dk: #C06020;
  --sky:       #5BA4CF;
  --sky-lt:    #AED6F1;
  --green:     #4A7C59;
  --sand:      #F5E6C8;
  --tan:       #D4A96A;
  --card:      #FFFFFF;
  --text:      #2C1A0E;
  --muted:     #7A6855;
  --border:    #E8D5BA;
  --red:       #C0392B;
  --purple:    #7D3C98;
  --teal:      #148F77;
  --family-a:  #2980B9;
  --family-b:  #E67E22;
  --radius:    16px;
  --shadow:    0 4px 20px rgba(44,26,14,.12);
  --shadow-sm: 0 2px 8px rgba(44,26,14,.08);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--sand);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Typography ──────────────────────────────────────────────────── */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.15; }
h2 { font-size: 1.4rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { line-height: 1.6; }

.small { font-size: 0.8rem; color: var(--muted); }
.muted { color: var(--muted); }

/* ── ===== LANDING PAGE ===== ─────────────────────────────────────── */

/* Sky scene */
.scene {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(180deg,
    #0d2137 0%,
    #1a4a6e 20%,
    #2e7bbc 45%,
    #87CEEB 65%,
    #FFD8A0 80%,
    #FFB347 90%,
    #E88C30 100%
  );
  height: 52vh;
  min-height: 280px;
}

/* Sun */
.sun {
  position: absolute;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #FFF5C0 30%, #FFD700 60%, #FFB347 100%);
  border-radius: 50%;
  bottom: 22%;
  right: 12%;
  box-shadow: 0 0 60px 20px rgba(255,200,80,.5);
  animation: sunrise 4s ease-out forwards;
}
@keyframes sunrise {
  from { transform: translateY(40px); opacity: .7; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Clouds */
.cloud {
  position: absolute;
  background: rgba(255,255,255,.85);
  border-radius: 50px;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,.85);
  border-radius: 50%;
}
.c1 { width:90px;  height:30px; top:15%; left:5%;  animation-duration:28s; animation-delay:-5s; }
.c1::before { width:40px; height:40px; top:-20px; left:15px; }
.c1::after  { width:55px; height:35px; top:-15px; left:30px; }
.c2 { width:70px;  height:22px; top:25%; left:45%; animation-duration:35s; animation-delay:-12s; }
.c2::before { width:30px; height:30px; top:-15px; left:10px; }
.c2::after  { width:45px; height:28px; top:-12px; left:22px; }
.c3 { width:110px; height:28px; top:10%; left:70%; animation-duration:22s; animation-delay:-8s; }
.c3::before { width:50px; height:50px; top:-28px; left:15px; }
.c3::after  { width:65px; height:40px; top:-22px; left:35px; }

@keyframes drift {
  from { transform: translateX(110vw); }
  to   { transform: translateX(-200px); }
}

/* Stars (visible at top of scene) */
.stars {
  position: absolute; top: 0; left: 0; width: 100%; height: 40%;
  overflow: hidden; pointer-events: none;
}
.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle 2s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity:.3; } to { opacity:1; } }

/* Mountains silhouette */
.mountains {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 45%;
}

/* Road scene below sky */
.road-wrap {
  position: relative;
  background: #C8A96A;
  overflow: hidden;
  height: 110px;
}

/* Road surface */
.road-surface {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55px;
  background: #555;
  border-top: 3px solid #777;
}

/* Dashed center line */
.road-lines {
  position: absolute;
  bottom: 20px; left: 0;
  width: 100%; height: 6px;
  background: repeating-linear-gradient(
    90deg,
    #FFD700 0px,
    #FFD700 40px,
    transparent 40px,
    transparent 80px
  );
  animation: lines-scroll 2s linear infinite;
}
@keyframes lines-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-80px); }
}

/* Cactus decorations */
.cactus {
  position: absolute;
  bottom: 52px;
  animation: cactus-scroll linear infinite;
  font-size: 2.5rem;
  filter: drop-shadow(2px 2px 3px rgba(0,0,0,.3));
}
.cx1 { left: 5%;  animation-duration: 14s; animation-delay: 0s; }
.cx2 { left: 25%; animation-duration: 18s; animation-delay: -4s; }
.cx3 { left: 60%; animation-duration: 12s; animation-delay: -7s; }
.cx4 { left: 80%; animation-duration: 16s; animation-delay: -2s; }
@keyframes cactus-scroll {
  from { transform: translateX(120vw); }
  to   { transform: translateX(-200px); }
}

/* THE CAR */
.car-lane {
  position: absolute;
  bottom: 54px; left: 0; right: 0;
  height: 60px;
  animation: car-drive 8s linear infinite;
}
@keyframes car-drive {
  0%   { transform: translateX(110vw)  translateY(0px); }
  10%  { transform: translateX(95vw)   translateY(-2px); }
  20%  { transform: translateX(80vw)   translateY(0px); }
  30%  { transform: translateX(65vw)   translateY(-3px); }
  40%  { transform: translateX(50vw)   translateY(0px); }
  50%  { transform: translateX(35vw)   translateY(-2px); }
  60%  { transform: translateX(20vw)   translateY(0px); }
  70%  { transform: translateX(5vw)    translateY(-2px); }
  100% { transform: translateX(-120vw) translateY(0px); }
}

.car-svg {
  width: 160px;
  height: 70px;
  display: block;
}

/* Wheel animation */
.wheel-spin {
  animation: wheel-turn 0.4s linear infinite;
}
.wheel-front { transform-origin: 85% 88%; }
.wheel-rear  { transform-origin: 22% 88%; }

@keyframes wheel-turn {
  to { transform: rotate(360deg); }
}

/* Exhaust puff */
.exhaust {
  position: absolute;
  left: -20px; bottom: 10px;
  animation: puff 1.2s ease-out infinite;
  font-size: 1.2rem;
  opacity: 0;
}
@keyframes puff {
  0%   { opacity:.6; transform: translateX(0) scale(.5); }
  100% { opacity:0;  transform: translateX(-25px) scale(1.2); }
}

/* ── Landing title & buttons ─────────────────────────────────────── */
.landing-title {
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  padding: 28px 20px 0;
  z-index: 10;
  animation: title-fade 1.2s ease-out both;
}
@keyframes title-fade {
  from { opacity: 0; transform: translateY(-15px); }
  to   { opacity: 1; transform: translateY(0); }
}

.landing-title h1 {
  font-size: clamp(1.4rem, 6vw, 2rem);
  color: #FFFFFF;
  text-shadow: 0 2px 12px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.8);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.landing-title .subtitle {
  margin-top: 6px;
  font-size: clamp(1rem, 4vw, 1.4rem);
  color: #FFD700;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  letter-spacing: 0.08em;
}

/* Family buttons */
.family-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px 32px;
  max-width: 500px;
  margin: 0 auto;
}

.family-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius);
  text-decoration: none;
  color: white;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.family-btn:active { transform: scale(.97); box-shadow: var(--shadow-sm); }

.family-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius);
}

.btn-nana   { background: linear-gradient(135deg, #2980B9, #1A5276); }
.btn-dustin { background: linear-gradient(135deg, #E67E22, #A04000); }

.btn-icon { font-size: 2.8rem; flex-shrink: 0; }

.btn-text { flex: 1; }
.btn-name { font-size: 1.3rem; font-weight: 800; line-height: 1.2; display: block; }
.btn-desc { font-size: 0.85rem; opacity: .85; display: block; margin-top: 3px; }

.btn-arrow {
  font-size: 1.6rem;
  opacity: .7;
  flex-shrink: 0;
}

/* Footer credit */
.trip-footer {
  text-align: center;
  padding: 8px 20px 24px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── ===== FAMILY PAGES ===== ─────────────────────────────────────── */

/* Top header bar */
.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: white;
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--sand);
  color: var(--text);
  font-size: 1.2rem;
  text-decoration: none;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.page-header h1 {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  flex: 1;
}

.header-emoji { font-size: 1.8rem; }

/* Color accent per family */
.nana-header  { border-bottom-color: var(--family-a); }
.nana-header .page-header-bar { background: var(--family-a); }
.dustin-header { border-bottom-color: var(--family-b); }

/* Page content */
.page-content {
  padding: 20px 16px 100px;
  max-width: 600px;
  margin: 0 auto;
}

/* Section */
.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-icon { font-size: 1.5rem; }
.section-title { font-size: 1.1rem; font-weight: 700; }

.section-accent {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
}
.nana .section-accent { background: var(--family-a); opacity: .4; }
.dustin .section-accent { background: var(--family-b); opacity: .4; }

/* ── AUDIO PLAYER ────────────────────────────────────────────────── */

.audio-deck {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.deck-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.deck-title {
  font-size: 1rem;
  font-weight: 700;
}

.deck-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Currently playing display */
.now-playing {
  padding: 10px 16px;
  background: #F8F4EE;
  border-bottom: 1px solid var(--border);
  display: none;
}
.now-playing.active { display: block; }
.np-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.np-title { font-size: 0.92rem; font-weight: 600; color: var(--text); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Controls */
.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.ctrl-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
  color: var(--text);
}
.ctrl-btn:active { background: var(--border); }

.ctrl-play {
  width: 44px; height: 44px;
  background: var(--orange);
  color: white;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ctrl-play.nana-play { background: var(--family-a); }
.ctrl-play.dustin-play { background: var(--family-b); }

.ctrl-play:active { filter: brightness(.9); }

/* Progress bar */
.progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
  width: 0%;
  transition: width .2s linear;
}
.nana .progress-fill { background: var(--family-a); }
.dustin .progress-fill { background: var(--family-b); }

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Track list */
.track-list {
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.04);
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.track-item:active { background: var(--sand); }
.track-item.playing {
  background: #EEF6FF;
  border-left: 3px solid var(--family-a);
}
.dustin .track-item.playing {
  background: #FFF4EA;
  border-left-color: var(--family-b);
}

.track-num {
  width: 24px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.track-item.playing .track-num { color: var(--family-a); font-weight: 700; }
.dustin .track-item.playing .track-num { color: var(--family-b); }

.track-title { flex: 1; font-size: 0.88rem; line-height: 1.3; }
.track-item.playing .track-title { font-weight: 600; }

.track-wave { font-size: 0.9rem; color: var(--family-a); animation: wave-pulse .6s ease-in-out infinite alternate; }
.dustin .track-wave { color: var(--family-b); }
@keyframes wave-pulse { from { opacity: .4; } to { opacity: 1; } }

/* ── LINK CARDS ──────────────────────────────────────────────────── */

.link-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 10px;
}

.link-group {
  padding: 12px 16px 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}

.link-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid rgba(0,0,0,.04);
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.link-item:last-child { border-bottom: none; }
.link-item:active { background: var(--sand); }

.link-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 1px; }
.link-body { flex: 1; }
.link-name { font-size: 0.9rem; font-weight: 600; }
.link-desc { font-size: 0.78rem; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.link-badge { font-size: 0.7rem; color: var(--orange); font-weight: 600; }
.link-arrow { font-size: 0.9rem; color: var(--muted); flex-shrink: 0; align-self: center; }

/* Info card */
.info-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
  border-left: 3px solid var(--border);
}
.info-card strong { color: var(--text); }
.info-card.tip { border-left-color: var(--orange); background: #FFF8F2; }
.info-card.nana-tip { border-left-color: var(--family-a); background: #F0F7FF; }
.info-card.dustin-tip { border-left-color: var(--family-b); background: #FFF7F0; }

/* Hero card (big intro card for each family) */
.hero-card {
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  margin-bottom: 20px;
  color: white;
  box-shadow: var(--shadow);
}
.hero-nana   { background: linear-gradient(135deg, #1A5276, #2980B9); }
.hero-dustin { background: linear-gradient(135deg, #A04000, #E67E22); }
.hero-card h2 { font-size: 1.3rem; margin-bottom: 6px; }
.hero-card p  { font-size: 0.85rem; opacity: .9; line-height: 1.5; }

/* ── Tab bar for subsections ─────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: wrap;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: white;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, color .1s;
}
.tab-pill.active {
  background: var(--family-a);
  color: white;
}
.dustin .tab-pill.active {
  background: var(--family-b);
}

/* Hidden sections */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* ── Accordion for subgroups ─────────────────────────────────────── */
.accordion {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.accordion-trigger.open .acc-chevron { transform: rotate(180deg); }
.acc-chevron { transition: transform .2s; font-size: 0.8rem; color: var(--muted); }

.accordion-body {
  display: none;
  padding: 0 0 4px;
}
.accordion-body.open {
  display: block;
}

/* Easter egg section */
.egg-intro {
  background: linear-gradient(135deg, #2C3E50, #4A235A);
  border-radius: var(--radius);
  padding: 16px;
  color: white;
  margin-bottom: 12px;
}
.egg-intro h3 { margin-bottom: 6px; }
.egg-intro p  { font-size: 0.83rem; opacity: .9; line-height: 1.5; }
.egg-badge {
  display: inline-block;
  background: #FFD700;
  color: #2C3E50;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Quality tier badge */
.star-badge {
  display: inline-block;
  background: #FFD700;
  color: #2C3E50;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Curia subsection pills ──────────────────────────────────────── */
.curia-category {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 16px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.curia-category:first-child { border-top: none; }

.loading-hint {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ── Utilities ───────────────────────────────────────────────────── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none; }

/* ── Media queries ───────────────────────────────────────────────── */
@media (max-height: 600px) {
  .scene { height: 44vh; min-height: 220px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --sand: #1C140E;
    --card: #2A1F16;
    --text: #F5E6C8;
    --muted: #A89070;
    --border: #3D2E20;
  }
  body { background: #1C140E; }
  .info-card { background: #2A1F16; }
  .info-card.tip { background: #2A200F; }
  .info-card.nana-tip { background: #0E1C28; }
  .info-card.dustin-tip { background: #2A180A; }
  .track-item.playing { background: #0E1C28; }
  .dustin .track-item.playing { background: #2A180A; }
  .tab-pill { background: #3D2E20; color: #A89070; }
  .accordion { background: #2A1F16; }
  .now-playing { background: #241A12; }
  .audio-deck { background: #2A1F16; }
  .link-item:active { background: #3D2E20; }
  .road-wrap { background: #5C4020; }
}
