/* The reel: a child page as a handful of torn sheets lashed together, scrolling
 * through the same cardboard frame the alley is staged in.
 *
 * The home page is a stage you look at. A child page has to be read, and a
 * 16:9 box you cannot scroll is the wrong shape for reading, so the frame stops
 * being the edge of a stage and becomes the edge of the *window*: it is fixed
 * to the viewport and the paper runs behind it. That keeps the one thing the
 * redesign is built on -- you are looking into a cardboard box -- while letting
 * the content be as long as it needs to be.
 *
 * The paper itself is made by tools/paper.py. Its grain ships as a seamless
 * tile and the colour stays here, so the stock can be warmed or cooled without
 * regenerating anything. The torn edges come from paper.gen.css and the TV's
 * screen position from tv.gen.css; both are generated because both are
 * properties of the art, and this project has been bitten three times by a
 * layout constant that quietly stopped being true when the art was re-pulled.
 */

:root {
  /* The rails are a fixed share of the viewport width up to a cap: without the
     cap a 2560px monitor gets a 260px slab of cardboard across the top. */
  --rail: clamp(38px, 9.6vw, 120px);
  --rail-side: clamp(16px, 4vw, 58px);

  /* The sheets stand apart with daylight between them and are taped across the
     gap. Overlapping them made the reel read as one long thing that happened to
     have lines across it; separated, it reads as a stack of pages somebody put
     in order by hand. */
  --sheet-gap: clamp(30px, 4.4vw, 52px);
  --tape-reach: clamp(18px, 2.9vw, 29px);   /* how far onto each sheet it sticks */

  --paper: #d5cdb9;
  --paper-ink: #241f18;
  --paper-dim: #5c5142;
  --paper-link: #8a2f12;
}

/* --- the frame ---------------------------------------------------------- */

/* The same curtain that hangs behind the alley, fixed and well down, so the
   paper scrolls through a room rather than across a void. Flat black behind the
   sheets made them read as cards on a web page; a lit backdrop makes them read
   as paper in the same box the stage is in. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.backdrop img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(.38) saturate(.7);
}
.backdrop::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(74% 58% at 50% 26%, transparent 26%, rgba(0,0,0,.62) 100%);
}

.proscenium {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;    /* it is a frame, not a lid */
}
.proscenium img { position: absolute; display: block; filter: none; }

/* object-fit: cover rather than the stage's natural height, because here the
   rail spans the whole viewport and has to be allowed a maximum. Anchoring to
   the outer edge keeps the cut side of the cardboard against the glass. */
.proscenium .rail-t,
.proscenium .rail-b { left: 0; width: 100%; height: var(--rail); object-fit: cover; }
.proscenium .rail-t { top: 0;    object-position: center top; }
.proscenium .rail-b { bottom: 0; object-position: center bottom; }
.proscenium .rail-l,
.proscenium .rail-r { top: 0; height: 100%; width: var(--rail-side); object-fit: fill; }
.proscenium .rail-l { left: 0; }
.proscenium .rail-r { right: 0; transform: scaleX(-1); }

/* The marquee is home, the same as it is on the stage, and it lives on the top
   rail for the same reason: that is where the sign is nailed. */
.reel-home {
  position: fixed;
  z-index: 25;
  left: 50%;
  top: calc(var(--rail) * .06);
  transform: translateX(-50%);
  border-bottom: 0;
  line-height: 0;
}
.reel-home img {
  display: block; filter: none;
  width: clamp(150px, 34vw, 320px); height: auto;
}
.reel-home:hover { opacity: 1; }
.reel-home:focus-visible { outline: 3px solid #ffd27a; outline-offset: 4px; }

/* The other props stand on the bottom rail. Keeping them in the frame rather
   than at the end of the page means the navigation is never scrolled away,
   and it keeps the rule the whole site runs on: the props ARE the nav. */
.prop-rail {
  position: fixed;
  z-index: 25;
  left: 0; right: 0;
  bottom: calc(var(--rail) * .14);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1.1rem, 6vw, 3.4rem);
  padding-inline: calc(var(--rail-side) + .6rem);
}
.prop-rail a { display: block; border-bottom: 0; line-height: 0; }
.prop-rail a:hover { opacity: 1; }
.prop-rail a:focus-visible { outline: 3px solid #ffd27a; outline-offset: 4px; }
.prop-rail img {
  display: block; width: auto;
  /* Sized from the budget rather than by eye, because the props are labelled
     and a label too small to read is not navigation.

     The tightest rail is ride-info's -- flyer, bunting, can, tin cans -- whose
     aspect ratios sum to 8.78. At 375px the frame leaves about 335px between
     the side rails, so 8.78h + 3 gaps <= 335 puts the ceiling near 35px, which
     is what the vw term lands on there. Re-run that sum if a prop is ever
     re-pulled at a different shape; this is exactly the kind of constant that
     has quietly expired on this project before. */
  height: clamp(30px, 9.2vw, 76px);
  /* beats site.css's grayscale on every <img>, and lifts the props off the
     rail they are standing on. */
  filter: drop-shadow(3px 6px 7px rgba(0,0,0,.55));
}

/* On a phone the gap is what gives, not the props. */
@media (max-width: 560px) {
  .prop-rail { gap: clamp(.4rem, 2.4vw, .7rem); padding-inline: calc(var(--rail-side) + .3rem); }
}

/* --- the paper ---------------------------------------------------------- */

.reel {
  position: relative;
  z-index: 1;
  max-width: none;
  margin: 0 auto;
  padding: calc(var(--rail) + clamp(1rem, 3vw, 2.4rem))
           calc(var(--rail-side) + clamp(.7rem, 2.5vw, 1.6rem))
           calc(var(--rail) + clamp(3rem, 9vw, 6rem));
}

/* A leaf is the sheet plus everything that hangs off it. The sheet is clipped
   to its torn outline, and a clip-path takes the element's pseudo-elements with
   it -- so the twine has to be attached out here or it gets cut off at the
   tear. */
.leaf {
  position: relative;
  width: min(100%, 640px);
  margin: 0 auto;
  rotate: var(--tilt, 0deg);
}
.leaf + .leaf { margin-top: var(--sheet-gap); }

.leaf:nth-child(odd)  { --tilt: -.45deg; }
.leaf:nth-child(even) { --tilt:  .4deg;  }

.sheet {
  position: relative;
  /* Generous top and bottom because that is where the tape lands, and a line
     of type under a piece of tape is a line of type nobody reads. */
  padding: clamp(2.1rem, 5vw, 3rem) clamp(1.2rem, 4vw, 2.4rem);
  color: var(--paper-ink);
  background: var(--paper) url("/Images/art/paper.webp") repeat;
  background-size: 310px 310px;
  background-blend-mode: multiply;
  /* box-shadow would be clipped away with the rest of the box, so the lift
     comes from a filter, which reads the clipped alpha instead. Same trick the
     stage uses, same light direction. */
  filter: drop-shadow(5px 9px 10px rgba(0,0,0,.5))
          drop-shadow(14px 22px 30px rgba(0,0,0,.42));
}

/* Taped across the gap, two pieces a joint. Three pieces of tape were drawn
   and they are cycled at varying angles, because the giveaway that nothing was
   actually stuck down is a row of identical, perfectly square pieces.

   The tape belongs to the lower sheet and reaches up onto the one above. That
   is also the right paint order for free: a later leaf draws over an earlier
   one, so the tape lands on top of the sheet it is holding. */
.leaf + .leaf::before,
.leaf + .leaf::after {
  content: "";
  position: absolute;
  z-index: 4;
  top: calc(-1 * (var(--sheet-gap) + var(--tape-reach)));
  height: calc(var(--sheet-gap) + var(--tape-reach) * 2);
  width: clamp(54px, 8vw, 94px);
  background: var(--tape) center / 100% 100% no-repeat;
  filter: drop-shadow(2px 3px 3px rgba(0,0,0,.45));
}
.leaf + .leaf::before { left: 11%;  --tape: url("/Images/art/tape-1.webp"); rotate: -6deg; }
.leaf + .leaf::after  { right: 13%; --tape: url("/Images/art/tape-2.webp"); rotate: 5deg; }

/* Same specificity as the two above, so these have to come after them. */
.leaf:nth-child(3n)::before   { --tape: url("/Images/art/tape-3.webp"); rotate: 4deg; }
.leaf:nth-child(4n)::before   { --tape: url("/Images/art/tape-2.webp"); rotate: -9deg; }
.leaf:nth-child(3n+1)::after  { --tape: url("/Images/art/tape-1.webp"); rotate: -7deg; }
.leaf:nth-child(5n)::after    { --tape: url("/Images/art/tape-3.webp"); rotate: 9deg; }

/* --- type on paper ------------------------------------------------------ */
/* Headings in the same hand that wrote on the props; body in something you can
   actually read a paragraph of. The display face is the site's voice, but a
   page of ride rules is the one place on this site where being legible beats
   being in character. */

.sheet h2, .sheet h3 {
  font-family: "Reenie Beanie", "Bradley Hand", "Segoe Script", cursive;
  color: #17120c;
  margin: 0 0 .5rem;
  line-height: 1.05;
  text-wrap: balance;
  letter-spacing: .01em;
}
.sheet h2 { font-size: clamp(1.9rem, 5.6vw, 2.9rem); }
.sheet h3 { font-size: clamp(1.55rem, 4.4vw, 2.2rem); }
.sheet h2:first-child, .sheet h3:first-child { margin-top: 0; }

.sheet p, .sheet li {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  line-height: 1.58;
  margin: 0 0 .85rem;
  color: var(--paper-ink);
}
.sheet p:last-child { margin-bottom: 0; }
.sheet strong { color: #141018; }

.sheet a {
  color: var(--paper-link);
  border-bottom: 1px solid currentColor;
}
.sheet a:hover { opacity: 1; border-bottom-width: 2px; }

.sheet img {
  display: block; width: 100%; height: auto; filter: none;
  margin-top: .9rem;
}
/* A screenshot is the one genuinely rectangular, genuinely digital thing that
   has to appear on a sheet of torn paper. Trying to disguise it would be worse
   than admitting it, so it is admitted: a print, with its white border, stuck
   on at an angle. */
.sheet img.photo {
  width: calc(100% - 16px);
  margin: 1.2rem auto .4rem;
  rotate: -.7deg;
  box-shadow: 0 0 0 8px #ece6d6, 5px 9px 11px rgba(0,0,0,.4);
}
/* The Sauce poster is already a torn sheet with its own edges; framing it
   would put a print border round a poster. */
.sheet img.pasted {
  width: min(100%, 300px);
  margin: 1.2rem auto .9rem;
  rotate: 1.4deg;
  filter: drop-shadow(3px 6px 7px rgba(0,0,0,.4));
}
/* site.css reveals colour on hover for page images. On paper the image is
   already shown as it is, so there is nothing to reveal and the transition
   just makes it twitch. Scoped to the sheets so it cannot reach the television,
   whose filter is its shadow. */
.sheet img:hover { filter: none; }

/* The lede sheet: the one line that says what this page is. */
.sheet.lede { text-align: center; }
.sheet.lede h1 {
  font-family: "Reenie Beanie", "Bradley Hand", "Segoe Script", cursive;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: .95;
  margin: 0 0 .3rem;
  color: #17120c;
}
.sheet.lede .sub {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--paper-dim);
  margin: 0;
}

/* --- the television ----------------------------------------------------- */
/* ride-info's opener, which needs a hole in it rather than a sway. */
/* The video is not on the paper: it is in a cardboard set standing in front of
   the first sheet, which is why the cabinet sits outside .sheet entirely. */

.tv {
  position: relative;
  width: min(100%, 620px);
  margin: 0 auto;
}
.tv-cab {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%; height: auto;
  filter: drop-shadow(6px 11px 12px rgba(0,0,0,.55))
          drop-shadow(18px 28px 36px rgba(0,0,0,.45));
  /* A transparent pixel still catches a click, and the whole middle of this
     image is transparent -- without this the cabinet eats every press meant
     for the player underneath it. */
  pointer-events: none;
}
.tv .hls-player {
  position: absolute;
  z-index: 1;
  left: var(--tv-x); top: var(--tv-y);
  width: var(--tv-w); height: var(--tv-h);
}
/* player.css is not linked here: it redefines --bg, body and a bare `video`
   rule, which would fight both site.css and this file. The handful of rules the
   player actually needs are cheaper to restate than to untangle. */
.tv .player-wrap { position: relative; width: 100%; height: 100%; background: #000; overflow: hidden; }
.tv video { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; filter: none; }
.tv .hls-badge { position: absolute; right: .5rem; top: .4rem; font-size: .72rem; color: #b9c4cf; }

/* --- the opener --------------------------------------------------------- */
/* Every reel starts on its own prop, standing in the room before the paper
   begins: the television here, the bunting on sponsors, the can on why-10, the
   tin cans on contact. It is the page saying where you landed, in the same
   language the stage uses, and it is why the big header band the old child
   pages had is gone.

   The caption goes above the prop, not below: anything under it lands behind
   the prop rail at rest and is never seen. */
.opener { margin: 0 0 clamp(1.6rem, 4vw, 2.8rem); }
.opener-caption {
  font-family: "Reenie Beanie", "Bradley Hand", "Segoe Script", cursive;
  text-align: center;
  color: #d8cdb6;
  font-size: clamp(1.2rem, 3.4vw, 1.7rem);
  margin: 0 0 .5rem;
  opacity: .8;
}

.opener-prop {
  display: block;
  margin: 0 auto;
  width: var(--w, min(100%, 420px));
  height: auto;
  filter: drop-shadow(6px 11px 12px rgba(0,0,0,.55))
          drop-shadow(18px 28px 36px rgba(0,0,0,.45));
  /* Idle sway, the same gesture the props have on the stage. The pivot sits
     where the thing is actually held -- off the bottom of the frame for
     something on a stick -- so a small angle reads as an arc rather than as the
     prop twisting on the spot. */
  transform-origin: 50% var(--pivot, 50%);
  animation: sway var(--t, 9s) ease-in-out infinite alternate;
}
@keyframes sway {
  from { rotate: calc(var(--sway, 1.2deg) * -1); }
  to   { rotate: var(--sway, 1.2deg); }
}

.opener-prop.pennants { --w: min(100%, 700px); --pivot: -8%;  --sway: .7deg;  --t: 11.3s; }
.opener-prop.can      { --w: min(40%, 160px);  --pivot: 320%; --sway: 1.7deg; --t: 7.4s; }
.opener-prop.tincans  { --w: min(100%, 440px); --pivot: 170%; --sway: 1.1deg; --t: 9.6s; }

/* --- the call to action ------------------------------------------------- */

.sheet .cta {
  display: block;
  text-align: center;
  font-family: "Reenie Beanie", "Bradley Hand", "Segoe Script", cursive;
  font-size: clamp(1.8rem, 5.5vw, 2.6rem);
  color: #8a2f12;
  border: 3px solid currentColor;
  border-radius: 2px;
  padding: .35em .6em;
  rotate: -.8deg;
  line-height: 1;
}
.sheet .cta:hover { border-bottom-width: 3px; }
.sheet .cta-note {
  text-align: center;
  color: var(--paper-dim);
  margin: .7rem 0 0;
  font-size: clamp(.85rem, 2.2vw, .98rem);
}

.sheet .social {
  display: flex; flex-wrap: wrap; gap: .8rem 1.4rem;
  align-items: center; justify-content: center;
  margin: 0;
}
.sheet .social a { border-bottom: 1px solid currentColor; }

/* --- things that live on a sheet ---------------------------------------- */
/* site.css styles all of these for the dark page, which is the opposite ground
   from a sheet of paper: dark input wells, pale rules, a light-blue success
   message. Every one of them has to be restated here rather than tweaked,
   because the background flipped.  */

.sheet ul, .sheet ol { margin: .5rem 0 .9rem; padding-left: 1.35rem; }
.sheet li { margin-bottom: .4rem; }

.sheet table {
  width: 100%;
  border-collapse: collapse;
  margin: .4rem 0 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: clamp(.95rem, 2.4vw, 1.05rem);
}
.sheet th, .sheet td {
  padding: .45rem .5rem;
  border-bottom: 1px solid rgba(40, 30, 20, .28);
}
.sheet th { text-align: left; color: var(--paper-dim); font-weight: 700; }
.sheet th:last-child, .sheet td:last-child { text-align: right; }
.sheet tbody tr:last-child td { border-bottom: 0; }

/* --- the contact form, on paper ----------------------------------------- */

.sheet .field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .9rem;
}
.sheet .field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.sheet .field span {
  font-family: "Reenie Beanie", "Bradley Hand", "Segoe Script", cursive;
  font-size: clamp(1.2rem, 3.2vw, 1.45rem);
  font-weight: 400;
  color: #17120c;
}
.sheet .field input,
.sheet .field textarea {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 1rem;
  color: var(--paper-ink);
  background: rgba(255, 255, 255, .36);
  border: 1px solid rgba(40, 30, 20, .42);
  border-radius: 2px;
  padding: .52rem .6rem;
  width: 100%;
}
.sheet .field input::placeholder,
.sheet .field textarea::placeholder { color: rgba(60, 50, 38, .5); }
.sheet .field input:focus,
.sheet .field textarea:focus { outline: 2px solid var(--paper-link); outline-offset: 1px; }
.sheet .field small { color: var(--paper-dim); font-size: .85rem; }

.sheet .step-actions { display: flex; justify-content: flex-start; margin-top: .4rem; }
.sheet .btn.primary {
  font-family: "Reenie Beanie", "Bradley Hand", "Segoe Script", cursive;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  color: var(--paper-link);
  background: transparent;
  border: 3px solid currentColor;
  border-radius: 2px;
  padding: .2em .7em;
  rotate: -.9deg;
  line-height: 1.1;
  cursor: pointer;
}
.sheet .btn.primary:hover { border-color: currentColor; background: rgba(138, 47, 18, .07); }
.sheet .btn.primary:disabled { opacity: .5; cursor: default; }

.sheet .status { font-family: system-ui, sans-serif; margin-top: .8rem; }
.sheet .status.ok  { color: #2f6b35; }
.sheet .status.bad { color: #8a2f12; }

/* --- a sponsor, on paper ------------------------------------------------ */
/* The logo is somebody else's mark and keeps its own colour and background --
   the same rule the Sauce poster is held to. It is a card stuck on the sheet,
   so it gets a card's edge and a shadow instead of being bled into the paper. */

.sponsor-entry { display: grid; grid-template-columns: 200px 1fr; gap: 1.3rem; align-items: start; }
.sponsor-logo {
  display: grid; place-items: center;
  min-height: 118px;
  padding: .9rem;
  background: #efeade;
  border: 1px solid rgba(40, 30, 20, .3);
  border-bottom: 1px solid rgba(40, 30, 20, .3);
  rotate: -1.3deg;
  box-shadow: 3px 6px 9px rgba(0, 0, 0, .32);
}
.sponsor-logo:hover { opacity: 1; }
.sponsor-logo img { max-width: 100%; max-height: 108px; width: auto; height: auto; margin: 0; filter: none; }
.sponsor-entry h3 { margin-bottom: .25rem; }
.sponsor-what { margin-bottom: .3rem !important; font-weight: 600; }
.sponsor-address { color: var(--paper-dim); margin-bottom: .6rem !important; }
@media (max-width: 640px) {
  .sponsor-entry { grid-template-columns: 1fr; gap: 1rem; }
  .sponsor-logo { justify-self: start; }
}

/* --- hover: only the things that go somewhere --------------------------
   The same rule as the stage, for the same reason: gated behind hover:hover so
   a phone carries no hover state and a tap navigates first time rather than
   painting a hover and waiting for a second tap. */
@media (hover: hover) {
  .prop-rail img, .reel-home img { transition: filter .18s ease; }
  .prop-rail a:hover img,
  .prop-rail a:focus-visible img {
    filter: drop-shadow(3px 6px 7px rgba(0,0,0,.55)) brightness(1.22) contrast(1.03);
  }
  .reel-home:hover img,
  .reel-home:focus-visible img { filter: brightness(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .leaf { rotate: 0deg; }
  .opener-prop { animation: none; }
}
