/* Silkscreen, vendored locally (SIL OFL 1.1 — see assets/fonts/silkscreen-LICENSE.txt).
   A bitmap face drawn on an 8px grid, so it wants no antialiasing at all. */
@font-face {
    font-family: 'Silkscreen';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('../fonts/silkscreen-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Silkscreen';
    font-style: normal;
    font-weight: 700;
    font-display: block;
    src: url('../fonts/silkscreen-latin-700-normal.woff2') format('woff2');
}

/* ============================================================
   skylrk — the screen lives on the model's LCD (see stage.js)
   ============================================================ */

:root {
    --ink: #0a0d10;
    --screen: #e9e7de;
    --accent: #3d9ae0;
    --led: #21c221;
    --edge: rgba(10, 13, 16, 0.35);


    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "DejaVu Sans Mono", Menlo, Consolas, monospace;
    --font-pixel: 'Silkscreen', ui-monospace, "SF Mono", Menlo, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

html {
    background: linear-gradient(100deg, #83c3e9 0%, #83c3e9 42%, #2b5d78 78%, #052840 100%);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    color: var(--ink);
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

button {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================ background ============================ */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 30%, #9dd5f1, #8fd5ff);
}

/* ============================ 3D layers ============================ */

.stage {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    /* stage.js sets these in px; 100% of a fixed box resolves differently on
       iOS depending on the address bar, which desynced it from the CSS3D layer */
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}

.stage.is-over-button {
    cursor: pointer;
}

.stage:active {
    cursor: grabbing;
}

/* the CSS3D container spans the viewport but must not eat pointer events */
.css3d {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* the screen is transformed onto the panel and can swing wide of the
       host's box while the device turns; never let that grow the page */
    overflow: hidden;
}

/* ============================ the screen ============================ */

.screen {
    position: absolute;
    /* width/height are set by stage.js to match the LCD's on-screen size */
    width: 300px;
    height: 328px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-pixel);
    /* 16px is 2x Silkscreen's 8px grid, so stems land on whole pixels */
    font-size: 16px;
    line-height: 1.4;
    letter-spacing: 0;
    background: var(--screen);
    color: var(--ink);
    border-radius: 4px;
    /* the LCD is lit: bleed a little light onto the bezel around it */
    box-shadow:
        0 0 8px 1px rgba(210, 235, 255, 0.18),
        inset 0 0 18px rgba(0, 0, 0, 0.3),
        inset 0 0 4px rgba(0, 0, 0, 0.55);
    transition: opacity 0.2s linear, background 0.3s, filter 0.3s;
    /* no antialiasing: a bitmap face should be hard-edged, not blurred */
    -webkit-font-smoothing: none;
    font-smooth: never;
    text-rendering: geometricPrecision;
}

html[data-fuel="low"] .screen {
    filter: brightness(0.92) contrast(0.96);
}

.screen__scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.3;
    background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
    mix-blend-mode: multiply;
}

.screen__glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(138deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.06) 26%, transparent 52%);
    opacity: 0.45;
}

/* ---- status bar ---- */

.screen[data-chrome="off"] .statusbar {
    display: none;
}

.statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    width: 100%;
    height: 1.75em;
    padding: 0 0.7em;
    border-bottom: 2px solid var(--ink);
    font-size: 0.85em;
}

.statusbar__left,
.statusbar__right {
    flex: 1;
    display: flex;
}

.statusbar__right {
    justify-content: flex-end;
}

.statusbar__back {
    background: none;
    border: 0;
    padding: 0;
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
}

.statusbar__back:disabled {
    visibility: hidden;
}

.statusbar__title {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 11em;
    overflow: hidden;
    white-space: nowrap;
}

.marquee {
    padding: 0 0.4em;
    min-width: max-content;
    text-transform: lowercase;
}

.marquee.is-running {
    animation: textrun 9s linear infinite;
}

@keyframes textrun {
    0%, 12% { transform: translateX(0); }
    88%, 100% { transform: translateX(calc(-100% + 11em)); }
}

/* ---- battery ---- */

.battery {
    position: relative;
    display: flex;
    gap: 1px;
    width: 1.7em;
    height: 0.95em;
    padding: 1px;
    border: 1.5px solid currentColor;
}

.battery__cell {
    flex: 1;
    max-width: calc(100% / 3);
    background: currentColor;
    transition: opacity 0.25s;
}

.battery__cell[data-state="empty"] {
    opacity: 0;
}

.battery[data-fuel="low"] .battery__cell[data-state="full"] {
    animation: blink 1s steps(2) infinite;
}

.battery[data-fuel="charging"] .battery__cell {
    animation: charge 1.2s steps(1) infinite;
}

.battery[data-fuel="charging"] .battery__cell:nth-child(2) { animation-delay: 0.4s; }
.battery[data-fuel="charging"] .battery__cell:nth-child(3) { animation-delay: 0.8s; }

@keyframes charge {
    0%, 49% { opacity: 0; }
    50%, 100% { opacity: 1; }
}

.battery__nub {
    position: absolute;
    right: 0;
    top: 50%;
    width: 0.3em;
    height: 0.45em;
    transform: translate(100%, -50%);
    border: 1.5px solid currentColor;
    border-left: 0;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ---- page viewport ---- */

.view {
    flex: 1 1 auto;
    min-height: 0;
    /* a flex column, so children can grow without percentage heights:
       WebKit resolves `height: 100%` against a flexed parent inconsistently
       and the page collapses to its content height */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    outline: none;
}

.view::-webkit-scrollbar {
    width: 0;
}

/* ---- menu ---- */

.menu {
    display: flex;
    flex-direction: column;
}

.menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    width: 100%;
    padding: 0.34em 0.7em;
    background: none;
    border: 0;
    border-bottom: 1px solid rgba(10, 13, 16, 0.22);
    text-align: left;
    font-size: 1em;
    text-transform: lowercase;
    cursor: pointer;
}

a.menu__item {
    color: inherit;
    text-decoration: none;
}

.menu__item .meta {
    margin-left: auto;
    padding-right: 0.4em;
}

.menu__item[aria-current="true"],
.menu__item:hover {
    background: var(--ink);
    color: var(--screen);
}

.menu__item::after {
    content: ">";
    opacity: 0.55;
}

.menu__item[data-external]::after {
    content: "^";
}

/* ---- pages ---- */

.page {
    padding: 0.7em;
    font-size: 0.85em;
}

.page h1 {
    margin: 0 0 0.5em;
    font-size: 1.5em;
    font-weight: 400;
    text-transform: lowercase;
}

.page h3 {
    margin: 0 0 0.15em;
    font-size: 1.15em;
    font-weight: 400;
}

.page p {
    margin: 0 0 0.75em;
}

.page a {
    color: inherit;
    text-decoration: underline;
}

.page hr {
    border: 0;
    border-top: 2px dashed rgba(10, 13, 16, 0.4);
    margin: 0.9em 0;
}

.page .meta {
    font-size: 0.9em;
    opacity: 0.72;
}

.card {
    border: 1.5px solid var(--ink);
    padding: 0.5em;
    margin-bottom: 0.6em;
}

.card__tag {
    display: inline-block;
    padding: 0 0.35em;
    margin-bottom: 0.3em;
    background: var(--ink);
    color: var(--screen);
    font-size: 0.85em;
    text-transform: uppercase;
}

.btn {
    display: inline-block;
    padding: 0.25em 0.7em;
    background: none;
    border: 2px solid currentColor;
    text-transform: lowercase;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--ink);
    color: var(--screen);
}

.lowpower .btn:hover {
    background: var(--screen);
    color: var(--ink);
}

/* ---- opening screen ---- */

.splash {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1em;
    height: 100%;
    padding: 1.2em;
    color: var(--ink);
}

.splash__mark {
    width: 72%;
}

.splash__word {
    width: 78%;
}

.splash__mark svg,
.splash__word svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ---- songs list ---- */

.tracklist {
    display: flex;
    flex-direction: column;
}

.track__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- now playing: the screen inverts, so the vortex runs edge to edge ---- */

.screen[data-page="nowplaying"] {
    background: #01060b;
    color: var(--screen);
}

.screen[data-page="nowplaying"] .screen__glare {
    opacity: 0.12;
}

.screen[data-page="nowplaying"] .screen__scanlines {
    mix-blend-mode: screen;
    opacity: 0.14;
}

/* ---- now playing ---- */

.np {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    background: #01060b;
    color: var(--screen);
}

.np__viz {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    min-height: 0;
    background: #01060b;
    cursor: pointer;
    /* the visualiser draws at ~116px and is blitted up, so keep the pixels hard */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.np[data-kind="video"] .np__viz {
    background: #000;
}

.tracklist__empty {
    margin: 0;
    padding: 1.2em 0.8em;
    text-align: center;
    font-size: 0.78em;
    opacity: 0.7;
}

.np__strip {
    flex: 0 0 auto;
    padding: 0.2em 0.3em 0.3em;
    background: #01060b;
    color: var(--screen);
    border-top: 1px solid rgba(233, 231, 222, 0.22);
    text-align: center;
    line-height: 1.25;
}

.np__file {
    /* Silkscreen is wide: keep this small enough that a real filename fits */
    font-size: 0.66em;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np__time {
    font-size: 0.6em;
    opacity: 0.75;
}

.track {
    display: flex;
    justify-content: space-between;
    gap: 0.5em;
    width: 100%;
    padding: 0.3em 0.7em;
    background: none;
    border: 0;
    border-bottom: 2px solid rgba(10, 13, 16, 0.2);
    text-align: left;
    font-size: 0.85em;
    cursor: pointer;
}

.tracklist__note {
    margin: 0;
    padding: 0.4em 0.7em;
    background: var(--ink);
    color: var(--screen);
    font-size: 0.72em;
}

.track--action {
    opacity: 0.8;
}

.track[aria-current="true"],
.track:hover {
    background: var(--ink);
    color: var(--screen);
}

/* more content below the fold */

.screen:has(.view.has-more)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.4em;
    z-index: 50;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(233, 231, 222, 0) 0%, rgba(233, 231, 222, 0.92) 78%);
}

.screen:has(.view.has-more)::before {
    content: "\25BE";
    position: absolute;
    left: 50%;
    bottom: 0.1em;
    z-index: 51;
    transform: translateX(-50%);
    font-size: 0.9em;
    opacity: 0.8;
    pointer-events: none;
    animation: blink 1.6s steps(2) infinite;
}

/* ---- low power ---- */

.lowpower {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9em;
    padding: 1em;
    text-align: center;
    background: var(--ink);
    color: var(--screen);
}

html[data-fuel="empty"] .lowpower {
    display: flex;
}

.lowpower__icon svg {
    width: 2.6em;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
}

.lowpower__icon .bolt {
    fill: currentColor;
    stroke: none;
    animation: blink 1.4s steps(2) infinite;
}

.lowpower__copy {
    margin: 0;
    font-size: 0.8em;
}

/* ============================ page chrome ============================ */

.topbar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.6rem;
    font-size: 0.95rem;
}

/* ---- the glass logo pill ----
   blur + saturate over the backdrop, a translucent white wash, and a stack of
   inset shadows for the bevel: lights on the top-left rim, darks underneath. */

.glass {
    --glass-blur: 8px;
    --glass-saturation: 150%;
    position: relative;
    overflow: hidden;
    background: rgba(251, 251, 251, 0.2);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 1.8px 3px 0 -2px rgba(255, 255, 255, 0.9),
        inset -2px -2px 0 -2px rgba(255, 255, 255, 0.8),
        inset -3px -8px 1px -6px rgba(255, 255, 255, 0.6),
        inset -0.3px -1px 4px rgba(0, 0, 0, 0.12),
        inset -1.5px 2.5px 0 -2px rgba(0, 0, 0, 0.2),
        inset 0 3px 4px -2px rgba(0, 0, 0, 0.2),
        inset 2px -6.5px 1px -4px rgba(0, 0, 0, 0.1),
        0 1px 5px rgba(0, 0, 0, 0.08),
        0 6px 16px rgba(0, 0, 0, 0.12);
}

.glass-pill {
    --glass-radius: 22px;
    align-items: center;
    border-radius: var(--glass-radius);
}

.topbar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 24px;
    color: #fff;
    text-decoration: none;
    transition: color 0.35s cubic-bezier(0.77, 0, 0.175, 1);
}

.topbar__wordmark {
    display: block;
    width: 172px;
    max-width: 100%;
}


.topbar__right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.topbar__charge {
    padding: 0.3rem 0.8rem;
    background: rgba(247, 252, 255, 0.72);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(247, 252, 255, 0.5);
    border-radius: 2rem;
    color: var(--ink);
    cursor: pointer;
    text-transform: lowercase;
}

.topbar__charge:hover {
    border-color: var(--led);
    color: #167f16;
}

html[data-fuel="empty"] .topbar__charge,
html[data-fuel="low"] .topbar__charge {
    border-color: var(--led);
    animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
    50% { box-shadow: 0 0 1.4rem rgba(33, 194, 33, 0.7); }
}

.hint {
    position: fixed;
    left: 1.6rem;
    bottom: 1.2rem;
    z-index: 40;
    margin: 0;
    color: #fff;
    font-size: 0.8rem;
    line-height: 2;
    white-space: nowrap;
    opacity: 0.5;
}

kbd {
    display: inline-block;
    padding: 0 0.3rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.2rem;
    font: inherit;
}

.hotspot-label {
    position: fixed;
    z-index: 45;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--edge);
    border-radius: 0.2rem;
    background: #fff;
    color: var(--ink);
    font-size: 0.8rem;
    text-transform: lowercase;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -160%);
    transition: opacity 0.12s;
}

.hotspot-label.is-visible {
    opacity: 1;
}

/* ---- the wing mark, bottom right ----
   the source art is black on transparent, and the outlines between the letters
   are gaps rather than white pixels, so flattening it to a flat white keeps
   those separations. the shadow keeps it readable if the light field drifts
   under it. */

.wingmark {
    position: fixed;
    right: 1.6rem;
    bottom: 1.2rem;
    z-index: 40;
    display: block;
    width: 132px;
    opacity: 0.45;
    filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.25));
    transition: opacity 0.25s ease-out;
}

/* it's a link now, so it has to take pointer events — it brightens on hover
   to say so */
.wingmark:hover,
.wingmark:focus-visible {
    opacity: 0.72;
}

.wingmark img {
    display: block;
    width: 100%;
    height: auto;
}

.noscript {
    position: fixed;
    left: 2rem;
    bottom: 2rem;
    z-index: 3000;
    max-width: 32rem;
    padding: 1.4rem;
    border-radius: 0.6rem;
    background: #000;
    color: #fff;
}

/* ============================ boot ============================ */

/* the loading screen is just the wordmark: a ghost of it underneath, and a
   solid copy on top revealed left to right as the model loads. --boot-progress
   runs 0 -> 1 and is set from main.js. */

.boot {
    --boot-progress: 0;
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: #052840;
    transition: opacity 0.5s ease-in-out;
}

.boot[data-loaded="true"] {
    opacity: 0;
    pointer-events: none;
}

.boot__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
}

.boot__mark {
    position: relative;
    width: min(58vw, 340px);
}

.boot__ghost,
.boot__fill {
    display: block;
    width: 100%;
    height: auto;
}

.boot__ghost {
    color: rgba(255, 255, 255, 0.16);
}

.boot__fill {
    position: absolute;
    inset: 0;
    color: #fff;
    clip-path: inset(0 calc((1 - var(--boot-progress)) * 100%) 0 0);
    filter: drop-shadow(0 0 7px rgba(151, 211, 247, 0.3));
}

/* only speaks up if something went wrong; empty on the happy path */
.boot__note {
    margin: 0;
    min-height: 1.2em;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    text-align: center;
}

/* ============================ responsive ============================ */

@media (max-width: 40rem) {
    .hint { display: none; }
    .topbar { padding: 1rem; font-size: 0.85rem; }
    .topbar__right { gap: 0.7rem; }

    /* the pill has to give up room to the charge control */
    .topbar__brand { height: 34px; padding: 0 14px; }
    .glass-pill { --glass-radius: 17px; }
    .topbar__wordmark { width: 104px; }

    .wingmark { width: 92px; right: 1rem; bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .marquee.is-running {
        animation: none !important;
    }
}

/* the hint fades away once the device has been used */
.hint {
    transition: opacity 0.6s ease-out;
}

.hint.is-faded {
    opacity: 0.16;
}
