/* ============================================================
   Dolce Music Academy – Practice Portal
   Colors: Beige #E5E1D5 | Charcoal #2A2926 | Muted Gray #6E6B63 | Bronze #B89A6C
   Fonts: Cormorant Garamond, Libre Baskerville, Georgia, Times New Roman
   ============================================================ */

:root {
  --beige: #E5E1D5;
  --beige-dark: #D9D4C5;
  --charcoal: #2A2926;
  --muted: #6E6B63;
  --bronze: #B89A6C;
  --bronze-light: #C9B07E;
  --bronze-dark: #9A7F54;
  --white: #F8F6F0;
  --success: #4A7C59;
  --error: #8B3A3A;
  --shadow: rgba(42, 41, 38, 0.08);
  --radius: 8px;
  --transition: 0.25s ease;
}

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

/* Remove browser focus / click outline (the white faded ring) */
button:focus,
button:focus-visible,
.option-btn:focus,
.option-btn:focus-visible,
.nav-link:focus,
.nav-link:focus-visible,
.card:focus,
.card:focus-visible,
.play-btn:focus,
.play-btn:focus-visible,
a:focus,
a:focus-visible {
  outline: none !important;
  box-shadow: none;
}

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

body {
  font-family: Georgia, "Times New Roman", Times, serif;
  background-color: var(--beige);
  color: var(--charcoal);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, .logo-text, .nav-link, .btn, .exercise-title {
  font-family: "Cormorant Garamond", "Libre Baskerville", Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.02em;
}

h1 { font-size: 2.6rem; font-weight: 600; }
h2 { font-size: 2rem; font-weight: 500; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.slogan {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  color: var(--bronze);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.label, .muted {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--beige-dark);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px var(--shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--charcoal);
  font-family: "Cormorant Garamond", Georgia, serif;
}

.logo-img {
  height: 52px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-emblem {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.logo-text {
  font-family: "Cormorant Garamond", "Libre Baskerville", Georgia, serif !important;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--charcoal);
  font-size: 1.05rem;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.nav-link:hover,
.nav-link.active {
  background: var(--beige);
  color: var(--bronze-dark);
}

/* ---------- Main content ---------- */
main {
  padding: 2.5rem 0 4rem;
  min-height: calc(100vh - 180px);
}

.section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.section.active {
  display: block;
}

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

/* ---------- Hero / Home ---------- */
.hero {
  text-align: center;
  padding: 3rem 1rem 4rem;
}

.hero h1 {
  margin-bottom: 0.5rem;
  color: var(--charcoal);
}

.hero .slogan {
  margin-bottom: 1.75rem;
  font-size: 1.35rem;
}

.hero-lead {
  max-width: 560px;
  margin: 0 auto 2.5rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* ---------- Cards & Grid ---------- */
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-header h2 {
  margin-bottom: 0.4rem;
}

.section-header p {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--beige-dark);
  border-radius: 10px;
  padding: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
}

.card-icon {
  font-size: 1.8rem;
  color: var(--bronze);
  margin-bottom: 0.25rem;
}

.card h3 {
  font-size: 1.25rem;
  color: var(--charcoal);
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.card .level-tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--beige);
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- Exercise View ---------- */
.exercise-view {
  display: none;
  max-width: 820px;
  margin: 0 auto;
}

.exercise-view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* When an exercise is open, hide the section "Music Theory / Aural" banner */
.section:has(.exercise-view.active) > .section-header {
  display: none;
}

.exercise-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.back-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1rem;
  transition: color var(--transition);
  box-shadow: none;
  justify-self: start;
}

.back-btn:hover {
  background: transparent;
  color: var(--charcoal);
}

.exercise-title {
  font-size: 1.75rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  text-align: center;
  justify-self: center;
  grid-column: 2;
}

.level-selector {
  display: flex;
  gap: 0.4rem;
  justify-self: end;
  grid-column: 3;
}

.level-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--beige-dark);
  background: var(--white);
  color: var(--muted);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: Georgia, serif;
  transition: all var(--transition);
}

.level-btn.active,
.level-btn:hover {
  background: var(--bronze);
  color: white;
  border-color: var(--bronze);
}

/* Exercise area — wider for scale note rows */
.exercise-panel {
  background: var(--white);
  border: 1px solid var(--beige-dark);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
  overflow-x: auto;
}

/* Scale palette: single horizontal row, centered */
.scale-palette {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  padding: 0.45rem 0.25rem 0.55rem;
  width: 100%;
}

.scale-palette .option-btn {
  flex: 0 0 auto;
  min-width: 40px;
  padding: 0.5rem 0.4rem;
  font-size: 0.95rem;
}

.prompt-area {
  text-align: center;
  margin-bottom: 1.75rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.prompt-label {
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--charcoal);
  color: var(--beige);
  border: none;
  padding: 0.7rem 1.6rem;
  border-radius: 30px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s;
}

.play-btn:hover {
  background: var(--bronze-dark);
  transform: scale(1.03);
}

.play-btn:active {
  transform: scale(0.98);
}

.play-btn.playing {
  background: var(--bronze);
}

/* Answer area */
.answer-area {
  margin-top: 1.5rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.7rem;
}

.option-btn {
  background: var(--beige);
  border: 1.5px solid transparent;
  color: var(--charcoal);
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all var(--transition);
}

.option-btn:hover {
  border-color: var(--bronze);
  background: var(--white);
}

.option-btn.correct {
  background: #E8F0EB;
  border-color: var(--success);
  color: var(--success);
}

.option-btn.incorrect {
  background: #F5E8E8;
  border-color: var(--error);
  color: var(--error);
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

/* Rhythm answer choices – enlarged notation, centered in the button */
.option-btn.rhythm-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 150px;
  padding: 0.55rem 0.3rem;
}

.option-btn.rhythm-choice svg {
  max-height: 130px;
  width: auto;
  max-width: 100%;
}

/* Piano keyboard */
.piano-wrap {
  overflow-x: auto;
  padding: 0.5rem 0 1rem;
  margin: 0.5rem 0 1.25rem;
}

.piano {
  display: flex;
  position: relative;
  height: 140px;
  user-select: none;
  min-width: max-content;
  margin: 0 auto;
}

.piano-key {
  position: relative;
  border: 1px solid #999;
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  transition: background 0.08s;
}

.piano-key.white {
  width: 36px;
  height: 100%;
  background: #f9f7f2;
  z-index: 1;
}

.piano-key.black {
  width: 22px;
  height: 60%;
  background: var(--charcoal);
  margin-left: -11px;
  margin-right: -11px;
  z-index: 2;
}

.piano-key.white:hover { background: #ebe6d9; }
.piano-key.black:hover { background: #444; }

.piano-key.active {
  background: var(--bronze) !important;
}

.piano-key.selected {
  background: var(--bronze-light) !important;
  box-shadow: inset 0 0 0 2px var(--bronze-dark);
}

/* No dots on keys — highlight only */

/* Feedback & score */
.feedback {
  text-align: center;
  margin-top: 1.25rem;
  min-height: 2rem;
  font-size: 1.1rem;
  font-family: "Cormorant Garamond", Georgia, serif;
}

.feedback.correct { color: var(--success); }
.feedback.incorrect { color: var(--error); }

.score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--beige-dark);
  font-size: 0.95rem;
  color: var(--muted);
}

.next-btn {
  background: var(--bronze);
  color: white;
  border: none;
  padding: 0.55rem 1.4rem;
  border-radius: 25px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
}

.next-btn:hover {
  background: var(--bronze-dark);
}

.next-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Construction helpers */
.construction-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.selected-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 2.2rem;
  justify-content: center;
}

.note-chip {
  background: var(--beige);
  border: 1px solid var(--bronze);
  color: var(--charcoal);
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.note-chip button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.action-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 0.55rem 1.2rem;
  border-radius: 25px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--charcoal);
  color: var(--beige);
}

.btn-primary:hover { background: var(--bronze-dark); }

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--beige-dark);
  color: var(--muted);
}

.btn-secondary:hover {
  border-color: var(--bronze);
  color: var(--charcoal);
}

/* About */
.about-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.about-content p {
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.mission-box {
  background: var(--white);
  border-left: 3px solid var(--bronze);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
  text-align: left;
  border-radius: 0 8px 8px 0;
}

.mission-box h4 {
  color: var(--bronze);
  margin-bottom: 0.5rem;
  font-style: italic;
}

/* Footer */
.site-footer {
  background: var(--charcoal);
  color: var(--beige);
  text-align: center;
  padding: 1.75rem 1rem;
  font-size: 0.9rem;
  font-family: "Cormorant Garamond", Georgia, serif;
}

.site-footer .slogan {
  color: var(--bronze);
  margin-bottom: 0.4rem;
  font-size: 1rem;
  font-family: "Cormorant Garamond", Georgia, serif;
}

/* Responsive */
@media (max-width: 700px) {
  .header-inner {
    flex-direction: column;
    gap: 0.75rem;
  }
  .main-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  h1 { font-size: 2.1rem; }
  .hero { padding: 2rem 0.5rem 3rem; }
  .exercise-panel { padding: 1.4rem; }
  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* Staff & notation */
#staff-container svg,
#chord-display svg,
#scale-display svg,
#rhythm-symbol svg {
  max-width: 100%;
  height: auto;
}

@media (max-width: 600px) {
  .logo-img {
    height: 40px;
    max-width: 160px;
  }
  .logo-text {
    font-size: 1.1rem;
  }
}
