/* ── Scroll padding — keeps focused elements clear of the sticky nav (WCAG 2.4.11) ── */

html {
    scroll-padding-top: 4.5rem;
}

/* ── Toast notifications ──────────────────────────────────────────────────── */

#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: opacity 0.5s;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

body {
    font-family: var(--font-body), sans-serif;
    background-color: #f5f3ee;
    color: #1a1a1a;
}

/* ── Text selection ───────────────────────────────────────────────────────── */

::selection {
    background-color: #003b6f;
    color: #ffffff;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #e8e5de;
}
::-webkit-scrollbar-thumb {
    background: #003b6f;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #1565c0;
}

/* ── Glow border ──────────────────────────────────────────────────────────── */

.glow-border {
    box-shadow: 0 0 0 1px rgba(0, 59, 111, 0.2), 0 2px 8px rgba(0,0,0,0.12);
}

.glow-border:hover {
    box-shadow: 0 0 0 1px rgba(0, 59, 111, 0.4), 0 4px 16px rgba(0,0,0,0.18);
}

/* ── Nav link ─────────────────────────────────────────────────────────────── */

.nav-link {
    position: relative;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #003b6f;
    transition: width 0.2s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ── Data table ───────────────────────────────────────────────────────────── */

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr.hidden {
    display: none;
}

.data-table tbody tr:hover {
    background-color: rgba(0, 59, 111, 0.07);
}

/* ── Vortex background (page header) ─────────────────────────────────────── */

.vortex-bg {
    background: radial-gradient(ellipse at 50% 0%, #dceeff 0%, #f5f3ee 60%) fixed;
    background-color: #f5f3ee;
}

/* ── Hex pattern overlay ──────────────────────────────────────────────────── */

.bg-hex-pattern {
    background-image: radial-gradient(circle, rgba(0,59,111,0.08) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ── Animations ───────────────────────────────────────────────────────────── */

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

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.animate-blink { animation: blink 1s step-start infinite; }

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

.animate-fade-in  { animation: fadeIn  0.4s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }

/* Remove number input arrows */

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* ── Dark mode ────────────────────────────────────────────────────────────── */

html[data-theme="dark"] {
    /* Remap brass scale — darks become lights so blue text stays readable */
    --color-brass-300: #99c2ff;
    --color-brass-400: #5b9dd4;
    --color-brass-500: #4a8fd4;
    --color-brass-600: #5b9dd4;
    --color-brass-700: #2e7bc4;
    --color-brass-800: #1a5a9a;
    --color-brass-900: #0d3060;

    --color-console-50:  #0a0c10;
    --color-console-100: #0e1117;
    --color-console-200: #141820;
    --color-console-300: #1a2030;
    --color-console-400: #202840;
    --color-console-500: #80828a;
    --color-console-600: #1e2d42;
    --color-console-700: #2a3a52;
    --color-console-800: #162030;
    --color-console-900: #0e1520;
    --color-console-950: #1a2535;

    --color-roundel-100: #e8e5de;
    --color-roundel-200: #d0ccc4;
    --color-roundel-300: #b0aca4;
    --color-roundel-400: #908c84;
    --color-roundel-500: #878787;
    --color-roundel-600: #505048;
    --color-roundel-700: #404038;
    --color-roundel-800: #303028;
    --color-roundel-900: #202018;
}

html[data-theme="dark"] body {
    background-color: #0e1117;
    color: #e8e5de;
}

html[data-theme="dark"] .vortex-bg {
    background: radial-gradient(ellipse at 50% 0%, #0d1a2e 0%, #0e1117 60%) fixed;
    background-color: #0e1117;
}

html[data-theme="dark"] ::-webkit-scrollbar-track { background: #1a1f2e; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #1a6baa; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #2e7bc4; }

html[data-theme="dark"] .glow-border {
    box-shadow: 0 0 0 1px rgba(26,107,170,0.25), 0 2px 8px rgba(0,0,0,0.4);
}
html[data-theme="dark"] .glow-border:hover {
    box-shadow: 0 0 0 1px rgba(26,107,170,0.5), 0 4px 16px rgba(0,0,0,0.5);
}

html[data-theme="dark"] .nav-link::after { background-color: #1a6baa; }

html[data-theme="dark"] .data-table tbody tr:hover { background-color: rgba(26,107,170,0.12); }

html[data-theme="dark"] .bg-hex-pattern {
    background-image: radial-gradient(circle, rgba(26,107,170,0.1) 1px, transparent 1px);
}

html[data-theme="dark"] .hero-title { color: #99c2ff; }

/* ── Celebration mode (1983 Doctor Who: A Celebration book) ───────────────── */

html[data-theme="celebration"] {
    /* Brass remapped to warm browns / muted golds — period-correct ink tones */
    --color-brass-300: #a06a2a;
    --color-brass-400: #8a5520;
    --color-brass-500: #7a4a1a;
    --color-brass-600: #6a3a10;
    --color-brass-700: #4a2810;
    --color-brass-800: #3a1e08;
    --color-brass-900: #2a1604;

    /* Console scale becomes a parchment palette — surfaces & rules on cream */
    --color-console-50:  #f8f1de;
    --color-console-100: #f3ead8;
    --color-console-200: #ede1c8;
    --color-console-300: #e8dcc1;
    --color-console-400: #d8c8a8;
    --color-console-500: #6a5a48;
    --color-console-600: #c4b48f;
    --color-console-700: #d8c8a8;
    --color-console-800: #ede1c8;
    --color-console-900: #f3ead8;
    --color-console-950: #ebdfc4;

    /* Roundel — body text and softer ink shades */
    --color-roundel-100: #1a1612;
    --color-roundel-200: #2a2218;
    --color-roundel-300: #3a2f23;
    --color-roundel-400: #4a3f33;
    --color-roundel-500: #6a5a48;
    --color-roundel-600: #8a7a64;
    --color-roundel-700: #a89878;
    --color-roundel-800: #c8b894;
    --color-roundel-900: #e8dcc1;
}

html[data-theme="celebration"] body {
    background-color: #f3ead8;
    color: #1a1612;
    font-family: var(--font-display), 'Cormorant Garamond', 'Times New Roman', serif;
}

html[data-theme="celebration"] .vortex-bg {
    background: radial-gradient(ellipse at 50% 0%, #ede1c8 0%, #f3ead8 60%) fixed;
    background-color: #f3ead8;
}

html[data-theme="celebration"] ::-webkit-scrollbar-track { background: #e8dcc1; }
html[data-theme="celebration"] ::-webkit-scrollbar-thumb { background: #6a3a10; }
html[data-theme="celebration"] ::-webkit-scrollbar-thumb:hover { background: #4a2810; }

html[data-theme="celebration"] ::selection {
    background-color: #2a2a3e;
    color: #f3ead8;
}

html[data-theme="celebration"] .glow-border {
    box-shadow: 0 0 0 1px rgba(42,42,62,0.25), 0 1px 4px rgba(60,40,20,0.18);
}
html[data-theme="celebration"] .glow-border:hover {
    box-shadow: 0 0 0 1px rgba(42,42,62,0.45), 0 2px 8px rgba(60,40,20,0.25);
}

html[data-theme="celebration"] .nav-link::after { background-color: #2a2a3e; }

html[data-theme="celebration"] .data-table tbody tr:hover {
    background-color: rgba(42,42,62,0.08);
}

html[data-theme="celebration"] .bg-hex-pattern {
    background-image: radial-gradient(circle, rgba(42,42,62,0.10) 1px, transparent 1px);
}

html[data-theme="celebration"] .hero-title {
    color: #2a2a3e;
    font-style: italic;
}

/* ── Forthcoming release rows ────────────────────────────────────────────── */

.forthcoming-row td {
    background: linear-gradient(to right, transparent, rgba(26, 107, 170, 0.15) 50%, transparent);
}

.forthcoming-row:hover td {
    background: linear-gradient(to right, transparent, rgba(26, 107, 170, 0.28) 50%, transparent);
}

html[data-theme="dark"] .forthcoming-row td {
    background: linear-gradient(to right, transparent, rgba(26, 107, 170, 0.25) 50%, transparent);
}

html[data-theme="dark"] .forthcoming-row:hover td {
    background: linear-gradient(to right, transparent, rgba(26, 107, 170, 0.40) 50%, transparent);
}

html[data-theme="celebration"] .forthcoming-row td {
    background: linear-gradient(to right, transparent, rgba(122, 42, 42, 0.14) 50%, transparent);
}

html[data-theme="celebration"] .forthcoming-row:hover td {
    background: linear-gradient(to right, transparent, rgba(122, 42, 42, 0.24) 50%, transparent);
}

/* ── VAM status filter buttons ───────────────────────────────────────────── */

.vam-status-btn.active,
.cohort-status-btn.active {
    border-color: currentColor;
    opacity: 1;
}

.vam-status-btn:not(.active),
.cohort-status-btn:not(.active) {
    opacity: 0.5;
}

/* ── Focus-visible ring (keyboard navigation) ────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--color-brass-500, #a07830);
    outline-offset: 2px;
}

/* Inputs/selects/textareas use border highlight + Tailwind ring — suppress
   the global outline so they don't double up. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

/* ── Disabled form fields ────────────────────────────────────────────────── */
/* The dark console palette swallows the browser's default disabled styling.
   Make disabled inputs / selects / checkboxes visibly inert. */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--color-console-950, #0a0f1a);
}
input[type="checkbox"]:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
/* Dim the label text next to a disabled checkbox so the whole row reads as
   inert, not just the checkbox itself. */
label:has(input:disabled),
label:has(select:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Page navigation loading bar ─────────────────────────────────────────── */
/* A thin progress bar pinned to the top of the viewport, shown while a new
   page is loading after an internal link click. */
#page-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 100;
    background: linear-gradient(to right,
        var(--color-brass-600, #8a6520),
        var(--color-brass-400, #c79a4a));
    box-shadow: 0 0 8px var(--color-brass-500, #a07830);
    opacity: 0;
    pointer-events: none;
    transition: width 0.2s ease, opacity 0.2s ease;
}
#page-loading-bar.loading {
    opacity: 1;
    width: 90%;
    /* Slow creep toward 90% so the bar keeps moving while the server works. */
    transition: width 8s cubic-bezier(0.1, 0.7, 0.1, 1), opacity 0.2s ease;
}

