/*
 * Base layer: reset, document defaults and typography, built on tokens.css. Component classes
 * live in components.css.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

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

body {
    background: var(--torch-surface-0);
    color: var(--torch-text-primary);
    font-family: var(--torch-font-body);
    font-size: var(--torch-text-base);
    line-height: var(--torch-leading-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Inter's tabular figures and contextual alternates — numbers in tables and version strings
       line up without switching to the mono face. */
    font-feature-settings: "cv05" 1, "cv11" 1;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--torch-font-display);
    font-weight: 600;
    letter-spacing: var(--torch-tracking-display);
    line-height: var(--torch-leading-display);
    color: var(--torch-text-primary);
    margin-top: 0;
    /* Czech headlines are long; balancing beats a lone trailing word on its own line. */
    text-wrap: balance;
}

h1 {
    font-size: var(--torch-text-2xl);
}

h2 {
    font-size: var(--torch-text-xl);
}

h3 {
    font-size: var(--torch-text-md);
}

p {
    text-wrap: pretty;
}

a {
    color: var(--torch-accent-strong);
    text-underline-offset: 0.2em;
    text-decoration-thickness: 1px;
    transition: color var(--torch-duration-fast) var(--torch-ease-out);
}

a:hover {
    color: var(--torch-accent);
}

code,
kbd,
samp,
pre {
    font-family: var(--torch-font-mono);
    font-size: 0.875em;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

::selection {
    background: var(--torch-accent-muted);
    color: var(--torch-text-primary);
}

/* One focus treatment everywhere, and only for keyboard users — the default UA outline is
   invisible against these surfaces on some browsers and jarring on others. */
:focus-visible {
    outline: none;
    box-shadow: var(--torch-focus-ring);
    border-radius: var(--torch-radius-sm);
}

/*
 * <FocusOnNavigate Selector="h1"> in Routes.razor moves focus to the page title after every
 * navigation so a screen reader announces the new page. That is correct and stays — but it also
 * lands the ring above around the heading for anyone navigating by keyboard, where a gold box
 * drawn around the title reads as a stuck selection rather than as an announcement.
 *
 * Only the box is suppressed. The focus move still happens, the page is still announced, and a
 * heading is not interactive, so no keyboard affordance is lost by not outlining it.
 */
h1:focus,
h1:focus-visible {
    box-shadow: none;
}

/* Global input styling — shared across TorchField-wrapped inputs and any standalone form
   control, since a scoped .razor.css cannot reach markup passed in as page content. */
.torch-input,
.torch-select {
    background: var(--torch-surface-2);
    border: 1px solid var(--torch-border);
    border-radius: var(--torch-radius-sm);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
    color: var(--torch-text-primary);
    font-family: var(--torch-font-body);
    padding: var(--torch-space-2) var(--torch-space-3);
    font-size: var(--torch-text-base);
    width: 100%;
    transition: border-color var(--torch-duration-fast) var(--torch-ease-out),
        box-shadow var(--torch-duration-fast) var(--torch-ease-out);
}

.torch-input:hover,
.torch-select:hover {
    border-color: var(--torch-border-strong);
}

.torch-input:focus,
.torch-select:focus {
    outline: none;
    border-color: var(--torch-accent);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(201, 151, 63, 0.15);
}

.torch-input::placeholder {
    color: var(--torch-text-muted);
}

/* The ambient ember canvas, the hero pan and the logo glow are atmosphere, not information —
   anyone who has asked the OS to reduce motion should get the page without them. */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        /* Delay has to collapse too, not just duration: a staggered entrance (.torch-rise) uses
           `animation-fill-mode: both`, so an un-reset delay would hold each element at opacity 0
           for its full stagger before snapping in — the reduced-motion path would be *slower* to
           become readable than the animated one. */
        animation-delay: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
