/* ============================================================
   White Noise & Co — styles
   Dependency-free. Dark theme, colour-coded 10-band mixer.
   ============================================================ */

/* ---- Fonts ---- */
@font-face { font-family:'Figtree'; src:url('../assets/fonts/figtree-v9-latin-300.woff2') format('woff2'); font-weight:300; font-style:normal; font-display:swap; }
@font-face { font-family:'Figtree'; src:url('../assets/fonts/figtree-v9-latin-300italic.woff2') format('woff2'); font-weight:300; font-style:italic; font-display:swap; }
@font-face { font-family:'Figtree'; src:url('../assets/fonts/figtree-v9-latin-regular.woff2') format('woff2'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'Figtree'; src:url('../assets/fonts/figtree-v9-latin-italic.woff2') format('woff2'); font-weight:400; font-style:italic; font-display:swap; }
@font-face { font-family:'Figtree'; src:url('../assets/fonts/figtree-v9-latin-500.woff2') format('woff2'); font-weight:500; font-style:normal; font-display:swap; }

/* ---- Design tokens ---- */
:root{
  --bg:            #121212;
  --panel:         rgba(25,25,25,0.60);
  --panel-border:  #555;
  --text:          rgb(190,189,182);
  --text-dim:      rgb(143,142,137);
  --text-faint:    rgb(107,107,103);
  --text-bright:   rgb(253,252,243);
  --accent:        rgb(60,204,228);
  --accent-ink:    #062a30;
  --orange:        rgb(255,85,50);
  --ctl:           rgba(131,130,126,0.5);
  --radius:        10px;
  --gap:           10px;
  --maxw:          760px;
}

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

html{ background:var(--bg); font-size:15px; -webkit-text-size-adjust:100%; }
body{
  font-family:Figtree, system-ui, Arial, sans-serif;
  font-weight:300;
  color:var(--text);
  min-height:100vh;
  overflow-x:hidden;
  line-height:1.4;
}

/* ---- Background ---- */
.bg, .bg-mask{
  position:fixed; inset:0 0 auto 0; height:min(72vh,640px);
  z-index:0; pointer-events:none;
  /* fade the whole layer out toward the bottom so there is no hard seam */
  -webkit-mask-image:linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
          mask-image:linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
}
.bg{
  background:var(--bg) center/cover no-repeat;
  background-image:url('../assets/img/bg.jpg');
  filter:blur(14px);
  opacity:0;
  transform:translateZ(0) scale(1.06);   /* scale hides blur bleed at the edges */
  transition:opacity 1.2s ease-out;
}
.bg.ready{ opacity:.85; }
.bg-mask{
  background:url('../assets/img/bg_mask.png') center/cover no-repeat;
  z-index:1;
}

/* ---- Layout ---- */
.app{
  position:relative;
  z-index:2;
  max-width:var(--maxw);
  margin:0 auto;
  padding:24px 16px 64px;
  text-align:center;
}
.app-header{ margin:12px 0 4px; }
.title{
  color:var(--text-bright);
  font-weight:400;
  font-size:2.1rem;
  line-height:1.1;
}
.title-accent{ color:#fff; font-weight:500; }
.tagline{ color:var(--text-dim); font-size:1.05rem; padding:6px 0 0; }

/* ---- Mixer ---- */
.mixer{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:6px 4px;
  max-width:440px;
  margin:26px auto 14px;
}
.slider{
  position:relative;
  width:34px;
  height:150px;
  display:flex;
  justify-content:center;
  touch-action:none;
  cursor:pointer;
  outline:none;
  transition:opacity .25s;
}
.slider.dim{ opacity:.32; }
.slider-track{
  position:relative;
  width:12px;
  height:100%;
  border-radius:10px;
  background:var(--ctl);
  overflow:visible;
}
.slider-fill{
  position:absolute;
  left:0; bottom:0; width:100%;
  border-radius:10px;
  background:transparent;
}
.slider-handle{
  position:absolute;
  left:50%;
  width:30px; height:30px;
  border-radius:50%;
  transform:translate(-50%,50%);   /* bottom is the anchor */
  border:2px solid var(--ctl);
  background-clip:content-box;
  box-shadow:inset 0 0 0 4px var(--bg);
  transition:width .15s, height .15s, box-shadow .2s;
}
.slider:hover .slider-handle,
.slider:focus-visible .slider-handle{ width:33px; height:33px; }
.slider:focus-visible{ }
.slider:focus-visible .slider-handle{ border-color:#fff; }

/* per-band handle colours */
.slider[data-band="0"] .slider-handle{ background:#683500; }
.slider[data-band="1"] .slider-handle{ background:#ce0f00; }
.slider[data-band="2"] .slider-handle{ background:#ff5232; }
.slider[data-band="3"] .slider-handle{ background:#c8e911; }
.slider[data-band="4"] .slider-handle{ background:#5cc93b; }
.slider[data-band="5"] .slider-handle{ background:#45edbf; }
.slider[data-band="6"] .slider-handle{ background:#3ccce4; }
.slider[data-band="7"] .slider-handle{ background:#0004f3; }
.slider[data-band="8"] .slider-handle{ background:#9000ca; }
.slider[data-band="9"] .slider-handle{ background:#c88fff; }

/* ---- Transport ---- */
.transport{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin:18px 0 6px;
  flex-wrap:wrap;
}
.btn{
  position:relative;
  display:flex; align-items:center; justify-content:center;
  width:34px; height:34px;
  border-radius:50%;
  border:2px solid var(--ctl);
  background:var(--ctl);
  color:#fff;
  cursor:pointer;
  padding:0;
  transition:transform .12s, background .2s, border-color .2s, opacity .2s;
}
.btn:hover{ transform:scale(1.08); }
.btn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.btn svg{ width:16px; height:16px; display:block; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.btn[aria-pressed="true"]{ background:#999; border-color:#ccc; }
.btn.is-disabled{ opacity:.25; pointer-events:none; }

.btn-play{ width:46px; height:46px; margin:0 4px; }
.btn-play svg{ width:22px; height:22px; }
.btn-play .play-icon{ display:flex; }
.btn-play.playing .play-icon{ display:none; }
.meter{ display:none; width:42px; height:42px; border-radius:50%; }
.btn-play.playing .meter{ display:block; }

/* ---- Message line ---- */
.msg{
  height:26px;                 /* fixed so status text never shifts the layout */
  display:flex; align-items:center; justify-content:center;
  margin:10px auto 20px;
  font-style:italic;
  color:var(--text);
  font-variant-numeric:tabular-nums;
  overflow:hidden;
}

/* ---- Panel / cards ---- */
.panel{
  display:flex;
  flex-wrap:wrap;
  gap:var(--gap);
  text-align:left;
  margin-top:8px;
}
.card{
  flex:1 1 320px;
  border:1px solid var(--panel-border);
  border-radius:var(--radius);
  background:var(--panel);
  box-shadow:0 0 40px 10px rgba(0,0,0,.2);
  padding:14px 16px 16px;
}
.card h2{
  color:var(--text-bright);
  font-weight:400;
  font-size:1.1rem;
  margin-bottom:10px;
}
.hint-text{ color:var(--text-dim); font-size:.85rem; margin:-4px 0 10px; }

.row{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:8px 0; }
.grow{ flex:1 1 auto; }

/* ---- Chips (preset / toggle buttons) ---- */
.chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chips.tight{ gap:6px; }

/* preset groups & sub-sections */
.card.full{ flex-basis:100%; }
.preset-group{ margin:12px 0; }
.preset-group:first-of-type{ margin-top:2px; }
.preset-label{
  display:block;
  font-size:.74rem;
  font-weight:500;
  text-transform:uppercase;
  letter-spacing:.07em;
  color:rgb(178,177,171);         /* brighter for readable contrast */
  margin-bottom:7px;
}
.sub + .sub{
  margin-top:14px; padding-top:14px;
  border-top:1px solid rgba(255,255,255,.07);
}
.card-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.card-head h2{ margin-bottom:0; }

/* preset controls row */
.preset-controls{
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
  margin-top:16px; padding-top:14px;
  border-top:1px solid rgba(255,255,255,.09);
}
.preset-controls .spacer{ flex:1 1 12px; }

/* custom preset chips + manage(delete) mode */
.chip.preset-custom .del{ display:none; }
#presets.manage .preset-custom{ border-color:var(--orange); color:var(--orange); background:transparent; }
#presets.manage .preset-custom .del{ display:inline-flex; }
#presets.manage .preset-custom.active{ background:transparent; }
.chip{
  font:inherit;
  font-size:.9rem;
  color:var(--accent);
  background:transparent;
  border:1px solid var(--accent);
  border-radius:6px;
  padding:4px 12px;
  cursor:pointer;
  white-space:nowrap;
  transition:background .15s, color .15s, opacity .15s;
}
.chip:hover{ background:var(--accent); color:var(--accent-ink); }
.chip:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.chip[aria-pressed="true"], .chip.active{ background:var(--accent); color:var(--accent-ink); }
.chip.solid{ background:var(--accent); color:var(--accent-ink); }
.chip.solid:hover{ color:#fff; }
.chip.ghost{ color:var(--text-dim); border-color:var(--text-faint); }
.chip.ghost:hover{ background:var(--text-faint); color:var(--bg); }
.chip.xs{ font-size:.82rem; padding:3px 9px; }
.chip.preset-custom{ display:inline-flex; align-items:center; gap:6px; }
.chip .del{
  border:none; background:none; color:inherit; cursor:pointer;
  font-size:1rem; line-height:1; padding:0 0 0 2px; opacity:.7;
}
.chip .del:hover{ opacity:1; }

/* ---- Form controls ---- */
.field{ display:flex; align-items:center; gap:6px; color:var(--text-dim); font-size:.9rem; }
.input-suffix{ display:inline-flex; align-items:center; gap:4px; color:var(--text-dim); }
.text-input{
  font:inherit;
  background:var(--bg);
  border:1px solid #555;
  border-radius:4px;
  color:var(--text);
  padding:3px 6px;
}
.text-input:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
.text-input.tiny{ width:64px; }
select{
  font:inherit;
  background:var(--bg);
  color:var(--text);
  border:1px solid #555;
  border-radius:4px;
  padding:3px 6px;
  cursor:pointer;
}
select:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }

/* ---- Tooltips (data-tip) ---- */
[data-tip]{ position:relative; }
[data-tip]::after{
  content:attr(data-tip);
  position:absolute;
  left:50%; bottom:calc(100% + 9px);
  transform:translateX(-50%) translateY(4px);
  background:#25282e;
  color:#f4f3ee;
  font-family:Figtree, system-ui, sans-serif;
  font-size:.82rem;
  font-weight:400;
  font-style:normal;
  line-height:1.35;
  text-align:center;
  white-space:normal;
  width:max-content;
  max-width:210px;
  padding:6px 10px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:7px;
  box-shadow:0 6px 22px rgba(0,0,0,.55);
  opacity:0;
  pointer-events:none;
  transition:opacity .14s ease, transform .14s ease;
  z-index:60;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after{
  opacity:1; transform:translateX(-50%) translateY(0);
}
@media (hover:none){ [data-tip]::after{ display:none; } }

/* ---- Help ---- */
.help{
  text-align:left;
  margin-top:28px;
  border-top:1px solid #444;
  padding-top:20px;
}
.help-title{ color:var(--text-bright); font-weight:400; font-size:1.3rem; margin-bottom:12px; }
.help details{
  border-bottom:1px solid rgba(255,255,255,.06);
  padding:8px 0;
}
.help summary{
  cursor:pointer;
  color:var(--accent);
  font-size:1.02rem;
  list-style:none;
  outline:none;
}
.help summary::-webkit-details-marker{ display:none; }
.help summary::before{
  content:'＋'; display:inline-block; width:1em; margin-right:8px;
  color:var(--accent); transition:transform .25s ease;
}
.help details[open] summary::before{ content:'－'; }
.help details p{ padding:8px 0 4px 22px; color:var(--text); }
.help details table.keys{ margin-top:6px; }
/* subtle reveal when a section opens */
.help details[open] > :not(summary){ animation:helpReveal .26s ease; }
@keyframes helpReveal{
  from{ opacity:0; transform:translateY(-6px); }
  to  { opacity:1; transform:translateY(0); }
}
.help a{ color:var(--orange); }
kbd{
  font-family:ui-monospace, Menlo, Consolas, monospace;
  font-size:.8em;
  background:rgba(255,255,255,.08);
  border:1px solid #444;
  border-radius:4px;
  padding:1px 5px;
}
table.keys{ border-collapse:collapse; margin:8px 0 4px 22px; }
table.keys td{ padding:4px 12px 4px 0; vertical-align:top; color:var(--text); }
table.keys td:first-child{ white-space:nowrap; }

/* ---- Footer ---- */
.app-footer{ margin-top:40px; color:var(--text-faint); font-size:.8rem; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion:reduce){
  *{ animation:none !important; transition:none !important; }
  .bg{ filter:none; }
}

/* ---- Small screens ---- */
@media (max-width:520px){
  .title{ font-size:1.8rem; }
  .slider{ width:30px; }
  .card{ flex-basis:100%; }
}
