/*----------------------------------------------------------------
//  global.css
//
//  Changelog:
//      Paulinchen  2026-11-01: Showed the install buttons only where the browser can open a game folder, and their wait for the installer
//                            - Showed Update all and Remove only where the browser can write into the game folder
//      Paulinchen  2026-10-21: Added the ink, sheet dark, pill radius and spacing tokens
//                            - Added the card, card link, column and alert body classes
//                            - Described the breakpoint pairs
//      Paulinchen  2026-10-16: Created
//
//----------------------------------------------------------------*/

/*-----------------------------------
/   Fonts
/-----------------------------------*/
/* Served from this site, so a visit never tells a font host who is reading. */
@font-face {
    font-display: swap;
    font-family: "Cinzel";
    font-style: normal;
    font-weight: 400 900;
    src: url("../fonts/cinzel-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-display: swap;
    font-family: "Cinzel";
    font-style: normal;
    font-weight: 400 900;
    src: url("../fonts/cinzel-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-display: swap;
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    src: url("../fonts/inter-latin.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-display: swap;
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    src: url("../fonts/inter-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/*-----------------------------------
/   Shared tokens
/-----------------------------------*/
:root {
    /* Featured worlds, as the game and the admin tool colour them. */
    --mgq-gold: #e8b85c;
    /* Raid Worlds. */
    --mgq-crimson: #ff5d78;
    /* Dark text that reads on the warning colour in both schemes, as on the count badges. */
    --mgq-ink: #140f1e;
    /* The dark of a party sheet, shown behind it while it loads so the box does not flash white. */
    --mgq-sheet-dark: #120e17;
    --mgq-radius-lg: 16px;
    --mgq-radius-pill: 999px;
    /* The px spacing of the denser parts (the admin consoles and dialogs, the banners), counted as
       MudBlazor's spacing classes count: step n is n times 4px, so --mgq-space-2 and mt-2 are both
       8px, and --mgq-space-1-5 is step 1.5. */
    --mgq-space-1: 4px;
    --mgq-space-1-5: 6px;
    --mgq-space-2: 8px;
    --mgq-space-2-5: 10px;
    --mgq-space-3: 12px;
    --mgq-space-3-5: 14px;
    --mgq-space-4: 16px;
    --mgq-space-4-5: 18px;
    --mgq-space-5: 20px;
    --mgq-space-6: 24px;
    --mgq-space-8: 32px;
    --mgq-glow: 0 0 0 1px color-mix(in srgb, var(--mud-palette-primary) 35%, transparent),
                0 12px 40px -12px color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
}

/*-----------------------------------
/   Breakpoints
/
/   Media queries cannot read custom properties, so the stylesheets write the widths out in
/   MudBlazor's pairs: "max-width: 599.98px" below a step and "min-width: 600px" from it on, so no
/   width shows both layouts or neither. The steps are 480, 600, 640, 800, 960, 1100 and 1280px.
/-----------------------------------*/

/*-----------------------------------
/   Page background
/-----------------------------------*/
/* A faint violet sky behind every page; the cards stay readable on top of it. */
.mud-layout {
    background:
        radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--mud-palette-primary) 16%, transparent), transparent 70%),
        radial-gradient(900px 500px at -10% 10%, color-mix(in srgb, var(--mud-palette-tertiary) 9%, transparent), transparent 70%),
        var(--mud-palette-background);
    min-height: 100vh;
}

/*-----------------------------------
/   Focus
/-----------------------------------*/
:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* FocusOnNavigate moves focus to the heading for screen readers; no visitor tabbed there. */
h1:focus,
h1:focus-visible {
    outline: none;
}

/*-----------------------------------
/   Screen reader only
/-----------------------------------*/
.mgq-visually-hidden {
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/*-----------------------------------
/   Reduced motion
/-----------------------------------*/
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/*-----------------------------------
/   Cards
/-----------------------------------*/
/* As many 19rem columns as fit in a row. */
.mgq-card-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}

.mgq-card {
    background: color-mix(in srgb, var(--mud-palette-surface) 92%, transparent);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mgq-radius-lg);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.mgq-card:hover,
.mgq-card:focus-within {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 55%, transparent);
    box-shadow: var(--mgq-glow);
}

@media (prefers-reduced-motion: no-preference) {
    .mgq-card:hover {
        transform: translateY(-2px);
    }
}

/* The title link of a card covers the whole card, so the card opens wherever it is clicked. */
.mgq-card-link {
    color: inherit;
    text-decoration: none;
}

.mgq-card-link::after {
    border-radius: var(--mgq-radius-lg);
    content: "";
    inset: 0;
    position: absolute;
}

.mgq-card-link:focus-visible {
    outline: none;
}

.mgq-card-link:focus-visible::after {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/*-----------------------------------
/   Columns
/
/   A page's two columns side by side on wide screens and one below the other on narrow ones;
/   the page sets the two widths in --mgq-columns.
/-----------------------------------*/
.mgq-columns {
    display: grid;
    gap: 2rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1100px) {
    .mgq-columns {
        align-items: start;
        grid-template-columns: var(--mgq-columns);
    }
}

/*-----------------------------------
/   Alert body
/-----------------------------------*/
/* A message with its action inside an alert; the action wraps below it on narrow screens. */
.mgq-alert-body {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    justify-content: space-between;
    width: 100%;
}

/*-----------------------------------
/   Character gallery
/-----------------------------------*/
/* A rule rather than an inline style, so the page scrolls again even when the open detail dialog
   is removed without closing, as it is when the visitor leaves the gallery. */
html:has(.mgq-gallery__dialog[open]) {
    overflow: hidden;
}

/*-----------------------------------
/   Install buttons
/   installerMode.js marks the page with data-installer where the browser can open a game folder;
/   install buttons carry .mgq-install-only, what gives way to them .mgq-install-none, and the
/   buttons that only work where the browser can write into the folder .mgq-install-write-only.
/-----------------------------------*/
html:not([data-installer]) .mgq-install-only,
html[data-installer="read"] .mgq-install-write-only {
    display: none !important;
}

html[data-installer] .mgq-install-none {
    display: none !important;
}

.mgq-install-action {
    display: contents;
}

.mgq-install-state {
    align-items: center;
    color: var(--mud-palette-text-secondary);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.875rem;
    gap: 0.25rem 0.5rem;
    margin: 0.75rem 0 0;
}

/* A button pressed before the installer runs shows that it waits, in the text the bridge set. */
[data-install-waiting] {
    pointer-events: none;
    position: relative;
}

[data-install-waiting] > * {
    visibility: hidden;
}

[data-install-waiting]::after {
    align-items: center;
    content: attr(data-install-waiting);
    display: flex;
    inset: 0;
    justify-content: center;
    position: absolute;
    white-space: nowrap;
}

/*-----------------------------------
/   Blazor Error UI
/-----------------------------------*/
#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 {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
