/* Tactus — design tokens.
   Everything keyed to CSS variables so the Tweaks panel can swap accent
   and density without re-rendering React. */

/* Self-hosted Jost — latin subset only (covers all copy on the site,
   including curly quotes/en-dash). Pulled from Google Fonts v20 so we
   don't hand every page load to fonts.googleapis.com/fonts.gstatic.com. */
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jost-v20-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/jost-v20-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Self-hosted DroidSansMono + Roboto -- same reasoning as Jost above, but
   also the fix for a real bug: the mono/meter stacks used to lead with Menlo
   and Helvetica Neue, both Apple-only. On any non-Apple device that fell
   straight through to the browser's generic fallback, which (confirmed by
   rendering it) commonly substitutes a monospace whose zero glyph is slashed
   -- visibly the wrong font, not just a stylistic mismatch. These aren't a
   compromise pick: they're literally what the real Android app renders
   (FontFamily.Monospace and FontFamily.SansSerif -- see Type.kt's
   numericTextStyle and MeterSignatureView.kt), confirmed against
   /system/etc/fonts.xml on a real device, not assumed from the family name --
   "monospace" resolves to DroidSansMono.ttf, not the Roboto Mono webfont
   those names might suggest; "sans-serif" does resolve to real Roboto.
   DroidSansMono ships as part of AOSP under the Apache 2.0 license, so
   redistributing it here is fine. Self-hosting both makes every visitor's
   browser match a real shipping app exactly, the same guarantee self-hosting
   already gives Jost. */
@font-face {
  font-family: 'Droid Sans Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/droid-sans-mono.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/roboto-v51-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ── Surfaces ──────────────────────────────────────────────── */
  --bg:           #0F0F10;
  --bg-elev-1:    #161618;   /* bar rows, list rows */
  --bg-elev-2:    #1C1C1F;   /* sheets, transport */
  --bg-elev-3:    #232327;   /* picker keys */
  --scrim:        rgba(0,0,0,0.55);

  /* ── Strokes ───────────────────────────────────────────────── */
  --hair:         rgba(255,255,255,0.05);
  --stroke:       rgba(255,255,255,0.09);
  --stroke-strong:rgba(255,255,255,0.16);

  /* ── Text ──────────────────────────────────────────────────── */
  --fg:           rgba(255,255,255,0.92);
  --fg-2:         rgba(255,255,255,0.68);
  --fg-3:         rgba(255,255,255,0.46);   /* readable quiet text -- 4.7:1 on --bg, WCAG AA */
  --fg-4:         rgba(255,255,255,0.20);   /* decorative/disabled only, not for text */

  /* ── Dot weights (the product) ─────────────────────────────── */
  --dot-strong:   rgba(255,255,255,1.00);
  --dot-normal:   rgba(255,255,255,0.58);
  --dot-soft:     rgba(255,255,255,0.34);
  --dot-silent:   rgba(255,255,255,0.22); /* used as stroke only */

  /* ── Accent (teal default) ─────────────────────────────────── */
  --accent:       oklch(0.74 0.055 185);
  --accent-dim:   oklch(0.74 0.055 185 / 0.35);
  --accent-glow:  rgba(139,190,182,0.45); /* #8BBEB6 @ 45% */

  /* ── Destructive (rare) ────────────────────────────────────── */
  --destructive:  oklch(0.65 0.13 25);

  /* ── Type ──────────────────────────────────────────────────────
     Chrome:  Jost 500 — matches the shipping app's wordmark, labels,
              buttons, titles, and body copy.
     Data:    Self-hosted Droid Sans Mono (400) — reserved strictly for
              numbers, ratios, BPM, meter, time / bar / beat. Not for
              category labels. This is the actual file the real Android app
              renders, confirmed against /system/etc/fonts.xml on a real
              device (the "monospace" generic family resolves to
              DroidSansMono.ttf, not the Roboto Mono webfont its
              FontFamily.Monospace name might suggest -- those are different
              fonts). Self-hosting it guarantees every visitor sees that,
              rather than whatever their browser substitutes for the
              previous Menlo-first stack once it falls off Apple-only fonts.
              That fallback path was a real, confirmed bug: the eventual
              generic "monospace" a non-Apple browser lands on commonly
              renders a slashed zero, which reads as a wrong font, not a
              close-enough one.
     Meter:   Self-hosted Roboto (700) — meter/time signatures only, kept off
              Jost on purpose (reads as engraved notation, see .meter). Also
              the real Android app's own choice (FontFamily.SansSerif Bold,
              MeterSignatureView.kt, confirmed against fonts.xml too) —
              matches for the same reason as above. */
  --ui:     "Jost", sans-serif;
  --mono:   "Droid Sans Mono", Menlo, ui-monospace, "SF Mono", Consolas, monospace;
  --meter-font: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* ── Radii / motion ────────────────────────────────────────── */
  --r-card: 14px;
  --r-key:  10px;
  --r-row:  8px;
  --ease-out: cubic-bezier(0.2, 0.65, 0.25, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset inside the Tactus surface — design-canvas hosts iframes worth of
   user CSS so we scope ourselves carefully. */
.tactus, .tactus * {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
.tactus {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Hide scrollbars in the device shell — gestural scroll feel. */
.tactus *::-webkit-scrollbar { width: 0; height: 0; }
.tactus *                    { scrollbar-width: none; }

/* ── Typographic primitives ─────────────────────────────────── */
.t-mono     { font-family: var(--mono); font-feature-settings: "tnum","ss01"; letter-spacing: 0; }
.t-meter    { font-family: var(--mono); font-weight: 500; letter-spacing: -0.01em; }
.t-bpm      { font-family: var(--mono); font-weight: 500; font-size: 28px; letter-spacing: -0.02em; }
/* Section header: grotesque, sentence-case, NOT tracked. Was uppercase mono — too SaaS. */
.t-section  { font-family: var(--ui); font-size: 12px; font-weight: 500; letter-spacing: -0.005em; color: var(--fg-3); }
.t-title    { font-family: var(--ui);   font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.t-label    { font-family: var(--ui);   font-size: 13px; font-weight: 400; color: var(--fg-3); }
.t-helper   { font-family: var(--ui);   font-size: 11px; font-weight: 400; color: var(--fg-3); letter-spacing: 0; }

/* ── Dot animation ──────────────────────────────────────────── */
/* No glow on the dot itself — the glow lives on the active-bar edge
   and the meter-picker caret instead. Attack 20ms / hold ~50ms / release
   80ms, ~150ms total. */
@keyframes tactus-hit {
  0%   { transform: scale(1); }
  13%  { transform: scale(1.22); }
  47%  { transform: scale(1.22); }
  100% { transform: scale(1); }
}
.tactus-dot.hit {
  animation: tactus-hit 150ms var(--ease-out);
}

/* Active-bar focal ring is drawn with a hairline accent on left edge. */
.tactus-bar.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  width: 3px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Selection ring for tapped beat clusters (Editor only) */
.tactus-cluster.selected {
  background:
    radial-gradient(closest-side, transparent 60%, rgba(255,255,255,0.04) 100%);
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 0 0 3px var(--accent-dim);
}

/* Tuplet bracket — hairline arc */
.tactus-tuplet-arc {
  stroke: var(--fg-3);
  fill: none;
  stroke-width: 1;
  stroke-linecap: round;
}
.tactus-tuplet-label {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--fg-3);
  letter-spacing: 0;
}
