/* SDA Hymnal Music — the FRELODY --k-* token layer, carried over so every surface reads the same in both products.
   Theme is [data-bs-theme="light|dark"] on <html>, set by hymnal.js; never branch on prefers-color-scheme here. */
@import url("fonts.css");

:root, [data-bs-theme="light"] {
    /* base palette the k-tokens alias */
    --modal-content-bg: #ffffff;
    --text-primary: #374151;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-hover: #f3f4f6;
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    /* surfaces */
    --k-bg-app: #f7f8fb;
    --k-bg-surface: var(--modal-content-bg);
    --k-bg-surface-2: #f9fafb;
    --k-bg-hover: var(--bg-hover);
    --k-bg-overlay: rgba(15, 23, 42, 0.45);
    /* text */
    --k-text: var(--text-primary);
    --k-text-muted: var(--text-secondary);
    --k-text-subtle: var(--text-muted);
    --k-text-on-accent: #ffffff;
    /* borders */
    --k-border: var(--border-light);
    --k-border-strong: var(--border-medium);
    /* accent + status */
    --k-accent: #3a31e3;
    --k-accent-hover: #2b23bf;
    --k-accent-soft: #eef2ff;
    --k-accent-soft-text: #3730a3;
    --k-success: #16a34a;
    --k-success-soft: #dcfce7;
    --k-success-soft-text: #166534;
    --k-warning: #d97706;
    --k-warning-soft: #fef3c7;
    --k-warning-soft-text: #92400e;
    --k-danger: #dc2626;
    --k-danger-soft: #fee2e2;
    --k-danger-soft-text: #991b1b;
    /* shape & motion */
    --k-radius-xs: 0.4rem;
    --k-radius-sm: 6px;
    --k-radius: 10px;
    --k-radius-md: 0.85rem;
    --k-radius-lg: 14px;
    --k-radius-pill: 999px;
    /* Small segmented pills — Sheet | Player, the sheet page's zoom. Two of them share a bar, so the height is a token
       rather than a number typed twice: one was 38px against the other's 30px and the strip read as lopsided. */
    --k-seg-h: 30px;
    --k-seg-item-h: 24px;
    --k-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --k-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    --k-shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.18);
    --k-tip-bg: #23201d;
    --k-tip-text: #f7f5f1;
    --k-tip-sub: #bdb6ad;
    --k-shadow-hover: 0 10px 25px rgba(15, 23, 42, 0.08);
    --k-space-1: 0.25rem;
    --k-space-2: 0.5rem;
    --k-space-3: 0.75rem;
    --k-space-4: 1rem;
    --k-space-5: 1.25rem;
    --k-space-6: 1.5rem;
    --k-transition-fast: 120ms ease;
    --k-transition: 160ms ease;
    --k-transition-slow: 220ms ease-out;
    /* four-part voice colours (chips, lights, labels) */
    --k-voice-s: #d64a5e;
    --k-voice-a: #22a392;
    --k-voice-t: #3b74b8;
    --k-voice-b: #c2882d;
    /* The second half of a divided part: its own voice's hue, lighter, so the four-colour key still reads. */
    --k-voice-s2: #e68f9b;
    --k-voice-a2: #76c6bb;
    --k-voice-t2: #85a9d3;
    --k-voice-b2: #d9b57d;
    /* The lead's unison line: the tune's own hue, deeper, an octave under it. */
    --k-voice-m: #9e3446;
    /* type */
    --k-font-sans: 'Kanit', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --k-font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --k-font-size-xs: 0.7rem;
    --k-font-size-sm: 0.85rem;
    --k-font-size: 0.9rem;
    /* safe areas (notches, home indicators) */
    --k-safe-top: env(safe-area-inset-top, 0px);
    --k-safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-bs-theme="dark"] {
    --modal-content-bg: #1f2937;
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --bg-hover: #374151;
    --border-light: #374151;
    --border-medium: #4b5563;
    --k-bg-app: #111827;
    --k-bg-surface: var(--modal-content-bg);
    --k-bg-surface-2: #111827;
    --k-bg-hover: var(--bg-hover);
    --k-bg-overlay: rgba(0, 0, 0, 0.6);
    --k-text: var(--text-primary);
    --k-text-muted: var(--text-secondary);
    --k-text-subtle: var(--text-muted);
    --k-border: var(--border-light);
    --k-border-strong: var(--border-medium);
    --k-accent: #8984f5;
    --k-accent-hover: #b6b4f9;
    --k-accent-soft: rgba(129, 140, 248, 0.15);
    --k-accent-soft-text: #c7d2fe;
    --k-success-soft: rgba(34, 197, 94, 0.18);
    --k-success-soft-text: #bbf7d0;
    --k-warning-soft: rgba(217, 119, 6, 0.2);
    --k-warning-soft-text: #fde68a;
    --k-danger-soft: rgba(220, 38, 38, 0.18);
    --k-danger-soft-text: #fecaca;
    --k-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --k-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --k-shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, 0.6);
    --k-tip-bg: #33302c;
    --k-tip-text: #f7f5f1;
    --k-tip-sub: #c3bcb2;
    --k-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.5);
    --k-voice-s: #f0748a;
    --k-voice-a: #3ccab6;
    --k-voice-t: #6ea1e6;
    --k-voice-b: #e0a94a;
    --k-voice-s2: #f6aebb;
    --k-voice-a2: #8ee0d5;
    --k-voice-t2: #abc8f1;
    --k-voice-b2: #edcd96;
    --k-voice-m: #c75068;
}

html, body {
    margin: 0;
    font-family: var(--k-font-sans);
    font-size: 16px;
    background: var(--k-bg-app);
    color: var(--k-text);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}
html { height: 100%; }
body { min-height: 100%; }
/* The router moves focus to each page's title so screen readers announce it; sighted users must not see a ring around the heading. */
h1:focus, h1:focus-visible { outline: none; box-shadow: none; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--k-accent); text-decoration: none; }

/* Editorial display face for titles and hymn words. */
.k-display {
    font-family: var(--k-font-display);
    font-optical-sizing: auto;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.1;
    text-wrap: balance;
}

/* Bootstrap's placeholder shimmer picks up the theme text colour; keep it soft. */
.placeholder { opacity: .18; }
[data-bs-theme="dark"] .placeholder { opacity: .22; }

#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; padding: .8rem 1.2rem; background: var(--k-warning-soft); color: var(--k-warning-soft-text); box-shadow: var(--k-shadow-lg); font-size: var(--k-font-size-sm); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Tooltip: one element, positioned by hymnal.js. A label line and, after the first " · ", a quieter line of detail.
   Dark in both themes the way a HUD is, because it sits over the page rather than in it. */
.k-tip { position: fixed; left: 0; top: 0; z-index: 1200; display: grid; gap: 2px; max-width: min(280px, 78vw); padding: 8px 11px; border-radius: var(--k-radius-md); background: var(--k-tip-bg); color: var(--k-tip-text); box-shadow: var(--k-shadow-lg); font-size: var(--k-font-size-xs); line-height: 1.4; pointer-events: none; opacity: 0; transition: opacity 120ms ease-out; }
.k-tip.show { opacity: 1; }
.k-tip b { font-weight: 600; }
.k-tip span { color: var(--k-tip-sub); }
/* The arrow tracks the control even when the tip has been pushed away from a screen edge. */
.k-tip::after { content: ""; position: absolute; left: var(--k-tip-ax, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; border-radius: 2px; background: var(--k-tip-bg); transform: rotate(45deg); }
.k-tip.below::after { bottom: auto; top: -5px; }
@media (prefers-reduced-motion: reduce) { .k-tip { transition: none; } }
