/* base.css */
:root {
  --bg: #fff;
  --fg: #000;
  --shadow-core: rgba(0, 0, 0, 0.18);
  --shadow-mid: rgba(0, 0, 0, 0.11);
  --shadow-edge: rgba(0, 0, 0, 0.045);
  --pad-x: clamp(20px, 5vw, 76px);
  --pad-top: clamp(32px, 8vh, 108px);
  --pad-bottom: clamp(32px, 8vh, 96px);
  --gap: clamp(14px, 2.3vh, 30px);
  --poster-size: clamp(34px, 8.4vw, 112px);
  --why-reserve: clamp(76px, 10vh, 116px);
  --why-copy-left: clamp(28px, 12vw, 420px);
  --why-copy-right: clamp(28px, 7vw, 120px);
  --why-copy-max-width: 680px;
  --why-copy-font-size: clamp(24px, 5.2vmin, 58px);
  --why-button-min-font-size: 11px;
  --why-button-fluid-font-size: 1.35vw;
  --why-button-max-font-size: 22px;
  --why-frame-pad-x: clamp(12px, 1.1vw, 16px);
  --why-frame-pad-y: clamp(10px, .9vw, 12px);
  --why-edge-gap: clamp(4px, .8vw, 12px);
  --why-reveal-duration: 1100ms;
  --pointer-size: clamp(280px, 42vw, 760px);
  --pointer-fade-duration: 560ms;
  --pointer-move-duration: 400ms;
  --ease-out-fast: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --fg: #fff;
    --shadow-core: rgba(255, 255, 255, 0.20);
    --shadow-mid: rgba(255, 255, 255, 0.12);
    --shadow-edge: rgba(255, 255, 255, 0.05);
  }
}

@property --hole-spread {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  font-family: MiSans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--fg);
  transition: background-color 360ms ease, color 360ms ease;
}

@media (max-width: 560px) {
  :root {
    --pad-x: clamp(18px, 5vw, 24px);
    --pad-top: clamp(28px, 5.2vh, 42px);
    --gap: clamp(13px, 2vh, 18px);
    --poster-size: clamp(32px, 8.9vw, 48px);
    --why-reserve: max(92px, calc(env(safe-area-inset-bottom) + 72px));
    --why-copy-left: clamp(22px, 8vw, 36px);
    --why-copy-right: clamp(22px, 8vw, 36px);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --pad-top: 20px;
    --pad-bottom: 24px;
    --why-reserve: max(68px, calc(env(safe-area-inset-bottom) + 56px));
    --why-copy-left: max(24px, env(safe-area-inset-left));
    --why-copy-right: max(24px, env(safe-area-inset-right));
    --why-copy-font-size: clamp(22px, 7vmin, 34px);
    --gap: 12px;
    --poster-size: clamp(28px, 7.2vmin, 38px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* pointer.css */
.pointer-shadow,
.why-glow {
  position: fixed;
  inset: 0 auto auto 0;
  width: var(--pointer-size);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(calc(var(--pointer-x, 50vw) - 50%), calc(var(--pointer-y, 50vh) - 50%), 0) scale(.82);
  transition:
    opacity var(--pointer-fade-duration) cubic-bezier(.22, 1, .36, 1),
    transform var(--pointer-move-duration) var(--ease-out-fast);
}

.pointer-shadow {
  z-index: 0;
  background: radial-gradient(circle, var(--shadow-core) 0, var(--shadow-mid) 26%, var(--shadow-edge) 48%, transparent 72%);
}

.why-glow {
  position: absolute;
  z-index: 1;
  background: radial-gradient(circle, rgba(255, 255, 255, .20) 0, rgba(255, 255, 255, .12) 26%, rgba(255, 255, 255, .05) 48%, transparent 72%);
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

@media (prefers-color-scheme: dark) {
  .pointer-shadow { mix-blend-mode: screen; }
}

body.is-pointing .pointer-shadow,
body.is-why-open.is-pointing .why-glow {
  opacity: 1;
  transform: translate3d(calc(var(--pointer-x, 50vw) - 50%), calc(var(--pointer-y, 50vh) - 50%), 0) scale(1);
}

/* reveal.css */
.why-anchor {
  display: flex;
  justify-content: flex-end;
  margin: var(--why-reserve) calc(0px - var(--pad-x)) 0;
  padding:
    0
    max(var(--why-edge-gap), env(safe-area-inset-right))
    max(var(--why-edge-gap), env(safe-area-inset-bottom))
    max(var(--why-edge-gap), env(safe-area-inset-left));
}

.why-button {
  position: relative;
  z-index: 20;
  width: max-content;
  max-width: calc(
    100vw
    - max(var(--why-edge-gap), env(safe-area-inset-left))
    - max(var(--why-edge-gap), env(safe-area-inset-right))
  );
  padding: var(--why-frame-pad-y) var(--why-frame-pad-x);
  border: 0;
  background: transparent;
  color: var(--fg);
  font:
    900
    var(
      --why-button-font-size,
      clamp(
        var(--why-button-min-font-size),
        var(--why-button-fluid-font-size),
        var(--why-button-max-font-size)
      )
    )/1.08
    MiSans, system-ui, sans-serif;
  letter-spacing: -.025em;
  white-space: nowrap;
  text-align: right;
  cursor: pointer;
  transition: opacity 220ms ease, color 220ms ease;
  isolation: isolate;
}

.why-button.is-wrapping { white-space: normal; }
.why-button:hover { opacity: .66; }
.why-button:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }

.why-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
  touch-action: none;
  overscroll-behavior: contain;
}

.why-mask-canvas,
.why-curtain-surface {
  display: block;
  width: 100%;
  height: 100%;
}

.why-mask-hole {
  x: calc(var(--why-hole-left, 50vw) - var(--hole-spread));
  y: calc(var(--why-hole-top, 50vh) - var(--hole-spread));
  width: calc(var(--why-hole-width, 1px) + var(--hole-spread) + var(--hole-spread));
  height: calc(var(--why-hole-height, 1px) + var(--hole-spread) + var(--hole-spread));
  rx: var(--hole-spread);
  ry: var(--hole-spread);
  --hole-spread: var(--why-hole-start-spread, 150vmax);
}

body.is-why-transitioning .why-mask-hole {
  transition: --hole-spread var(--why-reveal-duration) cubic-bezier(.16, 1, .3, 1);
}

.why-curtain-surface {
  position: relative;
  background: #000;
}

.why-copy {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: var(--why-copy-left);
  width: min(var(--why-copy-max-width), calc(100vw - var(--why-copy-left) - var(--why-copy-right)));
  margin: 0;
  color: #fff;
  font-size: var(--why-copy-font-size);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -.03em;
  text-wrap: balance;
  transform: translateY(-50%);
  opacity: 0;
}

body.is-why-open .why-overlay { pointer-events: auto; }
body.is-why-open .why-button:hover { opacity: 1; }
body.is-why-open .why-mask-hole { --hole-spread: 0px; }
body.is-why-open .why-copy {
  opacity: 1;
}

@media (max-width: 560px) {
  .why-button {
    max-width: calc(
      100vw
      - var(--why-edge-gap)
      - var(--why-edge-gap)
    );
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .why-button {
    max-width: calc(
      100vw
      - max(var(--why-edge-gap), env(safe-area-inset-left))
      - max(var(--why-edge-gap), env(safe-area-inset-right))
    );
  }

  .why-copy { line-height: 1.12; }
}

/* poster.css */
.page {
  position: relative;
  width: 100%;
  min-height: 100svh;
  padding: var(--pad-top) var(--pad-x) 0;
}

.list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--gap);
  max-width: min(100%, 1120px);
}

.item {
  max-width: 100%;
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  font-size: var(--poster-size);
  font-weight: 900;
  line-height: .98;
  text-wrap: pretty;
  animation: accelerate-in 760ms var(--ease-out-fast) forwards;
  animation-delay: calc(72ms + var(--i) * 72ms);
  opacity: 0;
  transform: translate3d(0, clamp(18px, 4.5vw, 58px), 0) scale(.985);
  will-change: transform, opacity;
}

@keyframes accelerate-in {
  0% { opacity: 0; transform: translate3d(0, clamp(18px, 4.5vw, 58px), 0) scale(.985); }
  62% { opacity: 1; }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@media (max-width: 560px) {
  .item { line-height: 1.03; }
}

/* Generated poster animation indices */
.item:nth-child(1) { --i: 0; }
.item:nth-child(2) { --i: 1; }
.item:nth-child(3) { --i: 2; }
.item:nth-child(4) { --i: 3; }
.item:nth-child(5) { --i: 4; }
.item:nth-child(6) { --i: 5; }
.item:nth-child(7) { --i: 6; }
.item:nth-child(8) { --i: 7; }
.item:nth-child(9) { --i: 8; }
.item:nth-child(10) { --i: 9; }
.item:nth-child(11) { --i: 10; }
.item:nth-child(12) { --i: 11; }
.item:nth-child(13) { --i: 12; }
.item:nth-child(14) { --i: 13; }
.item:nth-child(15) { --i: 14; }
.item:nth-child(16) { --i: 15; }
.item:nth-child(17) { --i: 16; }
.item:nth-child(18) { --i: 17; }
.item:nth-child(19) { --i: 18; }
.item:nth-child(20) { --i: 19; }
