/* The roller shutter: a shop front at dusk with its shutter down. A click rolls it up slat by slat over the roller,
   with a catch halfway and a bounce at the top, and the lights come on inside; the next click pulls it down and the
   street slides on to the shop next door. */
:root {
  --dusk: #1d2233;
  --pavement: #4a4b55;
  --pavement-line: #3b3c45;
  --kerb: #6d6e78;
  --recess: #14161f;
  --hood: #8d9097;
  --hood-dark: #5f626a;
  --rail: #7b7e86;
  --rail-dark: #464951;
  --bar: #6f7178;
  --glow: #ffd27a;
  --bulb: #fff3c4;
  --button: #f6efe3;
  --button-ink: #1d2233;
  /* the elastic curve of the button: it overshoots, then settles */
  --bounce: cubic-bezier(0.34, 1.9, 0.45, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--dusk);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.street {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--dusk);
}

.shops {
  position: absolute;
  inset: 0;
}

/* ------------------------------------------------------------------ one shop: the script sets the measures */
.shop {
  position: absolute;
  inset: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shop__wall {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 6%, transparent 94%, rgba(0, 0, 0, 0.2)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 30%),
    var(--facade);
}

/* a drainpipe on the left pilaster, so two shops side by side read as two houses */
.shop__pipe {
  position: absolute;
  top: 0;
  bottom: var(--sh);
  left: calc(var(--pw) * 0.28);
  width: max(5px, calc(var(--pw) * 0.16));
  background: linear-gradient(90deg, #2a2d36, #6b6f79 40%, #2a2d36);
  opacity: 0.85;
}

.shop__fascia {
  position: absolute;
  top: calc(var(--fh) * 0.16);
  left: var(--pw);
  right: var(--pw);
  height: calc(var(--fh) * 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* the board is moved by GSAP; the lettering inside it by CSS */
.board {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  padding: 0 1.4em;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.18)), var(--sign);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25), 0 10px 18px rgba(0, 0, 0, 0.35), inset 0 0 0 2px var(--sign-ink);
  transform-origin: 50% 0;
}

.board__name {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 640;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: min(calc(var(--fh) * 0.34), 6.4vw);
  line-height: 1;
  color: var(--sign-ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.board__tag {
  font-size: min(calc(var(--fh) * 0.105), 2.6vw);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 560;
  color: var(--sign-ink);
  opacity: 0.8;
  white-space: nowrap;
  margin-top: 0.3em;
}

/* the dark recess behind the roller and the opening */
.shop__recess {
  position: absolute;
  background: var(--recess);
  box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.7);
}

/* the drum with the turns of shutter already wound on it */
.drum {
  position: absolute;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.1) 32%, rgba(255, 255, 255, 0.08) 50%, rgba(0, 0, 0, 0.5) 100%),
    repeating-linear-gradient(180deg, var(--metal) 0 calc(var(--h) * 0.34), var(--metal-dark) calc(var(--h) * 0.34) calc(var(--h) * 0.4));
}

.hood {
  position: absolute;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--hood), var(--hood-dark));
  border-radius: 3px 3px 2px 2px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.45);
}

.hood::after {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -3px;
  height: 5px;
  border-radius: 2px;
  background: var(--hood-dark);
}

.hub {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #9fa2a9, #4a4d55 70%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hub svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* the window behind the shutter */
.opening {
  position: absolute;
  overflow: hidden;
}

.interior {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ------------------------------------------------------------------ the shutter */
.shutter {
  position: absolute;
  z-index: 0;
  height: 0;
}

/* the script moves the slat; the face inside is shaken by GSAP; the paint and the shading are CSS */
.slat {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  transform-origin: 50% 0;
  will-change: transform;
}

.slat__in {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0, rgba(255, 255, 255, 0.08) 22%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.16) 78%, rgba(0, 0, 0, 0.5) 92%, rgba(0, 0, 0, 0.78) 100%),
    var(--metal);
}

.slat__paint {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}

/* the corrugation over the paint, so the grooves run through the letters too */
.slat__in::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0, rgba(255, 255, 255, 0) 18%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.22) 84%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.22), transparent 6%, transparent 94%, rgba(0, 0, 0, 0.22));
  pointer-events: none;
}

.slat__shade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  z-index: 1;
}

/* the bottom bar: heavier, with the handle and the lock */
.slat--bar .slat__in {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.35) 85%, rgba(0, 0, 0, 0.7)),
    var(--bar);
}

.handle {
  position: absolute;
  top: 36%;
  width: calc(var(--h) * 1.3);
  height: calc(var(--h) * 0.22);
  border-radius: 99px;
  background: linear-gradient(180deg, #d9dbe0, #8a8d95);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.lock {
  position: absolute;
  top: 22%;
  width: calc(var(--h) * 0.5);
  height: calc(var(--h) * 0.5);
  z-index: 1;
}

.lock__face {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3d78a, #a77c2a 75%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.lock__face svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* the guides on either side */
.rail {
  position: absolute;
  background: linear-gradient(90deg, var(--rail-dark), var(--rail) 30%, var(--rail-dark) 55%, var(--rail) 80%, var(--rail-dark));
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.step {
  position: absolute;
  background: linear-gradient(180deg, #8a8b94, #5d5e67);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* the warm light that spills out on the pavement */
.spill {
  position: absolute;
  pointer-events: none;
  background: radial-gradient(ellipse 50% 100% at 50% 0, color-mix(in srgb, var(--glow) 55%, transparent), transparent 75%);
  opacity: 0;
}

.dust {
  position: absolute;
  border-radius: 50%;
  background: rgba(205, 200, 190, 0.55);
  pointer-events: none;
}

/* ------------------------------------------------------------------ the pavement */
.pavement {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--sh);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 30%), var(--pavement);
  border-top: 3px solid var(--kerb);
}

.pavement__tiles {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 300%;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(var(--tile) - 2px), var(--pavement-line) calc(var(--tile) - 2px) var(--tile)),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--tile) * 0.5 - 2px), var(--pavement-line) calc(var(--tile) * 0.5 - 2px) calc(var(--tile) * 0.5));
}

/* ------------------------------------------------------------------ the button: GSAP moves the button, CSS the inside */
.pull-spot {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sh) * 0.5);
  translate: -50% 50%;
  z-index: 5;
}

.pull {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.pull__bg {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--button);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.55s var(--bounce);
}

.pull__text {
  position: relative;
  display: block;
  padding: 0.85em 1.6em;
  font-size: 15px;
  font-weight: 620;
  font-stretch: 100%;
  letter-spacing: 0.02em;
  color: var(--button-ink);
  white-space: nowrap;
  transition: font-stretch 0.5s var(--bounce), letter-spacing 0.5s var(--bounce);
}

.pull:focus-visible {
  outline: none;
}

.pull:focus-visible .pull__bg {
  box-shadow: 0 0 0 3px var(--dusk), 0 0 0 5px var(--button);
}

.pull:active .pull__bg {
  transform: scale(0.94);
}

@media (hover: hover) {
  .pull:hover .pull__bg {
    transform: scale(1.08, 1.14);
  }

  .pull:hover .pull__text {
    font-stretch: 122%;
    letter-spacing: 0.05em;
  }
}

@media (max-width: 40em) {
  .pull__text {
    font-size: 14px;
  }
}
