/* Water beading demo. Phone first: everything stacks. Wide screens: panel left, words right. */

html, body { min-height: 100%; }
body { min-height: 100svh; overscroll-behavior-y: none; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
}

.demo {
  display: grid; gap: 14px;
  max-width: 560px; margin: 0 auto;
  padding: 14px max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.intro h1 { font-size: clamp(2rem, 8.4vw, 3.25rem); }
.sub { margin-top: 8px; color: var(--snow-2); font-size: 1rem; line-height: 1.4; max-width: 36ch; text-wrap: pretty; }

/* The panel */
.panel {
  position: relative; width: 100%;
  height: clamp(300px, 50svh, 470px);
  border-radius: 22px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .9), 0 0 0 1px var(--line);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#scene {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  border-radius: 22px; background: #07080b;
  touch-action: none; /* a finger on the panel sprays, it never scrolls the page */
  cursor: crosshair;
}
/* soft dark edge so the panel looks like it has depth */
.panel::after {
  content: ''; position: absolute; inset: 0; border-radius: 22px; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 0 50px rgba(0, 0, 0, .55);
}

.tag {
  position: absolute; top: 12px; z-index: 2; pointer-events: none;
  padding: 7px 12px; border-radius: 999px;
  background: rgba(10, 10, 11, .62); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font: 500 .8125rem/1 var(--text); letter-spacing: .01em; color: var(--snow); white-space: nowrap;
}
.tag--left { left: 12px; color: var(--brass); border-color: rgba(207, 174, 116, .45); }
.tag--right { right: 12px; }

/* The line between the two halves, and the round handle you drag. */
.divider {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(245, 245, 247, 0), rgba(245, 245, 247, .8) 12%, rgba(245, 245, 247, .8) 88%, rgba(245, 245, 247, 0));
}
.knob {
  position: absolute; top: 50%; left: 50%; z-index: 3;
  width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; padding: 0;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .7); background: rgba(16, 16, 17, .78); color: var(--snow);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .55);
  cursor: ew-resize; touch-action: none;
}
.knob:active { background: rgba(60, 60, 62, .9); }

/* The ring that shows where the water is landing. */
.brush {
  position: absolute; z-index: 1; left: 0; top: 0; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  border: 1.5px solid rgba(245, 245, 247, .6); background: rgba(245, 245, 247, .05);
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.brush.is-on { opacity: 1; }

.hint { margin-top: 10px; text-align: center; color: var(--snow-2); font-size: .9375rem; line-height: 1.35; min-height: 1.35em; }
.nogl { position: absolute; inset: 40% 20px auto; text-align: center; color: var(--snow-2); }
.nogl[hidden] { display: none; }

/* Controls */
.controls { display: grid; gap: 12px; }
.tilt { display: grid; gap: 4px; }
.tilt__name { font: 500 .9375rem/1.2 var(--text); color: var(--snow); }
.tilt__row { display: flex; align-items: center; gap: 12px; }
.tilt__end { flex: none; font-size: .8125rem; color: var(--snow-2); }

input[type="range"] {
  flex: 1; min-width: 0; height: 44px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none; touch-action: none;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(245, 245, 247, .22); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; margin-top: -13px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(245, 245, 247, .22); }
input[type="range"]::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 0; }

.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn--small { min-height: 44px; padding: 0 18px; font-size: 1rem; }

/* Words and the one button */
.copy { display: grid; gap: 14px; margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--line); }
.benefit { font: 500 1.1875rem/1.35 var(--display); letter-spacing: -0.01em; color: var(--snow); text-wrap: pretty; }
.copy .btn { width: 100%; }
.note { color: #86868b; font-size: .8125rem; line-height: 1.4; }

.nojs { text-align: center; padding: 20px; }
.nojs a { color: var(--brass); }

/* Wide screens: big panel on the left, everything else in a column on the right. */
@media (min-width: 900px) {
  body { display: flex; flex-direction: column; }
  .top { padding: 22px 32px 0; }
  .demo {
    flex: 1; width: 100%; max-width: 1280px; padding: 24px 32px 40px;
    grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto auto 1fr;
    column-gap: 56px; row-gap: 26px; align-content: center;
  }
  .stage { grid-column: 1; grid-row: 1 / span 3; align-self: center; }
  .intro, .controls, .copy { grid-column: 2; }
  .intro { align-self: end; }
  .intro h1 { font-size: 3.5rem; }
  .sub { font-size: 1.0625rem; }
  .panel { height: min(66vh, 620px); border-radius: 28px; }
  #scene, .panel::after { border-radius: 28px; }
  .tag { top: 16px; font-size: .875rem; }
  .tag--left { left: 16px; } .tag--right { right: 16px; }
  .hint { text-align: left; margin-top: 14px; }
  .copy { margin-top: 0; align-self: start; }
  .copy .btn { width: auto; justify-self: start; }
}
