/* ===================================================
   Shaping Time — South Indian Music
   Shared Stylesheet
   =================================================== */

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

:root {
  --bg:        #0e0907;
  --bg2:       #160d09;
  --surface:   rgba(255,160,60,0.05);
  --surface2:  rgba(255,160,60,0.10);
  --border:    rgba(200,120,40,0.18);
  --border2:   rgba(200,120,40,0.32);
  --text:      #f4e8d4;
  --text-dim:  rgba(244,220,180,0.60);
  --text-mute: rgba(244,220,180,0.35);
  --accent:    #d46030;
  --accent2:   #e89040;
  --gold:      #d4a020;

  /* tala colors */
  --tisra:    #f07030;
  --chatusra: #d4a820;
  --khanda:   #c03840;
  --misra:    #e85050;
  --sankirna: #f0c030;

  --nav-h: 56px;
  --radius: 10px;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}

/* ─── NAV ─────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(14,9,7,0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}

.nav-brand {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  font-weight: normal;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.3px;
  white-space: nowrap;
  margin-right: auto;
}
.nav-brand span { color: var(--accent2); }

.nav-links {
  display: flex;
  gap: 2px;
  list-style: none;
}
.nav-links a {
  display: block;
  padding: 6px 13px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  transition: all var(--transition);
  letter-spacing: 0.2px;
}
.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--accent2); background: rgba(212,96,48,0.15); }

/* hamburger for mobile */
.nav-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; }

/* ─── PAGE WRAP ───────────────────────────────────── */
.page-wrap {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

/* ─── HERO ────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 24px 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  opacity: 0.40;
}
.hero-content { position: relative; z-index: 1; max-width: 700px; }
.hero h1 {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: normal;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 16px;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent2);
}
.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

/* ─── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border2);
}
.btn-outline:hover { background: var(--surface2); border-color: rgba(200,120,40,0.50); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ─── SECTIONS ────────────────────────────────────── */
.section {
  padding: 64px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
.section-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px;
}
.section-title {
  font-family: Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: normal;
  color: var(--text);
  margin-bottom: 8px;
}
.section-sub {
  color: var(--text-dim);
  font-size: 1rem;
  margin-bottom: 40px;
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ─── CARDS ───────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
}
.card:hover {
  background: var(--surface2);
  border-color: var(--border2);
  transform: translateY(-2px);
}
.card-icon { font-size: 28px; line-height: 1; }
.card-title {
  font-family: Georgia, serif;
  font-size: 1.2rem;
  font-weight: normal;
  color: var(--text);
}
.card-desc { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.card-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(212,96,48,0.15);
  color: var(--accent2);
  margin-top: auto;
  width: fit-content;
}

/* ─── PROSE ───────────────────────────────────────── */
.prose h2 {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: normal;
  color: var(--text);
  margin: 48px 0 12px;
  padding-top: 12px;
}
.prose h3 {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: normal;
  color: var(--text);
  margin: 28px 0 8px;
}
.prose p { margin-bottom: 16px; color: var(--text-dim); font-size: 1rem; }
.prose p:first-child { color: var(--text); }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--gold); font-style: italic; }
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 0 10px 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-dim);
}
.prose blockquote cite {
  display: block;
  font-size: 12px;
  font-style: normal;
  color: var(--text-mute);
  margin-top: 6px;
}

/* ─── TIMELINE ────────────────────────────────────── */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border2);
}
.timeline-item {
  position: relative;
  margin-bottom: 40px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px; top: 8px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline-date {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.timeline-title {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 8px;
}
.timeline-body { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* ─── GLOSSARY / TERM BLOCKS ──────────────────────── */
.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.term-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.term-name {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 2px;
}
.term-pronunciation { font-size: 11px; color: var(--text-mute); margin-bottom: 6px; }
.term-def { font-size: 13px; color: var(--text-dim); }

/* ─── SYLLABLE DISPLAY ────────────────────────────── */
.syllable-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.syl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
  user-select: none;
}
.syl:hover { filter: brightness(1.2); transform: scale(1.05); }
.syl.active { transform: scale(1.15); filter: brightness(1.4); }

.syl-tisra    { background: rgba(240,112,48,0.15); color: var(--tisra);    border-color: rgba(240,112,48,0.35); }
.syl-chatusra { background: rgba(212,168,32,0.15); color: var(--chatusra); border-color: rgba(212,168,32,0.35); }
.syl-khanda   { background: rgba(192,56,64,0.15);  color: var(--khanda);   border-color: rgba(192,56,64,0.35); }
.syl-misra    { background: rgba(232,80,80,0.15);  color: var(--misra);    border-color: rgba(232,80,80,0.35); }
.syl-sankirna { background: rgba(240,192,48,0.15); color: var(--sankirna); border-color: rgba(240,192,48,0.35); }

/* ─── HAND GESTURE ────────────────────────────────── */
.gesture-display {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.gesture-hand {
  width: 120px; height: 120px;
  position: relative;
  flex-shrink: 0;
}
.gesture-info { flex: 1; min-width: 160px; }
.gesture-beat { font-size: 28px; font-weight: bold; color: var(--accent); }
.gesture-type { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.gesture-name { font-size: 11px; color: var(--text-mute); }

/* ─── METRONOME ───────────────────────────────────── */
.metro-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 0;
}
.metro-beat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.metro-beat {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--border2);
  color: var(--text-dim);
  transition: all 0.1s;
  flex-direction: column;
  gap: 2px;
}
.metro-beat.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(212,96,48,0.55);
}
.metro-beat.sam {
  border-color: var(--gold);
}
.metro-beat.sam.current {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(212,160,32,0.55);
}
.metro-beat-label { font-size: 9px; opacity: 0.7; text-transform: uppercase; }
.metro-bpm-display {
  font-family: Georgia, serif;
  font-size: 3rem;
  color: var(--text);
  letter-spacing: -1px;
}
.metro-bpm-display span { font-size: 1rem; color: var(--text-dim); margin-left: 4px; }
.metro-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.metro-btn-play {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.metro-btn-play:hover { background: var(--accent2); transform: scale(1.05); }

/* ─── GAME ELEMENTS ───────────────────────────────── */
.game-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.game-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 24px;
}
.game-header h1 {
  font-family: Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: normal;
  margin-bottom: 8px;
}
.game-header p { color: var(--text-dim); font-size: 0.95rem; }
.score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 28px;
  font-size: 14px;
}
.score-val { font-size: 20px; font-weight: bold; color: var(--accent2); }
.score-label { font-size: 11px; color: var(--text-mute); text-transform: uppercase; }
.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  text-align: center;
}
.q-prompt { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 16px; }
.q-display {
  font-family: 'Courier New', monospace;
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: var(--text);
  margin: 16px 0;
  letter-spacing: 2px;
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}
.choice-btn {
  padding: 14px 20px;
  border-radius: 8px;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.choice-btn:hover { background: var(--surface2); border-color: var(--accent); }
.choice-btn.correct { background: rgba(240,192,48,0.18); border-color: var(--sankirna); color: var(--sankirna); }
.choice-btn.wrong   { background: rgba(232,80,80,0.18);  border-color: var(--misra);    color: var(--misra); }
.feedback {
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  font-size: 15px;
  margin-top: 16px;
  display: none;
}
.feedback.correct { background: rgba(240,192,48,0.12); color: var(--sankirna); display: block; }
.feedback.wrong   { background: rgba(232,80,80,0.12);  color: var(--misra);    display: block; }
.next-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(212,96,48,0.10);
  color: var(--accent2);
  font-size: 15px;
  cursor: pointer;
  transition: all var(--transition);
  display: none;
}
.next-btn.show { display: block; }
.next-btn:hover { background: rgba(212,96,48,0.22); }

/* Mora builder specific */
.mora-timeline {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-height: 80px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
  position: relative;
}
.mora-block {
  padding: 8px 14px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
  user-select: none;
}
.mora-block.statement { background: rgba(212,96,48,0.15); color: var(--accent2); border-color: rgba(212,96,48,0.35); }
.mora-block.gap       { background: rgba(212,160,32,0.15); color: var(--gold);   border-color: rgba(212,160,32,0.35); }
.mora-block:hover { filter: brightness(1.3); }
.pulse-counter {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-mute);
  text-align: right;
  margin-top: 6px;
}
.pulse-counter.match { color: var(--sankirna); font-weight: bold; }
.pulse-counter.over  { color: var(--misra); }

/* ─── SELECT / RANGE ──────────────────────────────── */
select, input[type="range"] {
  accent-color: var(--accent);
}
select {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); }
.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.range-wrap input { flex: 1; }
.range-wrap .val { min-width: 36px; text-align: right; color: var(--text-dim); }

/* ─── TALA BADGE ──────────────────────────────────── */
.tala-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-tisra    { background: rgba(240,112,48,0.15); color: var(--tisra);    border: 1px solid rgba(240,112,48,0.35); }
.badge-chatusra { background: rgba(212,168,32,0.15); color: var(--chatusra); border: 1px solid rgba(212,168,32,0.35); }
.badge-khanda   { background: rgba(192,56,64,0.15);  color: var(--khanda);   border: 1px solid rgba(192,56,64,0.35); }
.badge-misra    { background: rgba(232,80,80,0.15);  color: var(--misra);    border: 1px solid rgba(232,80,80,0.35); }
.badge-sankirna { background: rgba(240,192,48,0.15); color: var(--sankirna); border: 1px solid rgba(240,192,48,0.35); }

/* ─── FOOTER ──────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-mute);
}
.site-footer a { color: var(--text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 680px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: rgba(14,9,7,0.97); border-bottom: 1px solid var(--border); padding: 12px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .choices { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}
