/* ============================================================
   RD-OFR — Home "What We Offer" photo cards (index.html, the six section.ofr[data-ofr]).
   Owner 2026-11-11 (this section is otherwise frozen, changelist item 6): two changes only —
   1. "align and resize them so people can see the face and board at least clear" (waist down may be cut):
      every photo gets its own crop, so all faces and the APPROVED BYSAINI.COM board sit clear of the
      dark text panel, below the fixed header and above the words.
   2. "there is a line in between the photo and the details on the side … merge or blur it so there is no
      hard line": the photo's edge now fades out (a soft mask) into the blurred, darkened copy of itself
      that v9.css already lays under it (.ofr-blur); on phones the photo's lower edge fades into the
      panel's own colour (#070b13) under the words.
   Nothing else changes: same images, words, order, panel scrim, fixed-photo "window" animation.
   Loaded after v9.css (index.html only). No HTML change: each card is found by its own photo
   (its inline --photo), and so is the strip rd-morph copies under #why's rounded corners (.rdy-under),
   which continues card 06's photo with the same crop.

   How a crop is described (fractions of the photo, read off the image):
     --o-ar  width / height          --o-yt  top of the highest head
     --o-xl / --o-xr  left / right of the faces + board (the part that must stay clear)
     desktop: --o-ds  photo height in screen heights (1 = as before)   --o-fe / --o-fr  fade length at the photo's
              left / right edge, as a share of the photo's width (never reaching a face)
     phones:  --o-k   photo width in screen widths   --o-fx  horizontal focal point (0 left … 1 right)
   ============================================================ */

/* ---- the six photos ---- */
:is(.ofr, .rdy-under)[style*="offer-01.jpg"] { --o-ar: 1;      --o-xl: .60; --o-xr: .84; --o-yt: .045; --o-fe: .30; --o-fr: .12; --o-k: 1.6; --o-fx: 1; }
:is(.ofr, .rdy-under)[style*="offer-02.jpg"] { --o-ar: 1;      --o-xl: .20; --o-xr: .97; --o-yt: .15;  --o-fe: .12; --o-fr: .07; --o-k: 1.2; --o-fx: 1; }
:is(.ofr, .rdy-under)[style*="offer-03.jpg"] { --o-ar: 1.3333; --o-xl: .55; --o-xr: .80; --o-yt: .20;  --o-fe: .30; --o-fr: .15; --o-k: 2.6; --o-fx: .78; --o-ds: 1.2; }
:is(.ofr, .rdy-under)[style*="offer-04.jpg"] { --o-ar: 1.0024; --o-xl: .25; --o-xr: .83; --o-yt: .01;  --o-fe: .10; --o-fr: .15; --o-k: 1.4; --o-fx: .62; }
:is(.ofr, .rdy-under)[style*="offer-05.jpg"] { --o-ar: .75;    --o-xl: .31; --o-xr: .57; --o-yt: .305; --o-fe: .25; --o-fr: .28; --o-k: 2.0; --o-fx: .45; }
:is(.ofr, .rdy-under)[style*="offer-06.jpg"] { --o-ar: 1.0881; --o-xl: .40; --o-xr: .72; --o-yt: .11;  --o-fe: .23; --o-fr: .20; --o-k: 1.8; --o-fx: .61; }

/* ---- desktop / tablet landscape: the photo beside the text panel ----
   The photo is as tall as the screen (×--o-ds), at least .68 of the screen wide, and never so wide that its
   faces + board can't all fit in the clear part of the screen (from 57% to 97.5% of the width on the photo's
   side; the panel's scrim is ≤ .08 there). It slides off its outer edge just far enough to bring them in;
   it moves down only to clear the fixed header (a gap under the header, faded). */
@media (min-width: 901px) {
  :is(.ofr, .rdy-under)[style*="/offer/"] > :is(.ofr-pic, .ofr-blur) {
    --pw: min(max(calc(var(--o-ds, 1) * 100vh * var(--o-ar)), calc(.68 * 100vw)),
              calc(.405 * 100vw / (var(--o-xr) - var(--o-xl))));
    --ph: calc(var(--pw) / var(--o-ar));
    --T: max(calc(100vh - var(--ph)), calc(var(--o-top, 64px) - var(--o-yt) * var(--ph)));   /* photo top */
    --Tf: calc(var(--T) + min(48px, var(--o-yt) * var(--ph) * .8));                      /* top fade ends (above every head) */
    --top: linear-gradient(180deg, transparent var(--T), rgba(0,0,0,.5) calc((var(--T) + var(--Tf)) / 2), #000 var(--Tf));
    background-size: var(--pw) var(--ph);
  }
  :is(.ofr, .rdy-under)[style*="/offer/"] > .ofr-pic {
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-composite: source-in; mask-composite: intersect;
  }
  /* the highest head starts 12px under the fixed header (51px from 1280px wide; 72px between 901 and 1279, where
     the menu is taller) */
  :is(.ofr, .rdy-under)[style*="/offer/"] { --o-top: 64px; }
  /* the blurred, darkened bed under the photo (v9.css .ofr-blur) now lies exactly under it, so where the photo
     fades out its own blurred copy continues it — the edge melts instead of meeting a different blurred picture */
  :is(.ofr, .rdy-under)[style*="/offer/"] > .ofr-blur { transform: none; background-repeat: no-repeat; }
  /* photo on the right, text panel on the left: the photo's LEFT edge fades out */
  html:not([dir="rtl"]) :is(.ofr, .rdy-under):not(.ofr-r)[style*="/offer/"] > :is(.ofr-pic, .ofr-blur) {
    --s: max(0px, min(calc(var(--pw) * (1 - var(--o-xl)) - .43 * 100vw), calc(var(--pw) * (1 - var(--o-xr)) - .025 * 100vw)));
    --e: calc(100% + var(--s) - var(--pw));
    --f: calc(var(--o-fe) * var(--pw));
    background-position: right calc(-1 * var(--s)) top var(--T);
  }
  html:not([dir="rtl"]) :is(.ofr, .rdy-under):not(.ofr-r)[style*="/offer/"] > .ofr-pic {
    -webkit-mask-image: linear-gradient(90deg, transparent var(--e), rgba(0,0,0,.18) calc(var(--e) + var(--f) * .3), rgba(0,0,0,.62) calc(var(--e) + var(--f) * .62), #000 calc(var(--e) + var(--f))), var(--top);
            mask-image: linear-gradient(90deg, transparent var(--e), rgba(0,0,0,.18) calc(var(--e) + var(--f) * .3), rgba(0,0,0,.62) calc(var(--e) + var(--f) * .62), #000 calc(var(--e) + var(--f))), var(--top);
  }
  /* photo on the left, text panel on the right (.ofr-r; and every card in Arabic, where the text sits on the
     right): the photo's RIGHT edge fades out */
  :is(.ofr, .rdy-under).ofr-r[style*="/offer/"] > :is(.ofr-pic, .ofr-blur),
  html[dir="rtl"] :is(.ofr, .rdy-under)[style*="/offer/"] > :is(.ofr-pic, .ofr-blur) {
    --s: max(0px, min(calc(var(--pw) * var(--o-xr) - .43 * 100vw), calc(var(--pw) * var(--o-xl) - .025 * 100vw)));
    --e: calc(var(--pw) - var(--s));
    --f: calc(var(--o-fr) * var(--pw));
    background-position: left calc(-1 * var(--s)) top var(--T);
  }
  :is(.ofr, .rdy-under).ofr-r[style*="/offer/"] > .ofr-pic,
  html[dir="rtl"] :is(.ofr, .rdy-under)[style*="/offer/"] > .ofr-pic {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--e) - var(--f)), rgba(0,0,0,.62) calc(var(--e) - var(--f) * .62), rgba(0,0,0,.18) calc(var(--e) - var(--f) * .3), transparent var(--e)), var(--top);
            mask-image: linear-gradient(90deg, #000 calc(var(--e) - var(--f)), rgba(0,0,0,.62) calc(var(--e) - var(--f) * .62), rgba(0,0,0,.18) calc(var(--e) - var(--f) * .3), transparent var(--e)), var(--top);
  }
  /* Arabic: the text of the cards whose photo is on the right sits on the right (the page's own RTL flow), so
     their photo and panel shade swap sides too — v9.css's own .ofr-r shade, mirrored — and the words keep the
     panel's contrast instead of lying on the photo */
  html[dir="rtl"] :is(.ofr, .rdy-under):not(.ofr-r)[style*="/offer/"] > .ofr-scrim {
    background: linear-gradient(270deg, rgba(6,9,16,.96) 0%, rgba(6,9,16,.92) 24%, rgba(6,9,16,.72) 42%, rgba(6,9,16,.10) 56%, rgba(6,9,16,0) 66%);
  }
}

@media (min-width: 901px) and (max-width: 1279px) { :is(.ofr, .rdy-under)[style*="/offer/"] { --o-top: 84px; } }
/* (2026-11-14) photo 03 (Sell/trade), computers: its left edge fades out over .50 of the photo's width instead of .30
   (table above), still ending short of the faces and board (--o-xl .55). On wide screens the text column ends where the
   panel shade thins out, so the long paragraph lines and the kicker lay on the bright white car. Worst line at 1904x950:
   paragraph 3.54 -> 5.35, kicker 3.94 -> 4.57. Most other computer sizes improve too, but not all reach 4.5 (1920x1080:
   paragraph 3.51 -> 4.43, kicker 3.25 -> 4.01).
   --o-fe is read only by the computer photo rules above, so phones are unchanged. */
@media (min-width: 901px) { :is(.ofr, .rdy-under)[style*="offer-03.jpg"] { --o-fe: .50; } }

/* ---- phones and tablets (v9.css's own phone layout: the photo above, the words over the dark foot) ----
   Sized and placed by the screen WIDTH (and the small viewport height, which never changes while scrolling),
   never by the changing visible height, so a phone's sliding address bar cannot make the picture jump
   (the rule v9.css keeps). The highest head sits just under the fixed header; the photo's lower edge fades
   into the panel colour, so whatever the photo's height there is no line. */
@media (max-width: 900px) {
  :is(.ofr, .rdy-under)[style*="/offer/"] { --o-u: 100vw; }
  @supports (height: 1svh) { :is(.ofr, .rdy-under)[style*="/offer/"] { --o-u: min(100vw, 50svh); } }
  :is(.ofr, .rdy-under)[style*="/offer/"] > .ofr-pic {
    --pw: max(100vw, calc(var(--o-k) * var(--o-u)));
    --ph: calc(var(--pw) / var(--o-ar));
    --T: calc(66px - var(--o-yt) * var(--ph));
    background-image: linear-gradient(180deg, rgba(7,11,19,0), rgba(7,11,19,.5) 42%, rgba(7,11,19,.86) 72%, #070b13 92%), var(--photo);
    background-repeat: no-repeat;
    background-size: 100% calc(var(--ph) * .3 + 6px), var(--pw) auto !important;
    background-position: 0 calc(var(--T) + var(--ph) * .7), calc(var(--o-fx) * 100%) var(--T) !important;
  }
}
/* short phones (e.g. 360×640, 375×667): less height above the words, so the photos that reach lower (faces low in
   the frame, a tall group) are drawn a little smaller, keeping every face and the whole board above the dark foot */
@media (max-width: 900px) and (min-aspect-ratio: 11/20) {
  :is(.ofr, .rdy-under)[style*="offer-01.jpg"] { --o-k: 1.3; }
  :is(.ofr, .rdy-under)[style*="offer-03.jpg"] { --o-k: 2.4; }
  :is(.ofr, .rdy-under)[style*="offer-04.jpg"] { --o-k: 1.15; }
  :is(.ofr, .rdy-under)[style*="offer-05.jpg"] { --o-k: 1.75; }
  :is(.ofr, .rdy-under)[style*="offer-06.jpg"] { --o-k: 1.55; }
}

/* (2026-11-12) The pre-shrunk copies of photos 01, 02 and 05 for 1x desktop screens were taken out again: drawn from a
   copy only 1-3 % wider than its box, the photo came out softer than Chrome's own downscale from the 1800 px file (speed
   audit B1). Every screen draws the full files again, as the live site does. */

/* ============================================================
   PHONE LEGIBILITY BACKDROP (owner 2026-11-14, iPhone: "when we swipe up the text comes on top of photo and its not
   visible put something at the back of text aswell like a gradient or something which is transparent but also enough
   to see the text clearly"). Phones only (the phone layout, <= 900px); computers keep the panel scrim and are unchanged.
   CSS only, no HTML change (pseudo-elements on the existing .ofr / .ofr-in). Why it is needed: the photo and its dark
   foot (.ofr-scrim) are fixed to the screen, the words scroll, so on a swipe the words rise off the dark foot onto the
   bright parts of the photo (a jacket, the white sign, street lights).
   1. A dark gradient that travels WITH the words (.ofr-in::before, behind them, full width so it is never a box): it
      fades in softly over the 118px above the kicker (eased, no visible edge) and is .9 navy from just above the kicker
      down, turning solid #070b13 at the card's lower edge. .9 is what the blue kicker needs for 4.5:1 over the brightest
      pixels (white sign, lamps); the photo above the words, with the faces, is untouched. At rest it lies on the existing
      dark foot, so the resting card looks as before.
   2. (Taken out again later on 2026-11-14: a 64px fade from navy at the top of each card, .ofr::before, met the navy
      lower edge of the card before it, and where the two cards' clipped edges met, the photos under them showed through
      the shared edge pixel row as a thin bright line (both layers are clipped there, so neither can fully cover that
      row). Without the fade the next card's photo simply starts at the edge; no line. At rest the fade lay under the
      fixed header, so resting cards look as before.)
   3. The strip under the "Why Choose" sheet's rounded corners (.rdy-under, the last card's layers copied by rd-morph)
      shows the same navy, continuing the last card's lower edge.
   4. (Taken out again later on 2026-11-14: the header bar itself is now opaque on phones and tablets, v9.css, so the
      header-coloured strip each card painted under it, .ofr::after, had nothing left to cover.)
   No blur: a moving blur over the fixed photo is redrawn every frame (the judder v9.css removed on phones).
   ============================================================ */
@media (max-width: 900px) {
  section.ofr[data-ofr] > .ofr-in::before {
    /* bottom -3px: reaches past the card's lower edge (clipped there by the card) so no sub-pixel sliver of photo
       shows along that edge */
    content: ""; position: absolute; left: 0; right: 0; top: -118px; bottom: -3px; z-index: -1; pointer-events: none;
    background: linear-gradient(180deg, rgba(7,11,19,0) 0, rgba(7,11,19,.034) 14px, rgba(7,11,19,.132) 28px,
      rgba(7,11,19,.278) 42px, rgba(7,11,19,.45) 56px, rgba(7,11,19,.622) 70px, rgba(7,11,19,.768) 84px,
      rgba(7,11,19,.866) 98px, rgba(7,11,19,.9) 112px, rgba(7,11,19,.9) calc(100% - 49px),
      rgba(7,11,19,.96) calc(100% - 19px), #070b13 calc(100% - 3px));
  }
  #why.rdy > .rdy-under > .ofr-scrim { background: #070b13 !important; }
}

/* ============================================================
   (2026-11-14) CLEAR OF THE BACK-TO-TOP BUTTON (phones and tablets, <= 900px). The floating back-to-top button sits in
   the screen's bottom-right corner (proto.css .dock: 18px from the bottom, 42px tall, so its top is 60px up), and v9.css
   ends the words only 5svh above the bottom (33-51px). Whenever the card's last row of buttons reached the right side, it
   lay under the button at rest: every card in Arabic (the rows start at the right), and the Learn More link of one or
   more cards in French, Spanish, Tagalog, Chinese, Punjabi and English, depending on the phone's width. The words now
   end at least 70px above the bottom (60px + 10px air), so the last row always clears the button: the whole block sits
   19-37px higher than before (more on shorter phones), nothing else changes.
   ============================================================ */
@media (max-width: 900px) {
  section.ofr[data-ofr] > .ofr-in { padding-bottom: max(5svh, 70px); }
}
