/* ============================================
   EDITOR DE PARTITURAS — Responsive
   ============================================ */

/* ── Mobile menu button (hidden on desktop by default) ── */
.mobile-menu-btn {
  display: none;
}

/* ── Tablet (≤ 1024px) ── */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 56px;
    --header-height: 52px;
  }

  .header-nav .nav-link span {
    display: none;
  }

  .header-title-input {
    min-width: 140px;
  }

  .score-container {
    min-width: unset;
    padding: var(--space-6);
  }

  .transport-info {
    display: none;
  }

  .bpm-slider {
    width: 80px;
  }

  .page-content {
    padding: var(--space-6) var(--space-4);
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .article-nav {
    flex-direction: column;
  }

  .article-nav-link {
    max-width: 100%;
  }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  :root {
    --header-height: 48px;
    --transport-height: 64px;
  }

  #app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "transport";
  }

  /* Sidebar como drawer lateral */
  #sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: var(--transport-height);
    width: 220px;
    z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-xl);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-overlay) - 1);
  }

  #sidebar.open ~ .sidebar-overlay {
    display: block;
  }

  /* Header mobile */
  .header-center {
    display: none;
  }

  .hide-mobile {
    display: none !important;
  }

  .mobile-only-item {
    display: block !important;
  }

  .mobile-only-inline {
    display: inline-block !important;
  }

  .header-nav {
    display: none;
  }

  .header-title-input {
    min-width: 100px;
    font-size: var(--fs-sm);
  }

  /* Mobile menu button */
  .mobile-menu-btn {
    display: flex;
  }

  .mobile-nav-item {
    display: flex;
  }

  /* Transport bar mobile */
  #transport {
    gap: var(--space-3);
    padding: 0 var(--space-3);
  }

  .transport-bpm .bpm-label {
    display: none;
  }

  .bpm-slider {
    width: 60px;
  }

  .transport-btn {
    width: 36px;
    height: 36px;
  }

  .transport-btn.play-btn {
    width: 42px;
    height: 42px;
  }

  /* Editor */
  .editor-area {
    padding: var(--space-3);
  }

  .score-container {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    min-width: unset;
  }

  /* Pages */
  .page-content {
    padding: var(--space-5) var(--space-4);
  }

  .page-hero h1 {
    font-size: var(--fs-2xl);
  }

  .page-hero p {
    font-size: var(--fs-base);
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .credits-grid {
    grid-template-columns: 1fr;
  }

  .learn-categories {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-2);
    -webkit-overflow-scrolling: touch;
  }

  .category-tab {
    flex-shrink: 0;
  }

  /* Zoom controls */
  .zoom-controls {
    bottom: calc(var(--transport-height) + var(--space-2));
    right: var(--space-2);
  }

  /* Typography scale down */
  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
  h3 { font-size: var(--fs-lg); }
}

/* ── Small Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  .page-content {
    padding: var(--space-4) var(--space-3);
  }

  .bpm-value {
    font-size: var(--fs-base);
  }

  .bpm-slider {
    width: 50px;
  }
}

/* ── Desktop Large (≥ 1440px) ── */
@media (min-width: 1440px) {
  :root {
    --content-max-width: 1000px;
  }
}

/* ── Print ── */
@media print {
  #header,
  #sidebar,
  #transport,
  .zoom-controls {
    display: none !important;
  }

  #app {
    display: block;
  }

  .score-container {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}

