@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Base ───────────────────────────────── */
body { font-family: 'Inter', sans-serif; }
code, .mono { font-family: 'JetBrains Mono', monospace; }

/* ── Tiers ──────────────────────────────── */
.tier-a { border-left: 4px solid #3B82F6; }
.tier-b { border-left: 4px solid #10B981; }
.tier-c { border-left: 4px solid #F59E0B; }
.badge-a { background: #EFF6FF; color: #1D4ED8; }
.badge-b { background: #ECFDF5; color: #065F46; }
.badge-c { background: #FFFBEB; color: #92400E; }

/* ── Cards ──────────────────────────────── */
.card { background: white; border-radius: 0.75rem; border: 1px solid #E5E7EB; padding: 2rem; margin-top: 2rem; }

/* ── TOC links ──────────────────────────── */
.toc-link { transition: color 0.15s; }
.toc-link:hover { color: #111827; }

/* ── Copy blocks ────────────────────────── */
.copy-block { background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 6px; padding: 12px 16px; font-size: 14px; line-height: 1.6; }
.char-count { font-size: 11px; font-family: 'JetBrains Mono', monospace; color: #6B7280; }
.ok { color: #059669; }
.warn { color: #D97706; }

/* ── Accordions ─────────────────────────── */
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary .chevron { transform: rotate(180deg); }
.chevron { transition: transform 0.2s; display: inline-block; }

/* ── Scroll offset ──────────────────────── */
.section-anchor { scroll-margin-top: 24px; }

/* ── Print ──────────────────────────────── */
@media print { .no-print { display: none; } }

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════ */

/* Sidebar: hidden by default on mobile, shown as overlay */
.page-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background: white;
  border-right: 1px solid #E5E7EB;
  z-index: 60;
  padding: 1.5rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Backdrop overlay */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-toggle:hover {
  background: #F3F4F6;
}

/* On desktop: inline sidebar (default Tailwind behavior) */
@media (min-width: 1024px) {
  .page-sidebar {
    position: static;
    width: 14rem;
    max-width: none;
    background: transparent;
    border-right: none;
    z-index: auto;
    padding: 0;
    transform: none;
    transition: none;
  }

  .sidebar-backdrop {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .page-layout {
    flex-direction: row !important;
  }
}

/* On mobile: stack layout vertically */
@media (max-width: 1023px) {
  .page-layout {
    flex-direction: column !important;
  }

  .card {
    padding: 1.25rem;
    margin-top: 1rem;
  }

  /* Stack all grids */
  .responsive-grid,
  [class*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Header: simpler on mobile */
  .page-header-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Body padding */
  .page-body {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 1rem !important;
    padding-bottom: 2rem !important;
    gap: 0 !important;
  }

  /* Metrics: 2x2 on mobile instead of 4-across */
  .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Copy block grid: stack */
  .copy-grid {
    grid-template-columns: 1fr !important;
  }

  /* Checklist: stack */
  .checklist-grid {
    grid-template-columns: 1fr !important;
  }

  /* Tables: allow horizontal scroll */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr !important;
  }
}
