:root {
    color-scheme: light;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-synthesis: none;
    --paper: #f7f7f4;
    --ink: #161719;
    --muted: #8b8c88;
    --orange: #f28b35;
    --purple: #8c69d6;
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: var(--paper);
    color: var(--ink);
}

button,
a {
    font: inherit;
}

.loading-screen {
    position: relative;
    isolation: isolate;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.92) 0 8rem, transparent 25rem),
        linear-gradient(115deg, #fafaf7 0%, var(--paper) 52%, #f3f3ef 100%);
}

.loading-screen::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(rgba(20, 20, 18, 0.075) 0.55px, transparent 0.55px);
    background-size: 5px 5px;
    content: "";
    opacity: 0.18;
    pointer-events: none;
}

.masthead {
    position: absolute;
    inset: 0 0 auto;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 2rem 2.25rem;
    pointer-events: none;
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-transform: uppercase;
}

.wordmark .brand-mark {
    width: 2rem;
    height: 2rem;
}

.wordmark-name {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 760;
    letter-spacing: 0.17em;
}

.connection-state,
.screen-footer {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.connection-state {
    display: flex;
    max-width: 44vw;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    line-height: 1.4;
    text-align: right;
}

.status-light {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #55a36a;
    box-shadow: 0 0 0 3px rgba(85, 163, 106, 0.1);
    animation: status-breathe 2.8s ease-in-out infinite;
}

.flight-zone {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

/*
 * Flight motion is composed across three nested elements so each part can use
 * different timing without affecting the others:
 *   .flying-event      moves horizontally at a constant speed and fades;
 *   .flying-event-body follows the broad vertical arc;
 *   .package           adds a small, repeating bob and rock.
 */
.flying-event {
    position: absolute;
    top: var(--lane);
    left: 0;
    z-index: var(--layer);
    display: block;
    width: clamp(230px, 23vw, 330px);
    color: inherit;
    opacity: 0;
    text-decoration: none;
    will-change: transform, opacity;
    pointer-events: auto;
    animation: fly-across var(--duration) linear forwards;
}

.flying-event-body {
    display: block;
    width: 100%;
    will-change: transform;
    animation: arc-flight var(--duration) ease-in-out forwards;
}

.flying-event-payload {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.7rem;
}

.flying-event:is(:hover, :focus-visible),
.flying-event:is(:hover, :focus-visible) .flying-event-body,
.flying-event:is(:hover, :focus-visible) .package {
    animation-play-state: paused;
}

.flying-event:focus-visible .event-copy,
.flying-event:hover .event-copy {
    border-color: rgba(22, 23, 25, 0.2);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 9px 26px rgba(22, 23, 25, 0.1);
}

.package {
    --package-front: #e9a85d;
    --package-ink: rgba(53, 36, 18, 0.78);
    --package-side: #d98b43;
    --package-top: #f1c17d;
    position: relative;
    width: 43px;
    height: 45px;
    flex: 0 0 43px;
    transform-origin: right center;
    scale: var(--scale);
    will-change: transform;
    animation:
        airframe-bob var(--bob-duration) ease-in-out var(--motion-delay) infinite alternate,
        airframe-rock var(--rock-duration) ease-in-out var(--motion-delay) infinite alternate;
}

.package-face {
    position: absolute;
    top: 8px;
    left: 0;
    z-index: 2;
    display: grid;
    width: 36px;
    height: 37px;
    place-items: center;
    border: 1px solid rgba(36, 30, 20, 0.14);
    border-radius: 2px 1px 2px 3px;
    background: var(--package-front);
    box-shadow: 0 7px 5px rgba(30, 31, 34, 0.12);
    color: var(--package-ink);
}

.package-top,
.package-side {
    position: absolute;
    z-index: 1;
}

.package-top {
    top: 0;
    left: 0;
    width: 43px;
    height: 9px;
    background: var(--package-top);
    clip-path: polygon(7px 0, 100% 0, 36px 100%, 0 100%);
}

.package-side {
    top: 0;
    left: 36px;
    width: 7px;
    height: 45px;
    background: var(--package-side);
    clip-path: polygon(100% 0, 100% 37px, 0 100%, 0 8px);
}

.package-face svg {
    fill: currentColor;
}

.event-issue .package {
    --package-front: #8fbd95;
    --package-ink: #25482b;
    --package-side: #6b9d74;
    --package-top: #b9d8bc;
}

.event-change-request .package {
    --package-front: #83adc8;
    --package-ink: #234256;
    --package-side: #638ca7;
    --package-top: #b0cddd;
}

.event-comment .package {
    --package-front: #a794dc;
    --package-ink: #3f315f;
    --package-side: #846dc1;
    --package-top: #c3b5e7;
}

.event-review .package {
    --package-front: #8da8c3;
    --package-ink: #263c50;
    --package-side: #6f8ea9;
    --package-top: #b5c8d9;
}

.event-merge .package {
    --package-front: #9c7ed2;
    --package-ink: #35244f;
    --package-side: #7559aa;
    --package-top: #c4b1e5;
}

.event-copy {
    min-width: 0;
    padding: 0.56rem 0.68rem 0.62rem;
    overflow: hidden;
    border: 1px solid rgba(22, 23, 25, 0.08);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 6px 20px rgba(22, 23, 25, 0.055);
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.event-kicker {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.3rem;
    color: #6e6f6b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.event-kicker > span:first-child,
.event-repository,
.event-summary,
.event-author {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-kicker > span:first-child,
.event-repository {
    min-width: 0;
}

.event-repository {
    color: #a0a19d;
}

.event-summary {
    font-size: 0.72rem;
    font-weight: 590;
    line-height: 1.3;
}

.event-author {
    margin-top: 0.22rem;
    color: #8c8d89;
    font-size: 0.59rem;
}

.screen-footer {
    position: absolute;
    right: 2.25rem;
    bottom: 1.8rem;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
}

.boot-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    background: var(--paper);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.boot-screen .brand-mark {
    width: 8rem;
    height: 8rem;
    animation: boot-pulse 1.6s ease-in-out infinite;
}

.not-found {
    display: grid;
    min-height: 100dvh;
    place-content: center;
    justify-items: center;
    gap: 1rem;
    background: var(--paper);
    text-align: center;
}

.not-found .brand-mark {
    width: 8rem;
    height: 8rem;
}

.not-found h1 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.08em;
}

.not-found a {
    color: #777874;
    font-size: 0.72rem;
}

/* Horizontal travel stays linear; vertical easing belongs to the nested body. */
@keyframes fly-across {
    0% {
        opacity: 0;
        transform: translate3d(calc(-100% - 5vw), 0, 0);
    }

    8%,
    88% {
        opacity: var(--event-opacity);
    }

    100% {
        opacity: 0;
        transform: translate3d(calc(100vw + 100%), 0, 0);
    }
}

/* Ease into the signed midpoint, then ease toward the final drift. */
@keyframes arc-flight {
    0% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(0, var(--flight-y-mid), 0);
    }

    100% {
        transform: translate3d(0, var(--drift), 0);
    }
}

/* Separate transform properties let bob and rock run at unrelated randomized periods. */
@keyframes airframe-bob {
    from { translate: 0 -2px; }
    to { translate: 0 2px; }
}

@keyframes airframe-rock {
    from { rotate: -0.55deg; }
    to { rotate: 0.55deg; }
}

@keyframes status-breathe {
    50% { opacity: 0.38; }
}

@keyframes boot-pulse {
    50% {
        transform: scale(0.96);
        opacity: 0.58;
    }
}

@media (max-width: 700px) {
    .masthead { padding: 1.25rem; }

    .connection-state {
        max-width: 58vw;
        font-size: 0.56rem;
    }

    .flying-event { width: 235px; }

    .screen-footer {
        right: 1.25rem;
        bottom: 1.1rem;
        left: 1.25rem;
        justify-content: center;
        font-size: 0.55rem;
    }

}

@media (prefers-reduced-motion: reduce) {
    .flying-event {
        opacity: 0 !important;
        pointer-events: none;
        animation-duration: 1ms;
    }

    .flying-event-body,
    .package,
    .status-light,
    .boot-screen .brand-mark {
        animation: none;
    }
}

#blazor-error-ui {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 1000;
    display: none;
    padding: 0.8rem 8rem 0.8rem 1rem;
    border: 1px solid #d9b6b0;
    border-radius: 3px;
    background: #fff8f6;
    box-shadow: 0 8px 30px rgba(34, 20, 18, 0.12);
    color: #6b3028;
    font-size: 0.75rem;
}

#blazor-error-ui a {
    margin-left: 0.5rem;
    color: inherit;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 0.55rem;
    right: 0.75rem;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.7rem;
}
