/* JB Authentic 2.0: the JB diamond (plan 19.1), loaded only while it is on (includes/diamond/page.php): the hint,
 * the reveal, the transmission screen, the buttons and the reveal without live 3D. From prototypes/jb-diamond/. */
:root { --jbd-ease: cubic-bezier(.22,.8,.24,1); }

/* the tap target over the header logo (the logo itself is just a picture) */
.jbd-hit { position: absolute; z-index: 5; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent; border-radius: 12px; }
.jbd-hit:focus-visible { outline: 2px solid rgba(255,255,255,.7); outline-offset: 3px; }

/* the fallback loop and the light sweep sit exactly over the header logo */
.jbd-loop, .jbd-sweep { position: absolute; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .25s linear; }
.jbd-loop { background-repeat: no-repeat; }
.jbd-loop.is-on { opacity: 1; }
.jbd-sweep { -webkit-mask: var(--jbd-mask) center / 100% 100% no-repeat; mask: var(--jbd-mask) center / 100% 100% no-repeat;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.85) 48%, rgba(190,240,255,.55) 52%, transparent 65%) -150% 0 / 300% 100% no-repeat; }
.jbd-sweep.is-sweeping { opacity: 1; animation: jbd-sweep 1s var(--jbd-ease) forwards; }
@keyframes jbd-sweep { to { background-position: 150% 0; } }

/* the hint's words, on the first visits only (round 5): placed round the diamond's bottom point (the box is that
 * point). A: "TAP ME" beside it. B: "TAP" left of it, "THE" right of it, "JB DIAMOND" centred below. Each word
 * draws in towards the diamond (wide, soft letters closing up and sharpening), one after another, then glows once. */
.jbd-cue { position: absolute; z-index: 4; width: 0; height: 0; pointer-events: none; transition: opacity .6s ease;
  font: 700 11px/1 Jura, system-ui, sans-serif; letter-spacing: .24em; text-transform: uppercase;
  color: #fff; text-shadow: 0 0 6px rgba(160,120,255,.95), 0 0 16px rgba(110,220,255,.6), 0 1px 2px rgba(0,0,0,.8); }
.jbd-cue .w { position: absolute; white-space: nowrap; opacity: 0; }
.jbd-cue .w-l { right: 11px; top: -7px; margin-right: -.24em; }       /* level with the point; its last letter's spacing doesn't count */
.jbd-cue .w-r { left: 11px; top: -7px; }
.jbd-cue .w-b { left: 0; top: 10px; transform: translateX(-50%); padding-left: .24em; }   /* centred below the point */
.jbd-cue.is-on .w { animation: jbd-word .95s var(--jbd-ease) both, jbd-word-glow 1.5s ease-in-out 1.1s both; }
.jbd-cue.hint-b.is-on .w-r { animation-delay: .15s, 1.25s; }       /* round 6: "TAP THE" while it spins... */
.jbd-cue.hint-b.is-on .w-b { animation-delay: .95s, 2.05s; }      /* ...and "JB DIAMOND" as it lands (the spin: 1.3 s) */
.jbd-cue.is-off { opacity: 0; }
@keyframes jbd-word { 0% { opacity: 0; letter-spacing: .95em; filter: blur(5px); } 55% { opacity: 1; } 100% { opacity: 1; letter-spacing: .24em; filter: blur(0); } }
@keyframes jbd-word-glow { 0%, 100% { text-shadow: 0 0 6px rgba(160,120,255,.95), 0 0 16px rgba(110,220,255,.6), 0 1px 2px rgba(0,0,0,.8); }
  45% { text-shadow: 0 0 7px rgba(190,160,255,1), 0 0 22px rgba(120,235,255,.95), 0 1px 2px rgba(0,0,0,.8); } }
@media (prefers-reduced-motion: reduce) { .jbd-cue.is-on .w { animation: jbd-fade .6s ease both; } }
@keyframes jbd-fade { from { opacity: 0; } to { opacity: 1; } }

/* round 5: the orbs' badges hide as soon as the diamond is tapped (the orbs become moons); after closing they are
 * as the page has them */
html.jbd-revealing .bubble-badge { opacity: 0 !important; transition: none !important; }
/* November 10: and once the orbs are back in place, the badges and the orbs' news (the Diamond Dust rising from the
 * gems orb, the Messages spark) come back softly: they appeared all at once. Later that day: the gem's highlight is no
 * longer among them, it travels with its orb and lands with it; and the Diamond Dust starts again from nothing, a speck
 * at a time (jb-orbs-new.js), under this fade. */
html.jbd-returning .bubble-badge { transition: opacity .8s ease !important; }   /* (a transition: a count's own pop animation is left alone) */
html.jbd-returning .jbo-news { animation: jbd-back .8s ease both; }
@keyframes jbd-back { from { opacity: 0; } }

/* the reveal: nothing here takes a tap unless it is showing (so the page works again after closing). November 10: the
   backdrop takes taps for as long as it shows, the half second of its fade too (hidden after, it takes none). Without
   live 3D it starts fading as the close button is tapped, and that tap's own click, sent after the finger lifts, went
   through it to the page beneath (on the unfolded Duo, onto the Care button). */
/* November 12 (Jason): solid black. It was nearly black (round 6), and a little of the page's video showed through and
   moved. Nothing of the page shows now, so the blur behind it is gone, and once it has faded in the page behind it is
   held as it is behind Messages (html.jbd-dark, jb-diamond.js). */
.jbd-backdrop { position: fixed; inset: 0; z-index: 1000; background: #000; overflow: hidden;
  opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s linear .5s; }
/* A faint starfield, drifting slowly up, so it feels like space (Jason, November 12): the stars behind Messages
   (jb-messages.css: the same five points on a 220 px tile, the same speed, 220 px in 30 s), here at full strength so
   they can be noticed on plain black (his pick of four levels), and still faint enough that the diamond stands out:
   each is a point about a pixel across. Measured in Safari: about 2 of the window's 23. Moved the cheap way: a
   ready-made picture one tile taller than the screen that slides (a transform), so nothing is painted again while it
   drifts. It drifts only while the black shows, and goes on from where it was. On iPhone and iPad it moves in whole
   screen pixels, so each star stays as crisp as it is drawn (as the Transmissions' scan lines do). With Reduce Motion
   the stars stand still. */
.jbd-backdrop::after { content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: -220px; pointer-events: none;
  background-image: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 80%, #fffc, transparent),
    radial-gradient(1.5px 1.5px at 40% 60%, #b9a6ff, transparent), radial-gradient(1px 1px at 85% 20%, #8fe9ff, transparent),
    radial-gradient(1px 1px at 10% 85%, #fffa, transparent); background-size: 220px 220px;
  animation: jbd-stars 30s linear infinite; will-change: transform; }
@keyframes jbd-stars { to { transform: translate3d(0, -220px, 0); } }
.jbd-backdrop:not(.is-on)::after { animation-play-state: paused; }
@supports (-webkit-touch-callout: none) {   /* Safari's engine on an iPhone or iPad (every browser there) */
  @media (-webkit-device-pixel-ratio: 3) { .jbd-backdrop::after { animation-timing-function: steps(660); } }
  @media (-webkit-device-pixel-ratio: 2) { .jbd-backdrop::after { animation-timing-function: steps(440); } }
}
@media (prefers-reduced-motion: reduce) { .jbd-backdrop::after { animation: none; } }
.jbd-backdrop.is-on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .5s ease; }
canvas.jbd-full { position: fixed !important; left: var(--jbd-l, 0px) !important; top: var(--jbd-t, 0px) !important; z-index: 1001 !important; opacity: 1 !important; transition: none !important; }   /* (--jbd-l, --jbd-t: the landing canvas's place, the last stretch of the close) */
.jbd-layer { position: fixed; inset: 0; z-index: 1002; pointer-events: none; visibility: hidden; }
.jbd-layer.is-on { visibility: visible; }
.jbd-layer > * { position: absolute; left: 0; top: 0; }
.jbd-layer .jbd-img2d { z-index: 2; will-change: transform, opacity; opacity: 0; }
.jbd-layer .jbd-img2d.jbd-stay { visibility: visible; }   /* the flown logo, a moment after the reveal's layer is put away: until the turning logo has faded in under it */

/* the transmission: the screen and the text float together inside the diamond */
.jbd-float { z-index: 3; transform: translate(-50%, -50%); pointer-events: none; }
.jbd-float.is-3d { opacity: 0; }                                 /* live 3D draws it in the scene; this stays for screen readers */
.jbd-screen { position: absolute; inset: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); opacity: 0; transition: opacity .45s ease;
  /* a dark glass screen lit from its edges (round 4): the light glows in from the rim and fades towards the middle */
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%2326d9ff'/><stop offset='1' stop-color='%238a4dff'/></linearGradient><filter id='b' x='-20%25' y='-20%25' width='140%25' height='140%25'><feGaussianBlur stdDeviation='4.5'/></filter></defs><polygon points='50,1 99,50 50,99 1,50' fill='none' stroke='url(%23g)' stroke-width='9' filter='url(%23b)' opacity='.75'/><polygon points='50,2 98,50 50,98 2,50' fill='none' stroke='url(%23g)' stroke-width='.9' opacity='.8'/></svg>") center / 100% 100% no-repeat,
              linear-gradient(135deg, transparent 44%, rgba(140,160,255,.05) 50%, transparent 56%),
              rgba(3,2,9,.93); }
/* a little live static over it (never over the text, which is above the screen) */
.jbd-screen::after { content: ""; position: absolute; inset: 0; opacity: .1; mix-blend-mode: screen; animation: jbd-static .5s steps(4) infinite;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .7  0 0 0 0 .8  0 0 0 0 1  0 0 0 1.3 -.2'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>") 0 0 / 120px 120px; }
@keyframes jbd-static { 0% { background-position: 0 0; } 25% { background-position: -37px 21px; } 50% { background-position: 53px -46px; } 75% { background-position: -18px -71px; } 100% { background-position: 0 0; } }
.jbd-float.is-on .jbd-screen { opacity: 1; }
.jbd-float.is-away { visibility: hidden; }                       /* round 6: while the frame is the logo (Refresh A, without live 3D) */
.tx-a .jbd-screen::before { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(120,190,255,.09) 0 1px, transparent 1px 3.2px); animation: jbd-drift 9s linear infinite; }
@keyframes jbd-drift { to { background-position: 0 64px; } }
/* The screen's static and its drifting lines run only while the screen can be seen (November 11, the warm iPhone Duo
   check). They ran from the moment the page loaded, on a layer that is hidden until the diamond is tapped, and under
   the live 3D scene, which draws its own screen (this one is then never shown). Held, not stopped: they go on from
   where they were, so the open window looks as it always has. */
.jbd-layer:not(.is-on) .jbd-screen::before, .jbd-layer:not(.is-on) .jbd-screen::after,
.jbd-float.is-3d .jbd-screen::before, .jbd-float.is-3d .jbd-screen::after { animation-play-state: paused; }
.jbd-beam { position: absolute; left: 0; right: 0; height: 2px; top: -4px; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(110,240,255,.9), transparent); box-shadow: 0 0 14px 3px rgba(110,240,255,.45); }
.tx-a .jbd-screen.is-decoding .jbd-beam { animation: jbd-beam .72s ease-out forwards; }
@keyframes jbd-beam { 0% { top: -4px; opacity: 1; } 85% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

.jbd-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; overflow: hidden; text-align: center; color: #fff;
  font: 600 17px/1.3 Jura, system-ui, sans-serif; letter-spacing: .01em; text-shadow: 0 0 3px rgba(140,225,255,.5), 0 0 12px rgba(120,80,255,.5), 0 1px 2px rgba(0,0,0,.7); }   /* round 5: a faint glow, set in the screen's light */
.jbd-msg.is-limit { color: rgba(225,215,255,.92); font-weight: 500; }
.jbd-msg.jbd-twin { visibility: hidden; pointer-events: none; }      /* round 5: where the next message is laid out ahead */
.jbd-msg .jbd-l, .jbd-msg .jbd-r { width: 50%; height: 100%; shape-margin: 3px; }
.jbd-msg .jbd-l { float: left; shape-outside: polygon(0 0, 100% 0, 0 50%, 100% 100%, 0 100%); }
.jbd-msg .jbd-r { float: right; shape-outside: polygon(0 0, 100% 0, 100% 100%, 0 100%, 100% 50%); }
.jbd-msg .jbd-pad { display: block; }
/* the words lock in one by one: a flicker with a colour split, then steady */
.jbd-msg .jbd-w { opacity: 0; white-space: nowrap; }   /* a word is never split, not even at a hyphen (the 3D screen draws each word in one piece) */
.jbd-msg .is-in { animation: jbd-lock .34s linear both; }
.jbd-msg .is-now { animation: none; opacity: 1; }
.jbd-msg.is-out .jbd-w { animation: jbd-out .3s ease both; }   /* November 10: the words leave, the lit screen stays (the notice at the day's end) */
@keyframes jbd-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes jbd-lock {   /* a quick flicker into place: opacity and position only, nothing the phone must repaint */
  0% { opacity: 0; transform: translateY(2px); } 25% { opacity: .9; } 40% { opacity: .2; } 55% { opacity: 1; } 70% { opacity: .55; }
  100% { opacity: 1; transform: none; }
}
/* measured while laid out: never transitioned (the site's Reduce Motion rule gives every element a .01 ms transition) */
.ui-v15 .jbd-float, .ui-v15 .jbd-msg, .ui-v15 .jbd-msg * { transition: none !important; }   /* the font size is inherited: the words too */
@media (prefers-reduced-motion: reduce) { .jbd-msg .is-in { animation: none; opacity: 1; } .jbd-screen::before, .jbd-screen::after { animation: none !important; } }

/* Refresh, Copy and Close: clear glass circles like the title pills (round 5: our own, no class of the site's, so
 * nothing of its glass paints over them): a smoky core only in the middle, a light blur, a thin prism rim (an SVG
 * ring: it can only ever paint the edge) and the orbs' neon green icons. Labels for screen readers. */
.jbd-layer .jbd-cbtn { z-index: 5; display: grid; place-items: center; padding: 0; margin: 0; border: 0; border-radius: 50%; cursor: pointer;
  color: #34ff82; font: inherit; background: radial-gradient(closest-side, rgb(7 9 15 / .3), rgb(7 9 15 / .06));
  -webkit-backdrop-filter: blur(2.5px) saturate(1.2) brightness(.8); backdrop-filter: blur(2.5px) saturate(1.2) brightness(.8);
  box-shadow: inset 0 .5px 0 rgb(255 255 255 / .26), 0 6px 18px -10px rgb(0 0 0 / .55);
  transform: translate(-50%, -50%) scale(.92); opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s var(--jbd-ease);
  will-change: opacity, transform;   /* their layers are made ahead, not in the frame they appear */
  -webkit-tap-highlight-color: transparent; }
.jbd-layer .jbd-cbtn.is-on { opacity: 1; transform: translate(-50%, -50%); pointer-events: auto; }
.jbd-layer .jbd-cbtn::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; }   /* round 5: a slightly missed tap still counts (and doesn't close the reveal) */
.jbd-layer .jbd-cbtn:active { transform: translate(-50%, -50%) scale(.94); }
.jbd-cbtn .jbd-rim { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.jbd-rim circle { fill: none; stroke-width: .75; }
.jbd-rim .holo { stroke: url(#jbdRimHolo); opacity: .78; }
.jbd-rim .glint { stroke: url(#jbdRimGlint); }
.jbd-cbtn .jbd-ico { display: grid; place-items: center; width: 40%; aspect-ratio: 1; }   /* 20 px in a 50 px button; larger buttons, larger icons */
.jbd-cbtn .jbd-ico svg { width: 100%; height: 100%; filter: drop-shadow(0 0 3px rgba(52,255,130,.6)) drop-shadow(0 0 8px rgba(52,255,130,.25)); }
/* the charge ring round Refresh: a segment for each refresh left today */
.jbd-cbtn .jbd-charge { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); overflow: visible; pointer-events: none; }
.jbd-charge path { fill: none; stroke: rgba(52,255,130,.14); stroke-width: 2.2; stroke-linecap: round; transition: stroke .5s ease, filter .5s ease; }
.jbd-charge path.on { stroke: #34ff82; filter: drop-shadow(0 0 3px rgba(52,255,130,.85)); }
/* recharging (round 4): the ring is empty, and a slow, faint energy runs round it */
.jbd-charge .flow { fill: none; stroke: #34ff82; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 9 91; opacity: 0;
  transform-origin: 30px 30px; transform: rotate(-90deg); filter: drop-shadow(0 0 3px rgba(52,255,130,.8)); }
.is-recharging .jbd-charge .flow { animation: jbd-flow 5.5s linear infinite, jbd-breathe 2.75s ease-in-out infinite alternate; }
@keyframes jbd-flow { to { stroke-dashoffset: -100; } }
@keyframes jbd-breathe { from { opacity: .18; } to { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .is-recharging .jbd-charge .flow { animation: none; opacity: .35; } }
.jbd-cbtn.is-done { color: #b6ffd0; }
.jbd-cbtn:focus-visible { outline: 2px solid rgba(255,255,255,.85); outline-offset: 3px; }
.jbd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the moons without live 3D: the orb's still fades into a plain glass moon as it grows */
.jbd-layer .jbd-moon2d { z-index: 1; opacity: 0; will-change: transform; }
.jbd-moon2d img, .jbd-moon2d i { position: absolute; inset: 0; width: 100%; height: 100%; }
.jbd-moon2d i { inset: 21%; width: auto; height: auto; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.85) 0 6%, rgba(200,180,255,.35) 16%, rgba(106,44,255,.35) 45%, rgba(40,10,90,.75) 78%, rgba(161,44,255,.6) 100%);
  box-shadow: 0 0 14px 2px rgba(150,110,255,.45), inset 0 0 6px rgba(255,255,255,.25); }

/* The wardrobe's wide tray opens under the diamond's tip (November 10). The diamond is taller than the orbs beside it
   (its tip reaches 14.5 px below them), and the tray's top edge cut across it. The narrow tray (four pieces or
   fewer) hangs under the closet orb alone and stays where it is. */
.hanger-tray:is(.grid, .grid-compact){ margin-top: 20px; }
