/* css/n64-props.css — the N64 layer
   Props are low-poly 3D objects drawn by js/n64-props.js into [data-prop]
   placeholders; the words beside them use the HUD voice: a chunky display
   face with a hard, unblurred drop shadow, the way a 1997 pause menu was
   lettered. Panels are flat and square-cornered with a double sand-gold
   frame — a dialog box, not a sheet of glass. */

/* The HUD face lives with the site (fonts/, SIL Open Font License) and every
   page preloads it, so the first paint is already lettered in it: a
   stand-in face would set the words wider, wrap them and then jump. */
@font-face {
    font-family: 'Lilita One';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('../fonts/lilita-one-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Lilita One';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('../fonts/lilita-one-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --hud-font: 'Lilita One', 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
    --hud-ink: #fff4d8;
    --hud-gold: #ffd36a;
    --hud-shadow: #061220;
    --panel-bg: rgba(3, 12, 24, 0.88);
    --panel-line: #d8b56a;
    --panel-line-dim: rgba(216, 181, 106, 0.38);
}

/* ===== The prop canvas: fixed over the page, transparent, never clickable ===== */
.n64-props {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 250;
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transition: opacity 0.4s ease;
}

/* (drawn over the arrival's mist, so held back until it parts, then eased in with it) */
html.nav-arriving:not(.nav-reveal) .n64-props {
    opacity: 0;
}

html.nav-arriving.nav-reveal .n64-props {
    transition-duration: 0.7s;
}

/* ===== Bubbles given off by props (collect bursts, the open chest) =====
   Same air as the ambient bubbles: a lens with a bright rim and one glint. */
.prop-bubble {
    position: fixed;
    z-index: 255;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle at 42% 36%,
            rgba(255, 255, 255, 0.5) 0%,
            rgba(255, 255, 255, 0.06) 22%,
            rgba(3, 24, 54, 0.05) 55%,
            rgba(150, 210, 255, 0.38) 86%,
            transparent 100%);
    border: 1px solid rgba(190, 230, 255, 0.26);
    animation: propBubbleRise var(--dur, 2s) ease-out forwards;
}

.prop-bubble::before {
    content: '';
    position: absolute;
    top: 18%;
    left: 26%;
    width: 22%;
    height: 13%;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 50%;
}

.prop-bubble--burst {
    animation: propBubbleBurst var(--dur, 0.9s) cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes propBubbleRise {
    0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
    12% { opacity: 0.85; }
    50% { transform: translate(var(--sway, 10px), calc(var(--rise, -120px) * 0.5)) scale(0.95); }
    100% { transform: translate(calc(var(--sway, 10px) * -0.5), var(--rise, -120px)) scale(1); opacity: 0; }
}

@keyframes propBubbleBurst {
    0% { transform: translate(0, 0) scale(0.5); opacity: 0.9; }
    60% { opacity: 0.85; }
    100% { transform: translate(var(--bx, 40px), var(--by, -120px)) scale(1.05); opacity: 0; }
}

/* A torrent of real bubbles racing up past the top of the view: the cave
   collapsing (projects) and the surfacing that follows it (home) */
.flood-bubble {
    position: fixed;
    z-index: 480;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle at 42% 36%,
            rgba(255, 255, 255, 0.5) 0%,
            rgba(255, 255, 255, 0.06) 22%,
            rgba(3, 24, 54, 0.05) 55%,
            rgba(150, 210, 255, 0.4) 86%,
            transparent 100%);
    border: 1px solid rgba(190, 230, 255, 0.3);
    will-change: transform;
    animation: floodRise var(--dur, 1.4s) cubic-bezier(0.45, 0, 0.7, 1) forwards;
}

.flood-bubble::before {
    content: '';
    position: absolute;
    top: 18%;
    left: 26%;
    width: 22%;
    height: 13%;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 50%;
}

@keyframes floodRise {
    0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
    10% { opacity: 0.9; }
    50% { transform: translate(var(--sway, 20px), calc(var(--rise, -120vh) * 0.45)) scale(0.95); }
    100% { transform: translate(calc(var(--sway, 20px) * -0.6), var(--rise, -120vh)) scale(1.1); opacity: 0.8; }
}

/* ===== Placeholders ===== */
.prop-stage {
    display: block;
    width: var(--stage-w, 180px);
    height: var(--stage-h, 180px);
    flex: none;
}

.prop-stage--sm {
    --stage-w: 56px;
    --stage-h: 56px;
    display: inline-block;
    vertical-align: middle;
}

/* ===== HUD voice ===== */
.hud-label {
    font-family: var(--hud-font);
    font-weight: 400;
    font-size: 1.25rem;
    line-height: 1.1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--hud-ink);
    text-shadow:
        2px 2px 0 var(--hud-shadow),
        3px 3px 0 rgba(6, 18, 32, 0.45);
    transition: color 0.2s ease, transform 0.25s ease;
}

.hud-title {
    font-family: var(--hud-font);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hud-ink);
    text-shadow:
        3px 3px 0 var(--hud-shadow),
        5px 5px 0 rgba(6, 18, 32, 0.35);
}

.hud-sub {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(220, 236, 255, 0.78);
    text-shadow: 1px 1px 0 rgba(6, 18, 32, 0.9);
}

/* ===== Prop links (journey stops, bottom nav, return nav) ===== */
.prop-link,
.dive-prop {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    gap: 0.1rem;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.prop-link:hover .hud-label,
.prop-link:focus-visible .hud-label,
.dive-prop:hover .hud-label,
.dive-prop:focus-visible .hud-label {
    color: var(--hud-gold);
    transform: translateY(-2px);
}

.prop-link:focus-visible,
.dive-prop:focus-visible {
    outline: 2px solid var(--hud-gold);
    outline-offset: 6px;
}

/* collected: the word pops once and is gone with the object */
.dive-prop.nav-collecting .hud-label {
    animation: hudPop 0.5s ease-out forwards;
}

.dive-prop.nav-collecting .prop-peek {
    opacity: 0;
}

@keyframes hudPop {
    0% { transform: scale(1); opacity: 1; }
    35% { transform: scale(1.25) translateY(-6px); opacity: 1; }
    100% { transform: scale(0.6) translateY(-30px); opacity: 0; }
}

/* ===== "Press A to inspect": the only instruction a find carries =====
   A gold key-cap names the input (CLICK with a pointer, TAP on a touch
   screen) and the HUD word names the act. It pops up only for the thing in
   reach: the one under the pointer or keyboard focus, or, while you swim,
   the one nearest the middle of the view. The page scripts set .in-reach. */
.press-prompt {
    display: inline-flex;
    align-items: center;
    gap: 0.42em;
    font-family: var(--hud-font);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--hud-ink);
    text-shadow: 2px 2px 0 var(--hud-shadow);
    opacity: 0;
    transform: translateY(5px) scale(0.88);
    transition: opacity 0.18s ease, transform 0.32s cubic-bezier(0.3, 1.6, 0.5, 1);
    pointer-events: none;
}

.press-key {
    position: relative;
    z-index: 0;
    display: inline-block;
    padding: 0.22em 0.45em 0.16em;
    color: #1a1206;
    background: var(--hud-gold);
    border: 2px solid #2a1c08;
    box-shadow: 2px 2px 0 var(--hud-shadow);
    text-shadow: none;
    letter-spacing: 0.06em;
}

.key-tap {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .key-click {
        display: none;
    }

    .key-tap {
        display: inline;
    }
}

.in-reach .press-prompt {
    opacity: 1;
    transform: none;
}

/* the key blinks the way a waiting button prompt does: a paler layer under
   the lettering pulses in and out (opacity alone, so it never repaints) */
.press-key::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: #fff0c2;
    opacity: 0;
}

.in-reach .press-key::before {
    animation: keyBlink 1.4s ease-in-out infinite;
}

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

/* destination peek under the label (hover/focus) */
.prop-peek {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(220, 236, 255, 0.85);
    text-shadow: 1px 1px 0 rgba(6, 18, 32, 0.95);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s ease 0.05s, transform 0.25s ease 0.05s;
    white-space: nowrap;
}

.dive-prop:hover .prop-peek,
.dive-prop:focus-visible .prop-peek {
    opacity: 1;
    transform: translateY(0);
}

/* ===== The signpost (contact) ===== */
.signpost {
    position: relative;
    width: min(380px, 94vw);
    height: 470px;
    margin: 0 auto;
}

.signpost .prop-stage {
    --stage-w: 100%;
    --stage-h: 100%;
}

/* each plank is a real link, laid over its projected plank by the stage */
.plank-link {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    display: block;
    color: transparent;
    font-size: 0;
    overflow: hidden;
    cursor: pointer;
    outline-offset: 3px;
}

.plank-link:focus-visible {
    outline: 2px solid var(--hud-gold);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* without WebGL the signpost falls back to plain HUD links */
html.no-props .prop-stage {
    display: none;
}

html.no-props .signpost {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 0 2rem;
}

html.no-props .plank-link {
    position: static;
    width: auto;
    height: auto;
    font-family: var(--hud-font);
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--hud-ink);
    text-shadow: 2px 2px 0 var(--hud-shadow);
}

html.no-props .visually-hidden.plank-title {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
}

/* ===== Panels: flat, square, double-framed ===== */
.n64-panel {
    background: var(--panel-bg);
    border: 2px solid var(--panel-line);
    border-radius: 0;
    outline: 1px solid var(--panel-line-dim);
    outline-offset: 4px;
    box-shadow: 6px 6px 0 rgba(2, 8, 16, 0.55);
}

/* chunky 90s push-button: flat fill, hard offset shadow, moves when pressed */
.n64-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--hud-font);
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a1206;
    background: var(--panel-line);
    border: 2px solid #2a1c08;
    border-radius: 0;
    padding: 0.55rem 1.1rem;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--hud-shadow);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.n64-button:hover,
.n64-button:focus-visible {
    background: var(--hud-gold);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--hud-shadow);
}

.n64-button:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--hud-shadow);
}

/* mono tag with a hard edge (tools, dates, status) */
.n64-tag {
    display: inline-block;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hud-ink);
    background: rgba(8, 24, 44, 0.9);
    border: 1px solid var(--panel-line-dim);
    border-radius: 0;
    padding: 0.28rem 0.7rem;
}

@media (max-width: 640px) {
    .hud-label {
        font-size: 1.05rem;
    }

    .signpost {
        height: 420px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hud-label,
    .prop-peek,
    .n64-button,
    .press-prompt {
        transition: none;
    }

    .in-reach .press-key::before {
        animation: none;
    }

    .dive-prop.nav-collecting .hud-label {
        animation: none;
    }
}
