/* ============================================================
   HardLounge - styles
   Every object in the room is a direct child of .stage and is
   absolutely positioned, sized in %.
   ============================================================ */

:root {
    --ink: #2b2a6b;          /* ballpoint blue, like the sketch */
    --paper: #fbf8f2;
    --lamp-glow: #ffe3a3;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
}

body {
    background: #1d1a2b;
    color: var(--paper);
    font-family: var(--font);
    overflow: hidden;
    cursor: url("images/cursor_arrow.png") 4 2, auto;
}


/* ---------- The room frame (fills the whole window) ----------
   The picture is scaled to the window height. On a window less wide than the
   picture the far left/right edges get trimmed, so keep the important stuff
   in the middle. */
.stage {
    --pan: 0px;

    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    touch-action: none;
    overflow: hidden;

    background-image: url("images/wall_02.png");
    background-size: auto 100%;
    background-position: calc(50% + var(--pan)) center;
    background-repeat: no-repeat;
    z-index: 0;
}

/* Every direct child of the stage is absolutely positioned */
.stage > * { position: absolute; }

/* No blue tap highlight or text/image selection on the room's objects */
.stage img,
.stage button {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Hide the focus ring after a tap or click, keep it for keyboard users */
.stage img:focus:not(:focus-visible),
.stage button:focus:not(:focus-visible) {
    outline: none;
}

/* Everything in the room slides by the same amount as the picture (not the dark overlay) */
.stage > *:not(.shade) {
    translate: var(--pan) 0;
}


/* ---------- Back wall ---------- */

.right_curtain {
    left: -12%;
    bottom: 32%;
    width: 34%;
    height: 68%;
    z-index: 2;
}

.left_curtain {
    left: -24%;
    bottom: 30%;
    width: 29%;
    height: 70%;
    z-index: 2;
}

.shelf {
    right: -34%;
    bottom: 2.5%;
    height: 100%;
    z-index: 2;
}

.cabinet {
    right: 19%;
    bottom: 12%;
    width: 60%;
    height: 23%;
    z-index: 1;
}

.mug {
    right: 40%;
    bottom: 16%;
    width: 5.5%;
    height: 9%;
    z-index: 2;

    padding: 0;
    border: none;
    background: transparent;
    cursor: url("images/cursor_pointer.png") 8 2, pointer;

    transition: transform 0.2s ease;
}

.mug img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.plant {
    right: -17%;
    bottom: 2%;
    height: 60%;
    z-index: 3;
}

.poster {
    right: 12%;
    top: 3%;
    width: 12%;
    height: auto;
    z-index: 3;

    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    transition: transform 0.15s;
}

.art {
    right: -5%;
    top: 3%;
    width: 12%;
    height: auto;
    z-index: 3;

    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    transition: transform 0.15s;
}

.mug:hover,
.mug:focus-visible {
    transform: translateY(-4px) scale(1.07);
}

.poster:hover,
.poster:focus-visible,
.art:hover,
.art:focus-visible {
    transform: rotate(-2deg) scale(1.03);
}


/* ---------- Lamp ---------- */

.lamp {
    left: -16%;
    top: 2%;
    width: 35%;
    height: 80%;
    z-index: 6;

    background: none;
    border: none;
    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    touch-action: manipulation;
}

.lamp-pole {
    position: absolute;
    left: 0;
    top: 4%;
    width: 100%;
    height: 109%;
    object-fit: contain;
    z-index: 6;
}

.lamp-shade {
    position: absolute;
    left: 0;
    top: 6.5%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 5;
}


/* ---------- TV ---------- */

.tv {
    left: 24%;
    top: 4%;
    width: 52%;
    z-index: 3;
}

/* YouTube screen - large clickable area */
.tv-screen {
    position: absolute;
    left: 6%;
    top: 11.3%;
    width: 84%;
    aspect-ratio: 16 / 9;

    background: #14122a;
    overflow: hidden;
    z-index: 4;

    /* The whole screen is clickable on desktop and mobile */
    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* YouTube video */
.tv-screen iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;

    animation: tv-on 0.6s ease-out;
}

/* TV off screen */
.tv-idle {
    position: absolute;
    inset: 0;
    z-index: 5;

    background: #14122a;
    color: var(--paper);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2%;

    font-size: clamp(16px, 4cqw, 80px);
    font-weight: 700;
    letter-spacing: 0.04em;

    /* The dark screen can be clicked to turn the TV back on */
    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    touch-action: manipulation;
}

.tv-idle[hidden] {
    display: none;
}

.tv-idle small {
    font-size: 0.32em;
    font-weight: 400;
    opacity: 0.7;
    letter-spacing: 0;
}

/* TV body artwork */
.tvBody {
    display: block;
    position: relative;
    width: 98%;
    height: auto;
    z-index: 4;
    pointer-events: none;
}

/* Power button - a separate clickable control */
.tv-power {
    position: absolute;
    right: 15%;
    bottom: 7%;
    width: 3.5%;
    aspect-ratio: 1;
    z-index: 6;

    border-radius: 50%;
    border: 3px solid var(--ink);
    background: #a35d6a;

    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    transition: box-shadow 0.3s, background 0.3s;
}

.tv-power:hover {
    background: #c47686;
}

.tv.on .tv-power {
    background: var(--lamp-glow);
    box-shadow: 0 0 12px 3px rgba(255, 227, 163, 0.9);
}

/* TV switch-on animation */
@keyframes tv-on {
    from {
        opacity: 0;
        filter: brightness(3);
        transform: scaleY(0.05);
    }

    to {
        opacity: 1;
        filter: brightness(1);
        transform: scaleY(1);
    }
}


/* ---------- Desk ---------- */

.desk {
    left: 25%;
    top: 73%;
    width: 52%;
    height: 35%;
    z-index: 1;
}


/* ---------- Sofa + Dip & Pip ---------- */

.sofa {
    left: -20%;
    bottom: -25%;
    width: 148%;
    height: 47%;
    z-index: 9;
}

.character {
    transition: transform 0.2s;
    cursor: url("images/cursor_pointer.png") 8 2, pointer;
    touch-action: manipulation;
}

.character:hover {
    transform: translateY(-2%);
}

.dip {
    left: -5%;
    bottom: 10%;
    width: 36%;
    height: auto;
    z-index: 8;
}

.pip {
    right: -4%;
    bottom: 5%;
    width: 36%;
    height: auto;
    z-index: 8;
}


/* ---------- Lamp glow + on / off ---------- */

/* Soft pool of light coming from the lampshade */
.lamp-glow {
    left: -19%;
    top: 28%;
    width: 45%;
    height: 76%;

    background: radial-gradient(
        ellipse at center top,
        rgba(255, 227, 163, 0.75) 0%,
        rgba(255, 227, 163, 0.45) 20%,
        rgba(255, 227, 163, 0.22) 40%,
        rgba(255, 227, 163, 0.08) 60%,
        rgba(255, 227, 163, 0) 78%
    );

    border-radius: 50%;
    filter: blur(25px);
    opacity: 1;

    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 7;
}

/* When lamp is OFF, remove the glow */
.stage.lamp-off .lamp-glow {
    opacity: 0;
}


/* ---------- Dark room overlay ---------- */

.shade {
    inset: 0;
    background: rgba(12, 10, 30, 0.5);
    opacity: 0;

    pointer-events: none;
    transition: opacity 0.5s;
    z-index: 10;
}

/* When lamp is OFF, darken the room */
.stage.lamp-off .shade {
    opacity: 1;
}


/* ---------- Dialogs ---------- */

.poster-dialog,
.art-dialog {
    margin: auto;
    padding: 24px;
    max-width: 400px;
    border: 3px solid var(--ink);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
}

.poster-dialog::backdrop,
.art-dialog::backdrop {
    background: rgba(10, 8, 25, 0.6);
}

.poster-dialog h2,
.art-dialog h2 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.poster-dialog p,
.art-dialog p {
    margin-bottom: 14px;
}


.copyright {
    font-size: 0.75rem;
    opacity: 0.7;
}


/* ---------- No-JavaScript message ---------- */

.noscript-message {
    position: fixed;
    inset: 0;
    z-index: 200;

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;

    background: #1d1a2b;
    color: var(--paper);
    text-align: center;
    font-size: 1.2rem;
}


/* ---------- Rotate-your-phone notice ---------- */

.rotate-notice {
    display: none;
}

/* script.js adds the "portrait" class when a phone is held upright */
html.portrait .rotate-notice {
    position: fixed;
    inset: 0;
    z-index: 100;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;

    background: #1d1a2b;
    color: var(--paper);
    text-align: center;
}

html.portrait .rotate-notice p {
    font-size: 1.4rem;
    font-weight: 700;
}

html.portrait .rotate-notice small {
    opacity: 0.7;
}

.rotate-icon {
    font-size: 3rem;
    animation: rotate-hint 2s ease-in-out infinite;
}

@keyframes rotate-hint {
    0%, 20%   { transform: rotate(0deg); }
    60%, 100% { transform: rotate(-90deg); }
}


/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}


/* ============================================================
   RESPONSIVE LANDSCAPE LAYOUT
   Desktop layout stays unchanged. Only values that differ
   from the base are listed here.
   ============================================================ */

/* ---------- Landscape tablets ---------- */

@media screen and (orientation: landscape)
    and (min-width: 700px)
    and (max-height: 900px) {

    .tv {
        left: 22%;
        top: 3%;
        width: 56%;
    }

    .tv-power {
        width: 4%;
        min-width: 16px;
        border-width: 2px;
    }

    /* Comfortable tap sizes */
    .poster,
    .art {
        min-width: 48px;
        min-height: 48px;
    }

    .mug {
        min-width: 44px;
        min-height: 44px;
    }
}


/* ---------- Landscape phones ---------- */

@media screen and (orientation: landscape)
    and (max-width: 699px)
    and (max-height: 500px) {

    .tv {
        left: 20%;
        top: 2%;
        width: 60%;
    }

    .tv-idle {
        font-size: clamp(14px, 4cqw, 36px);
    }

    .tv-idle small {
        font-size: 0.38em;
    }

    .tv-power {
        width: 5%;
        min-width: 18px;
        border-width: 2px;
    }

    .tv.on .tv-power {
        box-shadow: 0 0 10px 3px rgba(255, 227, 163, 0.9);
    }

    .poster {
        min-width: 44px;
        min-height: 44px;
        right: 5%;
        top: 2%;
    }

    /* Position .art here too if it overlaps the poster on phones */
    .art,
    .mug {
        min-width: 44px;
        min-height: 44px;
    }

    /* Keep dialogs within the small screen */
    .poster-dialog,
    .art-dialog {
        width: min(90vw, 400px);
        max-width: 90vw;
        max-height: 85dvh;
        overflow-y: auto;
        padding: 16px;
    }

    .poster-dialog h2,
    .art-dialog h2 {
        font-size: 1rem;
    }

    .poster-dialog p,
    .art-dialog p {
        font-size: 0.9rem;
    }
}


/* ---------- Touchscreens ---------- */

/* Hover effects are reserved for devices with a real hover pointer */
@media (hover: none) and (pointer: coarse) {

    .poster:hover,
    .poster:focus-visible,
    .art:hover,
    .art:focus-visible,
    .mug:hover,
    .mug:focus-visible,
    .character:hover {
        transform: none;
    }

    .tv-power:hover {
        background: #a35d6a;
    }

    /* Keep the glowing state when the TV is on */
    .tv.on .tv-power:hover {
        background: var(--lamp-glow);
    }
}