/* Layer order is locked in here, on first mention (see rules/css-architecture.md). Everything
   below this point in the file is currently un-layered, which the cascade treats as higher
   priority than any of these layers - that's fine today (nothing below conflicts with tokens),
   but keep new global rules unlayered-vs-layered decision deliberate as this file grows. */
@layer tokens, reset, base, objects, utilities;

@import url('styles/tokens.css') layer(tokens);
@import url('styles/theme.css');
@import url('styles/objects.css');

html, body {
    margin: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Splash title font (Figma "Sudoku"/"GLADIATOR" text styles). Self-hosted rather than linked
   to fonts.googleapis.com so the MAUI apps render it without a network call. */
@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/_content/Sudoku.App.Shared/fonts/Cinzel-Bold.ttf') format('truetype');
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLz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zkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.status-bar-safe-area {
    display: none;
}

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: #f7f7f7;
        width: 100%;
        z-index: 1;
    }

    .flex-column, .navbar-brand {
        padding-left: env(safe-area-inset-left);
    }
}

/* Splash screen + notebook-grid-bg - kept global (not Component.razor.css) on purpose. Both
   Sudoku.Web/wwwroot/index.html and Sudoku.App/wwwroot/index.html render a static pre-Blazor
   placeholder that reuses these exact classes so the page looks identical during WASM
   download / BlazorWebView startup as it does once SplashPage.razor/MainLayout.razor take
   over. That static HTML exists before Blazor mounts, so it can never carry a scoped-CSS
   attribute - these rules must stay unscoped to reach it. See rules/css-architecture.md. */

/* Recreates the "Notebook Grid" Figma vector (node 8:4: stroke #8FB4D6 @ 40% opacity, 1px
   weight, ~23.2836 unit spacing) as a CSS pattern instead of a raster/vector image asset -
   scales to any element size and tiles natively, unlike a fixed-viewBox SVG.

   Phase is anchored per-axis to match how the content inside this element is itself anchored
   (background-size gives each gradient a finite 23.2836px tile so background-position is
   meaningful - a gradient left at its default 100%-of-box size has no room for a percentage
   position to shift it, since offset = (boxSize - imageSize) * percentage = 0 when equal):
   - Horizontal: centered. .home-screen/.splash-screen/.game-screen are horizontally centered
     inside this element (margin: 0 auto), growing/shrinking symmetrically on both sides during
     a resize - so the grid is centered too, keeping cells behind that column phase-locked;
     only the outer left/right edges gain or lose cells.
   - Vertical: top. .home-screen/.game-screen are NOT vertically centered - margin: 0 auto only
     centers horizontally, so they're top-aligned and grow downward from a fixed top edge
     (min-height: 100vh just ensures they're tall enough). Centering the grid vertically too
     would anchor it to .content's vertical center, which moves as height changes - the fix is
     to anchor it to the top instead, which never moves relative to that top-aligned content.
     .splash-screen is the exception: unlike the other two, its own children ARE vertically
     centered within it (justify-content: center), so top-anchoring the grid would slide
     vertically under the (differently-resizing) centered emblem/title on a height resize -
     see the .splash-screen.notebook-grid-bg override below, which re-centers it just there. */
.notebook-grid-bg {
    background-color: var(--color-bg-app);
    background-image:
        linear-gradient(to right, rgba(143, 180, 214, 0.4) 0 1px, transparent 1px 100%),
        linear-gradient(to bottom, rgba(143, 180, 214, 0.4) 0 1px, transparent 1px 100%);
    background-size: 23.2836px 23.2836px;
    background-position: center top;
}

/* .splash-screen carries notebook-grid-bg itself (both here in SplashPage.razor and in the
   pre-Blazor static placeholder in index.html - see the comment above), fully covering
   .content's own top-anchored grid underneath it (same box, so no visible seam) with one
   anchored to its own full center instead, matching justify-content: center above. */
.splash-screen.notebook-grid-bg {
    background-position: center;
}

.splash-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 4vh 1.5rem;
    box-sizing: border-box;
}

/* Emblem, title and subtitle flow naturally (no absolute positioning against a fixed Figma
   frame size) so the stack re-centers and reflows at any viewport - font sizes use clamp() so
   they scale with the viewport between a reasonable min/max instead of a fixed 40px. */
.splash-emblem {
    width: min(70vw, 320px);
    height: auto;
    object-fit: contain;
}

.splash-title {
    margin: 3vh 0 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    color: var(--color-text-heading);
    text-align: center;
}

.splash-subtitle {
    margin: 0.5vh 0 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    letter-spacing: 0.2em;
    color: var(--color-text-primary);
    text-align: center;
}

.splash-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 6vh;
}

.splash-progress-track {
    position: relative;
    width: min(80vw, 320px);
    height: 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--color-progress-track-bg);
    border: 1px solid var(--color-progress-track-border);
    box-shadow: inset 0 1px 2px var(--color-progress-track-inset-shadow);
    overflow: hidden;
}

.splash-progress-fill {
    position: relative;
    height: 100%;
    border-radius: inherit;
    background: var(--gradient-accent);
    box-shadow: 0 0 6px var(--color-progress-fill-glow);
    transition: width 0.35s ease;
    overflow: hidden;
}

.splash-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 20%, var(--color-shimmer-highlight) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: splash-shimmer 1.6s ease-in-out infinite;
}

.splash-progress-spark {
    position: absolute;
    top: 50%;
    right: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-progress-spark);
    box-shadow: 0 0 6px 2px var(--color-progress-spark-glow);
    transform: translateY(-50%);
}

@keyframes splash-shimmer {
    to {
        transform: translateX(200%);
    }
}

.splash-status {
    color: var(--color-text-secondary);
    margin: 0;
    animation: splash-status-fade-in 0.4s ease;
}

@keyframes splash-status-fade-in {
    from {
        opacity: 0;
        transform: translateY(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
