/* Shared מיתר tokens and base controls (design v2, 21.11.2026). Loaded by index.html and songs/index.html.
   Themes: dark | paper, set on <html data-theme> by theme.js ("auto" resolves via prefers-color-scheme, live).
   Font URLs are relative to this file. No network fonts. */
@font-face { font-family: "Heebo"; src: url("fonts/Heebo.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/SpaceGrotesk.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }

/* ---------- palette + theme objects (analysis §3.1-3.3) ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121417; --card: #1B1E23; --card-line: #1B1E23; --card2: #262A31; --line: #2E333B;
  --ink: #F3EFE7; --body: #C9CDD3; --muted: #A3A9B2; --faint: #4A505A;
  --accent: #F2A541; --accent-text: #F2A541;
  --grid: #5A606A; --dot: #F2A541; --tabnum: #F2A541;
  --rec: #FF5C5C; --cta: #F3EFE7; --cta-ink: #121417; --ok: #7FC8A9; --pick-shadow: rgba(0,0,0,.55);
  --amber-ink: #1A1206; --dot-ink: #1A1206; --thumb-off: #F3EFE7;
  --overlay: rgba(0,0,0,.55); --nav-bg: rgba(18,20,23,.9);
  --warn-bg: #3a2c12; --warn-line: #7a5a1f;
}
:root[data-theme="paper"] {
  color-scheme: light;
  --bg: #EFE9DD; --card: #FBF8F1; --card-line: #E2DACB; --card2: #F1EBDF; --line: #D6CDBC;
  --ink: #17181B; --body: #33363B; --muted: #5C6169; --faint: #B4AC9E;
  --accent: #F2A541; --accent-text: #8A4F00;
  --grid: #8C8578; --dot: #17181B; --tabnum: #17181B;
  --rec: #C62828; --cta: #17181B; --cta-ink: #FBF8F1; --ok: #2E7D5B; --pick-shadow: rgba(120,80,20,.3);
  --amber-ink: #1A1206; --dot-ink: #FBF8F1; --thumb-off: #17181B;
  --overlay: rgba(23,24,27,.35); --nav-bg: rgba(251,248,241,.92);
  --warn-bg: #FFF3DC; --warn-line: #D9A441;
}
:root {
  /* score / notation always sits on a paper card with dark ink, in both themes (artboard 4) */
  --score-bg: #F6F1E7; --score-ink: #17181B; --score-line: #D6CDBC;
  /* metallic amber pick (identity artboard 13) */
  --pick-1c: #FFE2A8; --pick-2c: #F2A541; --pick-3c: #C87418; --pick-under: #8F5210;
  --sun: linear-gradient(135deg, #FFE2A8 0%, #F2A541 45%, #C87418 100%);
  /* legacy aliases: the older component CSS and the songs module still speak these names */
  --page: var(--bg); --soft: var(--muted); --wash: var(--card); --wash2: var(--card2);
  --burn: var(--accent); --burn-wash: color-mix(in srgb, var(--accent) 12%, transparent); --burn-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --rock: var(--rec); --bad: var(--rec); --pop: var(--ok); --finger: var(--accent-text); --warn: var(--accent-text); --blue: var(--ok);
  --mute: var(--muted); --panel: var(--card);
  --heb: "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: "Space Grotesk", "Heebo", system-ui, sans-serif;
  --mus: var(--num);   /* old name, now Space Grotesk (Fraunces removed) */
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 20px; --r-s: 12px;
  --nav-h: 76px; --side-w: 248px;
  --ease: cubic-bezier(.2,.7,.2,1);
  /* motion "פריטה": one spring for everything pressable */
  --spring: cubic-bezier(.3,1.6,.5,1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--heb); font-size: 16px; line-height: 1.5; min-height: 100dvh; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 19px; font-weight: 800; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 700; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; border-radius: 8px; }
a { color: inherit; }
small, .muted { color: var(--muted); }
.muted { font-size: 15px; }
[hidden] { display: none !important; }

/* numbers: Space Grotesk, always an LTR island so "92 BPM" / "82.4 Hz" never scramble */
.num { font-family: var(--num); font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.term { font-family: var(--heb); font-style: normal; font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.kicker { font-size: 15px; color: var(--muted); font-weight: 500; }

/* ---------- motion "פריטה": press = quick squash, release = spring overshoot and settle ---------- */
:where(button, [role="button"], a.card, a.btn, a.pill, .tap, summary) { transition: transform .5s var(--spring), background-color .2s, border-color .2s, color .2s, box-shadow .2s; }
:where(button, [role="button"], a.card, a.btn, a.pill, .tap, summary):active { transform: scale(.94); transition-duration: .07s, .2s, .2s, .2s, .2s; }
:where(button:disabled):active { transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  :where(button, [role="button"], a.card, a.btn, a.pill, .tap, summary):active { transform: scale(.98); }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 999px; font-weight: 700; font-size: 17px; text-decoration: none; }
.btn-burn { color: var(--amber-ink); background: var(--sun); box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-ink { color: var(--cta-ink); background: var(--cta); }
.btn-ghost { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

.card { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r); padding: 16px 18px; }
.card + .card { margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--card2); font-size: 15px; color: var(--muted); white-space: nowrap; }

/* ---------- display type ---------- */
.display { font-size: clamp(32px, 8.4vw, 60px); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; margin: 0; }
.display b, .display span, .display .num { font-weight: inherit; }   /* one heavy weight for the whole title */
.display b { display: block; }
.display span { display: block; color: var(--ink); }
.display.inline b, .display.inline span { display: inline; }

/* ---------- string skeleton: decorative six hairlines, E A D G B E (LTR island) ---------- */
.string-skeleton { position: absolute; inset: 0; z-index: 0; pointer-events: none; display: grid; grid-template-columns: repeat(6, 1fr); direction: ltr; unicode-bidi: isolate; }
.string-skeleton .str { position: relative; min-width: 0; }
.string-skeleton .str::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: color-mix(in srgb, var(--grid) 70%, transparent); }
.string-skeleton .str b, .string-skeleton .str small { position: absolute; left: calc(50% + 7px); font-family: var(--num); font-size: 12px; line-height: 1.2; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.string-skeleton .str b { top: 12px; font-weight: 700; color: var(--ink); }
.string-skeleton .str small { top: 28px; }
.string-skeleton.band { position: relative; inset: auto; height: 50px; }
@media (max-width: 600px) {
  .string-skeleton .str b, .string-skeleton .str small { left: 50%; transform: translateX(-50%); }
  .string-skeleton .str small { font-size: 11px; letter-spacing: 0; }
  .string-skeleton .str::before, .string-skeleton.band .str::before { top: 46px; }
}

/* ---------- logo: Hebrew מ + amber pick as the yod + תר (reads מיתר) ---------- */
.logo { display: inline-flex; align-items: flex-start; gap: .02em; direction: rtl; font-family: var(--heb); font-weight: 900; letter-spacing: -.02em; line-height: 1; color: var(--ink); font-size: 28px; }
.logo svg { width: .36em; height: .42em; margin-top: .1em; transform: rotate(-12deg); filter: drop-shadow(0 .05em .05em rgba(0,0,0,.4)); overflow: visible; }

/* ---------- score / notation surface: paper card with dark ink in BOTH themes ---------- */
.score-card { background: var(--score-bg); color: var(--score-ink); border: 1px solid var(--score-line); border-radius: var(--r-s); }

/* confirm sheet (theme.js mitarConfirm): bottom sheet on phones, centered card on wide screens */
.cs-bg { position: fixed; inset: 0; z-index: 200; display: grid; align-items: end; background: var(--overlay); animation: cs-fade .18s ease-out; }
.cs { background: var(--card); color: var(--ink); width: 100%; max-width: 520px; margin: 0 auto; padding: 12px 22px calc(22px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; border: 1px solid var(--card-line); box-shadow: 0 -12px 40px -16px var(--pick-shadow); animation: cs-in .28s var(--ease); }
.cs-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }
.cs-title { font-size: 21px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; }
.cs-msg { margin-top: 8px; color: var(--body); font-size: 16px; line-height: 1.55; }
.cs-row { display: flex; gap: 10px; margin-top: 22px; }
.cs-row .btn { flex: 1; }
.cs-danger { background: var(--rec); color: var(--cta-ink); }
@media (min-width: 700px) { .cs-bg { align-items: center; } .cs { border-radius: 24px; padding-bottom: 22px; } .cs-grab { display: none; } }
@keyframes cs-fade { from { opacity: 0; } }
@keyframes cs-in { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cs-bg, .cs { animation: none; } }
