/*
 * Kestrow — a page played from footage (tickets/SC-43.md).
 *
 * The first part is the page as it is by itself: the still of each act with its words,
 * one under another, and the footer — what is shown without the script and where motion
 * is not wanted. The second part (".live") is the film: four acts, each with a stage that
 * holds while its clip is turned by the scroll, the page scrolling on between them.
 *
 * Three colours, the shoe's own: the off-white of the knit, the orange of the sole and
 * the heel loop, the black of the laces and the box. Kanit, bold italic, is the face on
 * the box; DM Sans sets everything small. The studio's faces (Unbounded, Onest) are in
 * the studio's lime corner and nowhere else.
 */

:root {
  --paper: #f4f4f4;
  --ink: #0a0a0a;
  --flame: #ff4d00;
  --gutter: clamp(18px, 3.4vw, 52px);
  --face-display: "Kanit", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --face-text: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --face-studio-display: "Unbounded", "Arial Black", Arial, sans-serif;
  --face-studio-text: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--face-text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul,
ol {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

img,
canvas,
svg {
  display: block;
}

a {
  color: inherit;
}

/* ——— The bar: the name and the acts ——— */

.bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
  color: var(--ink);
  pointer-events: none;
  transition: color 240ms linear;
}

.bar[data-tone="night"] {
  color: var(--paper);
}

.bar a {
  pointer-events: auto;
  text-decoration: none;
}

.brand {
  font-family: var(--face-display);
  font-size: 30px;
  font-style: italic;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.acts ol {
  display: flex;
  gap: clamp(14px, 2vw, 30px);
}

.acts a {
  position: relative;
  display: block;
  padding: 6px 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  opacity: 0.62;
  transition: opacity 200ms linear;
}

.acts a::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 320ms var(--ease-out);
}

.acts a:hover,
.acts a:focus-visible,
.acts .is-here a {
  opacity: 1;
}

.acts .is-here a::after {
  transform: scaleX(1);
}

.bar a:focus-visible,
.pill:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* ——— The page by itself: every act is its still and its words ——— */

.act {
  position: relative;
  padding: 0 0 clamp(40px, 6vw, 84px);
}

.act-drop {
  padding-top: 76px;
}

.view {
  position: relative;
  overflow: hidden;
  background-color: #d9d9db;
}

.still,
.still img {
  width: 100%;
  height: auto;
}

.view canvas,
.flood,
.leaders,
.hint {
  display: none;
}

.rail {
  padding: clamp(22px, 3vw, 40px) var(--gutter) 0;
}

.title {
  font-family: var(--face-display);
  font-size: clamp(54px, 8.4vw, 132px);
  font-style: italic;
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.title span {
  display: block;
}

.title span:last-child {
  color: var(--flame);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.tag {
  font-family: var(--face-display);
  font-size: clamp(22px, 2.1vw, 30px);
  font-style: italic;
  font-weight: 600;
  line-height: 1.1;
}

.act-foam {
  background-color: var(--ink);
}

.phrase {
  overflow: hidden;
  padding: clamp(56px, 9vw, 128px) 0;
  background-color: var(--ink);
  color: var(--paper);
}

.phrase h2 {
  font-family: var(--face-display);
  font-size: clamp(60px, 15vw, 250px);
  font-style: italic;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.phrase-line {
  display: block;
  padding: 0 var(--gutter);
}

.phrase-line > span {
  display: inline-block;
  will-change: transform;
}

.phrase-b {
  color: var(--flame);
  text-align: right;
}

/* The button: a capsule in the orange of the sole, the arrow in a black round. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 10px 10px 10px 30px;
  border-radius: 999px;
  background-color: var(--flame);
  color: var(--ink);
  font-family: var(--face-display);
  font-size: clamp(22px, 2vw, 30px);
  font-style: italic;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: auto;
  transition: background-color 180ms linear;
}

.pill:hover,
.pill:focus-visible {
  background-color: #ff6a26;
}

.pill-round {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--ink);
  color: var(--paper);
}

.pill-round svg,
.studio svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms var(--ease-out);
}

.pill:hover .pill-round svg,
.pill:focus-visible .pill-round svg {
  transform: translate3d(4px, 0, 0);
}

/*
 * ——— The footer: the end of the box and its label ———
 * Black board; on it one sheet ruled into cells, as a shoebox carries on its end.
 */

.foot {
  position: relative;
  padding: clamp(64px, 9vw, 132px) var(--gutter) clamp(112px, 11vw, 164px);
  background-color: var(--ink);
  color: var(--ink);
}

.label {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.62fr);
  grid-template-areas:
    "name name name"
    "line layers chips"
    "care layers chips";
  max-width: 1240px;
  margin: 0 auto;
  border: 2px solid var(--ink);
  background-color: var(--paper);
  outline: 12px solid var(--paper);
}

.label-name {
  grid-area: name;
  padding: 6px 22px 0;
  border-bottom: 2px solid var(--ink);
  font-family: var(--face-display);
  font-size: clamp(74px, 17.4vw, 264px);
  font-style: italic;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.label-cell {
  padding: 20px 22px 22px;
}

.label-line {
  grid-area: line;
  border-bottom: 2px solid var(--ink);
  font-family: var(--face-display);
  font-size: clamp(26px, 3vw, 44px);
  font-style: italic;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.label-care {
  grid-area: care;
  align-self: end;
  font-size: 17px;
  font-weight: 500;
}

.label-layers {
  grid-area: layers;
  border-left: 2px solid var(--ink);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
}

.label-layers li {
  padding: 7px 0;
  border-bottom: 1px solid rgb(10 10 10 / 0.22);
}

.label-layers li:first-child {
  padding-top: 0;
}

.label-layers li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

/* The three colours of the shoe, as chips: knit, sole, laces. */
.label-chips {
  grid-area: chips;
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  padding: 0;
  border-left: 2px solid var(--ink);
}

.label-chips i:nth-child(1) {
  background-color: var(--paper);
}

.label-chips i:nth-child(2) {
  border-block: 2px solid var(--ink);
  background-color: var(--flame);
}

.label-chips i:nth-child(3) {
  background-color: var(--ink);
}

/* The studio signs in its own colours, not the brand's: volt and ink, in the corner. */
.studio {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px var(--gutter) 18px 26px;
  border-top-left-radius: 28px;
  background-color: #d6fa50;
  color: #0a0a0a;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
  transition: background-color 180ms linear;
}

.studio-by {
  font-family: var(--face-studio-text);
  text-transform: uppercase;
}

.studio-name {
  font-family: var(--face-studio-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.studio:hover,
.studio:focus-visible {
  background-color: #b8dc2c;
}

.studio:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.studio svg {
  width: 16px;
  height: 16px;
}

.studio:hover svg,
.studio:focus-visible svg {
  transform: rotate(45deg);
}

/*
 * ——— The film ———
 * An act is as tall as its screen and its hold (--pin, in screens of a hundred); its
 * stage sticks for the hold and then leaves with the page.
 */

.live .act {
  height: calc(100vh + var(--pin, 100) * 1vh);
  height: calc(100svh + var(--pin, 100) * 1svh);
  padding: 0;
}

.live .stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.live .view {
  position: absolute;
  inset: 0;
  will-change: clip-path, transform;
}

.live .still,
.live .still img,
.live .view canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.live .still img {
  object-fit: cover;
}

/*
 * In the film the still of an act (its event) is not shown: until the frames have come,
 * the view shows the first frame of the act — never a black screen, and never the end
 * of the act before its beginning.
 */
.live .still {
  visibility: hidden;
}

.live .view {
  background-position: 50% 50%;
  background-size: cover;
}

.live .act-drop .view {
  background-image: url("stills/drop-first-w.webp");
}

.live .act-layers .view {
  background-image: url("stills/apart-first-w.webp");
}

.live .act-foam .view {
  background-color: var(--ink);
  background-image: url("stills/foam-first-w.webp");
}

.live .act-box .view {
  background-image: url("stills/pair-first-w.webp");
}

.live .view canvas {
  display: block;
  visibility: hidden;
}

.live .view canvas.is-on {
  visibility: visible;
}

/* The flood: the orange of the heel tab takes the screen, as a circle from the tab. */
.live .flood {
  display: block;
  position: absolute;
  inset: 0;
  background-color: var(--flame);
  clip-path: circle(0 at 50% 50%);
  visibility: hidden;
}

.live .rail {
  position: absolute;
  inset: 0;
  padding: 0;
  pointer-events: none;
  will-change: transform;
}

.live .act-drop {
  --pin: 78;
}

.live .act-layers {
  --pin: 145;
  background-color: var(--flame);
}

.live .act-foam {
  --pin: 72;
}

.live .act-box {
  --pin: 100;
}

/* Act one: the line in the corner of the first screen; it rides up and out with the page. */
.live .title {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(34px, 7vh, 78px);
  font-size: clamp(48px, 4.8vw, 88px);
}

.live .hint {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(34px, 7vh, 78px);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  transition: opacity 300ms linear;
}

.live .hint i {
  width: 1px;
  height: 44px;
  background-color: currentColor;
  transform-origin: 50% 0;
  animation: hint 2.2s var(--ease-out) infinite;
}

@keyframes hint {
  0% {
    transform: scaleY(0);
  }
  60%,
  100% {
    transform: scaleY(1);
  }
}

/* Act two: the names ride up the sides of the stage; a line runs from each to its layer. */
.live .tags {
  display: block;
}

.live .tag {
  position: absolute;
  top: calc(var(--y) * 1vh);
  top: calc(var(--y) * 1svh);
  width: max-content;
  max-width: 16vw;
  font-size: clamp(22px, 2vw, 32px);
  opacity: 0;
}

.live .tag span {
  display: inline-block;
  padding: 2px 0;
}

.live .tag-left {
  left: clamp(18px, 5.8vw, 96px);
}

.live .tag-right {
  right: clamp(18px, 3.4vw, 56px);
  text-align: right;
}

.live .leaders {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.leaders line {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.leaders circle {
  fill: var(--ink);
}

/* Act four: the button rides up from under the stage and stops beside the box. */
.live .act-box .pill {
  position: absolute;
  left: var(--gutter);
  top: calc(var(--y, 172) * 1vh);
  top: calc(var(--y, 172) * 1svh);
}

.live .phrase {
  padding: 16vh 0;
}

/*
 * ——— A tall screen: the tall frames ———
 * (The script switches to the tall series at the same ratio.) The picture is a 3:4 frame
 * across the screen's width at the top of the stage; the words ride in the page below it.
 */

@media (max-aspect-ratio: 4 / 5) {
  .brand {
    font-size: 26px;
  }

  .acts ol {
    gap: 12px;
  }

  .acts a {
    font-size: 14px;
  }

  .label {
    grid-template-columns: minmax(0, 1fr) 64px;
    grid-template-areas:
      "name name"
      "line line"
      "layers chips"
      "care care";
    outline-width: 8px;
  }

  .label-name {
    padding: 4px 12px 0;
  }

  .label-cell {
    padding: 16px 14px 18px;
  }

  .label-layers {
    border-left: 0;
  }

  .label-care {
    border-top: 2px solid var(--ink);
  }

  .label-chips {
    padding: 0;
  }

  .live .view {
    inset: var(--view-top, 0px) 0 auto;
    aspect-ratio: 3 / 4;
  }

  .live .act-drop .view {
    background-image: url("stills/drop-first-t.webp");
  }

  .live .act-layers .view {
    background-image: url("stills/apart-first-t.webp");
  }

  .live .act-foam .view {
    background-image: url("stills/foam-first-t.webp");
  }

  .live .act-box .view {
    background-image: url("stills/pair-first-t.webp");
  }

  .live .act-drop .stage {
    background-color: var(--paper);
  }

  /* The line of the first screen rides up and slips under the picture: it never lies over the falling shoe. */
  .live .act-drop .view {
    z-index: 1;
  }

  .live .act-drop .flood {
    z-index: 2;
  }

  .live .act-layers .stage {
    background-color: var(--flame);
  }

  .live .act-layers {
    --view-top: 12svh;
  }

  .live .act-foam {
    --view-top: 6svh;
  }

  .live .act-box {
    --view-top: 0px;
  }

  .live .title {
    bottom: auto;
    top: calc(100vw * 4 / 3 + 20px);
    font-size: clamp(46px, 14vw, 64px);
  }

  .live .hint {
    bottom: 22px;
  }

  .live .tag {
    top: calc(var(--y-tall) * 1svh);
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    font-size: 26px;
    text-align: center;
  }

  .live .act-box .pill {
    --y: 182;
    left: 50%;
    margin-left: -138px;
    width: 276px;
    justify-content: space-between;
    font-size: 21px;
  }
}

/* ——— Checks: ?hud ——— */

.hud {
  position: fixed;
  left: 8px;
  top: 76px;
  z-index: 40;
  margin: 0;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.82);
  color: #b6ff7a;
  font: 11px/1.45 ui-monospace, Menlo, monospace;
  white-space: pre;
  pointer-events: none;
}
