/* Musical Sifu — Static mockup
   Warm, jazz-club inspired palette. Serif + sans pair. */

:root {
  --bg: #1a1410;
  --surface: #251e18;
  --text: #f5efe6;
  --text-muted: #b8a99a;
  --accent: #d4a84b;
  --accent-dim: #9a7b36;
}

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

html, body {
  min-height: 100%;
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

html {
  font-size: 100%;
}

.page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page--wide {
  max-width: 72rem;
}

.site-branding {
  min-width: 0;
  flex-shrink: 0;
}

/* Site-wide nav */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(212, 168, 75, 0.2);
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header nav {
  margin-left: auto;
}

.site-header .language-switcher {
  order: 3;
  margin-left: 0.5rem;
  align-self: flex-start;
  flex-shrink: 0;
  position: relative;
}

.language-switcher__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(212, 168, 75, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--accent);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.language-switcher__trigger:hover,
.language-switcher__trigger:focus-visible {
  border-color: var(--accent);
  background: rgba(212, 168, 75, 0.12);
  color: var(--text);
  outline: none;
}

.language-switcher__flag {
  color: inherit;
  line-height: 1;
}

.language-switcher__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid rgba(212, 168, 75, 0.25);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.language-switcher__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.language-switcher__option:hover,
.language-switcher__option:focus-visible {
  background: rgba(212, 168, 75, 0.12);
  outline: none;
}

.language-switcher__option-flag {
  font-size: 1.1rem;
  line-height: 1;
}

.site-header .language-select {
  align-self: center;
  flex-shrink: 0;
}

.site-header a {
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.language-select {
  min-width: 6.5rem;
  width: auto;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
}

/* Hamburger toggle — visible only on mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  color: var(--accent);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 6px;
}

.nav-toggle:hover {
  background: rgba(212, 168, 75, 0.12);
}

.nav-toggle[aria-expanded="true"] {
  background: rgba(212, 168, 75, 0.15);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  list-style: none;
  flex-shrink: 0;
  align-items: center;
}

.site-nav a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.site-nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.nav-bass-scale-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
}

.nav-bass-scale-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(245, 239, 230, 0.45);
  text-decoration: none;
}

a.nav-bass-scale-label:hover,
a.nav-bass-scale-label:focus {
  color: var(--accent);
}

.nav-bass-scale-select {
  font-size: 0.78rem;
  font-family: inherit;
  max-width: 11rem;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(212, 168, 75, 0.25);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.nav-bass-scale-select:hover,
.nav-bass-scale-select:focus {
  border-color: rgba(212, 168, 75, 0.45);
  color: var(--accent);
  outline: none;
}

.nav-bass-scale-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

li.nav-bass-scale-item[aria-current="page"] .nav-bass-scale-select {
  color: var(--accent);
  border-color: rgba(212, 168, 75, 0.4);
}

/* Admin dropdown */
.nav-admin {
  position: relative;
}

.nav-admin-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}

.nav-admin-trigger:hover {
  color: var(--accent);
}

.nav-admin-trigger[aria-expanded="true"] {
  color: var(--accent);
}

.nav-admin-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.35rem;
  min-width: 10rem;
  padding: 0.4rem 0;
  background: var(--surface);
  border: 1px solid rgba(212, 168, 75, 0.2);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  list-style: none;
  z-index: 100;
}

.nav-admin-menu[hidden] {
  display: none;
}

.nav-admin-menu a {
  display: block;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-admin-menu a:hover {
  background: rgba(212, 168, 75, 0.1);
  color: var(--accent);
}

.nav-admin-menu a[aria-current="page"] {
  color: var(--accent);
  font-weight: 500;
}

/* Auth nav items */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-user {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}

.nav-admin-link,
.nav-logout {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.2s;
  cursor: pointer;
}

.nav-admin-link:hover,
.nav-logout:hover {
  color: var(--accent);
}

/* Mobile nav */
@media (max-width: 640px) {
  .nav-toggle {
    display: none;
  }

  .site-header {
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-branding {
    order: 1;
  }

  .site-header .language-switcher {
    order: 2;
    margin-left: auto;
    align-self: center;
  }

  .language-switcher__trigger {
    width: 0.9rem;
    height: 0.9rem;
    font-size: 0.5rem;
    border-radius: 2px;
  }

  .site-header nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: var(--surface);
    border: 1px solid rgba(212, 168, 75, 0.2);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    z-index: 50;
  }

  .site-nav > li {
    border-bottom: none;
  }

  .site-nav a,
  .nav-auth {
    padding: 0.4rem 0.7rem;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
  }

  .nav-admin {
    border-bottom: none;
    width: 100%;
  }

  .nav-admin-trigger {
    width: 100%;
    justify-content: center;
    padding: 0.4rem 0.7rem;
    text-align: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
  }

  .nav-admin-menu {
    position: static;
    margin: 0;
    margin-top: 0.35rem;
    padding: 0.4rem 0;
    width: 100%;
    border: 1px solid rgba(212, 168, 75, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    background: var(--surface);
  }

  .nav-admin-menu[hidden] {
    display: none;
  }

  .nav-admin.expanded .nav-admin-menu {
    display: block;
  }

  .nav-admin-menu a {
    padding: 0.45rem 1rem;
    border-radius: 0;
    background: transparent;
  }

  .nav-auth {
    padding: 0;
    background: transparent;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .nav-auth a {
    padding: 0.4rem 0.7rem;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
  }

  .nav-auth .nav-user {
    padding: 0.2rem 0.1rem;
  }
}

@media (max-width: 420px) {
  .site-header {
    padding: 1rem 0;
  }

  .site-nav {
    gap: 0.35rem;
    padding: 0.45rem;
  }

  .site-nav a,
  .nav-auth,
  .nav-auth a,
  .nav-admin-trigger {
    font-size: 0.8rem;
    padding: 0.35rem 0.58rem;
  }

  .nav-user {
    font-size: 0.8rem;
  }
}

@media (max-width: 360px) {
  .site-logo {
    font-size: 1.2rem;
  }

  .site-tagline {
    font-size: 0.72rem;
  }

  .site-nav {
    gap: 0.3rem;
    padding: 0.4rem;
  }

  .site-nav a,
  .nav-auth,
  .nav-auth a,
  .nav-admin-trigger {
    font-size: 0.76rem;
    padding: 0.3rem 0.52rem;
    letter-spacing: 0.02em;
  }

  .site-nav a,
  .nav-auth a {
    white-space: nowrap;
  }
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.site-logo {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.site-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Principle */
.principle {
  padding: 1.5rem 0;
  border-top: 1px solid rgba(212, 168, 75, 0.2);
}

.principle h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dim);
  margin-bottom: 0.5rem;
}

.principle p {
  color: var(--text-muted);
  max-width: 42ch;
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* Flow */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1rem;
  padding: 2rem 0;
}

.flow-step {
  flex: 1 1 12rem;
  min-width: 10rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.flow-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.flow-step p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.flow-step em {
  font-style: italic;
  color: var(--text);
  font-size: 0.85rem;
}

.flow-arrow {
  display: flex;
  align-items: center;
  color: var(--accent-dim);
  font-size: 1.25rem;
}

@media (max-width: 640px) {
  .flow-arrow {
    width: 100%;
    justify-content: center;
    transform: rotate(90deg);
  }
}

/* Context */
.context {
  padding: 1.5rem 0;
  border-top: 1px solid rgba(212, 168, 75, 0.2);
}

.context h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dim);
  margin-bottom: 0.5rem;
}

.context p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-size: 1rem;
  line-height: 1.65;
}

.context-list {
  list-style: none;
}

.context-list li {
  display: inline-block;
  margin: 0.25rem 0.5rem 0.25rem 0;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Site footer — shared across pages (symmetric with .site-header border) */
.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(212, 168, 75, 0.2);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 0.5rem;
}

.site-footer__brand {
  font-weight: 600;
  color: var(--text);
}

.site-footer__page-label {
  color: var(--text-muted);
}

.site-footer__note {
  font-size: 0.8rem;
  color: var(--accent-dim);
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

/* Tool-style pages: quieter footer on small screens */
@media (max-width: 640px) {
  .page--tool .site-footer {
    margin-top: 1.25rem;
    padding-top: 0.65rem;
    font-size: 0.72rem;
    line-height: 1.45;
    border-top-color: rgba(212, 168, 75, 0.12);
    opacity: 0.88;
  }
}

.footer-build-number {
  display: inline-block;
  margin-left: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.28);
  background: rgba(212, 168, 75, 0.06);
  color: var(--accent-dim);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Practice */
.practice {
  padding: 1.5rem 0;
  border-top: 1px solid rgba(212, 168, 75, 0.2);
}

.practice h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dim);
  margin-bottom: 0.75rem;
}

.practice-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.practice-list li {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 10rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.practice-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.practice-value {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}

/* CTA */
.cta {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.9375rem;
  color: var(--accent-dim);
  line-height: 1.65;
}

/* Page structure (Explore, Video Coach) */
.header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(212, 168, 75, 0.2);
  margin-bottom: 2rem;
}

.header h1 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header h1 span {
  color: var(--accent);
}

.header p {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.4fr);
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid rgba(212, 168, 75, 0.18);
  padding: 1.25rem 1.5rem;
}

.panel h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-dim);
  margin-bottom: 0.7rem;
}

.panel .tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.hm-graphs-panel {
  margin-bottom: 1rem;
}

.hm-graphs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.hm-shapes-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hm-shapes-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.hm-shapes-legend .legend-root {
  color: #b999ff;
}

.hm-shapes-legend .legend-guide {
  color: #f5c35f;
}

.hm-shapes-legend .legend-chord {
  color: #59b5ff;
}

.hm-shapes-legend .legend-tension {
  color: #cfd8dc;
}

.hm-shape-card {
  position: relative;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(212, 168, 75, 0.2);
  border-radius: 8px;
  padding: 0.6rem;
  cursor: zoom-in;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.hm-shape-card:hover {
  border-color: rgba(245, 195, 95, 0.38);
}

.hm-shape-card--area-of-week {
  position: relative;
  border-color: rgba(245, 195, 95, 0.72);
  box-shadow: inset 0 0 0 1px rgba(245, 195, 95, 0.24);
}

.hm-shape-card--area-of-week::after {
  content: "";
  position: absolute;
  top: 0.48rem;
  right: 0.48rem;
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 999px;
  background: #f5c35f;
  box-shadow: 0 0 0 3px rgba(245, 195, 95, 0.18);
}

.hm-shape-card--fullscreen {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
  right: calc(env(safe-area-inset-right, 0px) + 0.5rem);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.5rem);
  left: calc(env(safe-area-inset-left, 0px) + 0.5rem);
  z-index: 1200;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(16, 12, 10, 0.98);
  border-color: rgba(245, 195, 95, 0.78);
  box-shadow: 0 0 0 1px rgba(245, 195, 95, 0.22), 0 24px 72px rgba(0, 0, 0, 0.62);
  cursor: zoom-out;
  overflow: hidden;
  max-height: none;
  padding: 1rem;
}

.hm-shape-card--fullscreen h4 {
  margin-bottom: 0.5rem;
  text-align: center;
  font-size: 1rem;
}

.hm-shape-card--fullscreen .hm-shape-graph {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.hm-shape-card--fullscreen .hm-shape-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  display: block;
}

body.hm-card-fullscreen-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .hm-shape-card--fullscreen {
    top: calc(env(safe-area-inset-top, 0px) + 0.35rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.35rem);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.35rem);
    left: calc(env(safe-area-inset-left, 0px) + 0.35rem);
    border-radius: 10px;
    padding: 0.75rem;
  }

  .hm-shape-card--fullscreen h4 {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
  }
}

@media (max-height: 700px) {
  .hm-shape-card--fullscreen {
    top: calc(env(safe-area-inset-top, 0px) + 0.2rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.2rem);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.2rem);
    left: calc(env(safe-area-inset-left, 0px) + 0.2rem);
    padding: 0.5rem;
  }
}

.hm-shape-card h4 {
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.hm-shape-svg {
  width: 100%;
  height: auto;
}

/* Form elements */
label {
  display: block;
  margin-top: 0.7rem;
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 75, 0.18);
  background: #2e2520;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "DM Sans", sans-serif;
}

textarea {
  resize: vertical;
  min-height: 70px;
}

input[type="number"] {
  width: 80px;
  padding: 0.3rem 0.4rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(212, 168, 75, 0.4);
}

.hint {
  font-size: 0.75rem;
  color: var(--accent-dim);
  margin-top: 0.15rem;
}

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: var(--bg);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-dim);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(212, 168, 75, 0.3);
  color: var(--accent);
}

.btn-ghost:hover {
  background: rgba(212, 168, 75, 0.1);
}

/* Legacy alias — use .site-footer in markup */
.page-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(212, 168, 75, 0.2);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
}
