/* Generated from partials.html baseStyles + dock — served hashed via internal/static */


/* ─── Design tokens ─────────────────────────────────────────── */
:root {
    color-scheme: light;

    /* Surfaces */
    --bg:           #f1f5f9;
    --bg-2:         #e2e8f0;
    --card:         #ffffff;
    --card-strong:  #ffffff;

    /* Borders */
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    /* Text. Ratios verified by scripts/qa/app-contrast.mjs (WCAG AA text 4.5:1). */
    --text:    #0f172a;
    --muted:   #586880; /* secondary text: >= 4.6:1 on --card, --bg, --bg-2 and every -light tint (was #64748b: 3.86:1 on --bg-2) */
    --muted-2: #627189; /* tertiary text (placeholders, quiet labels): 4.95:1 on --card, 4.52:1 on --bg only — on --bg-2 or a tint use --muted (was #6b7a90: 4.36:1 on white) */

    /* Accent — Indigo. --accent is the fill (and text on --card/--bg, 4.93:1);
       --accent-strong is accent text on --accent-light/--bg-2 (5.6:1). */
    --accent:        #5a5df0; /* was #6366f1: 4.47:1 under white text */
    --accent-hover:  #4f46e5;
    --accent-strong: #4f46e5;
    --accent-light:  #eef2ff;

    /* Semantic. The base tokens are fills and icons (3:1 non-text); the
       -strong tokens are text on white, on the page surfaces and on the
       matching -light tint (>= 4.5:1), and fills that carry white text. */
    --success:        #16a34a;
    --success-strong: #14773a;
    --success-light:  #dcfce7;
    --danger:         #dc2626;
    --danger-strong:  #b91c1c;
    --danger-light:   #fee2e2;
    --warning:        #d97706;
    --warning-strong: #a04a08;
    --warning-light:  #fef3c7;
    --info:           #0284c7;
    --info-strong:    #0369a1;
    --info-light:     #e0f2fe;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(15,23,42,0.07), 0 1px 2px rgba(15,23,42,0.04);
    --shadow-md: 0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
    --shadow-lg: 0 10px 30px rgba(15,23,42,0.10), 0 4px 10px rgba(15,23,42,0.05);
    /* backward-compat aliases */
    --shadow-1: var(--shadow-lg);
    --shadow-2: var(--shadow-md);

    /* Border radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    /* backward-compat: old values were larger, keep vars mapped */

    /* Navbar */
    --navbar-h: 56px;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { min-height: 100%; }

/* ─── Base ───────────────────────────────────────────────────── */
body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-top: var(--navbar-h);
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

p { color: var(--muted); line-height: 1.6; }

h1, h2, h3, h4 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text);
}

/* ─── Layout shell ───────────────────────────────────────────── */
.app-shell {
    position: relative;
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 56px;
}

/* ─── Page hero ──────────────────────────────────────────────── */
.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.hero-card {
    flex: 1;
    padding: 28px 32px;
    border-radius: var(--radius-xl);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.hero-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--accent);
    margin-bottom: 8px;
}

.hero-title {
    font-size: clamp(1.625rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.hero-subtitle {
    font-size: 0.9375rem;
    color: var(--muted);
    max-width: 560px;
    line-height: 1.65;
}

/* ─── Cards & panels ─────────────────────────────────────────── */
.card,
.panel,
.panel-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.panel { padding: 20px; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.panel-subtitle {
    font-size: 0.8125rem;
    color: var(--muted);
}

/* ─── Buttons ────────────────────────────────────────────────── */
.button,
.btn,
.timer-btn,
.action-btn,
.icon-btn,
.class-btn,
.modal-btn,
.add-study-btn {
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}

.button, .btn {
    padding: 0.5rem 1.125rem;
    font-size: 0.875rem;
}

/* A bare .icon-btn used to inherit the UA grey button face (U17); pages
   that want a fill set it themselves (.icon-btn.primary, page rules). */
.icon-btn {
    background: transparent;
}

/* Primary */
.button.primary,
.btn-primary,
.btn-start,
.btn-save,
.class-btn-add,
.add-study-btn {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(99,102,241,0.25);
}

.button.primary:hover,
.btn-primary:hover,
.btn-start:hover,
.btn-save:hover,
.class-btn-add:hover,
.add-study-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 14px rgba(99,102,241,0.32);
    transform: translateY(-1px);
}

/* Ghost */
.button.ghost,
.btn-ghost {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.button.ghost:hover,
.btn-ghost:hover {
    background: var(--bg);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

/* Danger */
.button.danger,
.btn-danger,
.btn-finish,
.class-btn-pay,
.btn-delete {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 1px 3px rgba(220,38,38,0.2);
}

.button.danger:hover,
.btn-danger:hover,
.btn-finish:hover,
.class-btn-pay:hover,
.btn-delete:hover {
    background: var(--danger-strong);
    box-shadow: 0 4px 14px rgba(220,38,38,0.28);
    transform: translateY(-1px);
}

/* Small */
.button.small, .btn-small {
    min-height: 30px;
    font-size: 0.8125rem;
    padding: 0.25rem 0.75rem;
}

/* ─── Form elements ──────────────────────────────────────────── */
input, textarea, select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted-2);
}

/* ─── Badge ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-2);
    color: var(--muted);
    border: 1px solid var(--border);
}

/* ─── Floating back ──────────────────────────────────────────── */
.floating-back,
.back-pill {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-decoration: none;
    box-shadow: var(--shadow-md);
    z-index: 50;
    transition: all 0.15s ease;
}

.floating-back:hover,
.back-pill:hover {
    color: var(--text);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.floating-back svg,
.back-pill svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.35);
    backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.modal-overlay.show,
.modal-overlay.visible {
    display: flex;
}

.modal,
.modal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

/* ─── Toast ──────────────────────────────────────────────────── */
/* The chess SPA under #chess-app ships its own .toast (web/src/components/
   Toasts.css); these rules are the server-rendered pages' and must not leak
   into it — a fixed, translated, pointer-events:none toast is unclickable. */
.toast:not(#chess-app *) {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(72px);
    padding: 0.625rem 1.125rem;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 250;
    white-space: nowrap;
    pointer-events: none;
}

.toast.error:not(#chess-app *) { background: var(--danger); }
.toast.success:not(#chess-app *) { background: var(--success-strong); } /* white text needs the strong shade (--success is 3.3:1) */

.toast.show:not(#chess-app *) {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Utility ────────────────────────────────────────────────── */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.hidden { display: none !important; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes launcherIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-4px); }
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.06); }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .app-shell { padding: 28px 20px 48px; }
    .hero-card  { padding: 22px 24px; }
}

@media (max-width: 720px) {
    .app-shell { padding: 20px 16px 40px; }
    .page-hero  { flex-direction: column; align-items: flex-start; }
}

/* ─── Dock (top navigation) ─────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
    z-index: 100;
}

.navbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    height: 100%;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand {
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 16px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-link {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg);
}

.nav-link.active {
    color: var(--accent-strong);
    background: var(--accent-light);
    font-weight: 600;
}

/* The chess SPA pages (chess_app.html, docs/plans/chess-board-size B5/I3):
   no tool navbar here — the React shell renders one merged bar — so the body
   loses the navbar's padding, and a same-height placeholder holds the bar's
   place (with a way home) until the bundle mounts and hides it. */
body.chess-app {
    padding-top: 0;
}

.chess-bar-placeholder {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

.chess-bar-placeholder a {
    padding: 0 0.5rem;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--text);
}

body[data-chess-shell] .chess-bar-placeholder {
    display: none;
}

.navbar-end {
    display: flex;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-signout {
        background: none;
        border: 0;
        font: inherit;
        cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
}

.nav-signout:hover {
    color: var(--danger-strong);
    background: var(--danger-light);
}

@media (max-width: 720px) {
    .navbar-inner { padding: 0 16px; }
    .navbar-brand  { margin-right: 8px; font-size: 1rem; }
    .nav-link      { padding: 0.3rem 0.5rem; font-size: 0.8125rem; }
    .nav-signout   { padding: 0.3rem 0.5rem; font-size: 0; }
    .nav-signout svg { width: 18px; height: 18px; }
}
