/* Hydratica interactive Lock Screen
   Used on /how-much-water (and the homepage hero).
   Everything inside scales with the phone's width (cqw units), so the
   component can be dropped in at any size. */

.hls{
  --hls-clock:#c2ccb0; --hls-date:#edf8d8; --hls-chrome:#fff; --hls-widget:#fff;
  /* 93% leaves room for the iPhone frame (3.7% each side), so the framed phone
     takes the same space the bare screen used to */
  position:relative;width:93%;max-width:280px;margin:0 auto;aspect-ratio:9/19.5;
  container-type:inline-size;
  -webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;
}
.hls[data-theme="sage"]      {--hls-clock:#c2ccb0;--hls-date:#edf8d8}
.hls[data-theme="dusty-rose"]{--hls-clock:#f8c4c4;--hls-date:#fce8ea}
.hls[data-theme="ice-blue"]  {--hls-clock:#abdcfa;--hls-date:#dcf7ff}
.hls[data-theme="obsidian"]  {--hls-clock:#4f525b;--hls-date:#a7a9b6}
.hls[data-theme="platinum"]  {--hls-clock:#87858c;--hls-date:#fff;--hls-chrome:#3a354b}
.hls[data-theme="sand"]      {--hls-clock:#e0ceba;--hls-date:#fff6de}

/* iPhone frame: black bezel + thin metal edge (::before), side buttons (::after).
   Both sit around the screen, outside its box, so the screen layout is unchanged. */
.hls::before{
  content:'';position:absolute;inset:-2.6cqw;border-radius:18.3cqw;background:#0c0c0e;z-index:0;
  box-shadow:
    inset 0 0 0 .35cqw rgba(255,255,255,.07),
    0 0 0 .45cqw #4a4a4f,
    0 0 0 1.1cqw #a7a6ab,
    0 0 0 1.25cqw rgba(0,0,0,.35),
    0 30px 70px rgba(46,42,34,.26);
  pointer-events:none;
}
.hls::after{
  content:'';position:absolute;top:0;bottom:0;left:-4.6cqw;right:-4.6cqw;z-index:-1;pointer-events:none;
  background:
    linear-gradient(#8f8e93,#8f8e93) left 0 top 17.5% / 1.4cqw 6.4cqw no-repeat,   /* Action button */
    linear-gradient(#8f8e93,#8f8e93) left 0 top 25.5% / 1.4cqw 11cqw no-repeat,    /* volume up */
    linear-gradient(#8f8e93,#8f8e93) left 0 top 35% / 1.4cqw 11cqw no-repeat,      /* volume down */
    linear-gradient(#8f8e93,#8f8e93) right 0 top 29% / 1.4cqw 17cqw no-repeat;    /* side button */
}
.hls.is-glow::before{
  box-shadow:
    inset 0 0 0 .35cqw rgba(255,255,255,.07),
    0 0 0 .45cqw #4a4a4f,
    0 0 0 1.1cqw #a7a6ab,
    0 0 0 1.25cqw rgba(0,0,0,.35),
    0 0 60px rgba(255,255,255,.30),0 0 130px rgba(255,255,255,.20),0 20px 50px rgba(0,0,0,.35);
}

.hls-screen{
  position:absolute;inset:0;overflow:hidden;border-radius:15.7cqw;background:#9fa78f;z-index:1;
  font-family:-apple-system,BlinkMacSystemFont,'SF Pro Display','Helvetica Neue','Hanken Grotesk',system-ui,sans-serif;
  isolation:isolate;
}
.hls[data-theme="obsidian"] .hls-screen{background:#171c22}
/* Dynamic Island */
.hls-screen::after{content:'';position:absolute;top:2.8cqw;left:50%;width:32cqw;height:9.4cqw;margin-left:-16cqw;border-radius:4.7cqw;background:#000;z-index:4;pointer-events:none}

.hls-wall{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;opacity:0;transition:opacity .45s ease;pointer-events:none}
.hls-wall.is-on{opacity:1}

/* status bar: signal · wifi · battery, as in the real screenshots */
.hls-status{position:absolute;top:5.7cqw;right:8cqw;display:flex;align-items:center;gap:1.6cqw;color:var(--hls-chrome);z-index:2}
.hls-status svg{display:block;height:3.5cqw;width:auto;fill:currentColor}
.hls-status .hls-batt{height:3.9cqw}

.hls-date{position:absolute;left:0;right:0;top:19.6cqw;text-align:center;font-size:6.5cqw;font-weight:600;letter-spacing:-.01em;line-height:1;color:var(--hls-date);z-index:2}
.hls-clock{position:absolute;left:0;right:0;top:27.2cqw;text-align:center;font-size:30cqw;font-weight:700;letter-spacing:-.035em;line-height:1;color:var(--hls-clock);font-variant-numeric:tabular-nums;z-index:2}

.hls-home{position:absolute;left:50%;bottom:2.4cqw;width:35.6cqw;height:1.25cqw;margin-left:-17.8cqw;border-radius:1cqw;background:var(--hls-chrome);z-index:2}

/* the glass widget — the only interactive thing on the screen */
.hls-glass{
  position:absolute;left:50%;top:81.6%;width:19cqw;aspect-ratio:124/116;
  transform:translate(-46%,-50%);
  background:none;border:0;padding:0;margin:0;color:var(--hls-widget);cursor:pointer;z-index:3;
  touch-action:manipulation;-webkit-appearance:none;appearance:none;
}
.hls-glass::before{content:'';position:absolute;inset:-9cqw}                      /* generous tap target */
.hls-glass svg{position:relative;display:block;width:100%;height:100%;overflow:visible;transition:transform .18s cubic-bezier(.3,1.6,.5,1)}
.hls-glass:active svg{transform:scale(.92)}
.hls-glass:focus-visible{outline:none}
.hls-glass:focus-visible svg{filter:drop-shadow(0 0 1.4cqw rgba(255,255,255,.95))}
.hls-glass.is-tapped svg{animation:hls-pop .38s cubic-bezier(.3,1.5,.5,1)}
.hls-glass .hls-water{transition:transform .7s cubic-bezier(.22,1,.36,1)}
.hls-glass .hls-count{font-weight:600;font-family:inherit}

/* "tap me" pulse until the first tap */
.hls-pulse{position:absolute;left:50%;top:81.6%;width:17cqw;height:17cqw;margin:-8.5cqw 0 0 -8.5cqw;border-radius:50%;border:.6cqw solid var(--hls-widget);opacity:0;pointer-events:none;z-index:2}
.hls.is-hinting .hls-pulse{animation:hls-pulse 2.2s ease-out infinite}

/* ripple + drop on every tap */
.hls-ripple{position:absolute;left:50%;top:81.6%;width:17cqw;height:17cqw;margin:-8.5cqw 0 0 -8.5cqw;border-radius:50%;background:rgba(255,255,255,.35);pointer-events:none;z-index:2;animation:hls-ripple .6s ease-out forwards}

/* soft wash when the goal is reached */
.hls-done{position:absolute;inset:0;background:radial-gradient(circle at 50% 82%,rgba(255,255,255,.42),rgba(255,255,255,0) 62%);opacity:0;pointer-events:none;z-index:1;transition:opacity .8s ease}
.hls.is-complete .hls-done{opacity:1}

@keyframes hls-pop{0%{transform:scale(.9)}55%{transform:scale(1.1)}100%{transform:scale(1)}}
@keyframes hls-pulse{0%{transform:scale(.7);opacity:.75}70%{transform:scale(1.7);opacity:0}100%{transform:scale(1.7);opacity:0}}
@keyframes hls-ripple{0%{transform:scale(.6);opacity:.7}100%{transform:scale(2.4);opacity:0}}

@media (prefers-reduced-motion:reduce){
  .hls-glass svg,.hls-glass .hls-water,.hls-wall,.hls-done{transition:none}
  .hls-glass.is-tapped svg,.hls.is-hinting .hls-pulse,.hls-ripple{animation:none}
  .hls-ripple{display:none}
}

/* browsers without container units (pre-2022): fixed-size fallback at 280px */
@supports not (width:1cqw){
  .hls{width:260px}
  .hls-screen{border-radius:41px}
  .hls::before{inset:-7px;border-radius:48px}
  .hls::after{left:-12px;right:-12px}
  .hls-screen::after{top:7px;width:83px;height:24px;margin-left:-41px;border-radius:12px}
  .hls-status{top:15px;right:21px;gap:4px}.hls-status svg{height:10px}.hls-status .hls-batt{height:11px}
  .hls-date{top:55px;font-size:18px}.hls-clock{top:76px;font-size:84px}
  .hls-home{bottom:7px;width:100px;height:4px;margin-left:-50px}
  .hls-glass{width:48px}.hls-glass::before{inset:-24px}
  .hls-pulse,.hls-ripple{width:48px;height:48px;margin:-24px 0 0 -24px}
  .hls-pulse{border-width:2px}
}
