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

html,
body {
    margin: 0;
}

body {
    overflow: hidden;
    background: #0b1424;
    color: #f3e9d8;
    font-family: 'VT323', monospace;
}

/* ---------- Scene ---------- */

.scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.scene.is-ready {
    opacity: 1;
}

/* Each world is one painting at its native pixel size, scaled to cover the
   viewport with one transform. Screen and hotspot coordinates are in image pixels. */
.world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
}

.desk,
.front {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-drag: none;
}

.move {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Only one view shows at a time. The incoming view fades in on top while the
   outgoing one stays fully visible underneath, so there is never a dark dip;
   the short fade hides the seams where the video meets the paintings. */
.world-desk,
.move,
.world-front {
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0s linear 0.18s, visibility 0s linear 0.18s;
}

body.view-desk .world-desk,
body.view-move .move,
body.view-front .world-front {
    z-index: 2;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.18s ease, visibility 0s;
}

.scroll-hint,
.desk-toast {
    z-index: 3;
}

/* ---------- Computer screen ---------- */

/* Multiply lets the painted glow show through: white is invisible,
   dark text reads as if it were on the CRT itself. */
/* Sized in its own design pixels and warped onto the painted screen
   with a perspective matrix (see fitScreen in main.js). */
.screen {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    mix-blend-mode: multiply;
    color: #262433;
    border-radius: 5% / 6%;
    overflow: hidden;
}

.screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to bottom, rgba(40, 30, 60, 0.045) 0 1px, transparent 1px 3px);
    pointer-events: none;
}

.screen-hello {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sacramento', cursive;
    font-size: 120px;
    line-height: 1;
    color: #2e2a36;
    transition: opacity 0.6s ease;
}

.screen-hello span {
    clip-path: inset(0 100% 0 0);
    padding: 0 12px;
}

.scene.is-ready .screen-hello span {
    animation: hello-write 2.4s 0.8s ease-in-out forwards;
}

@keyframes hello-write {
    to {
        clip-path: inset(0 0 0 0);
    }
}

/* After the intro, "hello." fades out and a small note with a Help button fades in. */
.desk-screen.is-browsing .screen-hello {
    opacity: 0;
}

.screen-browse {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease 0.5s, visibility 0s linear 1.3s;
}

.desk-screen.is-browsing .screen-browse {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease 0.5s, visibility 0s;
}

.screen-browse p {
    margin: 0;
    font-size: 46px;
    line-height: 1;
}

.mac-button.help-button {
    display: inline-flex;
    margin: 0;
    align-items: center;
    gap: 12px;
    padding: 6px 26px 8px 14px;
    font-family: inherit;
    font-size: 40px;
    line-height: 1;
    border-width: 3px;
    border-radius: 14px;
}

/* The round question-mark badge of the old Mac Help. */
.help-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 3px solid currentColor;
    border-radius: 50%;
    font-size: 32px;
}

/* Only the desk view, once the visitor is free to browse, can press it. */
body:not(.mode-desk) .help-button {
    pointer-events: none;
}

.screen-panel {
    position: absolute;
    inset: 0;
    padding: 22px 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

.screen-panel.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0s;
}

/* ---------- 1984-style window ---------- */

.mac-window {
    height: 100%;
    border: 2px solid #262433;
    display: flex;
    flex-direction: column;
}

.mac-titlebar {
    position: relative;
    height: 22px;
    flex: 0 0 auto;
    border-bottom: 2px solid #262433;
    background: repeating-linear-gradient(to bottom, #262433 0 2px, transparent 2px 4px);
    background-clip: content-box;
    padding: 4px 3px;
    text-align: center;
}

.mac-titlebar span {
    position: relative;
    top: -6px;
    padding: 0 10px;
    background: #fff;
    font-size: 20px;
    line-height: 1;
}

.mac-body {
    flex: 1 1 auto;
    padding: 16px 18px;
    font-size: 22px;
    line-height: 1.15;
}

.mac-body p {
    margin: 0 0 12px;
    min-height: 1.15em;
}

.mac-body-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.mac-button {
    margin-top: 8px;
    padding: 4px 22px;
    border: 2px solid #262433;
    border-radius: 10px;
    background: #fff;
    color: #262433;
    font: inherit;
    cursor: pointer;
    transition: opacity 0.4s ease;
}

/* The intro's Explore button waits until the text has finished typing. */
.screen-panel[data-panel="intro"] .mac-button:not(.is-visible) {
    opacity: 0;
}

.mac-button:hover,
.mac-button:focus-visible {
    background: #262433;
    color: #fff;
    outline: none;
}

/* Photo on the left, the words beside it. */
.memorial-body {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 16px;
    min-height: 0;
}

.memorial-photo {
    display: block;
    height: 236px;
    width: auto;
    border: 2px solid #262433;
}

.memorial-side {
    flex: 1;
    text-align: center;
}

.memorial-text {
    margin: 0 0 18px;
    font-size: 32px;
    line-height: 1.05;
}

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

.hotspots {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hotspot {
    fill: #ffc58a;
    fill-opacity: 0;
    filter: url(#hotspot-soft);
    mix-blend-mode: screen;
    outline: none;
    transition: fill-opacity 0.6s ease;
}

body.mode-desk .hotspot {
    pointer-events: auto;
    cursor: pointer;
}

body.mode-desk .hotspot:hover,
body.mode-desk .hotspot:focus-visible {
    fill-opacity: 0.16;
}
/* ?debug in the URL outlines every hotspot, for lining them up with new art */
body.debug .hotspot {
    fill: #ff3355;
    fill-opacity: 0.25;
    filter: none;
    mix-blend-mode: normal;
    stroke: #ff3355;
    stroke-width: 4;
}

/* ---------- Scroll hint ---------- */

.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 22px;
    margin: 0;
    transform: translateX(-50%);
    font-size: 22px;
    letter-spacing: 0.3em;
    opacity: 0.55;
    transition: opacity 0.4s ease;
    animation: hint-bob 2.4s ease-in-out infinite;
}

.scroll-hint.is-hidden {
    opacity: 0;
}

@keyframes hint-bob {
    50% {
        transform: translate(-50%, 6px);
    }
}

/* ---------- Placeholder content inside panels ---------- */

.mac-body-scroll {
    overflow: hidden;
}

.mac-body h2 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: normal;
}

.mac-meta {
    opacity: 0.65;
}

.mac-actions {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

/* ---------- Live wall clock ---------- */

.clock-hands {
    fill: #000;
    opacity: 0.65;
    filter: url(#clock-soft);
    pointer-events: none;
}

/* ---------- Desk toast (Walkman etc.) ---------- */

.desk-toast {
    position: absolute;
    left: 50%;
    bottom: 26px;
    margin: 0;
    padding: 6px 16px;
    transform: translateX(-50%);
    background: rgba(11, 20, 36, 0.75);
    border: 1px solid rgba(243, 233, 216, 0.25);
    font-size: 22px;
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.desk-toast.is-visible {
    opacity: 1;
}

body.debug .hotspot-label {
    fill: #fff;
    font: 34px sans-serif;
    paint-order: stroke;
    stroke: #000;
    stroke-width: 6;
    pointer-events: none;
}

/* ---------- Floating dust ---------- */

.dust,
.steam {
    position: absolute;
    pointer-events: none;
}

/* ---------- Blinking answering-machine light ---------- */

.blinker {
    pointer-events: none;
}

.blinker-off {
    fill: #2a0d0b;
    animation: blink-off 1.4s steps(1, end) infinite;
}

.blinker-glow {
    fill: #ff5a3c;
    filter: url(#hotspot-soft);
    mix-blend-mode: screen;
    animation: blink-on 1.4s steps(1, end) infinite;
}

.blinker-core {
    fill: #ff7a55;
    mix-blend-mode: screen;
    animation: blink-on 1.4s steps(1, end) infinite;
}

@keyframes blink-on {
    0% { opacity: 0.85; }
    50% { opacity: 0; }
}

@keyframes blink-off {
    0% { opacity: 0; }
    50% { opacity: 0.88; }
}

/* Once the visitor has left a message, the light goes out and stays out. */
body.message-left .blinker-off {
    animation: none;
    opacity: 0.88;
}

body.message-left .blinker-glow,
body.message-left .blinker-core {
    animation: none;
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .blinker-off,
    .blinker-glow,
    .blinker-core {
        animation: none;
    }
}

/* ---------- Dog's Walk (joystick game) ---------- */

.screen-panel[data-panel="game"] {
    padding: 10px 12px;
}

.mac-body-game {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

/* The little square close box at the left of a 1984 title bar. */
.mac-close {
    position: absolute;
    left: 10px;
    top: 3px;
    z-index: 1;
    width: 14px;
    height: 14px;
    padding: 0;
    border: 2px solid #262433;
    background: #fff;
    cursor: pointer;
}

.mac-close:hover,
.mac-close:focus-visible {
    background: #262433;
    outline: none;
}

/* ---------- Blog panel ---------- */

/* Longer than the screen: the page scrolls, following the text as it is written. */
.blog-body {
    min-height: 0;
    overflow-y: auto;
    font-size: 20px;
    line-height: 1.25;
    cursor: default;
    scrollbar-width: thin;
    scrollbar-color: #262433 transparent;
}

.blog-body p {
    margin: 0 0 14px;
}

/* A solid block cursor at the end of the line being written. */
.blog-body .is-typing::after {
    content: '';
    display: inline-block;
    width: 0.5em;
    height: 0.95em;
    margin-left: 2px;
    vertical-align: -0.12em;
    background: currentColor;
    animation: cursor-blink 1s steps(1, end) infinite;
}

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

.blog-body .mac-button {
    margin: 0;
}

.screen-panel[data-panel="blog"]:not(.is-written) .blog-body .mac-button {
    opacity: 0;
    pointer-events: none;
}

/* ---------- Answering machine (contact form) ---------- */

.screen-panel[data-panel="contact"] .mac-body {
    padding: 10px 18px;
}

.screen-panel[data-panel="contact"] h2 {
    margin-bottom: 4px;
}

.screen-panel[data-panel="contact"] .mac-body > p {
    margin-bottom: 8px;
}

.contact-form label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.contact-form label span {
    flex: 0 0 62px;
}

.contact-form input {
    flex: 1;
    min-width: 0;
    height: 26px;
    padding: 0 6px;
    border: 2px solid #262433;
    border-radius: 0;
    background: #fff;
    color: #262433;
    font: inherit;
    font-size: 20px;
    outline: none;
}

.contact-form input:focus {
    box-shadow: inset 0 0 0 1px #262433;
}

/* Off-screen: only bots ever fill it in. */
.contact-trap {
    position: absolute;
    left: -9999px;
}

.screen-panel[data-panel="contact"] .mac-body > .contact-status {
    min-height: 2.3em;
}

.contact-status:empty {
    display: none;
}

.contact-status.is-error {
    text-decoration: underline;
}

/* Once the message is recorded, the fields and the submit button step aside. */
.contact-form.is-sent label,
.contact-form.is-sent [type="submit"] {
    display: none;
}

.contact-form .mac-actions {
    gap: 8px;
    margin-top: 0;
}

.contact-form .mac-button {
    margin-top: 0;
    padding: 2px 14px;
    text-decoration: none;
}

.mac-button:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* ---------- Help panel ---------- */

.screen-panel[data-panel="help"][data-step="ask"] .help-menu,
.screen-panel[data-panel="help"][data-step="menu"] .help-ask {
    display: none;
}

.help-question {
    margin: 0 0 18px;
    font-size: 34px;
}

.help-ask .mac-actions {
    flex-wrap: wrap;
    justify-content: center;
}

.help-menu {
    padding: 6px 0;
}

/* A pulled-down 1984 menu: items invert as the pointer passes over them. */
.mac-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mac-menu button {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 1px 18px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 1.05;
    text-align: left;
    cursor: pointer;
}

.mac-menu button span {
    opacity: 0.55;
}

.mac-menu button:hover,
.mac-menu button:focus-visible {
    background: #262433;
    color: #fff;
    outline: none;
}

.mac-menu button:hover span,
.mac-menu button:focus-visible span {
    opacity: 0.8;
}

.mac-menu-rule {
    margin: 4px 0;
    border-top: 2px dotted #262433;
    opacity: 0.6;
}

/* ---------- Clock panel ---------- */

.time-line {
    margin: 0 0 10px;
    font-size: 34px;
    line-height: 1.1;
}

.time-line [data-romania-time] {
    white-space: nowrap;
}

.time-sub {
    margin: 0 0 18px;
    font-size: 24px;
}
