/*
 * BrainSync Noise Machine — app.css
 * Dark meditative brand palette, matching player.css tokens exactly.
 */

/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --bg:      #070912;
  --bg2:     #0d1124;
  --card:    #121734;
  --line:    #222a52;
  --text:    #eef1ff;
  --muted:   #a3acd6;
  --accent:  #7c9cff;   /* blue  / white noise */
  --accent2: #5ad1c5;   /* teal  / green noise */
  --focus:   #c79bff;   /* violet / pink noise */
  --brown:   #d4956a;   /* warm orange / brown noise */
  --black-n: #4a5580;   /* dim slate   / black noise */

  --radius-card: 20px;
  --radius-btn:  14px;
}

/* ─── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #141a3a 0%, var(--bg) 55%) no-repeat,
              var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ─── Layout shell ─────────────────────────────────────────────────────────── */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ─── Nav ──────────────────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--line);
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  transition: color .15s;
}
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }

.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 14px var(--accent);
}

.nav-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(124,156,255,.08);
  border: 1px solid rgba(124,156,255,.2);
  border-radius: 9px;
  padding: 6px 12px;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-cta:hover {
  background: rgba(124,156,255,.16);
  border-color: var(--accent);
  color: var(--text);
}
@media (max-width: 480px) { .nav-cta { display: none; } }

/* ─── Main ─────────────────────────────────────────────────────────────────── */
main { flex: 1; padding: 32px 0 48px; }

/* page header */
.page-header {
  text-align: center;
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: clamp(24px, 5.5vw, 36px);
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.1;
}
.page-header h1 .grad {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-header p {
  color: var(--muted);
  font-size: 15px;
  margin-top: 8px;
}

/* ─── Machine card ─────────────────────────────────────────────────────────── */
.machine-card {
  background: linear-gradient(180deg, var(--card), #0c1130);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 26px 24px;
  margin-bottom: 28px;
}

/* ─── Color channels grid ──────────────────────────────────────────────────── */
.channels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 560px) {
  .channels {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
}

.channel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #141839, #0e1330);
  transition: border-color .18s, box-shadow .18s;
  position: relative;
}
.channel.active {
  border-color: var(--c-color, var(--accent));
  box-shadow: 0 0 0 1px var(--c-color, var(--accent)),
              inset 0 1px 0 rgba(255,255,255,.04);
}

/* per-channel color variables */
.channel[data-color="white"]  { --c-color: var(--accent); }
.channel[data-color="pink"]   { --c-color: var(--focus); }
.channel[data-color="brown"]  { --c-color: var(--brown); }
.channel[data-color="green"]  { --c-color: var(--accent2); }
.channel[data-color="black"]  { --c-color: var(--black-n); }

.ch-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex: none;
}
.channel[data-color="white"]  .ch-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.channel[data-color="pink"]   .ch-dot { background: var(--focus);  box-shadow: 0 0 8px var(--focus); }
.channel[data-color="brown"]  .ch-dot { background: var(--brown);  box-shadow: 0 0 8px var(--brown); }
.channel[data-color="green"]  .ch-dot { background: var(--accent2);box-shadow: 0 0 8px var(--accent2); }
.channel[data-color="black"]  .ch-dot { background: var(--black-n);box-shadow: 0 0 6px var(--black-n); }

.ch-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--muted);
}
.channel.active .ch-label { color: var(--c-color, var(--accent)); }

/* Vertical slider */
.ch-slider-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
}

/* Volume slider — vertical orientation */
input[type="range"].vol-slider {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;       /* so higher = top */
  width: 28px;
  height: 80px;
  background: transparent;
  cursor: pointer;
  outline: none;
}
/* Track */
input[type="range"].vol-slider::-webkit-slider-runnable-track {
  width: 4px;
  border-radius: 4px;
  background: var(--line);
}
input[type="range"].vol-slider::-moz-range-track {
  width: 4px;
  border-radius: 4px;
  background: var(--line);
}
/* Thumb */
input[type="range"].vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c-color, var(--accent));
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px var(--c-color, var(--accent));
  margin-left: -7px;  /* centre on track */
  transition: box-shadow .15s;
}
input[type="range"].vol-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c-color, var(--accent));
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px var(--c-color, var(--accent));
}
input[type="range"].vol-slider:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--c-color, var(--accent));
  outline-offset: 2px;
}

.ch-pct {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.channel.active .ch-pct { color: var(--text); }

/* ─── Visualiser ───────────────────────────────────────────────────────────── */
.viz-wrap {
  position: relative;
  margin-bottom: 22px;
  border-radius: 12px;
  overflow: hidden;
  background: #060810;
  border: 1px solid var(--line);
}
#specCanvas {
  display: block;
  width: 100%;
  height: 100px;
}

/* ─── Controls row (play + timer) ──────────────────────────────────────────── */
.controls {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 8px;
}

/* Play / Stop */
.play-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 20px;
  border-radius: var(--radius-btn);
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #06122b;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .2px;
  transition: filter .15s, transform .12s;
}
.play-btn:hover  { filter: brightness(1.08); transform: translateY(-1px); }
.play-btn:active { transform: translateY(0); filter: brightness(.95); }
.play-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.play-btn svg { width: 18px; height: 18px; flex: none; }

/* Timer select */
.timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  min-width: 120px;
}
.timer-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.timer-select {
  background: #0a0e22;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  cursor: pointer;
}
.timer-select:focus { outline: none; border-color: var(--accent); }
.timer-countdown {
  font-size: 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  min-height: 16px;
}

/* ─── Unsupported ──────────────────────────────────────────────────────────── */
.unsupported {
  display: none;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.unsupported h2 { color: var(--text); margin-bottom: 10px; }
body.no-audio .unsupported { display: block; }
body.no-audio .machine-card { display: none; }

/* ─── App upsell strip ─────────────────────────────────────────────────────── */
.upsell {
  background: linear-gradient(135deg, #16204e, #101533);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.upsell p {
  flex: 1;
  font-size: 14px;
  color: var(--muted);
  min-width: 200px;
}
.upsell p strong { color: var(--text); }
.upsell-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.upsell-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #000;
  border: 1px solid #2a2f55;
  border-radius: 11px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .15s, transform .15s;
}
.upsell-badge:hover { border-color: var(--accent); transform: translateY(-1px); }
.upsell-badge svg { width: 18px; height: 18px; flex: none; }

/* ─── Explainer section ────────────────────────────────────────────────────── */
.explainer { margin-bottom: 48px; }
.explainer h2 {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  letter-spacing: -.3px;
  margin-bottom: 20px;
}
.noise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.noise-card {
  background: linear-gradient(180deg, var(--card), #0e1330);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
.noise-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.noise-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
}
.noise-card[data-noise="white"] .noise-card-dot { background: var(--accent); }
.noise-card[data-noise="pink"]  .noise-card-dot { background: var(--focus); }
.noise-card[data-noise="brown"] .noise-card-dot { background: var(--brown); }
.noise-card[data-noise="green"] .noise-card-dot { background: var(--accent2); }
.noise-card[data-noise="black"] .noise-card-dot { background: var(--black-n); }
.noise-card h3 {
  font-size: 15px;
  font-weight: 700;
}
.noise-card p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}
.noise-card .best-for {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  border-radius: 6px;
  padding: 3px 8px;
}

/* ─── FAQ section ──────────────────────────────────────────────────────────── */
.faq-section { margin-bottom: 48px; }
.faq-section h2 {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  letter-spacing: -.3px;
  margin-bottom: 20px;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: linear-gradient(180deg, var(--card), #0e1330);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 18px;
  color: var(--accent);
  flex: none;
  margin-left: 12px;
  transition: transform .2s;
  line-height: 1;
}
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p {
  padding: 0 20px 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.faq-item summary:hover { color: var(--accent); }
.faq-item summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  margin-top: auto;
  text-align: center;
}
.footer-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.footer-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #000;
  border: 1px solid #2a2f55;
  border-radius: 13px;
  padding: 10px 16px;
  min-width: 170px;
  transition: transform .15s, border-color .15s;
}
.footer-badge:hover { transform: translateY(-2px); border-color: var(--accent); }
.footer-badge svg { width: 24px; height: 24px; flex: none; }
.footer-badge .b-sm { font-size: 10.5px; color: #c9cdf0; line-height: 1; }
.footer-badge .b-lg { font-size: 16px; font-weight: 600; line-height: 1.2; }
.footer-fine {
  font-size: 12.5px;
  color: #6b73a0;
  line-height: 1.7;
}
.footer-fine a { color: var(--muted); text-decoration: underline; }

/* ─── Sticky mobile CTA ─────────────────────────────────────────────────────── */
.sticky-cta {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(8,10,22,.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  gap: 10px;
  z-index: 50;
}
.sticky-cta a {
  flex: 1;
  text-align: center;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #06122b;
  font-weight: 700;
  border-radius: 11px;
  padding: 12px;
  font-size: 14px;
  transition: filter .15s;
}
.sticky-cta a:hover { filter: brightness(1.08); }
@media (max-width: 640px) {
  .sticky-cta { display: flex; }
  body { padding-bottom: 66px; }
}

/* ─── Responsive tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .machine-card { padding: 18px 14px; }
  .channels { gap: 5px; }
  .channel { padding: 10px 4px 10px; }
  .ch-label { font-size: 9px; }
  input[type="range"].vol-slider { height: 64px; }
  .controls { flex-wrap: wrap; }
  .timer-wrap { min-width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
}
