/* ============================================
   BPM Finder — style.css
   Design: dark hardware-panel aesthetic
   ============================================ */

:root {
  --bg: #14161a;
  --card: #1c2027;
  --card-hover: #23272f;
  --text: #e8eaed;
  --text-muted: #8b929c;
  --accent: #ff5c2b;
  --accent2: #22d3a6;
  --radius: 6px;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Header ---- */
.site-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.site-logo {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.site-logo:hover {
  color: var(--text);
}

/* ---- Main ---- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  width: 100%;
  flex: 1;
}

h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

/* ---- Tool Area / Cover ---- */
#toolCover,
#toolProgress,
#toolError {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex: 1;
}

.hidden {
  display: none !important;
}

/* ---- Dual-mode grid ---- */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mode-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem;
  min-height: 230px;
  display: flex;
  flex-direction: column;
}

.mode-title {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0.5rem;
  margin-bottom: 0.875rem;
}

/* Trust badges line */
.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.trust-badges span {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent2);
  border: 1px solid rgba(34, 211, 166, 0.3);
  border-radius: 3px;
  padding: 0.15em 0.5em;
}

/* Upload zone inside mode card */
.mode-card .drop-zone {
  max-width: none;
  padding: 1.5rem 1rem;
}

/* Big tap button */
.tap-btn-big {
  width: 100%;
  font-size: 2.25rem;
  line-height: 1.1;
  padding: 1.5rem 1rem;
  margin: 0 auto;
  max-width: 280px;
}

.tap-btn-sub {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.tap-controls {
  text-align: center;
  margin-top: 0.75rem;
}

/* Secondary mode card (tap tempo) — visually de-emphasized */
.mode-secondary {
  opacity: 0.85;
}

/* Related tools list */
.related-list {
  list-style: none;
  padding: 0;
}

.related-list li {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.related-list a {
  color: var(--accent2);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}

.related-list a:hover {
  color: var(--text);
}

/* ---- Tap-tool panel (inner pages) ---- */
.tap-tool-panel {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* ---- BPM Counter specific ---- */
.counter-instructions {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 400px;
}

.counter-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.counter-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.counter-select {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: var(--card-hover);
  color: var(--text);
}

.counter-status {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.counter-status strong {
  color: var(--accent);
}

/* ---- Tap-link (homepage) ---- */
.tap-link {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tap-link a {
  color: var(--accent2);
  font-weight: 500;
  text-decoration: none;
}

.tap-link a:hover {
  color: var(--text);
}

/* Cover */
.drop-zone {
  position: relative;
  width: 100%;
  max-width: 400px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(255, 92, 43, 0.06);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone .drop-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.drop-zone .drop-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.drop-zone .drop-label strong {
  color: var(--accent);
}

.format-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Progress */
.progress-bar-wrap {
  width: 100%;
  max-width: 360px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-stage {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Error message */
.error-msg {
  color: var(--accent);
  font-size: 0.9375rem;
  text-align: center;
  max-width: 360px;
}

/* ---- Results Panel (shared, below the mode grid) ---- */
.tool-results-panel {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1rem;
}

/* BPM readout — signature hardware panel */
.bpm-readout {
  width: 100%;
  max-width: 340px;
  margin: 0 auto 1rem;
  padding: 1rem 0;
  position: relative;
  text-align: center;
}

.bpm-tick-top,
.bpm-tick-bottom {
  display: block;
  width: 100%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--text-muted) 0,
    var(--text-muted) 1px,
    transparent 1px,
    transparent 8px
  );
  opacity: 0.3;
}

.bpm-number {
  font-family: var(--font-heading);
  font-size: 5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0.5rem 0;
  color: var(--accent);
}

.bpm-unit {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
}

/* Result details grid */
.result-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
  width: 100%;
  max-width: 340px;
  margin: 0 auto 1.25rem;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.result-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.result-value {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.result-value.camelot {
  color: var(--accent2);
}

/* Confidence badge */
.confidence-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15em 0.5em;
  border-radius: 3px;
}

.confidence-badge.high {
  background: rgba(34, 211, 166, 0.15);
  color: var(--accent2);
}

.confidence-badge.medium {
  background: rgba(255, 183, 77, 0.15);
  color: #ffb74d;
}

.confidence-badge.low {
  background: rgba(255, 92, 43, 0.15);
  color: var(--accent);
}

/* Action buttons */
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 1rem;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  background: var(--card-hover);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}

.btn:active {
  background: rgba(255,255,255,0.04);
}

.btn-accent {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-accent:hover {
  background: rgba(255, 92, 43, 0.12);
}

.btn-accent2 {
  border-color: var(--accent2);
  color: var(--accent2);
}

.btn-accent2:hover {
  background: rgba(34, 211, 166, 0.12);
}

/* Tap tempo area */
.tap-area {
  text-align: center;
  margin-bottom: 0.75rem;
}

.tap-btn {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border: 2px solid var(--accent2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent2);
  cursor: pointer;
  transition: background var(--transition), transform 0.08s ease;
  user-select: none;
  -webkit-user-select: none;
}

.tap-btn:hover {
  background: rgba(34, 211, 166, 0.08);
}

.tap-btn:active {
  transform: scale(0.96);
  background: rgba(34, 211, 166, 0.15);
}

.tap-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ---- BPM genre table ---- */
.bpm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin: 0.75rem 0;
}

.bpm-table th,
.bpm-table td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.bpm-table th {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.bpm-table td {
  color: var(--text-muted);
}

.bpm-table td:first-child {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.bpm-table tbody tr.row-hit {
  background: rgba(34, 211, 166, 0.08);
  border-left: 2px solid var(--accent2);
}

.bpm-table tbody tr.row-hit td {
  color: var(--accent2);
  font-weight: 600;
}

/* Low confidence warning */
.low-conf-warn {
  font-size: 0.75rem;
  color: var(--accent);
  text-align: center;
  margin: 0.5rem 0 0;
  width: 100%;
}

/* ---- Info Sections ---- */
.info-section {
  margin-bottom: 2rem;
}

.info-section h2 {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.75rem;
}

.info-section p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

/* Numbered steps */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--accent);
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: 50%;
}

/* ---- FAQ ---- */
.faq-section details {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--card);
}

.faq-section summary {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-section summary::after {
  content: '+';
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.faq-section details[open] summary::after {
  transform: rotate(45deg);
}

.faq-section summary:hover {
  background: var(--card-hover);
  border-radius: var(--radius);
}

.faq-section .faq-answer {
  padding: 0 1rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 2rem 1.5rem;
}

.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.footer-col h3 {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.25rem;
}

.footer-col a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--text);
}

.footer-copy {
  max-width: 720px;
  margin: 1rem auto 0;
  font-size: 0.6875rem;
  color: var(--text-muted);
  opacity: 0.6;
}

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

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  main {
    padding: 1.25rem 1rem 3rem;
  }

  h1 {
    font-size: 1.375rem;
  }

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

  .bpm-number {
    font-size: 3.5rem;
  }

  .result-details {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  .result-actions {
    max-width: 100%;
  }

  .tool-results-panel {
    padding: 1.5rem 1rem;
  }

  .drop-zone {
    padding: 1.5rem 0.75rem;
  }

  .bpm-table th,
  .bpm-table td {
    padding: 0.35rem 0.5rem;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }
}
