
/* =========================================
   LOCAL FONT
   ========================================= */

@font-face {
    font-family: "Pacifico";
    src: url("/Pacifico-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* =========================================
   VARIABLES
   ========================================= */

:root {
    --background: #050505;

    --frame-brightness: 0.32;
    --screen-brightness: 1.05;

    --glow-color: 110, 165, 220;
    --glow-strength: 0.35;

    --scanline-opacity: 0.16;
    --vignette-strength: 0.70;

    --tv-ratio: 2007 / 2048;
}

/* =========================================
   RESET
   ========================================= */

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

html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    max-width: 100%;
    min-height: 100%;
}

html {
    background: var(--background);
    overflow-x: clip;
}

body {
    min-height: 100vh;
    min-height: 100dvh;

    overflow-x: clip;
    background: var(--background);
}

/* =========================================
   ROOM
   ========================================= */

.room {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: clamp(12px, 2vh, 26px);
    padding: 24px 18px;

    background: var(--background);
}

/* =========================================
   NEON SIGN
   ========================================= */

.neon-title {
    position: relative;
    z-index: 10;

    flex: 0 0 auto;

    max-width: 100%;

    margin: 0;
    padding: 0.2em 0.35em;

    font-family: "Pacifico", cursive;
    font-size: clamp(24px, 4vw, 60px);
    font-weight: 400;
    line-height: 1.5;

    text-align: center;

    color: #e9faff;

    text-shadow:
        0 0 2px #ffffff,
        0 0 5px #b9eeff,
        0 0 10px #46c7ff,
        0 0 20px #009dff,
        0 0 40px #007bff,
        0 0 75px rgba(0, 100, 255, 0.65);

    animation: neon-flicker 9s infinite;
}

@keyframes neon-flicker {
    0%, 94%, 96%, 98%, 100% {
        opacity: 1;
    }

    95%, 97% {
        opacity: 0.85;
    }
}

/* =========================================
   MONITOR GRID
   ========================================= */

.monitor-grid {
    width: min(95vw, 1300px);
    max-width: 100%;
    min-width: 0;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    justify-items: center;
    align-items: center;

    gap: clamp(20px, 4vw, 70px);
}

/*
   A single monitor uses the full
   available space.
*/

.monitor-grid:has(> .monitor:only-child) {
    grid-template-columns: minmax(0, 1fr);
}

/* =========================================
   CRT MONITOR
   ========================================= */

.monitor {
    position: relative;
    display: block;

    width: min(100%, 500px);
    max-width: 100%;
    min-width: 0;

    aspect-ratio: var(--tv-ratio);

    text-decoration: none;
    color: inherit;

    cursor: pointer;

    isolation: isolate;
}

/*
   Large single-monitor layout.
*/

.monitor-grid:has(> .monitor:only-child) .monitor {
    width: min(
        85vw,
        650px,
        calc(60vh * 2007 / 2048)
    );
}

@supports (height: 100dvh) {
    .monitor-grid:has(> .monitor:only-child) .monitor {
        width: min(
            85vw,
            650px,
            calc(60dvh * 2007 / 2048)
        );
    }
}

/* =========================================
   AMBIENT LIGHT
   ========================================= */

.monitor::before {
    content: "";

    position: absolute;

    left: -15%;
    top: -8%;

    width: 130%;
    height: 100%;

    background: radial-gradient(
        ellipse at 50% 42%,
        rgba(var(--glow-color), 0.15) 0%,
        rgba(var(--glow-color), 0.07) 45%,
        transparent 75%
    );

    filter: blur(35px);

    pointer-events: none;
    z-index: -1;
}

/* =========================================
   CRT SCREEN
   ========================================= */

.screen {
    position: absolute;

    left: 12%;
    top: 10.5%;

    width: 76%;
    height: 59%;

    overflow: hidden;
    background: #050505;

    z-index: 2;

    box-shadow:
        0 0 18px rgba(
            var(--glow-color),
            var(--glow-strength)
        ),
        0 0 55px rgba(var(--glow-color), 0.20),
        0 0 110px rgba(var(--glow-color), 0.10);
}

/* =========================================
   PREVIEW IMAGE
   ========================================= */

.screen img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center top;

    filter:
        brightness(var(--screen-brightness))
        contrast(1.12)
        saturate(0.85);

    animation: crt-flicker 7s infinite;
}

/* =========================================
   CRT SCANLINES + VIGNETTE
   ========================================= */

.screen::after {
    content: "";

    position: absolute;
    inset: 0;

    pointer-events: none;
    z-index: 4;

    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 2px,
            rgba(
                0, 0, 0,
                var(--scanline-opacity)
            ) 3px,
            transparent 4px
        ),
        radial-gradient(
            ellipse at center,
            transparent 30%,
            rgba(0, 0, 0, 0.15) 55%,
            rgba(
                0, 0, 0,
                var(--vignette-strength)
            ) 100%
        );
}

/* =========================================
   GLASS REFLECTION
   ========================================= */

.screen::before {
    content: "";

    position: absolute;
    inset: 0;

    pointer-events: none;
    z-index: 3;

    background: linear-gradient(
        125deg,
        rgba(255, 255, 255, 0.10),
        rgba(255, 255, 255, 0.035) 18%,
        transparent 38%,
        transparent 75%,
        rgba(255, 255, 255, 0.025)
    );
}

/* =========================================
   TV FRAME
   ========================================= */

.tv-frame {
    position: absolute;
    inset: 0;

    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    pointer-events: none;
    user-select: none;

    z-index: 5;

    filter:
        brightness(var(--frame-brightness))
        contrast(1.1)
        drop-shadow(
            0 0 12px rgba(var(--glow-color), 0.12)
        );
}

/* =========================================
   CRT FLICKER
   ========================================= */

@keyframes crt-flicker {
    0%, 96%, 100% {
        opacity: 1;
    }

    97% {
        opacity: 0.97;
    }

    98% {
        opacity: 0.99;
    }

    99% {
        opacity: 0.96;
    }
}

/* =========================================
   INTERACTION
   ========================================= */

.monitor:focus-visible {
    outline: 2px solid #a9c9e9;
    outline-offset: 8px;
}

/* =========================================
   TABLETS
   ========================================= */

@media (max-width: 900px) {
    .room {
        padding: 20px 14px;
    }

    .monitor-grid {
        width: 100%;
        max-width: 100%;
        gap: 20px;
    }

    .monitor {
        width: 100%;
    }

    .monitor::before {
        filter: blur(26px);
    }
}

/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 700px) {
    .room {
        width: 100%;
        max-width: 100%;
        min-width: 0;

        justify-content: flex-start;

        padding: 16px 12px 32px;
        gap: 12px;
    }

    .neon-title {
        max-width: 100%;

        font-size: clamp(23px, 7vw, 42px);
        padding: 0.2em;

        overflow-wrap: anywhere;
    }

    .monitor-grid {
        grid-template-columns: minmax(0, 1fr);

        width: 100%;
        max-width: 430px;
        min-width: 0;

        gap: 32px;

        margin-inline: auto;
    }

    .monitor {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .monitor-grid:has(> .monitor:only-child) .monitor {
        width: min(
            100%,
            calc(62vh * 2007 / 2048)
        );
    }

    @supports (height: 100dvh) {
        .monitor-grid:has(> .monitor:only-child) .monitor {
            width: min(
                100%,
                calc(62dvh * 2007 / 2048)
            );
        }
    }

    /*
       Prevent ambient glow from creating
       horizontal overflow on mobile.
    */

    .monitor::before {
        left: 0;
        top: -8%;

        width: 100%;
        height: 100%;

        filter: blur(22px);
    }

    .screen {
        box-shadow:
            0 0 12px rgba(var(--glow-color), 0.30),
            0 0 32px rgba(var(--glow-color), 0.16),
            0 0 65px rgba(var(--glow-color), 0.08);
    }
}

/* =========================================
   SMALL PHONES
   ========================================= */

@media (max-width: 380px) {
    .room {
        padding: 12px 8px 24px;
    }

    .neon-title {
        font-size: 23px;
    }

    .monitor-grid {
        gap: 24px;
    }
}

/* =========================================
   REDUCED MOTION
   ========================================= */

@media (prefers-reduced-motion: reduce) {
    .screen img,
    .neon-title {
        animation: none;
    }
}

/* =========================================
   SCREEN OFF
   ========================================= */

.screen-off {
    background: #020304;
}

.screen-off::before,
.screen-off::after {
    display: none;
}
