@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: block;
}

/* Board inks: mustard #E0B23C, brick #B23A2E, teal #146B6E, cream #F1E6CF, ink #0E0E0E.
   --teal-field is lifted so ink display type clears 3:1 on a flooded frame. */
:root {
  --mustard: oklch(78.5% 0.14 86.6);
  --brick: oklch(52.1% 0.158 29.2);
  --teal: oklch(48.2% 0.076 198.5);
  --teal-field: oklch(54% 0.086 198.5);
  --cream: oklch(92.8% 0.033 85.5);
  --ink: oklch(16.4% 0 90);
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='2.6' intercept='-0.8'/%3E%3CfeFuncG type='linear' slope='2.6' intercept='-0.8'/%3E%3CfeFuncB type='linear' slope='2.6' intercept='-0.8'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='320' height='320' filter='url(%23g)'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--display);
  font-stretch: 100%;
  font-weight: 500;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--mustard) var(--ink);
  overscroll-behavior-y: none;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
}

::selection {
  background: var(--ink);
  color: var(--mustard);
}

[data-theme="obscure"] ::selection {
  background: var(--cream);
  color: var(--ink);
}

h1,
h2,
h3,
p,
ol {
  margin: 0;
}

svg[hidden] {
  display: none;
}

ol {
  padding: 0;
  list-style: none;
}

.object,
.figure {
  display: block;
}

/* Frames */

.frame {
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: grid;
  min-height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--field);
  color: var(--body);
}

.frame > *,
.frame::after {
  grid-area: 1 / 1;
  min-width: 0;
}

.frame::after {
  content: "";
  z-index: 6;
  background: var(--grain) 0 0 / 320px 320px;
  mix-blend-mode: var(--grain-blend);
  opacity: var(--grain-opacity);
  pointer-events: none;
}

.bar {
  z-index: 0;
  background: var(--bar);
  clip-path: var(--cut);
}

.stage {
  position: relative;
  z-index: 1;
  padding: var(--gutter);
}

.stage--knock {
  z-index: 2;
  clip-path: var(--cut);
  background: var(--bar);
  color: var(--body-on-bar);
  --display-color: var(--display-on-bar);
  --object-color: var(--object-on-bar);
  --meta: var(--body-on-bar);
  pointer-events: none;
  user-select: none;
}

[data-theme="claire"] {
  --body: var(--ink);
  --meta: oklch(31% 0.07 65);
  --display-color: var(--ink);
  --bar: var(--ink);
  --body-on-bar: var(--cream);
  --display-on-bar: var(--cream);
  --object-color: var(--ink);
  --object-on-bar: var(--cream);
  --grain-blend: multiply;
  --grain-opacity: 0.3;
}

[data-field="mustard"] {
  --field: var(--mustard);
}
[data-field="cream"] {
  --field: var(--cream);
  --meta: oklch(36% 0.07 65);
}
[data-field="teal"] {
  --field: var(--teal-field);
  --body: var(--cream);
  --meta: var(--cream);
}

[data-theme="obscure"] {
  --field: var(--ink);
  --body: var(--cream);
  --meta: oklch(82% 0.06 86);
  --display-color: var(--cream);
  --body-on-bar: var(--cream);
  --display-on-bar: var(--ink);
  --object-color: var(--cream);
  --object-on-bar: var(--ink);
  --grain-blend: screen;
  --grain-opacity: 0.2;
}

[data-bar="brick"] {
  --bar: var(--brick);
}
[data-bar="teal"] {
  --bar: var(--teal);
}
[data-bar="mustard"] {
  --bar: var(--mustard);
  --body-on-bar: var(--ink);
}

[data-field="brick"] {
  --field: var(--brick);
  --body: var(--cream);
  --bar: var(--ink);
  --display-on-bar: var(--cream);
  --object-color: var(--ink);
  --object-on-bar: var(--cream);
  --meta: var(--cream);
  --grain-blend: multiply;
  --grain-opacity: 0.28;
}

/* Type */

.num {
  display: inline-block;
  font-stretch: 62%;
  font-weight: 900;
  font-size: clamp(3.75rem, 16vw, 8rem);
  line-height: 0.82;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--display-color);
}

.num::after {
  content: "";
  display: block;
  height: 0.11em;
  margin-top: 0.08em;
  background: currentColor;
}

.kicker {
  display: inline-block;
  font-stretch: 75%;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--meta);
}

.ornament {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem 1.1rem;
  margin-bottom: 0;
}

.ornament .kicker {
  padding-top: 0.5em;
}

.ornament--corner {
  position: absolute;
  top: var(--gutter);
  right: var(--gutter);
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  margin: 0;
}

.ornament--corner .num {
  font-size: clamp(2.5rem, 9vw, 4.5rem);
}

.ornament--corner .kicker {
  padding: 0;
  font-size: 0.75rem;
}

.title {
  font-stretch: 62%;
  font-weight: 900;
  font-size: clamp(3rem, 12.5vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.012em;
  word-spacing: 0.1em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--display-color);
  margin-top: 0.03em;
  max-width: 11ch;
}

.sub {
  font-stretch: 75%;
  font-weight: 800;
  font-size: clamp(1.35rem, 5.2vw, 2.5rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  word-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--display-color);
  margin-top: 0.55rem;
  max-width: 24ch;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin-top: 1.5rem;
  font-stretch: 75%;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--meta);
}

.notes {
  margin-top: 1rem;
  max-width: 34ch;
  font-size: 1.0625rem;
  line-height: 1.4;
}

.items {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 0.35rem 1.5rem;
}

.items li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-stretch: 62%;
  font-weight: 800;
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  line-height: 1;
  letter-spacing: -0.01em;
  word-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--display-color);
}

.items li::before {
  content: "";
  flex: none;
  width: 0.42em;
  height: 0.42em;
  background: currentColor;
}

/* Objects */

.object {
  position: absolute;
  right: -6%;
  bottom: 4svh;
  width: min(72vw, 46svh);
  aspect-ratio: 1;
  color: var(--object-color);
  fill: currentColor;
}

.object--tone {
  z-index: 3;
  color: transparent;
  --tone: var(--mustard);
}

/* Cover */

.cover {
  grid-template-rows: 1fr auto;
  --bar-w: 33%;
  --cut: polygon(0 0, var(--bar-w) 0, var(--bar-w) 100%, 0 100%);
  --cut-from: polygon(-40% 0, -7% 0, -7% 100%, -40% 100%);
  --cut-teal: polygon(0 60%, 100% 44%, 100% 58%, 0 74%);
  --cut-teal-from: polygon(-100% 60%, 0 44%, 0 58%, -100% 74%);
}

.cover .bar--teal {
  --bar: var(--teal);
  --cut: var(--cut-teal);
  --cut-from: var(--cut-teal-from);
}

.cover > .bar,
.cover::after {
  grid-row: 1 / -1;
}

.cover .stage {
  z-index: 2;
  padding-top: calc(var(--gutter) + 5.5rem);
}

.cover .stage--knock {
  z-index: 3;
}

.cover__title {
  display: grid;
  justify-items: start;
  font-stretch: 62%;
  font-weight: 900;
  line-height: 0.78;
  letter-spacing: -0.035em;
  word-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--display-color);
}

.cover__title span:nth-child(1) {
  font-size: clamp(5.5rem, 37vw, 15rem);
}

.cover__title span:nth-child(2) {
  font-size: clamp(5.5rem, 37vw, 15rem);
  margin-left: 26vw;
  margin-top: -0.05em;
}

.cover__title span:nth-child(3) {
  font-size: clamp(9rem, 58vw, 24rem);
  margin-top: -0.02em;
}

.figure {
  position: absolute;
  right: 0;
  bottom: 0;
  height: min(40svh, 90vw);
  width: auto;
  aspect-ratio: 582 / 904;
  color: var(--ink);
  z-index: 1;
}

.cover__foot {
  grid-row: 2;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 2rem;
  padding: 0.9rem var(--gutter) max(0.9rem, env(safe-area-inset-bottom));
  background: var(--cream);
  color: var(--ink);
}

.cover__date {
  font-stretch: 62%;
  font-weight: 800;
  font-size: clamp(1.25rem, 5.4vw, 1.9rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.ast {
  color: var(--brick);
}

.cover__note {
  font-size: 0.9rem;
  line-height: 1.3;
  text-wrap: balance;
  color: oklch(36% 0.07 65);
}

/* Ouverture */

[data-cut="ouverture"] {
  --cut: polygon(0 0, 9% 0, 5% 100%, 0 100%);
  --cut-from: polygon(-20% 0, -11% 0, -15% 100%, -20% 100%);
}

.ouverture .stage {
  display: grid;
  align-content: center;
  padding-block: clamp(4rem, 12vh, 8rem);
  padding-left: calc(var(--gutter) + 6%);
}

.ouverture__display {
  font-stretch: 62%;
  font-weight: 900;
  font-size: clamp(2.6rem, 10vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: -0.025em;
  word-spacing: 0.1em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--display-color);
  max-width: 14ch;
}

.ouverture__body {
  margin-top: 2rem;
  max-width: 44ch;
  font-size: clamp(1.0625rem, 1.9vw, 1.25rem);
  line-height: 1.45;
}

.index {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 2.5rem;
  font-stretch: 62%;
  font-weight: 900;
  font-size: clamp(1.6rem, 6.5vw, 2.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--display-color);
}

.index__day,
.index__night {
  display: flex;
  gap: 0.55em;
}

.index__night {
  padding: 0.28em 0.55em 0.22em;
  background: var(--ink);
  color: var(--cream);
  clip-path: polygon(0 0, 100% 0, 97% 100%, 3% 100%);
}

.stage--knock .index__night {
  background: var(--cream);
  color: var(--ink);
}

.index a {
  color: inherit;
  text-decoration: none;
}

.index a:hover,
.index a:focus-visible {
  outline: none;
  text-decoration: underline;
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.08em;
}

/* Slates */

.slate .stage {
  display: grid;
  align-content: end;
  padding-block: clamp(3rem, 9vh, 6rem);
}

.slate__day {
  font-stretch: 62%;
  font-weight: 900;
  font-size: clamp(4.25rem, 21vw, 15rem);
  line-height: 0.8;
  letter-spacing: -0.035em;
  word-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--display-color);
}

.slate__day .ast {
  font-size: 0.5em;
  vertical-align: top;
}

.slate__name {
  margin-top: 0.75rem;
  font-stretch: 75%;
  font-weight: 800;
  font-size: clamp(1.6rem, 7vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--display-color);
}

.slate__date {
  margin-top: 1.25rem;
  font-stretch: 75%;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--meta);
}

[data-cut="slate-claire"] {
  --cut: polygon(0 0, 100% 0, 100% 16%, 0 34%);
  --cut-from: polygon(-100% 0, 0 0, 0 16%, -100% 34%);
}

[data-cut="slate-obscure"] {
  --cut: polygon(58% 0, 100% 0, 100% 100%, 44% 100%);
  --cut-from: polygon(118% 0, 160% 0, 160% 100%, 104% 100%);
}

/* Sessions */

.session .stage {
  padding-bottom: 35svh;
}

[data-cut="ca"] {
  --cut: polygon(0 0, 30% 0, 20% 100%, 0 100%);
  --cut-from: polygon(-40% 0, -10% 0, -20% 100%, -40% 100%);
}

[data-cut="cb"] {
  --cut: polygon(0 24%, 100% 10%, 100% 22%, 0 36%);
  --cut-from: polygon(-100% 24%, 0 10%, 0 22%, -100% 36%);
}

[data-cut="cc"] {
  --cut: polygon(0 64%, 100% 64%, 100% 74%, 0 74%);
  --cut-from: polygon(-100% 64%, 0 64%, 0 74%, -100% 74%);
}

[data-cut="cd"] {
  --cut: polygon(52% 0, 100% 0, 100% 24%, 52% 0);
  --cut-from: polygon(152% 0, 200% 0, 200% 24%, 152% 0);
}

[data-cut="oa"] {
  --cut: polygon(0 74%, 100% 50%, 100% 70%, 0 94%);
  --cut-from: polygon(-100% 74%, 0 50%, 0 70%, -100% 94%);
}

[data-cut="ob"] {
  --cut: polygon(0 53%, 100% 72%, 100% 100%, 0 100%);
  --cut-from: polygon(100% 70%, 200% 52%, 200% 100%, 100% 100%);
}

[data-cut="oc"] {
  --cut: polygon(18% 100%, 100% 42%, 100% 100%, 18% 100%);
  --cut-from: polygon(118% 100%, 200% 42%, 200% 100%, 118% 100%);
}

[data-cut="od"] {
  --cut: polygon(0 54%, 100% 54%, 100% 92%, 0 92%);
  --cut-from: polygon(-100% 54%, 0 54%, 0 92%, -100% 92%);
}

/* End card */

[data-cut="endcard"] {
  --cut: polygon(0 78%, 100% 56%, 100% 68%, 0 90%);
  --cut-from: polygon(-100% 78%, 0 56%, 0 68%, -100% 90%);
}

.endcard .stage {
  padding-bottom: 40svh;
}

.endcard .title {
  max-width: 12ch;
}

.endcard .object {
  bottom: max(7svh, 3.5rem);
  width: min(64vw, 31svh);
}

.rule {
  margin-top: 1.75rem;
  max-width: 38ch;
  font-size: 1.0625rem;
  line-height: 1.45;
}

.rule ol {
  margin: 1rem 0;
  display: grid;
  gap: 0.4rem;
  counter-reset: rule;
}

.rule li {
  counter-increment: rule;
  position: relative;
  padding-left: 2em;
}

.rule li::before {
  content: counter(rule) ".";
  position: absolute;
  left: 0;
  top: 0.05em;
  font-stretch: 62%;
  font-weight: 900;
  font-size: 1.5em;
  line-height: 0.8;
  color: var(--display-color);
}

.rule b {
  font-stretch: 75%;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.colophon {
  z-index: 3;
  align-self: end;
  display: flex;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1rem var(--gutter) max(1rem, env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--cream);
  font-stretch: 75%;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Fallback when the programme cannot load */

.fallback .stage {
  display: grid;
  align-content: center;
  gap: 1rem;
}

/* Desktop: the same frames at stage aspect, bars re-sliced */

@media (min-width: 900px) and (orientation: landscape) {
  .session .stage,
  .endcard .stage {
    padding-bottom: var(--gutter);
    padding-right: 40%;
    display: grid;
    align-content: center;
  }

  .object,
  .endcard .object {
    right: 5%;
    bottom: auto;
    top: 50%;
    width: min(38vw, 72vh);
    transform: translateY(-50%);
  }

  .endcard .title {
    max-width: 12ch;
  }

  .num {
    font-size: clamp(6rem, 12vw, 11rem);
  }

  .title {
    font-size: clamp(4.5rem, 8.4vw, 9.5rem);
  }

  .notes {
    font-size: 1.125rem;
    max-width: 40ch;
  }

  .items {
    grid-template-columns: repeat(2, max-content);
    column-gap: 2.5rem;
  }

  .cover {
    --bar-w: 21%;
    --cut-teal: polygon(0 66%, 100% 40%, 100% 54%, 0 80%);
    --cut-teal-from: polygon(-100% 66%, 0 40%, 0 54%, -100% 80%);
  }

  .cover .stage {
    padding-top: calc(var(--gutter) + 2rem);
    display: grid;
    align-content: center;
  }

  .cover__title {
    grid-template-columns: max-content max-content;
    align-items: end;
  }

  .cover__title span:nth-child(1),
  .cover__title span:nth-child(2) {
    font-size: min(15vw, 27vh);
    margin: 0;
  }

  .cover__title span:nth-child(2) {
    margin-left: 0.18em;
  }

  .cover__title span:nth-child(3) {
    grid-column: 1 / -1;
    font-size: min(34vw, 60vh);
    margin-top: -0.04em;
  }

  .figure {
    right: 2%;
    height: min(72vh, 38vw);
  }

  .cover__foot {
    padding-block: 1.1rem;
  }

  .ouverture .stage {
    padding-left: calc(var(--gutter) + 8%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 4rem;
    align-content: center;
    align-items: start;
  }

  .ouverture__display {
    grid-row: 1 / -1;
    font-size: clamp(4rem, 6.8vw, 7.5rem);
  }

  .ouverture__body {
    margin-top: 0.5rem;
  }

  .index {
    margin-top: 1.5rem;
  }

  .slate .stage {
    padding-right: 30%;
  }

  [data-cut="slate-claire"] {
    --cut: polygon(0 0, 100% 0, 100% 22%, 0 46%);
    --cut-from: polygon(-100% 0, 0 0, 0 22%, -100% 46%);
  }

  [data-cut="ca"] {
    --cut: polygon(0 0, 19% 0, 13% 100%, 0 100%);
    --cut-from: polygon(-30% 0, -11% 0, -17% 100%, -30% 100%);
  }

  [data-cut="cb"] {
    --cut: polygon(0 30%, 100% 12%, 100% 26%, 0 44%);
    --cut-from: polygon(-100% 30%, 0 12%, 0 26%, -100% 44%);
  }

  [data-cut="cc"] {
    --cut: polygon(0 44%, 100% 44%, 100% 56%, 0 56%);
    --cut-from: polygon(-100% 44%, 0 44%, 0 56%, -100% 56%);
  }

  [data-cut="cd"] {
    --cut: polygon(70% 0, 100% 0, 100% 40%, 70% 0);
    --cut-from: polygon(170% 0, 200% 0, 200% 40%, 170% 0);
  }

  [data-cut="oa"] {
    --cut: polygon(44% 100%, 100% 18%, 100% 48%, 62% 100%);
    --cut-from: polygon(144% 100%, 200% 18%, 200% 48%, 162% 100%);
  }

  [data-cut="ob"] {
    --cut: polygon(49% 0, 100% 0, 100% 100%, 96% 100%);
    --cut-from: polygon(164% 0, 200% 0, 200% 100%, 150% 100%);
  }

  [data-cut="oc"] {
    --cut: polygon(40% 100%, 100% 8%, 100% 100%, 40% 100%);
    --cut-from: polygon(140% 100%, 200% 8%, 200% 100%, 140% 100%);
  }

  [data-cut="od"] {
    --cut: polygon(50% 30%, 100% 30%, 100% 70%, 50% 70%);
    --cut-from: polygon(150% 30%, 200% 30%, 200% 70%, 150% 70%);
  }

  [data-cut="endcard"] {
    --cut: polygon(46% 100%, 100% 26%, 100% 42%, 60% 100%);
    --cut-from: polygon(146% 100%, 200% 26%, 200% 42%, 160% 100%);
  }
}

/* The cut: every frame enters as a freeze-frame. Motion only when JS confirmed
   IntersectionObserver and no reduced-motion preference. */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  html.motion .frame:not(.is-on) .stage {
    opacity: 0;
  }

  html.motion .frame.is-on .bar,
  html.motion .frame.is-on .stage--knock {
    animation: cut 0.7s var(--ease-out-expo) both;
  }

  html.motion .frame.is-on .num {
    animation: stamp 0.42s var(--ease-out-expo) 0.14s both;
  }

  html.motion .frame.is-on .items[data-list="gauntlet"] li {
    animation: rise 0.45s var(--ease-out-expo) calc(0.2s + var(--i) * 70ms) both;
  }

  @keyframes cut {
    from {
      clip-path: var(--cut-from);
    }
    to {
      clip-path: var(--cut);
    }
  }

  @keyframes stamp {
    from {
      transform: scale(1.5) rotate(-2deg);
      opacity: 0;
    }
    45% {
      opacity: 1;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }

  @keyframes rise {
    from {
      transform: translateX(-0.6em);
      opacity: 0;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
}
