/**
 * ignitio Player — app shell styling.
 *
 * Only the chrome AROUND the module lives here. Everything inside
 * `.h5p-content` is styled by generated/content-chrome.css, which is emitted
 * from the same server template the Editor, Preview, Deploy and the desktop
 * Player use — so the module looks identical everywhere.
 */

:root {
    --flame-start: #f83600;
    --flame-end: #ff9d1e;
    --ink: #222;
    --muted: #5b6169;
    --page: #f1f3f4;
    --inter: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        sans-serif;
    --display: 'Space Grotesk', 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--inter);
    color: var(--ink);
    background: var(--page);
    /* Dynamic viewport units keep the layout correct when a mobile browser's
       address bar collapses; 100vh is the pre-dvh fallback. */
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
}

/* Native-app feel, matching the Editor and desktop Player: no stray text
   selection in chrome. Real editing surfaces inside content stay selectable —
   content-chrome.css carries those exemptions. */
body {
    -webkit-user-select: none;
    user-select: none;
}

/* ── Shell views ─────────────────────────────────────────────────────────── */

.shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.shell[hidden] {
    display: none;
}

.card {
    width: 100%;
    max-width: 520px;
    padding: 40px 32px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2),
        0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
    text-align: center;
}

.card__logo {
    height: 96px;
    width: auto;
    object-fit: contain;
    margin-bottom: 8px;
}

.card__title {
    margin: 0 0 12px;
    font-family: var(--display);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    background: linear-gradient(
        to right,
        var(--flame-start),
        var(--flame-end)
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.card__title--error {
    font-size: 1.75rem;
    background: none;
    -webkit-text-fill-color: var(--ink);
    color: var(--ink);
}

.card__subtitle {
    margin: 0 0 24px;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--muted);
    /* Error detail can contain a long unbroken filename or path. */
    overflow-wrap: anywhere;
}

.card__subtitle code {
    font-size: 0.95em;
    padding: 1px 5px;
    border-radius: 4px;
    background: #f5f6f7;
}

.card__hint {
    margin: 16px 0 0;
    font-size: 0.875rem;
    color: #8a9099;
}

.button {
    appearance: none;
    border: 0;
    border-radius: 8px;
    padding: 12px 28px;
    font-family: var(--inter);
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--flame-start);
    cursor: pointer;
    /* Comfortably above the 44px touch-target minimum on phones. */
    min-height: 48px;
    transition: background-color 0.15s ease;
}

.button:hover {
    background: #d93100;
}

.button:active {
    background: #bf2b00;
}

.button:focus-visible {
    outline: 3px solid rgba(248, 54, 0, 0.4);
    outline-offset: 2px;
}

.is-dragging .card {
    outline: 3px dashed var(--flame-start);
    outline-offset: 8px;
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 24px;
    border: 4px solid rgba(248, 54, 0, 0.15);
    border-top-color: var(--flame-start);
    border-radius: 50%;
    animation: ignitio-spin 0.9s linear infinite;
}

@keyframes ignitio-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Respect a reduced-motion preference: keep the indicator, drop the spin. */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 3s;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Player view ─────────────────────────────────────────────────────────── */

#ignitio-player-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

#ignitio-player-view[hidden] {
    display: none;
}

/* Portrait phones: drop the brand wordmark and shorten the title so the module
   name is not squeezed out of the header. Mirrors livePreview.ts. */
@media (max-width: 600px) and (orientation: portrait) {
    .ignitio-player-brand {
        min-width: 48px !important;
        gap: 0 !important;
    }
    .ignitio-player-brand-name {
        display: none !important;
    }
    .ignitio-player-spacer {
        min-width: 48px !important;
    }
    .ignitio-player-title {
        padding: 0 8px !important;
        font-size: 0.9rem !important;
    }
    .ignitio-player-title-full {
        display: none !important;
    }
    .ignitio-player-title-short {
        display: inline !important;
    }
}

/* The welcome card is generously sized for desktop; tighten it on small
   screens so it never needs scrolling. */
@media (max-width: 480px) {
    .card {
        padding: 32px 20px;
        border-radius: 18px;
    }
    .card__title {
        font-size: 2.1rem;
    }
    .card__logo {
        height: 72px;
    }
    .card__subtitle {
        font-size: 1rem;
    }
}
