/* The home page: two screens, then the footer.
   Screen 1 is dark and stays pinned; screen 2 is bright and slides up over it.
   (Design chosen 27 Nov 2026. Colours come from brand.css, shared basics from style.css.)

   In this file:
     1. The box around both screens
     2. Screen 1
     3. Screen 2
     4. "Dr Ryan Joy" carrying over onto screen 2
     5. The animation
     6. Phones
     7. People who have asked for less motion */


/* =====================================================================
   1. THE BOX AROUND BOTH SCREENS
   Screen 1 can only stay pinned while this box is on screen, so it lets go once you scroll past screen 2.
   ===================================================================== */
.home-top { position: relative;
            --sh: 100vh;                                   /* the height of one screen */

            /* --u is this page's measuring unit for text. On a laptop or anything smaller it is 1rem (16px), exactly as before.
               On a bigger screen it grows with the screen, so the small text keeps its proportion to the photo and the headline
               instead of looking tiny. It follows whichever is tighter, the width or the height (so an extra-wide monitor
               doesn't get giant text), and it stops at 1.75 times normal. */
            --u: clamp(1rem, min(0.926vw, 1.6vh), 1.75rem);

            /* space at the left and right edges. On an iPhone held sideways it is at least as wide as the strip beside the
               camera cut-out (the two "env" values; they are 0 on everything else), so the words stay clear of it */
            --pad: max(clamp(1.5rem, 5vw, calc(var(--u) * 4)), env(safe-area-inset-left), env(safe-area-inset-right));
            --who-size: clamp(1.6rem, 2.8vw, calc(var(--u) * 2.3));      /* size of "Dr Ryan Joy" in the corner */
            --bar-h: calc(var(--u) * 2.6); }                             /* height of the top bar: exactly the height of the button in it */
/* On phones the browser's own bars come and go; "svh" is the height with them showing, so nothing gets cut off */
@supports (height: 100svh) { .home-top { --sh: 100svh; } }

/* Two invisible rulers, each one screen tall: the first lies over screen 1, the second over screen 2.
   The animations measure your scrolling against them (section 5). */
.ruler { position: absolute; left: 0; width: 1px; height: var(--sh); visibility: hidden; pointer-events: none; }
.ruler-1 { top: 0; }
.ruler-2 { top: var(--sh); }


/* =====================================================================
   2. SCREEN 1: you in the middle, "The Joyful" on one side, "Dentist" on the other
   ===================================================================== */
.screen-1 { --gap: 21vh;      /* how far from the middle the words sit when they are clear of your face */
            --nf: clamp(2.4rem, calc((50vw - var(--gap) - var(--pad)) / 5.4), calc(var(--u) * 9));   /* size of the big name: as large as fits beside you */

            /* Only older browsers use the next five lines (see section 5). home.js sets --p: 0 at the top of the page,
               1 when screen 2 has fully covered this one, and the name's position is a blend of its start and end. */
            --p: 0;
            --l-start: 5.5vh;  --l-end: -2.5vh;     /* "The Joyful": positive = towards your face, negative = away from it */
            --r-start: 3.5vh;  --r-end: -5vh;       /* "Dentist" and the tagline under it */
            --l-now: calc(var(--l-start) + (var(--l-end) - var(--l-start)) * var(--p));
            --r-now: calc(var(--r-start) + (var(--r-end) - var(--r-start)) * var(--p));

            position: sticky; top: 0;               /* "sticky" pins it to the top of the window */
            height: var(--sh); overflow: hidden;
            background: var(--studio);              /* the olive of the studio backdrop in the photo */
            color: var(--cream); padding: calc(var(--u) * 1.5) var(--pad); display: flex; flex-direction: column; }

/* Three layers: the photo, the words, then a cut-out copy of you on top (so the words can pass behind your head) */
.screen-1 .photo, .screen-1 .cutout { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); height: 100%; aspect-ratio: 1 / 1;
            /* the mask fades both sides of the photo to nothing, so there is no visible box around it */
            -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 28%, #000 72%, transparent 100%);
                    mask-image: linear-gradient(to right, transparent 0%, #000 28%, #000 72%, transparent 100%); }
.screen-1 .photo { width: auto; max-width: none; object-fit: cover; }
.screen-1 .cutout { z-index: 3; background: url(/images/ryan-joy-hero-cutout-v2.webp) center / cover no-repeat; }

.screen-1 h1 { font-size: var(--nf); line-height: 1; margin: 0; }
.screen-1 .name-l, .screen-1 .name-r, .screen-1 .tagline { position: absolute; z-index: 2; white-space: nowrap; will-change: transform; }
.screen-1 .name-l, .screen-1 .name-r { top: 21vh; }
.screen-1 .name-l { right: calc(50% + var(--gap)); transform: translateX(var(--l-now)); }
.screen-1 .name-r { left: calc(50% + var(--gap));  transform: translateX(calc(-1 * var(--r-now))); }
/* The tagline sits just under "Dentist" and uses the same movement, so the two travel together */
.screen-1 .tagline { left: calc(50% + var(--gap)); transform: translateX(calc(-1 * var(--r-now)));
                     top: calc(21vh + var(--nf) + 0.9rem); margin: 0;
                     font-family: Gelasio, Georgia, serif; font-style: italic; font-size: clamp(1.2rem, calc(var(--nf) * 0.3), calc(var(--u) * 2)); line-height: 1.2; }

/* The top bar: your name on the left, the menu on the right */
/* Everything in the bar is centred on the same line, so your name and the button sit level with each other */
.screen-1 .topbar { position: relative; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 1rem; height: var(--bar-h); }
.who { font-family: Gelasio, Georgia, serif; font-size: var(--who-size); line-height: 1.1; margin: 0; }
.screen-1 .menu { display: flex; align-items: center; gap: calc(var(--u) * 1.75); font-size: calc(var(--u) * 1.05); }
.screen-1 .menu a { text-decoration: none; }
.screen-1 .menu a:not(.btn) { opacity: 0.9; }
.screen-1 .menu a:not(.btn):hover { opacity: 1; text-decoration: underline; text-underline-offset: 0.3em; }
.screen-1 .menu .btn { font-size: var(--u); line-height: 1.4; padding: calc(var(--u) * 0.6) calc(var(--u) * 1.1); }   /* 1.4 + 0.6 + 0.6 = 2.6: the bar's height */


/* =====================================================================
   3. SCREEN 2: bright, the loupes photo
   The page is the colour of the photo's backdrop and the photo fades in from the left and the top.
   The headline sits on the wall to the right of your head; the paragraph and the handwritten line are on the left.
   ===================================================================== */
.screen-2 { position: relative; z-index: 2; min-height: var(--sh);
            overflow: hidden; overflow: clip;       /* "clip" hides what sticks out, like "hidden", but still lets your green name follow the window */
            background: var(--wall);                /* the pale grey of the white studio wall (the colour is in brand.css) */
            color: var(--forest); padding: calc(var(--u) * 1.5) var(--pad); display: flex; align-items: center;
            box-shadow: 0 -2rem 4rem rgba(0, 0, 0, 0.35);    /* soft shadow where it slides over screen 1 */

            /* --side is the width of the clear wall between your head and the right edge of the screen.
               It is worked out from the size of the photo, so the headline stays beside your head on any screen. */
            --side: calc(min(63vh, 37.8vw) - 5vw - var(--pad) - var(--u) * 4);

            /* The animation's numbers (section 5) */
            --g0: 0.9;          /* the headline's size as this screen first appears: 10% smaller than normal */
            --g1: 1.1;          /* and its size as this screen leaves: 10% bigger */
            --shift: calc(var(--u) * 2.5);    /* how far to the left the headline starts; it slides right to its place as the screen comes up.
                                                 Always less than the gap between your hair and the headline (4 units, in --side above), so it never touches your hair */
            --shift2: var(--u);               /* and how much further right it drifts as the screen leaves */
            --slide: 1.5rem; }  /* how far to the left the paragraph and the line start */

.screen-2 .portrait { position: absolute; right: -5%; bottom: 0; height: min(100%, 60vw); width: auto; max-width: none; aspect-ratio: 3 / 2; object-fit: cover;
                      -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 20%), linear-gradient(to bottom, transparent 0%, #000 10%);
                              mask-image: linear-gradient(to right, transparent 0%, #000 20%), linear-gradient(to bottom, transparent 0%, #000 10%);
                      -webkit-mask-composite: source-in; mask-composite: intersect; }

/* The headline goes BEHIND you (added 28 Nov 2026). Three layers, back to front: the photo above; the headline; then ".cut",
   a second copy of the same photo with everything except you made see-through, so only you are drawn again, exactly on top
   of yourself. Whatever sits between the two copies (the headline) disappears behind you.
   The see-through part comes from a mask: a small file holding just your silhouette (head, shirt, arms, the loupes).
   Three masks are used at once: the silhouette, plus two that switch this copy off in the strips where the photo underneath
   fades into the page (its left 20% and top 10%), because a half-faded photo drawn twice would look more solid there.
   "intersect" means a pixel is only drawn where all three allow it. */
.screen-2 .cut { z-index: 3; pointer-events: none;        /* in front of the headline (which is 2); taps go straight through it */
                 -webkit-mask-image: url(/images/ryan-joy-loupes-cut-mask.webp), linear-gradient(to right, transparent 20%, #000 20%), linear-gradient(to bottom, transparent 10%, #000 10%);
                         mask-image: url(/images/ryan-joy-loupes-cut-mask.webp), linear-gradient(to right, transparent 20%, #000 20%), linear-gradient(to bottom, transparent 10%, #000 10%);
                 -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
                 -webkit-mask-composite: source-in, source-in; mask-composite: intersect, intersect; }

/* The headline. "transform-origin: 0% 100%" pins its bottom-left corner, so when it grows it grows up and to the right. */
.screen-2 h2 { position: absolute; z-index: 2; right: var(--pad); top: 15vh; width: var(--side); margin: 0;
               font-size: clamp(1.8rem, calc(var(--side) / 5.7), calc(var(--u) * 4.2)); line-height: 1.05; color: var(--forest);
               transform-origin: 0% 100%; }
.screen-2 h2 span { display: block; transform-origin: 0% 100%; }     /* the words sit in their own box, so they can carry on growing after the screen lands (section 5) */

/* The left column: the paragraph, then the handwritten line with the two links */
.screen-2 .words { position: relative; z-index: 4; max-width: min(calc(var(--u) * 27), 30vw); }      /* the column widens with the text, so the lines break in the same places */
.screen-2 .lede { font-size: calc(var(--u) * 1.1); color: var(--moss); max-width: none; margin-bottom: var(--u); }
.line { font-family: Allura, cursive; font-size: clamp(1.9rem, 2.9vw, calc(var(--u) * 2.5)); line-height: 1.25; margin: calc(var(--u) * 0.5) 0 0; color: var(--forest); }
.line a { color: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; text-decoration-color: var(--sand); }
.line a:hover { text-decoration-color: currentColor; }


/* =====================================================================
   4. "DR RYAN JOY" CARRYING OVER FROM SCREEN 1 ONTO SCREEN 2
   There are two copies of your name in exactly the same spot: a cream one on the dark screen
   (in the top bar) and a green one on the light screen (below).

   The green copy is "sticky" (it holds its place at the top of the window) inside a tall invisible box,
   the "rail". The rail starts one screen above the light screen and runs to the bottom of it, so the name
   holds still the whole time. The ".who-clip" box around it cuts off anything outside the light screen,
   which is what hides the green name until the light screen reaches it.

   Then it leaves: home.js measures how close the paragraph has come to the name and sets --out
   (0 = fully there, 1 = gone). The name fades and shrinks a little as --out rises.
   ===================================================================== */
.who-clip { position: absolute; inset: 0; z-index: 3; clip-path: inset(0); pointer-events: none; }
.who-rail { position: absolute; left: 0; right: 0; top: calc(-1 * var(--sh)); bottom: 0; }
.who-green { position: sticky; top: calc(var(--u) * 1.5); padding-left: var(--pad); color: var(--forest);
             height: var(--bar-h); display: flex; align-items: center;      /* the same height and centring as the top bar, so the two copies of your name sit exactly on top of each other */
             opacity: calc(1 - var(--out, 0)); transform: scale(calc(1 - 0.2 * var(--out, 0))); transform-origin: var(--pad) 50%; }


/* =====================================================================
   5. THE ANIMATION
   Everything that moves is tied to your scrolling by the browser itself. "animation-timeline" says:
   don't run this animation off a clock, run it off how far the page has been scrolled.

   What it measures against: the two rulers from section 1. Each ruler gives a timeline that runs from 0% to 100%
   as that ruler slides off the top of the window ("exit"):
     --first    0% = the top of the page,  100% = one screen scrolled (the light screen has just covered screen 1)
     --second   0% = one screen scrolled,  100% = two screens scrolled

   Why rulers, and why "off the top": on an iPhone, Safari's address bar shrinks as you start scrolling, which changes
   the height of the window. Anything measured against the bottom of the window jumps when that happens.
   The top of the window never moves, so these timelines stay steady.

   Each "@keyframes" below is one movement: where something starts ("from") and where it ends ("to").
   ===================================================================== */
@keyframes name-left     { from { transform: translateX(5.5vh); }  to { transform: translateX(-2.5vh); } }   /* "The Joyful": tucked behind your hair, then out to the left */
@keyframes name-right    { from { transform: translateX(-3.5vh); } to { transform: translateX(5vh); } }      /* "Dentist" and the tagline: out to the right */
@keyframes headline-out  { from { transform: translateX(calc(-1 * var(--shift))) scale(var(--g0)); } to { transform: translateX(0px) scale(1); } }   /* the headline on screen 2 slides to the right and grows up to its normal size... */
@keyframes headline-on   { from { transform: translateX(0px) scale(1); } to { transform: translateX(var(--shift2)) scale(var(--g1)); } }                /* ...and then carries on, a little further right and a little bigger */
@keyframes from-left     { from { opacity: 0; transform: translateX(calc(-1 * var(--slide))); } to { opacity: 1; transform: translateX(0px); } }   /* fade in, sliding from the left */
/* phones only (section 6) */
@keyframes name-rise     { from { transform: translateY(calc(var(--ph) * var(--tuck))); } to { transform: translateY(0px); } }
@keyframes photo-settle  { from { transform: translateX(-50%) scale(var(--zoom)); }      to { transform: translateX(-50%) scale(1); } }

@supports (animation-timeline: view()) and (timeline-scope: --first) {
  .home-top { timeline-scope: --first, --second; }     /* lets everything inside the box use the two timelines */
  .ruler-1 { view-timeline: --first block; }
  .ruler-2 { view-timeline: --second block; }

  /* Screen 1: the two halves of the name move apart, from the first pixel of scrolling until screen 2 has covered them */
  .screen-1 .name-l { animation: name-left linear both; }
  .screen-1 .name-r, .screen-1 .tagline { animation: name-right linear both; }
  .screen-1 .name-l, .screen-1 .name-r, .screen-1 .tagline { animation-timeline: --first; animation-range: exit 0% exit 100%; }

  /* Screen 2: the headline slides right and grows as the screen comes up, and is in its place at normal size when the screen lands...
     (The plain "transform" is the starting position and size, so the very first frame is right.) */
  .screen-2 h2 { transform: translateX(calc(-1 * var(--shift))) scale(var(--g0)); animation: headline-out linear both; animation-timeline: --first; animation-range: exit 0% exit 100%; }
  /* ...then the words inside it keep moving and growing as you scroll on */
  .screen-2 h2 span { animation: headline-on linear both; animation-timeline: --second; animation-range: exit 0% exit 100%; }

  /* Screen 2: the paragraph and the handwritten line fade in from the left as the screen comes up.
     They have finished just before the screen lands, so the words are never half-faded while you read. */
  .screen-2 .lede, .screen-2 .line { animation: from-left linear both; animation-timeline: --first; animation-range: exit 35% exit 90%; }
}
/* Browsers that don't know "animation-timeline" skip that block. For them home.js measures the scrolling and sets --p,
   which moves the name on screen 1 (see the top of section 2). Screen 2 simply stays still. */


/* =====================================================================
   6. PHONES, and any window that is not clearly wider than it is tall
   Screen 1: there is no room beside you, so the big name sits above your photo and rises from behind the top of your head.

   When this layout is used (changed 28 Nov 2026): on anything up to 760px wide, AND on any window whose shape is
   squarer than 4 wide to 3 tall. It goes by shape because the computer layout needs room for the name on both sides
   of your head; in a squarish window there isn't any, however many pixels wide it is.
   (home.js has the same test near its top. If you change one, change the other.)
   ===================================================================== */
@media (max-width: 760px), (max-aspect-ratio: 4/3) {

  /* ----- Screen 1 ----- */
  .screen-1 { /* THE SIZE OF THE BIG NAME. It is the smaller of two sums:
                   17vw                          as big as the window's WIDTH allows (17% of it), or
                   (54% of the screen - 11.5rem) / 2     as big as the window's HEIGHT allows while leaving your photo 46% of the screen.
                 (The 11.5rem is the top bar, the tagline and the gaps. The "/ 2" is because the name is two lines.)
                 On a normal phone the width sum is the smaller one, so nothing changed there. In a squat window the height sum
                 takes over and the name shrinks, instead of your photo being squeezed. It never goes below 2.25rem or above 6rem. */
              --fs: clamp(2.25rem, min(17vw, calc((var(--sh) * 0.54 - 11.5rem) / 2)), 6rem);
              --ph: min(100vw, calc(var(--sh) - 11.5rem - 2 * var(--fs)));         /* photo height: full width, or whatever is left under the words */
              --tuck: 0.03;       /* how far down the name starts, as a share of the photo's height. Bigger = more of "Dentist" hidden behind your hair */
              --zoom: 1.05;       /* how much larger your photo starts. 1 = no zoom */

              /* THE GLOW. The photo has a soft pool of light on the backdrop behind you, but the photo stops at the top of your head,
                 so the light used to stop there too, in a straight line. This paints the same light onto the screen itself,
                 as an oval centred a little below the top of the photo, so it carries on upwards and fades out naturally.
                 The colours are measured from the photo: brightest in the middle, down to the plain backdrop olive at the edge. */
              background: radial-gradient(ellipse calc(var(--ph) * 0.62) calc(var(--ph) * 0.6) at 50% calc(100% - var(--ph) * 0.8),
                                          rgb(112 105 88) 0%, rgb(99 93 77) 35%, rgb(84 80 65) 68%, var(--studio) 100%) var(--studio); }

  /* The menu on a phone is just "About", as plain underlined words. The "Watch my videos" button is for bigger screens. */
  .screen-1 .menu .btn { display: none; }
  .screen-1 .menu a.about-link { opacity: 1; font-size: 1.1rem; text-decoration: underline; text-underline-offset: 0.3em; }
  /* "Dr Ryan Joy" sits 3px lower on a phone. The letters were already level with "About", but the line under "About"
     makes that word reach further down, so the name looked as if it floated high. This centres the name against
     "About" plus its line. "translate" slides it without moving anything else, and because both copies of the name
     (the cream one here and the green one for the second screen) are ".who", they stay exactly on top of each other. */
  .who { translate: 0 0.1875rem; }      /* 0.1875rem = 3px */

  /* the photo and the cut-out copy of you, exactly on top of each other (the cut-out is a smaller file here) */
  .screen-1 .photo, .screen-1 .cutout { height: var(--ph); transform-origin: 50% 100%; will-change: transform; }
  /* The photo fades out at the sides, and gently over its top fifth, so its backdrop melts into the glow behind it */
  .screen-1 .photo { -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%, #000 78%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 18%);
                             mask-image: linear-gradient(to right, transparent 0%, #000 22%, #000 78%, transparent 100%), linear-gradient(to bottom, transparent 0%, #000 18%);
                     -webkit-mask-composite: source-in; mask-composite: intersect; }
  /* The cut-out of you fades at the sides only. Its top must stay solid: that is your hair, and it has to hide the letters behind it */
  .screen-1 .cutout { background-image: url(/images/ryan-joy-hero-cutout-v2-900.webp);
                      -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%, #000 78%, transparent 100%);
                              mask-image: linear-gradient(to right, transparent 0%, #000 22%, #000 78%, transparent 100%); }

  /* The big name is measured up from the bottom of the screen, so it always sits in the same place relative to your photo.
     At rest its bottom edge is just above your hair. The tagline sits above it. */
  .screen-1 h1 { font-size: var(--fs); position: absolute; z-index: 2; left: var(--pad); bottom: calc(var(--ph) * 0.985); will-change: transform; }
  .screen-1 .name-l, .screen-1 .name-r { position: static; display: block; transform: none; animation: none; }     /* two lines, and no sideways movement */
  .screen-1 .tagline { left: var(--pad); top: auto; bottom: calc(var(--ph) * 0.985 + 2 * var(--fs) + 0.5rem);
                       font-size: 1.4rem; transform: none; animation: none; }

  /* The movement: the name rises and your photo settles back. It is over by the time the light screen
     is 55% of the way up, because on a phone the light screen reaches the name sooner. */
  @supports (animation-timeline: view()) and (timeline-scope: --first) {
    .screen-1 h1 { transform: translateY(calc(var(--ph) * var(--tuck))); animation: name-rise linear both; }
    .screen-1 .photo, .screen-1 .cutout { transform: translateX(-50%) scale(var(--zoom)); animation: photo-settle linear both; }
    .screen-1 h1, .screen-1 .photo, .screen-1 .cutout { animation-timeline: --first; animation-range: exit 0% exit 55%; }
  }
  /* Older browsers: the same movement, driven by --p from home.js */
  @supports not ((animation-timeline: view()) and (timeline-scope: --first)) {
    .screen-1 { --pp: min(1, calc(var(--p) / 0.55)); }
    .screen-1 h1 { transform: translateY(calc((1 - var(--pp)) * var(--ph) * var(--tuck))); }
    .screen-1 .photo, .screen-1 .cutout { transform: translateX(-50%) scale(calc(var(--zoom) - (var(--zoom) - 1) * var(--pp))); }
  }

  /* ----- Screen 2: like the computer version. Your head is on the left with the headline on the wall beside it;
           the paragraph and the handwritten line go underneath the photo. ----- */
  .screen-2 { display: block; padding: 0 0 3rem;
              --photo-h: max(calc(var(--sh) * 0.6), 98vw);    /* height of the photo: 60% of the screen, and always tall enough to reach the right edge */
              --g0: 0.94;         /* on a phone the headline starts 6% smaller than normal... */
              --g1: 1;            /* ...grows up to its normal size and stops (any bigger would run off the edge) */
              --slide: 1rem; }    /* and the text only slides 1rem, so it never starts off the edge of the screen */

  /* The photo is taller than the screen is wide, and slid left so your face is about a quarter of the way across.
     (In the photo your face is half-way across, and the photo is one and a half times as wide as it is tall: that is where 0.75 comes from.)
     It fades into the page at the top and the bottom. */
  .screen-2 .portrait { position: absolute; top: 3rem; left: calc(27vw - var(--photo-h) * 0.75); right: auto; bottom: auto;
                        width: auto; height: var(--photo-h);
                        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 84%, transparent 100%);
                                mask-image: linear-gradient(to bottom, transparent 0%, #000 14%, #000 84%, transparent 100%);
                        -webkit-mask-composite: source-over; mask-composite: add; }
  /* The headline: on the wall to the right of your head, level with your face */
  .screen-2 h2 { left: 47vw; right: 0; width: auto; top: calc(3rem + var(--photo-h) * 0.15);
                 font-size: clamp(1.6rem, 9.2vw, 2.9rem);
                 --shift: 10vw; }              /* how far to the left the headline starts. Bigger = more of it hidden behind your head at first */
  .screen-2 h2 span { animation: none; }       /* no growing past normal size here */

  /* The masked copy of the photo (".cut", section 3) is what lets the headline start tucked behind your hair and slide out to the
     right as the screen comes up. Here its second mask is the phone's own: the photo fades out over its bottom 16%, so this copy
     stops where that fade starts (84% of the way down). */
  .screen-2 .cut { -webkit-mask-image: url(/images/ryan-joy-loupes-cut-mask.webp), linear-gradient(to bottom, #000 84%, transparent 84%);
                           mask-image: url(/images/ryan-joy-loupes-cut-mask.webp), linear-gradient(to bottom, #000 84%, transparent 84%);
                   -webkit-mask-composite: source-in; mask-composite: intersect; }
  /* (The slide itself is the same animation as on a computer, in section 5. Here it just starts further left: see --shift above.) */
  /* The paragraph and the handwritten line start just below the photo */
  .screen-2 .words { max-width: none; padding: calc(var(--photo-h) + 1.5rem) var(--pad) 0; }
  .line { font-size: 2.1rem; }

  /* "Dr Ryan Joy": on a phone it does not linger. The rail ends just below the name, so it holds still
     for one screen of scrolling and then scrolls away with the photo. */
  .who-rail { bottom: auto; height: calc(var(--sh) + var(--u) * 1.5 + var(--bar-h)); }
  .who-green { opacity: 1; transform: none; }
}
/* Very short windows (a phone on its side): don't pin, and don't carry the name over, so nothing gets cut off.
   The first screen becomes 34rem tall, which is taller than the window, and you scroll down through it. */
@media (max-height: 520px) {
  .screen-1 { position: relative; height: 34rem; }
  .who-clip { display: none; }
}
/* A phone on its side, second screen (added 28 Nov 2026). That screen sizes itself from the HEIGHT of the window: your photo is
   as tall as the screen and the headline gets the wall left over to the right of your head. On a sideways phone that left
   about 100px, and the headline was squeezed to one word per line. So here the second screen is 34rem tall too, like the first,
   and does the same sums with that number instead of the window's height.
   "pointer: coarse" means a finger, not a mouse, so a short laptop window is left exactly as it was. */
@media (max-height: 520px) and (min-width: 761px) and (pointer: coarse) {
  .screen-2 { --h: 34rem;                 /* this screen's height here */
              min-height: var(--h);
              --side: calc(min(var(--h) * 0.63, 37.8vw) - 5vw - var(--pad) - var(--u) * 4); }     /* as at the top of section 3, with --h in place of the window's height */
  .screen-2 h2 { top: calc(var(--h) * 0.15); }
  /* the side strip pushes the paragraph in from the left, so trim its width to match: its right edge stays 35% of the way across */
  .screen-2 .words { max-width: calc(35vw - var(--pad)); }
}
/* ...and in the phone layout, work out the name and photo sizes for that 34rem screen, not for the short window.
   (--sh is "the height of one screen" in the sums in section 6. Here the screen is 34rem, so say so.) */
@media (max-height: 520px) and (max-width: 760px) {
  .screen-1 { --sh: 34rem; }
}


/* =====================================================================
   7. PEOPLE WHO HAVE ASKED THEIR DEVICE FOR LESS MOTION
   Nothing moves, and everything sits in its resting position, with the name clear of your face.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .screen-1 { --p: 1 !important; --l-end: 0vh; --r-end: 0vh; }
  .screen-1 .name-l, .screen-1 .name-r, .screen-1 .tagline, .screen-1 h1, .screen-1 .photo, .screen-1 .cutout,
  .screen-2 h2, .screen-2 h2 span, .screen-2 .lede, .screen-2 .line { animation: none !important; }
  .screen-1 h1, .screen-2 h2 { transform: none !important; }
  .screen-1 .photo, .screen-1 .cutout { transform: translateX(-50%) !important; }
}
