/* =============================================================
   Base styles — shared by all pages
   ============================================================= */

body {
  background: linear-gradient(to right, #ff7e5f, #feb47b);
  font-family: "Montserrat", sans-serif;
  margin: 0;
  padding: 20px;
  color: #333;
  text-align: center;
}

h1 {
  color: #fff;
  margin-bottom: 30px;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
}

/* =============================================================
   Navbar (moved from navbar.html inline styles)
   ============================================================= */

nav.navbar {
  background: linear-gradient(135deg, #ff6f61, #ffba08);
  padding: 15px 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

nav.navbar ul.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

nav.navbar ul.nav-menu li {
  margin: 0 15px;
}

nav.navbar ul.nav-menu li a {
  text-decoration: none;
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 20px;
  padding: 10px 15px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

nav.navbar ul.nav-menu li a:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
}

/* =============================================================
   Wheel selectors (Keys & Modes page)
   ============================================================= */

.wheel-container {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin-bottom: 40px;
}

.wheel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-btn {
  background: #4CAF50;
  border: none;
  color: white;
  padding: 10px;
  cursor: pointer;
  font-size: 18px;
  border-radius: 4px;
  width: 60px;
  margin: 5px 0;
}

.wheel-btn:hover {
  background: #45a049;
}

.wheel-display {
  width: 100px;
  height: 50px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  position: relative;
}

.wheel-display.chord-display {
  width: 150px;
}

.wheel-list {
  transition: transform 0.3s ease-in-out;
}

.wheel-item {
  height: 50px;
  line-height: 50px;
  font-weight: bold;
  font-size: 20px;
}

#scale-display {
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  margin-bottom: 40px;
}

/* =============================================================
   Piano keyboard styles
   ============================================================= */

.keyboard {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 10px;
}

.chordboard {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  margin: 0;
}

.chordboard .key.black {
  align-self: flex-start;
}

/* Instrument toggle (chords page) */
.instrument-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 30px auto 0;
  position: relative;
}

.instrument-selector input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.instrument-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

.instrument-switch label {
  flex: 1;
  padding: 8px 26px;
  text-align: center;
  cursor: pointer;
  z-index: 1;
  user-select: none;
  transition: color 160ms ease;
}

.slider-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  right: calc(50% + 4px);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  transition: left 280ms cubic-bezier(0.4, 0, 0.2, 1), right 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

#instrument-guitar:checked~.instrument-switch .slider-indicator {
  left: calc(50% + 4px);
  right: 4px;
}

#instrument-piano:checked~.instrument-switch label[for="instrument-piano"],
#instrument-guitar:checked~.instrument-switch label[for="instrument-guitar"] {
  color: #222;
}

.instrument-stage {
  position: relative;
  width: 100%;
  min-height: 300px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

#instrument-piano:checked~.instrument-stage {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  border-radius: 0;
}

#instrument-guitar:checked~.instrument-stage {
  width: fit-content;
}

.instrument-panel {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 24px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(0) scale(0.96);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 220ms ease;
}

.instrument-panel.fretboard {
  inset: auto;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  color: #363636;
  transform: translateX(18%) scale(0.94);
  padding: 12px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* =============================================================
   Fretboard (guitar)
   ============================================================= */

.fretboard {
  --cell-w: 72px;
  --cell-h: 44px;
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto auto;
  gap: 0 8px;
  justify-content: center;
}

.fretboard-labels {
  display: grid;
  grid-template-rows: repeat(6, var(--cell-h));
  align-items: center;
  justify-items: end;
  padding-right: 8px;
  font-weight: 600;
  color: #555;
}

.fretboard-open {
  display: grid;
  grid-template-rows: repeat(6, var(--cell-h));
  align-items: center;
  justify-items: center;
  font-weight: 600;
  color: #555;
}

.fretboard-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(15, var(--cell-w));
  grid-template-rows: repeat(6, var(--cell-h));
  border-left: 6px solid #1f1f1f;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.fretboard-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to right, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px var(--cell-w));
  pointer-events: none;
}

.fretboard-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--cell-h) - 2px), rgba(0, 0, 0, 0.32) calc(var(--cell-h) - 2px) var(--cell-h));
  pointer-events: none;
}

.fretboard-cell {
  display: grid;
  place-items: center;
  padding: 0 6px;
  font-size: 14px;
  color: #222;
  text-align: center;
  z-index: 1;
  user-select: none;
  cursor: pointer;
}

.fretboard-grid [data-fret="12"] {
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.35);
}

.fretboard-cell.highlight,
.fretboard-cell.key-highlight {
  border-radius: 50%;
}

.fretboard-numbers {
  grid-column: 3;
  display: grid;
  grid-template-columns: repeat(15, var(--cell-w));
  justify-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  padding-top: 6px;
}

#instrument-piano:checked~.instrument-stage .chordboard {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1.02);
  z-index: 2;
}

#instrument-guitar:checked~.instrument-stage .instrument-panel.fretboard {
  position: relative;
}

#instrument-guitar:checked~.instrument-stage .fretboard {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1.02);
  z-index: 2;
}

#instrument-guitar:checked~.instrument-stage .chordboard {
  transform: translateX(-24%) scale(0.94);
}

#instrument-piano:checked~.instrument-stage .fretboard {
  transform: translateX(24%) scale(0.92);
}

/* =============================================================
   Key layout
   ============================================================= */

.chordbody {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.C-E {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.F-B {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.key {
  width: 60px;
  height: 200px;
  border: 1px solid #000;
  background: white;
  text-align: center;
  line-height: 340px;
  font-weight: bold;
  color: black;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.2s;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  position: relative;
}

.key:active {
  transform: scale(0.95);
  animation: pressGlow 0.5s forwards;
}

.chord-key.black {
  margin-top: 0%;
  padding-top: 0%;
}

.key.black {
  width: 40px;
  height: 130px;
  background: black;
  color: white;
  margin-left: -20px;
  margin-right: -20px;
  z-index: 1;
  line-height: 20px;
}

.key-black-text {
  margin-top: 80px;
}

/* =============================================================
   Chord page grid of buttons
   ============================================================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  max-width: 600px;
  margin: 20px auto;
}

.grid-button {
  border-radius: 6px;
  padding: 10px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.3);
}

.chord-output {
  margin-top: 20px;
  font-size: 18px;
  text-align: center;
}

/* =============================================================
   Highlight / glow animations
   ============================================================= */

/* Blue glow for scale highlights */
@keyframes regGlow {
  from {
    box-shadow: none;
  }

  to {
    background: rgb(70, 187, 216);
  }
}

.highlight {
  animation: regGlow 0.5s forwards;
}

@keyframes pressGlow {
  from {
    box-shadow: none;
  }

  to {
    background: rgb(6, 225, 10);
  }
}

.presslight {
  animation: pressGlow 0.5s forwards;
}

@keyframes keyGlow {
  from {
    box-shadow: none;
  }

  to {
    background: rgb(69, 160, 73);
  }
}

.key-highlight {
  animation: keyGlow 0.5s forwards;
}

/* =============================================================
   Page layout utilities (about, references, etc.)
   ============================================================= */

:root {
  --page-max-width: 1100px;
  --page-padding-inline: clamp(16px, 5vw, 56px);
  --page-padding-block: clamp(32px, 8vw, 96px);
  --page-stack-gap: clamp(20px, 4vw, 32px);
  --reading-width: 68ch;
  --surface-bg: rgba(255, 255, 255, 0.85);
  --surface-border: rgba(255, 255, 255, 0.55);
  --surface-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
}

.page {
  max-width: var(--page-max-width);
  width: min(var(--page-max-width), 100%);
  margin: 0 auto;
  padding: var(--page-padding-block) var(--page-padding-inline);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--page-stack-gap);
  align-items: center;
  text-align: left;
}

.page-header {
  display: grid;
  gap: clamp(12px, 2vw, 20px);
  width: 100%;
  max-width: var(--reading-width);
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3rem);
  color: #ffffff;
}

.page-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

.content-stack {
  display: grid;
  width: 100%;
  gap: var(--page-stack-gap);
}

.reading-width {
  max-width: var(--reading-width);
}

.surface {
  width: 100%;
  background: var(--surface-bg);
  color: #222222;
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  box-shadow: var(--surface-shadow);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
  padding: clamp(20px, 4vw, 36px);
}

.surface.reading-width {
  max-width: var(--reading-width);
}

.content-stack>* {
  margin: 0;
}

.content-stack ul,
.content-stack ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.45rem;
}

.content-stack ul ul,
.content-stack ol ol {
  margin-top: 0.45rem;
}

.page a {
  color: #1b3dd1;
  font-weight: 600;
  text-decoration: underline;
}

.page a:hover,
.page a:focus {
  color: #122a8a;
}

.auto-grid {
  display: grid;
  gap: var(--page-stack-gap);
}

@media (min-width: 768px) {
  .auto-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .page {
    padding-inline: clamp(32px, 6vw, 80px);
  }
}

@media (min-width: 1080px) {
  .page {
    max-width: 1200px;
  }
}