/* 17k Rinkside — application styles.
 *
 * MudBlazor supplies the component library and theming; this file covers only what
 * the theme cannot: the pre-Blazor startup screen, the brand mark, the record hero,
 * and calendar density tuning.
 *
 * Colours come from MudBlazor CSS variables (--mud-palette-*) wherever possible so
 * dark mode is handled by the theme rather than duplicated here. */

html,
body {
    margin: 0;
    /* Prevent the horizontal scroll a wide table or calendar would otherwise cause
       on a phone. Wide content scrolls inside its own container instead. */
    overflow-x: hidden;
}

/* ---------------------------------------------------------------------------
   Startup screen
   Shown by index.html before the WebAssembly runtime has loaded, so it cannot
   use MudBlazor. Colours are hard-coded and match the dark palette.
   --------------------------------------------------------------------------- */

.startup-shell {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #0b1220;
    color: #e8ecf5;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.startup-mark {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #5c93ff, #2fbd82);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.startup-caption {
    font-size: 0.875rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #9aa5bb;
}

.startup-bar {
    width: 160px;
    height: 3px;
    border-radius: 999px;
    background: rgba(154, 165, 187, 0.2);
    overflow: hidden;
}

.startup-bar span {
    display: block;
    width: 40%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5c93ff, #2fbd82);
    animation: startup-slide 1.1s ease-in-out infinite;
}

@keyframes startup-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Respect a reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
    .startup-bar span {
        animation: none;
        width: 100%;
    }
}

/* ---------------------------------------------------------------------------
   Brand
   --------------------------------------------------------------------------- */

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.75rem;
    letter-spacing: -0.04em;
    line-height: 1;
    background: linear-gradient(135deg, var(--mud-palette-primary), var(--mud-palette-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-mark-sm {
    font-size: 1.25rem;
}

.brand-word {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.rinkside-appbar {
    border-bottom: 1px solid var(--mud-palette-divider);
    backdrop-filter: saturate(180%) blur(12px);
}

/* Team name in the app bar. Truncates instead of wrapping so a long name cannot
   push the theme toggle or the account menu off a narrow screen. */
.team-name-badge {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.85;
}

@media (min-width: 960px) {
    .team-name-badge {
        max-width: 24rem;
    }
}

.rinkside-main {
    min-height: 100vh;
    /* Keep content clear of a phone's home indicator. */
    padding-bottom: env(safe-area-inset-bottom);
}

/* Available to assistive technology, not painted. Used to give screen readers a
   sentence where the visual design shows only bare figures. */
.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;
}

/* ---------------------------------------------------------------------------
   Authentication screens
   --------------------------------------------------------------------------- */

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 1.5rem 1rem 3rem;
}

.auth-card {
    width: 100%;
    max-width: 27rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 16px;
    background: var(--mud-palette-surface);
}

/* "or" separator between the password form and the Google button. Grid rather than
   flex so the two rules share the leftover width exactly and cannot overflow. */
.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
}

.auth-divider span {
    height: 1px;
    background: var(--mud-palette-divider);
}

/* ---------------------------------------------------------------------------
   Record hero
   The landing page's headline element: the team record at display size.
   --------------------------------------------------------------------------- */

.record-hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid var(--mud-palette-divider);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(61, 126, 255, 0.18), transparent 55%),
        radial-gradient(120% 140% at 100% 0%, rgba(34, 160, 107, 0.16), transparent 55%),
        var(--mud-palette-surface);
    padding: clamp(1.5rem, 5vw, 3rem);
}

/* Subtle sheen across the top edge. */
.record-hero::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
}

.record-hero-label {
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
}

/* Scales from phone to desktop without breakpoints. */
.record-hero-figures {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: clamp(0.75rem, 4vw, 2.5rem);
    margin: clamp(0.75rem, 3vw, 1.5rem) 0;
}

.record-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.record-figure-value {
    font-size: clamp(3.25rem, 17vw, 7.5rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

.record-figure-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: clamp(0.6rem, 2.5vw, 0.75rem);
    color: var(--mud-palette-text-secondary);
}

.record-figure-win { color: var(--mud-palette-success); }
.record-figure-loss { color: var(--mud-palette-error); }
.record-figure-tie { color: var(--mud-palette-text-secondary); }

.record-separator {
    font-size: clamp(2rem, 9vw, 4rem);
    font-weight: 300;
    line-height: 1;
    color: var(--mud-palette-divider);
    align-self: center;
}

/* ---------------------------------------------------------------------------
   MHR rating
   Sits inside the record hero, separated by a rule rather than its own border so
   the two read as one block.
   --------------------------------------------------------------------------- */

.mhr-card {
    position: relative;
    margin-top: clamp(1rem, 3vw, 1.75rem);
    padding-top: clamp(1rem, 3vw, 1.5rem);
    border-top: 1px solid var(--mud-palette-divider);
}

/* Rating sits centred under the record. The link is taken out of flow so it can
   hold the top-right corner without pulling the figure off centre. */
.mhr-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mhr-label {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
}

.mhr-asof {
    font-size: 0.7rem;
    color: var(--mud-palette-text-disabled);
}

.mhr-value {
    font-size: clamp(2.25rem, 9vw, 3.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    margin-top: 0.35rem;
    background: linear-gradient(135deg, var(--mud-palette-primary), var(--mud-palette-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Pill rather than an underlined link, to sit in the same visual language as the
   chips used elsewhere on the page. */
.mhr-link {
    position: absolute;
    top: clamp(1rem, 3vw, 1.5rem);
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-divider);
    background: var(--mud-palette-background);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
    transition: border-color 120ms ease, transform 120ms ease;
    white-space: nowrap;
}

.mhr-link:hover {
    border-color: var(--mud-palette-primary);
    transform: translateY(-1px);
}

/* On a narrow screen the pill would sit on top of the centred rating, so it drops
   back into flow beneath it instead. */
@media (max-width: 700px) {
    .mhr-link {
        position: static;
        margin-top: 0.9rem;
    }

    .mhr-card {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .mhr-center {
        order: -1;
    }
}

/* ---------------------------------------------------------------------------
   Week at a glance
   --------------------------------------------------------------------------- */

.week-row {
    display: grid;
    grid-template-columns: 3px 3.5rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.week-row:last-child {
    border-bottom: none;
}

.week-row-bar {
    align-self: stretch;
    border-radius: 999px;
    min-height: 1.75rem;
}

.week-row-day {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mud-palette-text-secondary);
    font-weight: 700;
}

.week-row-today .week-row-day {
    color: var(--mud-palette-primary);
}

.week-row-main {
    min-width: 0;
}

.week-row-title {
    font-size: 0.85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.week-row-meta {
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.week-row-time {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Events
   --------------------------------------------------------------------------- */

/* Result badge. Coloured by outcome rather than by event type, so a win reads as a
   win at a glance regardless of which competition it was. */
.result-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.result-pill-win {
    color: var(--mud-palette-success);
    background: rgba(34, 160, 107, 0.16);
}

.result-pill-loss {
    color: var(--mud-palette-error);
    background: rgba(214, 69, 93, 0.16);
}

.result-pill-tie {
    color: var(--mud-palette-text-secondary);
    background: rgba(122, 134, 153, 0.16);
}

/* Game-type pill, sitting beside the countdown chip on the next-game card. Styled
   here rather than as a MudChip so it can take an arbitrary palette colour. */
.type-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.event-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    padding: 2px 6px;
    border-radius: 6px;
    border-left: 3px solid var(--event-accent);
    color: var(--event-accent);
    background: var(--event-fill);
    font-size: 0.7rem;
    line-height: 1.3;
    font-weight: 600;
    cursor: default;
    /* One line per event keeps a month grid legible on a phone. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Week and day views draw a block sized by the time the event occupies, so there is
   room for the time and arena that will not fit in a month cell. Colours come from
   the same palette as the month chip — without this, week view fell back to
   MudCalendar's default styling and lost the type colour-coding entirely. */
.calendar-block {
    display: flex;
    flex-direction: column;
    gap: 1px;
    height: 100%;
    width: 100%;
    padding: 4px 7px;
    border-radius: 8px;
    border-left: 4px solid var(--event-accent);
    background: var(--event-fill);
    color: var(--event-accent);
    font-size: 0.72rem;
    line-height: 1.25;
    overflow: hidden;
    cursor: default;
}

.calendar-block-title {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-block-meta {
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-block-result {
    margin-top: auto;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.event-chip-clickable {
    cursor: pointer;
    transition: filter 120ms ease;
}

.event-chip-clickable:hover {
    filter: brightness(1.08);
}

.event-accent-bar {
    width: 4px;
    border-radius: 999px;
    align-self: stretch;
    min-height: 2.5rem;
}

.agenda-row {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    background: var(--mud-palette-surface);
}

/* ---------------------------------------------------------------------------
   Management game listing
   Grid rather than a table: a five-column table is unreadable at 390px, and this
   collapses to two columns without a separate mobile markup path.
   --------------------------------------------------------------------------- */

.game-row {
    display: grid;
    grid-template-columns: 3.25rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--mud-palette-divider);
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: 10px;
}

.game-row-date {
    text-align: center;
    line-height: 1.1;
}

.game-row-day {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mud-palette-text-secondary);
    font-weight: 700;
}

.game-row-num {
    font-size: 1.25rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.game-row-mon {
    font-size: 0.62rem;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.game-row-main {
    min-width: 0;
}

.game-row-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-row-meta {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-header-title {
    letter-spacing: -0.02em;
}

/* Breathing room between the Management tab bar and its content. Done here because
   MudTabs exposes no panel-class parameter in v9. */
.mud-tabs-panels {
    padding-top: 1.5rem;
}

/* Roster rows and the announcement management wrapper. */
.roster-row {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    background: var(--mud-palette-surface);
}

.roster-number {
    font-size: 1.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--mud-palette-primary);
    text-align: center;
}

.roster-main {
    min-width: 0;
}

.roster-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roster-meta {
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.announcement-manage {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.announcement-manage > :first-child {
    flex: 1;
}

/* Win/loss/tie stepper on the Management team panel. */
.record-stepper-label {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.65rem;
    color: var(--mud-palette-text-secondary);
    font-weight: 700;
}

.record-stepper-value {
    min-width: 2.5rem;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   Calendar density
   The month grid needs tighter cells on a phone than MudCalendar's defaults.
   --------------------------------------------------------------------------- */

@media (max-width: 600px) {
    .mud-cal-month-cell {
        min-height: 62px;
    }

    .mud-cal-month-link {
        font-size: 0.75rem;
    }
}

/* ---------------------------------------------------------------------------
   Blazor error banner
   --------------------------------------------------------------------------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: 0.75rem 1.25rem;
    background: #ffeaa7;
    color: #2d3436;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.2);
}

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

/* ---------------------------------------------------------------------------
   Video embeds

   The poster is a real <button>, so these rules strip the browser's default
   button chrome rather than styling a div that only looks clickable.
   --------------------------------------------------------------------------- */

.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.video-embed iframe,
.video-embed-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-embed-poster {
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: #000;
    display: block;
}

.video-embed-poster img {
    width: 100%;
    height: 100%;

    /* YouTube pads hqdefault to 4:3 with black bars. Cropping to fill removes them
       rather than letterboxing a 16:9 box inside a 4:3 image. */
    object-fit: cover;
    display: block;
    transition: transform 180ms ease, opacity 180ms ease;
}

.video-embed-poster:hover img,
.video-embed-poster:focus-visible img {
    transform: scale(1.03);
    opacity: 0.85;
}

.video-embed-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(11, 18, 32, 0.72);
    color: #fff;
    backdrop-filter: blur(2px);
    transition: background 180ms ease, transform 180ms ease;
}

.video-embed-poster:hover .video-embed-play,
.video-embed-poster:focus-visible .video-embed-play {
    background: var(--mud-palette-primary);
    transform: translate(-50%, -50%) scale(1.08);
}

.video-embed-poster:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -2px;
}

/* A poster that never animates for anyone who has asked for less motion. */
@media (prefers-reduced-motion: reduce) {
    .video-embed-poster img,
    .video-embed-play {
        transition: none;
    }

    .video-embed-poster:hover img,
    .video-embed-poster:focus-visible img {
        transform: none;
    }

    .video-embed-poster:hover .video-embed-play,
    .video-embed-poster:focus-visible .video-embed-play {
        transform: translate(-50%, -50%);
    }
}
