/* TapBell page — cinematic doorbell scene (loaded only by home/tapbell.php).
   The plaque close-up in front of the house photo (blurred), a slow push-in, a scan glow on the plaque's QR,
   the phone that rings it, sound rings from the plaque and the owner's alert. */

.tb-grain { position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: tbGrain 1.2s steps(6) infinite; }
@keyframes tbGrain { 0%{transform:translate(0,0)} 25%{transform:translate(-3%,2%)} 50%{transform:translate(2%,-3%)} 75%{transform:translate(-2%,3%)} 100%{transform:translate(0,0)} }

.tb-scene { position: relative; aspect-ratio: 16 / 9; border-radius: 34px; overflow: hidden; container-type: inline-size; isolation: isolate; background: #2a1d17;
  box-shadow: 0 40px 100px -40px rgba(28,25,23,.55), 0 0 0 1px rgba(28,25,23,.08); }

/* the house behind, out of focus, drifting slowly */
.tb-back { position: absolute; inset: -6%; background-size: cover; background-position: 70% 40%; filter: blur(10px) brightness(.62) saturate(1.1); animation: tbDrift 22s ease-in-out infinite alternate; }
@keyframes tbDrift { from { transform: scale(1.04) translateX(0); } to { transform: scale(1.12) translateX(-2%); } }
.tb-warm { position: absolute; inset: 0; background: radial-gradient(60% 80% at 30% 50%, rgba(255,190,120,.22), transparent 70%), linear-gradient(90deg, rgba(20,12,8,.35), transparent 45%, rgba(20,12,8,.45)); }

/* the plaque close-up keeps its own shape so the glow stays on its QR */
.tb-stage { position: absolute; left: 30%; top: 50%; translate: -50% -50%; height: 104%; aspect-ratio: 864 / 1211; transition: transform 1s cubic-bezier(.16,1,.3,1); will-change: transform; }
.tb-photo-wrap { position: absolute; inset: 0; border-radius: 1.4cqw; overflow: hidden; box-shadow: 0 3cqw 6cqw -2cqw rgba(0,0,0,.75); }
.tb-photo { width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 55%; animation: tbPush 16s ease-in-out infinite alternate; display: block; }
@keyframes tbPush { from { transform: scale(1); } to { transform: scale(1.06); } }
.tb-shine { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(110deg, transparent 35%, rgba(255,240,215,.22) 45%, transparent 56%) -90% 0 / 240% 100% no-repeat; animation: tbShine 8s ease-in-out infinite; }
@keyframes tbShine { 0%, 15% { background-position: -90% 0; } 65%, 100% { background-position: 190% 0; } }
.tb-qr-hit { position: absolute; left: 24%; top: 37.5%; width: 48.5%; height: 38.5%; border-radius: .8cqw; transform-origin: 52% 15%; animation: tbPush 16s ease-in-out infinite alternate; overflow: hidden;
  box-shadow: 0 0 0 .25cqw rgba(16,185,129,0); transition: box-shadow .5s; }
.tb-scene.is-scanning .tb-qr-hit { box-shadow: 0 0 0 .25cqw rgba(251,146,60,.95), 0 0 4cqw rgba(251,146,60,.6); }
.tb-scene.is-alerted .tb-qr-hit { box-shadow: 0 0 0 .2cqw rgba(16,185,129,.9), 0 0 3cqw rgba(16,185,129,.45); }
.tb-qr-line { position: absolute; left: 0; right: 0; top: -10%; height: 10%; background: linear-gradient(transparent, rgba(251,146,60,.7), transparent); opacity: 0; }
.tb-scene.is-scanning .tb-qr-line { animation: tbLine 1.2s ease-in-out 2; }
@keyframes tbLine { 0% { top: -10%; opacity: 1; } 100% { top: 100%; opacity: 1; } }

/* sound rings from the plaque when it rings */
.tb-rings { position: absolute; left: 80%; top: 55%; width: 0; height: 0; }
.tb-rings span { position: absolute; left: 0; top: 0; width: 8cqw; height: 8cqw; margin: -4cqw 0 0 -4cqw; border-radius: 50%; border: .25cqw solid rgba(255,214,150,.9); opacity: 0; }
.tb-scene.is-alerted .tb-rings span { animation: tbRing 1.6s cubic-bezier(.16,1,.3,1) 3; }
.tb-scene.is-alerted .tb-rings span:nth-child(2) { animation-delay: .35s; }
.tb-scene.is-alerted .tb-rings span:nth-child(3) { animation-delay: .7s; }
@keyframes tbRing { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

/* the visitor's phone */
.tb-phone { position: absolute; z-index: 6; right: 12%; top: 50%; translate: 0 -46%; width: 17cqw; aspect-ratio: 9 / 18.5; border-radius: 2.6cqw; padding: .55cqw; background: #0b0a09; rotate: 5deg;
  box-shadow: 0 3cqw 6cqw -2cqw rgba(0,0,0,.85), 0 0 0 .1cqw rgba(255,255,255,.14) inset; transition: transform .9s cubic-bezier(.16,1,.3,1); }
.tb-scene.is-alerted .tb-phone { animation: tbBuzz .5s linear 2 .2s; }
@keyframes tbBuzz { 0%, 100% { margin-left: 0; } 25% { margin-left: -.3cqw; } 75% { margin-left: .3cqw; } }
.tb-screen { position: relative; height: 100%; border-radius: 2.1cqw; overflow: hidden; background: radial-gradient(120% 80% at 50% 30%, #3e352f, #16120f); }
.tb-view { position: absolute; inset: 0; transition: opacity .45s, translate .45s cubic-bezier(.16,1,.3,1); }
.tb-cam { display: grid; place-items: center; }
.tb-frame { position: relative; width: 58%; aspect-ratio: 1; }
.tb-frame span { position: absolute; width: 24%; height: 24%; border: .32cqw solid #fff; }
.tb-frame span:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: .6cqw 0 0 0; }
.tb-frame span:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 .6cqw 0 0; }
.tb-frame span:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 .6cqw; }
.tb-frame span:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 .6cqw 0; }
.tb-scene.is-scanning .tb-frame span { border-color: #fb923c; transition: border-color .3s; }
.tb-cam-label { position: absolute; left: 0; right: 0; bottom: 22%; text-align: center; color: rgba(255,255,255,.85); font-size: .9cqw; }
.tb-page { background: #fffaf3; color: #1c1917; padding: 1.4cqw 1.1cqw; display: grid; align-content: start; gap: .6cqw; opacity: 0; translate: 0 2cqw; }
.tb-page small { font-size: .8cqw; color: #78716c; }
.tb-page b { font-size: 1.2cqw; line-height: 1.2; }
.tb-opt { display: flex; align-items: center; gap: .6cqw; padding: .7cqw .8cqw; border-radius: .9cqw; background: #fff; box-shadow: inset 0 0 0 .1cqw #eadfd2; font-size: .9cqw; font-weight: 600; transition: background .3s, color .3s, box-shadow .3s; }
.tb-opt i { width: 1.2cqw; text-align: center; color: #b45309; }
.tb-scene.is-alerted .tb-opt.is-pick { background: #ea580c; color: #fff; box-shadow: none; }
.tb-scene.is-alerted .tb-opt.is-pick i { color: #fff; }
.tb-sent { margin-top: .3cqw; text-align: center; font-size: .8cqw; color: #15803d; font-weight: 700; opacity: 0; transition: opacity .4s .3s; }
.tb-scene.is-alerted .tb-sent { opacity: 1; }
.tb-scene.is-alerted .tb-cam { opacity: 0; }
.tb-scene.is-alerted .tb-page { opacity: 1; translate: 0 0; }

/* the owner's alert */
.tb-notif { position: absolute; z-index: 7; right: 4%; top: 6%; display: flex; align-items: center; gap: 1cqw; padding: 1cqw 1.4cqw; border-radius: 1.6cqw;
  background: rgba(255,250,243,.95); backdrop-filter: blur(8px); color: #1c1917; font-size: 1.05cqw; line-height: 1.3; box-shadow: 0 1.4cqw 3cqw -1cqw rgba(0,0,0,.45);
  opacity: 0; translate: 0 -1.4cqw; transition: opacity .5s .9s, translate .6s cubic-bezier(.16,1,.3,1) .9s; }
.tb-notif i { display: grid; place-items: center; width: 2.6cqw; height: 2.6cqw; border-radius: .8cqw; background: #059669; color: #fff; font-size: 1.2cqw; }
.tb-notif b { display: block; font-size: 1.1cqw; }
.tb-notif small { color: #78716c; }
.tb-scene.is-alerted .tb-notif { opacity: 1; translate: 0 0; }
.tb-cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }

/* phones: a taller frame, the plaque big in the middle, the phone small at the foot */
@media (max-width: 700px) {
  .tb-scene { aspect-ratio: 4 / 5; border-radius: 24px; }
  .tb-stage { left: 44%; height: 100%; }
  .tb-rings span { width: 16cqw; height: 16cqw; margin: -8cqw 0 0 -8cqw; border-width: .5cqw; }
  .tb-phone { width: 25cqw; right: 3%; top: auto; bottom: -24%; translate: none; border-radius: 4cqw; padding: .9cqw; } .tb-screen { border-radius: 3.2cqw; }
  .tb-frame span { border-width: .6cqw; } .tb-cam-label { font-size: 1.7cqw; }
  .tb-page { padding: 2.2cqw 1.8cqw; gap: 1cqw; } .tb-page b { font-size: 2.1cqw; } .tb-page small { font-size: 1.5cqw; }
  .tb-opt { font-size: 1.7cqw; padding: 1.2cqw 1.3cqw; border-radius: 1.6cqw; gap: 1cqw; } .tb-opt i { width: 2.2cqw; } .tb-sent { font-size: 1.5cqw; }
  .tb-notif { right: 4%; left: auto; top: 4%; max-width: 62%; font-size: 2.4cqw; padding: 2.2cqw; border-radius: 3cqw; gap: 2cqw; }
  .tb-notif i { width: 6cqw; height: 6cqw; font-size: 2.8cqw; border-radius: 1.8cqw; } .tb-notif b { font-size: 2.6cqw; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-grain, .tb-back, .tb-photo, .tb-shine, .tb-qr-hit { animation: none !important; }
}
