/* personal site — palette lives in the :root variables below */

:root {
    /* type scale — three tiers, nothing else */
    --type-lg: 0.95rem;    /* the words you click to enter a room: menu, listen */
    --type-md: 0.72rem;    /* everything read or navigated: lists, letter, back, controls */
    --type-sm: 0.55rem;    /* the mark in the corner */
    --track:   0.08em;     /* one tracking for every UI word */
    --track-lg: 0.12em;    /* a touch more air on the large tier */

    /* the halo: light bleeding softly off the letters, like the water's own glow */
    --halo:       0 0 6px rgba(255, 255, 255, 0.55), 0 0 18px rgba(255, 255, 255, 0.28);   /* lg: menu, listen */
    --halo-hover: 0 0 8px rgba(255, 255, 255, 0.75), 0 0 24px rgba(255, 255, 255, 0.40);
    --halo-md:    0 0 3px rgba(255, 255, 255, 0.45), 0 0 10px rgba(255, 255, 255, 0.22);   /* md: prose stays crisp */

    --ink: #535F75;
    --ink-soft: #6E7788;
    --ink-faint: #9AA0B0;
    --paper: #EDE8F0;
    --accent: #757F99;
    --rule: #D3CDDF;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-size: 0.8rem;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3.5rem;
    background-color: var(--paper);
    color: var(--ink);
    line-height: 2;
    text-align: center;
}

/* Your water, untouched, mid-scale glisten */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url("assets/water.png") center / cover no-repeat;
    opacity: 0.45;
    pointer-events: none;
}

/* Pool of calm: depth beneath the words */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 46% 36% at 50% 50%, rgba(47, 53, 78, 0.42), rgba(47, 53, 78, 0) 70%),
        radial-gradient(ellipse 85% 65% at 50% 50%, rgba(47, 53, 78, 0.32), rgba(47, 53, 78, 0) 75%);
    pointer-events: none;
}

a {
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 400;
    text-shadow: var(--halo);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover {
    text-shadow: var(--halo-hover);
}

/* Landing: the three words, stacked */
.menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.menu a {
    font-size: var(--type-lg);
    letter-spacing: var(--track-lg);
}

/* Inner pages: lists of things (films) */
.sub {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: var(--type-md);
    letter-spacing: var(--track);
}

.sub a {
    color: rgba(255, 255, 255, 0.85);
}

.sub a:hover {
    color: #FFFFFF;
}

/* Blog post */
.post {
    max-width: 34rem;
    padding: 0 1.5rem;
    max-height: 70vh;
    max-height: 70dvh;
    overflow-y: auto;
    text-align: left;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.post::-webkit-scrollbar {
    display: none;
}

/* the text dissolves only where it continues — never over the first or last line */
.post {
    --fade-top: 0px;
    --fade-bottom: 0px;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
}

.post-title {
    font-size: var(--type-md);
    font-weight: 400;
    letter-spacing: var(--track);
    color: #FFFFFF;
    margin: 0 0 2rem;
}

.post-body {
    font-size: var(--type-md);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.88);
    text-align: left;
}

.post-body p {
    margin: 0 0 1.1rem;
}

/* the typing caret, crisp vertical terminal bar */
.caret {
    display: inline-block;
    width: 2.5px;
    height: 1.2em;
    margin-left: 0.2em;
    background: #FFFFFF;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 0 2px #FFFFFF;
    vertical-align: -0.2em;
    transition: none;
}

.post-body p.sig-top {
    margin-bottom: 0.15rem;
}

.post-body p.sig-bottom {
    margin-top: 0;
    padding-bottom: 1.6rem;
}

.caret[hidden] {
    display: none !important;
}

/* resting: the letter complete, the water alone */
body.resting .caret {
    opacity: 0;
}

body.resting .post {
    transition: opacity 1.6s ease;
}

/* Screening room: dark, film fills the screen */
body.room {
    background: #0B0D14;
    display: block;
    gap: 0;
}

body.room::before,
body.room::after {
    display: none;
}

body.room canvas.screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0B0D14;
    touch-action: manipulation;
}

body.room video#deck {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 2px;
    height: 2px;
    opacity: 0;
    pointer-events: none;
}

/* the way back, same everywhere */
.back {
    position: fixed;
    top: 1.4rem;
    left: 1.7rem;
    padding: 0.6rem 0.8rem;
    margin: -0.6rem -0.8rem;
    font-size: var(--type-md);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.75);
    z-index: 2;
}

.back:hover {
    color: #FFFFFF;
}

/* film title, quiet, upper left */
.room-title {
    position: fixed;
    top: 1.35rem;
    left: 4.6rem;
    font-size: var(--type-md);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.4);
    z-index: 2;
    pointer-events: none;
}

/* custom controls, same mono, whisper-quiet */
.controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.2rem 1.7rem 1.2rem;
    background: linear-gradient(to top, rgba(5, 6, 12, 0.72), rgba(5, 6, 12, 0));
    z-index: 2;
    transition: opacity 0.7s ease;
}

.bar-hit {
    cursor: pointer;
    padding: 0.9rem 0;
    margin: -0.4rem 0 0.05rem;
    touch-action: none;
}

.bar {
    height: 1px;
    background: rgba(255, 255, 255, 0.22);
}

.bar-fill {
    height: 1px;
    width: 0;
    background: rgba(255, 255, 255, 0.85);
}

.row {
    display: flex;
    align-items: baseline;
    gap: 1.4rem;
    font-size: var(--type-md);
}

.row button {
    font-family: inherit;
    font-size: inherit;
    font-weight: 400;
    background: none;
    border: none;
    padding: 0.6rem 0.7rem;
    margin: -0.6rem -0.7rem;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    letter-spacing: var(--track);
    transition: color 0.3s ease;
    touch-action: manipulation;
}

.row button:hover {
    color: #FFFFFF;
}

.time {
    color: rgba(255, 255, 255, 0.45);
}

body.idle .controls,
body.idle .back,
body.idle .room-title {
    opacity: 0;
}

body.idle {
    cursor: none;
}

/* experiment: the water, breathing */
body.drift::before {
    animation: drift 36s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes drift {
    from { transform: scale(1) translate(0, 0); }
    to   { transform: scale(1.08) translate(-1.8%, 1.4%); }
}

@media (prefers-reduced-motion: reduce) {
    body.drift::before {
        animation: none;
    }
}
    
    /* moving water: the current beneath everything */
    body.current::before {
        display: none;
    }
    
    .current-water {
        position: fixed;
        inset: 0;
        z-index: -3;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0.72;
        pointer-events: none;
    }

@supports (height: 100dvh) {
    /* belt-and-suspenders for mobile browsers whose chrome shows/hides:
       inset:0 already pins all four edges, this just guards the rare case
       where a percentage height lags behind the visual viewport */
    .current-water {
        height: 100dvh;
    }
}

/* iOS 26 Safari clips position:fixed layers at its status bar and toolbar, and at
   scroll 0 fills the status bar with the root colour. Only in-page content that is
   scrolled past shows through the bars. So on touch screens the water leaves fixed
   positioning: the page starts one runway down (bleed.js scrolls there), and the
   water reaches past both edges. The visible frame and everything in it keep their
   size and place. */
@media (hover: none) and (pointer: coarse) {
    :root {
        --bleed-top: 62px;      /* covers the status bar */
        --bleed-bottom: 136px;  /* covers the expanded toolbar */
    }

    /* the frame is locked: no rubber-band past the edges, no dragging the page.
       Taps and links still land; only the letter scrolls, and it never hands its
       scroll on to the page when it reaches an end */
    html {
        overscroll-behavior: none;
    }

    body.current,
    body.room {
        touch-action: none;
    }

    body.current .post {
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    body.current {
        padding-top: var(--bleed-top);
        min-height: calc(100vh + var(--bleed-top));
        min-height: calc(100dvh + var(--bleed-top));
    }

    .current-water {
        position: absolute;
        inset: auto;
        top: 0;
        left: 0;
        width: 100%;
        height: calc(100vh + var(--bleed-top) + var(--bleed-bottom));
        height: calc(100dvh + var(--bleed-top) + var(--bleed-bottom));
    }
}

.note {
    margin: 0;
    font-size: var(--type-sm);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.4);
    position: fixed;
    bottom: 1.4rem;
    left: 0;
    right: 0;
}

@media (max-width: 480px) {
    .menu {
        gap: 2rem;
    }
}

/* copyright, very small, lower left */
.legal {
    margin: 0;
    position: fixed;
    left: 1.4rem;
    bottom: 1.1rem;
    font-size: var(--type-sm);
    letter-spacing: var(--track);
    line-height: 1.8;
    text-align: left;
    color: rgba(255, 255, 255, 0.72);
    z-index: 3;
}

body.room .legal {
    bottom: 1.3rem;
}

.legal-right {
    left: auto;
    right: 1.4rem;
    text-align: right;
}

body.idle .legal {
    opacity: 0;
}

/* the diary: photographed pages, whole screen, scrollable */
body.diary {
    display: block;
    background: #191A20;
    overflow-y: auto;
    scrollbar-width: none;
}

body.diary::before,
body.diary::after {
    display: none;
}

.pages {
    max-width: 720px;
    margin: 0 auto;
    padding: 4rem 1rem 5rem;
}

.pages img {
    display: block;
    width: 100%;
    margin-bottom: 0.6rem;
    border-radius: 2px;
}

/* while the letter writes itself, the water is a still photograph */
body.letter .current-water {
    filter: brightness(0.92);
    transition: filter 2.4s ease;
}

/* the letter scrolls without chrome */
.letter {
    scrollbar-width: none;
}

.letter::-webkit-scrollbar,
.diary::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

body {
    scrollbar-width: none;
}

/* no browser chrome on any video, ever: no pip button, no overlays */
video::-webkit-media-controls,
video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-picture-in-picture-button,
video::-webkit-media-controls-start-playback-button {
    display: none !important;
    -webkit-appearance: none;
}

/* canvas water fills like cover does for video */
canvas.current-water {
    -o-object-fit: cover;
    object-fit: cover;
}

/* the quiet word that begins it all, when the browser asks for a touch first */
.listen-gate {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    font-family: inherit;
    font-size: var(--type-lg);
    font-weight: 400;
    letter-spacing: var(--track-lg);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 0.8rem 1.6rem;
    z-index: 10;
    transition: opacity 0.4s ease, color 0.3s ease;
}

.listen-gate .gate-icon {
    margin-right: 0.55em;
    font-size: 0.75em;
    vertical-align: 0.05em;
    opacity: 0.75;
}

.listen-gate .caret {
    margin-left: 0;
}

.listen-gate:hover {
    color: #FFFFFF;
}


/* fullscreen: an icon, not a word — sits on the baseline with the other controls */
.row .fs {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    padding: 0.6rem 0.7rem;
    margin-right: -0.7rem;
    line-height: 1;
}

.row .fs[hidden] {
    display: none;
}

.row .fs svg {
    display: block;
    opacity: 0.75;
    transition: opacity 0.3s ease;
}

.row .fs:hover svg {
    opacity: 1;
}

/* the date, set down after the signature: bottom-right, across from the mark */
.dated {
    margin: 0;
    position: fixed;
    right: 1.4rem;
    bottom: 1.1rem;
    font-size: var(--type-sm);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.72);
    z-index: 3;
    opacity: 0;
    transition: opacity 1.6s ease;
}

.dated[hidden] { display: none; }
body.resting .dated { opacity: 1; }

/* listen again: the gate's quieter echo, offered once the letter rests */
.again {
    position: fixed;
    left: 50%;
    bottom: 1.1rem;
    transform: translateX(-50%);
    padding: 0.6rem 0.8rem;
    margin-bottom: -0.6rem;
    font-size: var(--type-md);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.55);
    z-index: 3;
    opacity: 0;
    animation: againIn 1.6s ease 0.8s forwards;
}
.again:hover { color: #FFFFFF; }
@keyframes againIn { to { opacity: 1; } }

/* the halo, everywhere words live — scaled to the type, corners stay plain */
.listen-gate { text-shadow: var(--halo); }

.post-title,
.post-body,
.room-title,
.row button,
.time,
.sub a,
.back,
.again {
    text-shadow: var(--halo-md);
}

/* the work: named in its proper case, sitting at the reading tier — present, not loud */
.works a {
    color: #FFFFFF;
    text-shadow: var(--halo-md);
}

.works a:hover {
    text-shadow: var(--halo);
}

/* the year: metadata, a step behind the title */
.works .year {
    font-size: var(--type-sm);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.5);
    text-shadow: none;
    margin-left: 0.5em;
}

/* the room's title matches the marquee it came from */
.room-title {
    text-shadow: var(--halo-md);
}

/* a quiet note in the corner, across from the mark */
.note-line {
    margin: 0;
    position: fixed;
    right: 1.4rem;
    bottom: 1.1rem;
    font-size: var(--type-sm);
    letter-spacing: var(--track);
    color: rgba(255, 255, 255, 0.72);
    z-index: 3;
}

/* the signature: your hand, drawn once, in the moment you say your name */
.sig {
    display: block;
    width: 7.5rem;
    height: auto;
    margin: 0.2rem 0 0;
    overflow: visible;
    color: rgba(255, 255, 255, 0.92);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45));
}

.sig path {
    /* the hand matches the voice: 'Emma' is voiced for 0.22s */
    transition: stroke-dashoffset 0.22s linear;
}

.sig.writing path { stroke-dashoffset: 0; }

/* narrow screens: the bottom row can't hold three items side by side */
@media (max-width: 640px) {
    .again {
        bottom: 3.4rem;                 /* lifts clear of the corner marks */
    }

    .legal,
    .dated,
    .note-line {
        font-size: 0.5rem;
        letter-spacing: 0.04em;
    }

    .legal  { left: 1rem; }
    .dated,
    .note-line { right: 1rem; }

    /* the letter gets the full width it can spare */
    .post {
        padding: 0 1.2rem;
        max-height: 74vh;
    }
}

/* very narrow: the note stays in its corner, wrapping to two lines */
@media (max-width: 420px) {
    .note-line {
        max-width: 9.5rem;
        text-align: right;
        line-height: 1.5;
    }
}
