/* ============================================================================
   Smart Taala Tracker — base layer
   Reset, document defaults and the shared controls (buttons, selects, fields).
   Loaded after css/tokens.css and before css/app.css. Values come from tokens.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, p, ol, figure { margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* Text density. Every size in the app is in rem, so this one multiplier is
   what a patient who cannot read 17px type reaches for — 100%, 125% or 150%,
   from the top bar. Fixed panel and bar sizes scale with it (css/tokens.css)
   so the layout grows with the words instead of clipping them. */
html { font-size: calc(100% * var(--scale)); }

html, body { height: 100%; }
body {
    font-family: var(--font);
    font-size: var(--text-17);
    line-height: 1.45;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* Headings and large numerals in the display serif; its lining figures are
   what make a score legible at a glance across a room. */
h1, h2, .display { font-family: var(--font-display); letter-spacing: -.005em; }

button, select, input, output { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--beat); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Controls ─────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink);
    font-weight: 700; cursor: pointer;
    transition: background var(--motion-fast), border-color var(--motion-fast);
}
.btn:hover { border-color: var(--ink-3); background: var(--sunken); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-stop { background: var(--invert-bg); border-color: var(--invert-bg); color: var(--invert-ink); }
.btn-stop:hover { background: var(--invert-bg-hover); border-color: var(--invert-bg-hover); }
.btn-quiet { border-color: transparent; background: transparent; min-height: 36px; padding: 0 12px; }
.btn-quiet:hover { background: var(--sunken); border-color: transparent; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: var(--text-14); }
.btn-block { width: 100%; min-height: 52px; font-size: var(--text-18); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--ink-2); font-size: var(--text-14); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

select {
    width: 100%; min-height: 44px; padding: 0 36px 0 12px;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: var(--surface) var(--select-arrow) no-repeat right 12px center;
    appearance: none; cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 28px; cursor: pointer; }
.field-label { display: block; font-size: var(--text-14); font-weight: 700; color: var(--ink-2); margin: 12px 0 6px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-grid > label, .field-grid > div { display: block; }
.hint { font-size: var(--text-14); color: var(--ink-2); margin-top: 8px; }
.hint.strong { color: var(--ink); font-weight: 700; }
.hint.center { text-align: center; }

details.settings { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details.settings summary { cursor: pointer; font-size: var(--text-14); font-weight: 700; color: var(--ink-2); list-style: none; }
details.settings summary::-webkit-details-marker { display: none; }
details.settings summary::before { content: '+'; display: inline-block; width: 16px; color: var(--ink-3); }
details.settings[open] summary::before { content: '−'; }
details.settings audio { width: 100%; margin-top: 10px; }

