/* the pointing hand all over the page (the texts being edited keep their text cursor, see .ed-text) */
html, body, body * { cursor: pointer; }

:root {
    /* the soft vignette mask: a plain css gradient (no image to load or keep in memory), an ellipse that is clear in the middle and fades out towards the edges */
    --mask: radial-gradient(ellipse closest-side at 50% 50%, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 20%, rgba(0,0,0,.89) 35%, rgba(0,0,0,.71) 45%, rgba(0,0,0,.5) 55%, rgba(0,0,0,.29) 65%, rgba(0,0,0,.13) 75%, rgba(0,0,0,.03) 85%, rgba(0,0,0,0) 90%);
}

/* deb run — zoom tunnel */

/* nothing on the page can be selected, highlighted or dragged */
* {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

html, body {
    touch-action: none;        /* no pinch zoom, no double-tap zoom, no browser panning: the page handles touches itself */
    overscroll-behavior: none;
    margin: 0;
    height: 100%;
    background-color: black;
    overflow: hidden;          /* nothing scrolls: the animation runs by itself */
}

/* the background animation (not the posts). A click in the middle of the screen shrinks it to a point
   (main.js adds .collapsed); another click brings it back.
   The background also opens collapsed, and zooms out of the black once everything is loaded. */
#stage {
    /* as wide as the screen and as tall as the LARGE viewport (lvh = the page with Safari's toolbars tucked away), so on
       iPhone Safari the picture reaches down under the translucent bottom bar instead of stopping above it */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100lvh;
    transform-origin: 50% 50%;
    transition: transform var(--menu-seconds, .8s) cubic-bezier(.76, 0, .24, 1);
}
#stage.collapsed { transform: scale(0); }
#stage.onload { transition-duration: 3.5s; transition-timing-function: cubic-bezier(.4, 0, .15, 1); }   /* the zoom out of the black when the page opens: 1.5 times slower than the others (.8s) */

/* one box per image; only its .content is drawn (fixed to the screen) */
.box {
    display: block;
}

/* the picture itself: viewport-sized, masked by the vignette, zoomed by main.js */
.content {
    display: none;
    position: absolute;   /* fills #stage (which is the fixed, oversize frame) */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: center;
    will-change: transform, opacity;   /* each picture gets its own graphics layer, so zooming it doesn't repaint the mask every frame */
    background-size: cover;
    background-position: center;
}

/* the soft vignette: the background pictures are masked by it, stretched over the viewport */
.content {
    -webkit-mask-image: var(--mask);
    mask-image: var(--mask);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* main.js marks the four visible layers; the newest (smallest) is on top */
.current .content,
.prev .content,
.prev0 .content,
.prev00 .content { display: block; }

/* images next in line are drawn ahead of time, invisibly, so they are ready when they are needed */
.warm .content { display: block; z-index: 0; opacity: 0; }

.current .content { z-index: 4; }
.prev .content    { z-index: 3; }
.prev0 .content   { z-index: 2; }
.prev00 .content  { z-index: 1; }

video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Safari shows the mp4 through the box background instead, so hide the video tag there */
_::-webkit-full-page-media, _:future, :root .content > video {
    display: none;
}

/* the post in the middle of the screen (text comes from js/posts.js) */
/* main.js uses two of these, so one post can fade in while the previous one fades out */
.post, .pwrap {
    position: fixed;
    top: 50%;
    left: 50%;
    white-space: nowrap;       /* one line, however big it gets */
    line-height: 1;
    color: white;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    letter-spacing: .05em;
    text-transform: lowercase;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: none;   /* stop browsers inflating small text on their own: title and paragraph must scale together */
    text-size-adjust: none;
    opacity: 0;                /* main.js fades them in and out */
    pointer-events: none;
    z-index: 10;
}

.post {
    font-size: calc(6.912lvh * var(--title-raster, 3));   /* normal size (80% of 8.64) times --title-raster: the title is drawn once at that bigger size and only scaled by the graphics card, main.js divides its scale by --title-raster */
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    text-align: center;
    font-weight: 900;          /* heaviest weight the font has (falls back to bold) */
    -webkit-text-stroke: .025em white;   /* thickens the letters further; em = zooms with the text */
    text-rendering: geometricPrecision;
    z-index: 11;               /* the title is above the paragraph wrappers (and the pictures in them) */
}

/* the paragraph hangs below the title (which stays exactly centred): a gap, then a block of text at its own size.
   Line breaks are made in main.js (CHARS_PER_LINE, MAX_LINES). Everything is in em,
   so it zooms together with the title and stays sharp. */
/* The paragraph has its own wrapper (main.js moves it here), separate from the title: the wrapper sits at the
   centre of the screen and is scaled around that point, so the paragraph zooms from the middle of the page
   whatever the title is doing (e.g. flying to its place in the menu). Its font size is the base of the paragraph's em. */
.pwrap {
    font-size: 10.8lvh;
    width: 0;
    height: 0;
    transform-origin: 0 0;
}

.paragraph {
    position: absolute;
    top: calc((.25 + var(--post-gap, 1.15)) * 1.92em);   /* the gap from the bottom of the title's letters to the top of the first line, in title heights (set from IMAGE_GAP in main.js); .25 = from the title's centre to its letters' bottom, less the space above the paragraph's letters; 3em = one title height */
    left: 0;
    transform: translateX(-50%);
    width: max-content;        /* main.js sets one fixed width for all paragraphs (the widest line of any post) */
    font-size: .33333em;       /* paragraph = 3.6lvh at zoom 1 (80% of 4.5); the title is 6.912lvh */
    font-weight: 700;          /* all the text is bold (the titles are heavier still, with a stroke) */
    white-space: pre;          /* lines are already broken in main.js, so they never re-wrap */
    text-rendering: geometricPrecision;  /* text width scales exactly with font size */
    text-align: left;          /* lines start at the left edge of the box, which is centred under the title */
}

/* each line is its own block with a fixed height, so the gap between lines is exactly
   1.35 x the font size at every zoom (blank lines keep their height too) */
.paragraph div {
    height: 1.35em;
    line-height: 1.35em;
}

/* menu of all the titles, centred on the page (filled by main.js) */
#menu {
    position: fixed;
    top: 50lvh;                /* the menu's top edge is at the centre of the page; main.js slides it up so that the focused title is centred */
    left: 50%;
    transform: translate(-50%, 0);
    text-align: center;
    color: white;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 900;
    -webkit-text-stroke: .025em white;
    text-transform: lowercase;
    letter-spacing: .05em;
    text-rendering: geometricPrecision;
    font-size: calc(6.912lvh * var(--peak-size, .66));   /* the same size as a post's title at 100% (main.js sets --peak-size) */
    line-height: 1.7;
    white-space: nowrap;
    visibility: hidden;        /* main.js fades it in and out */
    pointer-events: none;
    z-index: 20;
}
#menu.open { pointer-events: auto; }
/* the text above the first title: formatted like a post's paragraph (a third of the title's size, heavy, left-aligned lines) */
.menu-text {
    position: absolute;
    font-size: .52083em;       /* the same size as a post paragraph (3.6lvh / the menu title's 6.912lvh)  */
    font-weight: 700;          /* bold, like a paragraph */
    -webkit-text-stroke: 0;    /* (it sits inside #menu, which thickens its titles with a stroke) */
    line-height: 1.35;
    text-align: left;
    white-space: pre;
    opacity: 0;
}
.menu-text div { height: 1.35em; line-height: 1.35em; }
.menu-text a { color: white; text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .15em; cursor: pointer; }
/* each menu title and the description is a graphics layer of its own, drawn once and then only moved and scaled by the graphics chip (without this the whole menu is
   painted again, at up to 5 times the size, on every frame of the zoom) */
.menu-text, .menu-item { will-change: transform, opacity; }
.menu-item {
    opacity: 0;
    cursor: pointer;
    padding: 0 .6em;
}

/* menu button (top left corner): three bars that turn into an X (same time and curve as the menu animation, see
   MENU_SECONDS). Everything is sized from the menu's font size (3.4lvh): the icon is one font-height tall,
   1.4 wide, and the bars are thick and close together, like the heavy letters. */
#menu-button {
    position: fixed;
    font-size: 2.295lvh;        /* 1.5 x the previous size (everything in the button is in em, so it all scales) */
    top: calc(28px - .5em + env(safe-area-inset-top, 0px));    /* the bars sit 28px from the top and left edges (plus the notch / status bar, if any) */
    left: calc(50% - 1.2em);   /* centred on the page: half of the button's 2.4em width (bars 1.4em + .5em padding on each side) */
    width: 1.4em;
    height: 1em;
    padding: .5em;             /* a comfortable tap area around the bars */
    box-sizing: content-box;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 30;
    -webkit-tap-highlight-color: transparent;
}
/* play / pause button (bottom centre): same size and tap area as the hamburger, its icon sits 28px above the bottom edge */
#play-button {
    position: fixed;
    font-size: 2.295lvh;
    bottom: calc(28px - .5em + env(safe-area-inset-bottom, 0px));
    left: calc(50% - 1.2em);
    width: 1.4em;
    height: 1em;
    padding: .5em;
    box-sizing: content-box;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 30;
    -webkit-tap-highlight-color: transparent;
    transition: transform .8s cubic-bezier(.76, 0, .24, 1);
}
#play-button.intro { transform: translate(var(--intro-x, 0px), var(--intro-y, 0px)) scale(0); }
#play-button span { position: absolute; top: .5em; height: 1em; background: white; transition: opacity .3s ease; }
#play-button .play  { left: calc(.5em + .7em - .45em); width: .9em; clip-path: polygon(0 0, 100% 50%, 0 100%); }
#play-button .pause { left: calc(.5em + .7em - .45em); width: .9em; opacity: 0; background: linear-gradient(90deg, white 33%, transparent 33% 67%, white 67%); }
#play-button.playing .play { opacity: 0; }
#play-button.playing .pause { opacity: 1; }
#sc-player { position: fixed; left: -300px; bottom: 0; width: 100px; height: 100px; border: 0; opacity: 0; pointer-events: none; }

/* on load the button starts as a point at the centre of the page, like the picture, and zooms out to its place with it
   (main.js sets --intro-x / --intro-y = the distance to the centre and removes .intro when the page opens) */
#menu-button { transition: transform .8s cubic-bezier(.76, 0, .24, 1); }
#menu-button.intro { transform: translate(var(--intro-x, 0px), var(--intro-y, 0px)) scale(0); }

#menu-button span {
    position: absolute;
    left: .5em;
    width: 1.4em;
    height: .28em;
    background: white;
    transition: transform .8s cubic-bezier(.76, 0, .24, 1), opacity .8s cubic-bezier(.76, 0, .24, 1);
}
#menu-button span:nth-child(1) { top: .5em; }
#menu-button span:nth-child(2) { top: .86em; }
#menu-button span:nth-child(3) { top: 1.22em; }
#menu-button.open span:nth-child(1) { transform: translateY(.36em) rotate(45deg); }
#menu-button.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
#menu-button.open span:nth-child(3) { transform: translateY(-.36em) rotate(-45deg); }

/* the layer that holds the texts of the posts (titles and paragraphs): fixed, as big as the viewport (no mask: the text is not faded at the edges). The pictures and videos are in #post-media, behind it; each has its own vignette (.post-image), sized to the picture itself. */
#posts, #post-media, #post-free {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100lvh;            /* the whole iPhone screen, also under the notch and the bars (see viewport-fit=cover in index.html) */
    pointer-events: none;
    z-index: 10;
}
#post-media { z-index: 9; }

/* a post's picture or video: centred on the page, behind the title and the paragraph. It sits in a wrapper of its own (.pwrap, in
   #post-media), so it zooms and shrinks to the centre of the page together with the paragraph. */
.post-image {
    display: none;             /* main.js shows it for posts that have an image */
    position: absolute;
    left: 0;                   /* the wrapper's origin is the centre of the page */
    transform: translate(-50%, -100%);
    width: 0;                  /* width, height and top (its bottom edge) are set by main.js (fitImage): the element is exactly the picture, never cropped or stretched */
    pointer-events: none;
    -webkit-mask-image: var(--mask);   /* the vignette is as big as the picture / video itself (the element is exactly its size) and zooms with it */
    mask-image: var(--mask);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* removed from the page (the markup and script stay, so each can come back by deleting this line): the hamburger (the menu opens with a click in the middle
   of the screen and closes when a title is chosen) and the play / pause button */
#menu-button, #play-button { display: none; }

/* iPhone Safari 26 ("edge" mode, set by main.js): fixed content cannot reach the notch or the bottom bar, but the page itself paints under them. So the layers are
   not fixed: they are as tall as the whole screen (--screen-h, set by main.js) inside the page, which is scrolled down by the height of the notch. */
:root { --screen-h: 100lvh; }
html.edge, html.edge body { overflow: visible; height: auto; }
html.edge body { position: relative; width: 100vw; height: var(--screen-h); }
html.edge #stage, html.edge #posts, html.edge #post-media, html.edge #post-free, html.edge #menu, html.edge .post, html.edge .pwrap { position: absolute; }
html.edge #stage, html.edge #posts, html.edge #post-media, html.edge #post-free { height: var(--screen-h); }
html.edge #menu { top: calc(var(--screen-h) / 2); }

/* never show the browser's own play button or controls on a video (a phone shows its round play button when it refuses to autoplay): they just play */
video::-webkit-media-controls,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-overlay-play-button,
video::-webkit-media-controls-start-playback-button,
video::-webkit-media-controls-play-button {
    display: none !important;
    opacity: 0 !important;
    -webkit-appearance: none;
    pointer-events: none;
}

/* NO GLOW: no text on the site has a shadow (the glow was removed). */
body, body * { text-shadow: none !important; }   /* no glow on any text */
/* the site brings its own colours (black page, white text and glow): the phone's dark mode must not recolour them */
:root, html, body { color-scheme: only light; }
* { forced-color-adjust: none; }
html, body { background-color: #000; }

/* test switches for the post titles (add them to the address): ?nostroke removes the extra thickness, ?noglow removes the glow, ?nowill removes will-change */
html.t-nostroke .post { -webkit-text-stroke: 0; }
html.t-noglow .post, html.t-noglow .post * { text-shadow: none !important; }
html.t-nowill .post { will-change: auto; }

/* ---------- editing (only for people who are logged in, see js/main.js "editing") ---------- */
#edit-button {
    position: fixed;
    right: 28px;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    z-index: 200;
    padding: .5em .6em;
    margin: -.5em -.6em;
    border: 0;
    background: none;
    color: white;
    font: inherit;
    font-size: 15px;
    opacity: .55;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
#edit-button:hover, html.is-editing #edit-button { opacity: 1; }
#edit-note { position: fixed; right: 28px; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); z-index: 200; max-width: 70vw; text-align: right; color: white; font-size: 13px; opacity: .8; pointer-events: none; }
/* the texts being edited stay where they are; they just take the pointer and the keyboard */
.post.editing, .post.editing .title, .pwrap.editing, .pwrap.editing .paragraph { pointer-events: auto; }
.ed-text, .ed-text * { -webkit-user-select: text; user-select: text; cursor: text; outline: none; }
.paragraph.ed-text, .menu-text.ed-text { white-space: pre-wrap; word-break: break-word; }
.paragraph.ed-text div, .menu-text.ed-text div { height: auto; min-height: 1.35em; }
.menu-text.ed-text { pointer-events: auto; }
.ed-text { caret-color: white; }
/* the two buttons at the end of a field */
.ed-btns { position: fixed; z-index: 200; display: flex; left: 0; top: 0; }
.ed-btns button { border: 0; background: none; color: white; font: inherit; font-size: 20px; line-height: 1; padding: 7px 8px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ed-btns button:disabled { opacity: .25; cursor: default; }
/* replace media: in the middle of the post's picture or video */
.ed-media { position: fixed; z-index: 200; display: flex; gap: 6px; align-items: center; transform: translate(-50%, -50%); }
.ed-media button { border: 1px solid rgba(255, 255, 255, .7); border-radius: 999px; background: rgba(0, 0, 0, .45); color: white; font: inherit; font-size: 14px; padding: 8px 14px; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.ed-media .ed-link { opacity: .8; }
/* the WordPress media library, when it opens over the page: plain, as in the admin (the glow, the no-select rule and the black are for the animation) */
.media-modal, .media-modal *, .media-modal-backdrop { text-shadow: none !important; -webkit-user-select: text; user-select: text; }

/* the public page while the posts are hidden: the soundcloud link under the two-line title in the middle (index.php; main.js fades it in with the title) */
#title-link {
    position: fixed;
    left: 50%;
    top: calc(50lvh + 6.912lvh * var(--peak-size, .66) + 2.2lvh);   /* under the two title lines at 100% zoom */
    transform: translateX(-50%);
    opacity: 0;
    z-index: 12;
    color: white;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 3.6lvh;
    letter-spacing: .05em;
    text-transform: lowercase;
    text-decoration: underline;
    text-decoration-thickness: .08em;
    text-underline-offset: .15em;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* the glow, only on the public page while the posts are hidden: the two-line title and the soundcloud link (one soft white shadow each; em = it zooms with the text) */
body.title-only .post .title { text-shadow: 0 0 .22em rgba(255, 255, 255, .65) !important; }
body #title-link, body.title-only #title-link { text-shadow: 0 0 .8em rgba(255, 255, 255, .95) !important; }
