/* SPOT Solution gallery (Jen, Nov 28): instead of one phone with a tab pill, the flows are spread
   across a grid of tiles, after roydenso.com/phia. A mix of three kinds of tile:
     phone videos   .sg-dark / .sg-yellow, the prototype clips playing in a drawn iPhone
     UI pieces      .sg-ui, single components cut from the real screens, floating on light grey
     still shots    .sg-photo, a phone over a New York street photo
   Rows: 7/5 split, then three across, then one wide tile. Everything stays inside the column.
   The drawn iPhone itself (.ip, .ip-bezel, .ip-screen, .ip-status, .ip-island, .ip-btn) is in
   spot-proto.css. spot-gallery.js adds the status bar, island and buttons, reveals tiles on
   scroll and plays each video only while it is on screen. */

.sg { --ease: cubic-bezier(.2, .8, .2, 1); margin-top: 56px; display: grid; gap: 44px 16px; }
.sg-row { display: grid; gap: 16px; }
.sg-r1 { grid-template-columns: 7fr 5fr; }
.sg-r2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sg-item { margin: 0; min-width: 0; }

.sg-tile {
  position: relative; overflow: hidden; isolation: isolate; container-type: inline-size;
  border-radius: 12px; display: grid; place-items: center;
}
/* equal heights in the 7/5 row: height = 6.75 parts of (row - gap) / 12 */
.sg-r1 .sg-item:first-child .sg-tile { aspect-ratio: 7 / 6.75; }
.sg-r1 .sg-item:last-child .sg-tile { aspect-ratio: 5 / 6.75; }
.sg-r2 .sg-tile { aspect-ratio: 7 / 9; }
.sg-wide .sg-tile { aspect-ratio: 15 / 8; }

/* tile grounds */
.sg-dark { background: radial-gradient(80% 70% at 50% 18%, #26262a 0%, #0c0c0d 62%, #080809 100%); }
.sg-light { background: rgb(245, 245, 247); }
:root[data-theme="dark"] .sg-light { background: rgb(26, 26, 28); }
.sg-yellow {
  background:
    radial-gradient(70% 60% at 18% 8%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%),
    radial-gradient(60% 70% at 92% 100%, rgba(240, 186, 0, .55), rgba(240, 186, 0, 0) 70%),
    linear-gradient(165deg, #fff5a1 0%, #ffe800 46%, #ffd400 100%);
}
.sg-photo { background: #1a1a1a; }
.sg-bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-r2 .sg-photo .sg-bg { object-position: 58% 50%; }
.sg-wide .sg-bg { object-position: 50% 62%; }
/* a soft pool of shade under the phone so it sits on the photo instead of floating */
.sg-photo::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(42% 52% at 50% 56%, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0) 72%);
}

/* the phones: sized off the tile, neutral shadow (the yellow stage keeps its warm one) */
.sg .ip {
  --w: 40cqw;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    inset 0 calc(var(--w) * .004) calc(var(--w) * .006) rgba(255, 255, 255, .22),
    0 calc(var(--w) * .12) calc(var(--w) * .22) rgba(0, 0, 0, .38),
    0 calc(var(--w) * .02) calc(var(--w) * .05) rgba(0, 0, 0, .3);
}
.sg-r2 .ip { --w: 49cqw; }
.sg-wide .ip { --w: 21.5cqw; }
.sg-yellow .ip {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    inset 0 calc(var(--w) * .004) calc(var(--w) * .006) rgba(255, 255, 255, .22),
    0 calc(var(--w) * .1) calc(var(--w) * .2) rgba(92, 70, 0, .32),
    0 calc(var(--w) * .02) calc(var(--w) * .04) rgba(60, 46, 0, .25);
}
.sg .ip-screen > video, .sg .ip-screen > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.sg .ip[data-dark] .ip-status { color: #fff; }
.sg .ip-status { transition: color .3s var(--ease); }

/* UI pieces: cut from the real screens, shown as white cards */
.sg-card {
  position: absolute; display: block; height: auto;
  border-radius: 14px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 18px 40px rgba(0, 0, 0, .10), 0 3px 10px rgba(0, 0, 0, .06);
}
:root[data-theme="dark"] .sg-card { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 18px 40px rgba(0, 0, 0, .5); }
/* next-step pieces are cut tight to the component's own rounded edge (transparent corners), so no
   second white card or ring around them: the shadow follows the image's own shape instead */
.sg-ui-next .sg-card, .sg-ui-lang .sg-card { background: none; border-radius: 0; box-shadow: none; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .09)) drop-shadow(0 2px 5px rgba(0, 0, 0, .06)); }
:root[data-theme="dark"] .sg-ui-next .sg-card, :root[data-theme="dark"] .sg-ui-lang .sg-card { box-shadow: none; filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .5)); }
/* stacked with a small gap, not overlapping, so the checklist never covers the languages line.
   Card heights at 74cqw: ~50cqw each, the tile is 135cqw tall, so the pair sits centred */
.sg-ui-next .c1 { width: 74cqw; left: 7cqw; top: 15cqw; }
.sg-ui-next .c2 { width: 74cqw; right: 7cqw; top: 70cqw; }
.sg-ui-lang .c1, .sg-ui-lang .c2 { width: 80cqw; left: 10cqw; }
.sg-ui-lang .c1 { bottom: 59cqw; }
.sg-ui-lang .c2 { bottom: 11cqw; }

/* the hello globe above the language list (Jen, Nov 29): the app picker's sphere of hellos.
   spot-gallery.js places each word; depth is only size, opacity and blur */
.sg-hello { position: absolute; left: 0; right: 0; top: 4%; height: 36%; pointer-events: none; }
.sg-hello span {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font: 400 clamp(15px, 7.6cqw, 28px)/1.3 "DM Sans", sans-serif; color: var(--head);
  will-change: transform, opacity, filter;
}
.sg-hello span.lat { letter-spacing: -.02em; }
.sg-hello span[lang="bn"] { font-family: "Noto Sans Bengali", "Nirmala UI", "Vrinda", sans-serif; }
.sg-hello span[lang="ar"] { font-family: "Noto Sans Arabic", "Segoe UI", "Tahoma", sans-serif; }

/* the language list as live UI (Jen, Nov 29): rebuilt from the app's picker (Inter, white card, thin row
   lines, grey English names) so a tap can move between the languages and select each one, on a loop.
   Sized in cqw off the tile so it matches the old cut-out (707 x 393) exactly. spot-gallery.js runs the taps. */
.sg-ui-lang .sg-langlist {
  background: #fff; border-radius: 3cqw; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
  font-family: Inter, -apple-system, "SF Pro Text", system-ui, sans-serif; color: #111;
}
:root[data-theme="dark"] .sg-ui-lang .sg-langlist { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
.ll-row { display: flex; align-items: center; height: 11.1cqw; padding: 0 3.6cqw 0 3.4cqw; border-top: 1px solid #ededed; transition: background-color .35s var(--ease); }
.ll-row:first-child { border-top: 0; }
.ll-row b { font-weight: 500; font-size: 3.7cqw; line-height: 1; letter-spacing: -.01em; }
.ll-row b[lang="bn"] { font-family: "Noto Sans Bengali", "Nirmala UI", "Vrinda", sans-serif; }
.ll-row small { margin-left: auto; font-size: 2.75cqw; line-height: 1; color: #8c8c8c; }
.ll-rd { position: relative; flex: none; width: 4.5cqw; height: 4.5cqw; margin-right: 4.2cqw; border-radius: 50%; box-shadow: inset 0 0 0 .22cqw #d6d6d6; transition: box-shadow .3s var(--ease); }
.ll-rd::after { content: ""; position: absolute; inset: 1.1cqw; border-radius: 50%; background: #111; transform: scale(0); transition: transform .32s cubic-bezier(.3, 1.5, .5, 1); }
.ll-row.sel { background: #fafafa; }
.ll-row.sel .ll-rd { box-shadow: inset 0 0 0 .3cqw #111; }
.ll-row.sel .ll-rd::after { transform: scale(1); }
/* the finger: a soft touch dot, like a screen recording with touches shown */
.sg-tap {
  position: absolute; left: 0; top: 0; z-index: 5; width: 6.4cqw; height: 6.4cqw; margin: -3.2cqw 0 0 -3.2cqw;
  border-radius: 50%; background: rgba(17, 17, 17, .16); box-shadow: 0 0 0 .3cqw rgba(255, 255, 255, .7), 0 .6cqw 1.6cqw rgba(0, 0, 0, .12);
  opacity: 0; pointer-events: none; will-change: transform, opacity;
}
.sg-tap::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: .3cqw solid rgba(17, 17, 17, .25); opacity: 0; }
.sg-tap.ping::after { animation: sg-ping .55s ease-out; }
@keyframes sg-ping { 0% { opacity: 1; transform: scale(.8); } 100% { opacity: 0; transform: scale(2.1); } }
.sg-hello span.on { font-weight: 500; }

/* captions use the page's .cap. Only some tiles have one (Jen, Nov 29); a small credit line for the photos */
.sg .cap { margin-top: 12px; }
.sg-credit { display: block; font-size: 12px; opacity: .75; }
.sg .cap.sg-credit-only { margin-top: 8px; }

/* reveal on scroll: tiles rise and unblur, UI cards follow a beat later */
.sg-item .sg-tile, .sg-item .cap { opacity: 0; transform: translateY(28px); filter: blur(8px); transition: opacity .9s var(--ease), transform 1.1s var(--ease), filter .9s var(--ease); }
.sg-item .cap { transition-delay: .12s; }
.sg-item.in .sg-tile, .sg-item.in .cap { opacity: 1; transform: none; filter: none; }
.sg-card { opacity: 0; transform: translateY(26px) scale(.98); transition: opacity .8s var(--ease) .25s, transform 1s var(--ease) .25s; }
.sg-ui-next .c2, .sg-ui-lang .c2 { transition-delay: .45s; }
.sg-item.in .sg-card { opacity: 1; transform: none; }
.sg-tilt { transform: rotate(-5deg) translateY(12px); transition: transform 1.2s var(--ease) .2s; }
.sg-item.in .sg-tilt { transform: rotate(-3deg); }

@media (max-width: 760px) {
  .sg { gap: 36px; margin-top: 40px; }
  .sg-r1, .sg-r2 { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .sg-r1 .sg-item:first-child .sg-tile, .sg-r1 .sg-item:last-child .sg-tile, .sg-r2 .sg-tile { aspect-ratio: 4 / 5; }
  .sg-wide .sg-tile { aspect-ratio: 4 / 5; }
  .sg .ip, .sg-r2 .ip, .sg-wide .ip { --w: 46cqw; }
  .sg-ui-next .c1, .sg-ui-next .c2 { width: 78cqw; }
  .sg-ui-next .c1 { left: 6cqw; top: 8cqw; }
  .sg-ui-next .c2 { right: 6cqw; top: 65cqw; }
}
@media (prefers-reduced-motion: reduce) {
  .sg-item .sg-tile, .sg-item .cap, .sg-card, .sg-tilt { transition: none !important; opacity: 1; transform: none; filter: none; }
  .sg-tilt { transform: rotate(-3deg); }
}
