/* ═══════════════════════════════════════════════════════════════════════════════
   Tux Software — Global Stylesheet
   Black / Red / White premium design system
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ───────────────────────────────────────────────────────── */
:root {
    /* Colour palette */
    --clr-black:       #0A0A0A;
    --clr-dark:        #111111;
    --clr-card:        #161616;
    --clr-border:      #222222;
    --clr-border-light:#2E2E2E;
    --clr-red:         #DC2626;
    --clr-red-dark:    #B91C1C;
    --clr-red-muted:   rgba(220, 38, 38, 0.10);
    --clr-white:       #FFFFFF;
    --clr-off-white:   #F5F5F5;
    --clr-gray:        #9CA3AF;
    --clr-gray-mid:    #6B7280;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Layout */
    --navbar-height:   68px;
    --content-width:   1200px;
    --spacing-page:    clamp(1.25rem, 5vw, 3rem);

    /* Border radii */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;

    /* Shadows */
    --shadow-card:       0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
    --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.5), 0 16px 48px rgba(0,0,0,0.3),
                         0 0 0 1px rgba(220,38,38,0.18);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ── 2. CSS Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    text-size-adjust: 100%;
}

body {
    background: var(--clr-black);
    color: var(--clr-gray);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
}

/* ── 3. Typography ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: var(--clr-white);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--clr-red);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--clr-red-dark);
}

code, pre, kbd {
    font-family: var(--font-mono);
}

strong, b {
    font-weight: 600;
}

/* ── 4. Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    align-items: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    gap: 0.5rem;
    justify-content: center;
    line-height: 1;
    padding: 0.6875rem 1.25rem;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast), box-shadow var(--transition-fast),
                transform var(--transition-fast);
    white-space: nowrap;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.4);
    outline: none;
}

.btn:active {
    transform: translateY(1px);
}

/* Primary — always white text on brand-red regardless of theme */
.btn-primary {
    background: var(--clr-red);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--clr-red-dark);
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
    color: #FFFFFF;
}

/* Outline */
.btn-outline {
    background: transparent;
    border: 1px solid var(--clr-border-light);
    color: var(--clr-white);
}

.btn-outline:hover {
    background: var(--clr-border);
    border-color: var(--clr-gray-mid);
    color: var(--clr-white);
}

/* Sizes */
.btn-sm {
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.875rem 1.625rem;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ── 5. Section Layout ──────────────────────────────────────────────────────── */
.section {
    padding: var(--spacing-section, 6rem) 0;
}

.section--dark {
    background: var(--clr-dark);
}

.section--black {
    background: var(--clr-black);
}

.section-container {
    margin: 0 auto;
    max-width: var(--content-width);
    padding: 0 var(--spacing-page);
}

/* Page hero sections (immediately after fixed navbar) */
.page-hero {
    background: var(--clr-black);
    border-bottom: 1px solid var(--clr-border);
    padding: calc(var(--navbar-height) + 4rem) var(--spacing-page) 4rem;
}

/* ── 6. Form elements (global) ──────────────────────────────────────────────── */
input, select, textarea, button {
    font-family: var(--font-sans);
}

/* Blazor validation state colours */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid rgba(74, 222, 128, 0.5);
}

.invalid {
    border-color: var(--clr-red) !important;
}

.validation-message {
    color: #F87171;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ── 7. Blazor reconnect / error UI ─────────────────────────────────────────── */
.blazor-error-boundary {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--clr-red);
    border-radius: var(--radius-md);
    color: #F87171;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ── 8. Scrollbar styling (Webkit) ──────────────────────────────────────────── */
::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--clr-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--clr-border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--clr-gray-mid);
}

/* ── 9. Selection ───────────────────────────────────────────────────────────── */
::selection {
    background: rgba(220, 38, 38, 0.3);
    color: var(--clr-white);
}

/* ── 10. Focus visible ──────────────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--clr-red);
    outline-offset: 2px;
}

/* ── 11. ReconnectModal ─────────────────────────────────────────────────────── */
#components-reconnect-modal {
    background: rgba(10, 10, 10, 0.85);
    bottom: 0;
    display: none;
    inset: 0;
    position: fixed;
    z-index: 200;
}

#components-reconnect-modal.components-reconnect-show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── 12. Utility classes ─────────────────────────────────────────────────────── */
.visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.text-center { text-align: center; }
.text-red { color: var(--clr-red); }
.text-white { color: var(--clr-white); }
.text-gray { color: var(--clr-gray); }

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

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

/* Apply subtle entrance animations to main content sections */
.page-hero,
.section {
    animation: fadeIn 0.4s ease forwards;
}

/* ── 14. Spacing helpers ─────────────────────────────────────────────────────── */
:root {
    --spacing-section: 6rem;
}

@media (max-width: 768px) {
    :root {
        --spacing-section: 4rem;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-section: 3rem;
    }
}
