/*
 * static/css/base.css — reset, Inter (self-hosted @font-face from /static/vendor/), buttons, focus ring (--ring), scrollbars, .visually-hidden, the reduced-motion block.
 *
 * Owner: WP A-13 (Phase 1), B-13 (Phase 2). Spec: FA §16.1.
 * Every selector is defined once, in one file (I7; T-CSS checks the critical ones).
 * Values are the legacy index.html's effective values (base rules merged with the later
 * "visual redesign" overrides). Screen-specific rules (sidebar, nav, home/auth, notices at
 * #main-area > .context-warning) live in layout.css; chat rules in chat.css.
 */

/* Inter 4.1 variable fonts (OFL-1.1), vendored by P0-6; replaces the legacy web-font link. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/vendor/inter/4.1/InterVariable.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('/static/vendor/inter/4.1/InterVariable-Italic.woff2') format('woff2');
}

/* Smooth colour transition on theme switch, for major surfaces only (body, below). #sidebar,
   #main-area, #top-nav, .context-warning and .auth-panel carry the same transition in their own
   layout.css rules, #chat-box and #input-area in chat.css (I7: each selector lives in one file). */

/* ============================================================
   RESET & BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
[hidden] { display: none !important; }
body {
    font-family: var(--font-sans); font-size: 15px; color: var(--text-color);
    display: flex; height: 100vh; height: 100dvh; overflow: hidden;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
    background: var(--bg-color);
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
::selection { background: var(--gold-glow); }
h1, h2, h3, h4 { letter-spacing: -0.02em; }
button, input, textarea { letter-spacing: -0.01em; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--gold-accent); outline-offset: 2px;
}

/* thin, themed scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-control); background-clip: content-box; }

/* Screen-reader-only text (sidebar ", working" labels, the shared live region). */
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ============================================================
   BUTTONS (shared by every screen)
   ============================================================ */
.btn { padding: 8px 16px; background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-color); border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s, border-color 0.15s; font-size: 0.88rem; font-family: inherit; }
.btn:hover { background: var(--border-color); border-color: var(--border-strong); }

.icon-btn { background: var(--surface-1); border: 1px solid var(--border-color); color: var(--text-muted); border-radius: var(--radius-pill); height: 40px; min-width: 40px; padding: 0 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.92rem; font-family: inherit; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.icon-btn:hover { background: var(--card-bg); color: var(--gold-accent); border-color: var(--border-strong); }

.theme-toggle { background: var(--surface-1); border: 1px solid var(--border-color); color: var(--text-muted); border-radius: var(--radius-md); min-width: 58px; height: 36px; padding: 0 10px; cursor: pointer; font-size: 0.88rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.theme-toggle:hover { background: var(--card-bg); color: var(--gold-accent); border-color: var(--border-strong); }

/* "Back to home" button */
.home-btn { background: var(--surface-1); border: 1px solid var(--border-color); color: var(--text-muted); border-radius: var(--radius-md); height: 36px; padding: 0 13px; cursor: pointer; font-size: 0.85rem; line-height: 1; display: inline-flex; align-items: center; gap: 6px; transition: background 0.2s, color 0.2s, border-color 0.2s; font-family: inherit; white-space: nowrap; }
.home-btn:hover { background: var(--card-bg); color: var(--text-color); border-color: var(--border-strong); }
.home-btn .home-btn-icon { font-size: 1rem; line-height: 1; }

/* Shared entrance animations (modals, file preview, stage). */
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============================================================
   GLOBAL NOTICE (home and auth screens, before the chat shell exists;
   the chat screen uses #main-area > .context-warning, layout.css)
   ============================================================ */
.global-notice {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
    z-index: var(--z-system-notice); max-width: min(560px, calc(100vw - 32px));
    padding: 10px 18px; border-radius: var(--radius-md);
    background: var(--surface-2); border: 1px solid var(--warning-border); color: var(--warning-text);
    box-shadow: var(--elev-2); font-size: 0.88rem; line-height: 1.5; text-align: center;
    animation: overlay-in 0.18s ease;
}
.global-notice[data-level="error"] { border-color: color-mix(in srgb, var(--danger-rich) 45%, transparent); color: var(--danger-text); }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
