/* ============================================================================
   QuickPlay — base layer: fonts, reset, typography, focus, scrollbars.
   Depends on tokens.css.
   ========================================================================= */

/* ---- Self-hosted typefaces (vendored under wwwroot/lib/fonts) ----------- */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../lib/fonts/inter/InterVariable.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../lib/fonts/inter/InterVariable-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
        U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("../lib/fonts/jetbrains-mono/JetBrainsMonoVariable.woff2") format("woff2");
}

/* ---- Reset -------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    height: 100%;
}

body {
    height: 100%;
    background: var(--qp-canvas);
    color: var(--qp-text);
    font-family: var(--qp-font-sans);
    font-size: var(--qp-text-md);
    line-height: var(--qp-leading-normal);
    font-weight: var(--qp-weight-normal);
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv05" 1, "cv11" 1, "ss03" 1, "calt" 1;
    overflow-wrap: break-word;
}

img,
svg,
video,
canvas {
    display: block;
    max-width: 100%;
}

svg {
    flex: none;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

ul[class],
ol[class] {
    list-style: none;
    padding: 0;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--qp-border-subtle);
}

fieldset {
    border: 0;
    padding: 0;
    min-inline-size: 0;
}

/* ---- Typography --------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--qp-text-strong);
    font-weight: var(--qp-weight-semibold);
    line-height: var(--qp-leading-tight);
    letter-spacing: var(--qp-tracking-tight);
    text-wrap: balance;
}

h1 {
    font-size: var(--qp-text-2xl);
    letter-spacing: var(--qp-tracking-tighter);
}

h2 {
    font-size: var(--qp-text-xl);
}

h3 {
    font-size: var(--qp-text-lg);
}

h4 {
    font-size: var(--qp-text-md);
}

p {
    text-wrap: pretty;
}

a {
    color: var(--qp-accent-text);
    text-decoration: none;
    text-underline-offset: 2px;

    &:hover {
        text-decoration: underline;
    }
}

code,
kbd,
samp,
pre,
.qp-mono {
    font-family: var(--qp-font-mono);
    font-feature-settings: "liga" 0;
    font-size: 0.925em;
}

code:not(pre code) {
    background: var(--qp-code-bg);
    border-radius: var(--qp-radius-xs);
    padding: 0.1em 0.36em;
    color: var(--qp-text);
}

small {
    font-size: var(--qp-text-xs);
}

strong,
b {
    font-weight: var(--qp-weight-semibold);
}

::selection {
    background: var(--qp-selection);
    color: var(--qp-text-strong);
}

/* ---- Focus -------------------------------------------------------------- */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--qp-focus-ring);
    outline-offset: 2px;
    border-radius: var(--qp-radius-xs);
}

/* Elements that own their ring geometry opt out of the generic radius. */
.qp-focusable:focus-visible {
    outline: 2px solid var(--qp-focus-ring);
    outline-offset: 2px;
    border-radius: inherit;
}

/* Programmatic focus targets — FocusOnNavigate's <h1>, the skip-link's <main>, overlay
   panels — receive focus without a pointer or Tab, so they must not draw a ring. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
    outline: none;
}

/* ---- Scrollbars --------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--qp-scrollbar) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--qp-scrollbar);
    border-radius: var(--qp-radius-full);
    border: 3px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--qp-scrollbar-hover);
    background-clip: content-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* ---- Utilities (the only global helpers; keep this list tiny) ----------- */
.qp-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.qp-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.qp-stack {
    display: flex;
    flex-direction: column;
    gap: var(--qp-space-4);
}

.qp-row {
    display: flex;
    align-items: center;
    gap: var(--qp-space-2);
}

.qp-spacer {
    flex: 1 1 auto;
}

.qp-muted {
    color: var(--qp-text-muted);
}

.qp-subtle {
    color: var(--qp-text-subtle);
}

.qp-overline {
    font-size: var(--qp-text-2xs);
    font-weight: var(--qp-weight-semibold);
    letter-spacing: var(--qp-tracking-caps);
    text-transform: uppercase;
    color: var(--qp-text-subtle);
}

.qp-numeric {
    font-variant-numeric: tabular-nums;
}

/* ---- Motion preferences -------------------------------------------------- */
@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;
    }
}

/* ---- Blazor's built-in error bar, restyled ------------------------------- */
#blazor-error-ui {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: var(--qp-z-toast);
    display: none;
    align-items: center;
    gap: var(--qp-space-3);
    padding: var(--qp-space-3) var(--qp-space-5);
    background: var(--qp-fail-bg);
    color: var(--qp-fail);
    border-top: 1px solid var(--qp-fail-border);
    box-shadow: var(--qp-shadow-2);
    font-size: var(--qp-text-sm);
}

#blazor-error-ui .reload {
    color: inherit;
    font-weight: var(--qp-weight-medium);
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    margin-inline-start: auto;
    cursor: pointer;
    opacity: 0.7;
}
