/* Ziggy Games. A dark screening room for the film, and a yardage book on cream stock for the plan. */
:root {
  --night: #0a0b09;
  --night-2: #12140f;
  --text: #eee6d4;
  --dim: rgba(238, 230, 212, 0.62);
  --faint: rgba(238, 230, 212, 0.16);
  --gold: #e3b04c;
  --gold-2: #f0c46a;
  --paper: #ebe3d0;
  --paper-2: #e2d7bf;
  --ink: #1e2820;
  --ink-2: #4c554b;
  --pencil: #b4412a;
  --fw: #c6d2a8;
  --grn: #a9c188;
  --water: #b3cacc;
  --sand: #efe2bd;
  --serif: 'Bodoni Moda', 'Didot', Georgia, serif;
  --sans: 'Schibsted Grotesk', system-ui, sans-serif;
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --gutter: clamp(18px, 4.2vw, 64px);
  --max: 1320px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

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

html {
  background: var(--night);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img,
video,
svg {
  display: block;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 20;
  background: var(--text);
  color: var(--night);
  padding: 8px 12px;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-variation-settings: 'opsz' 96;
  letter-spacing: -0.02em;
  margin: 0;
}

/* ---- header ------------------------------------------------------------- */
.top {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  --bar: clamp(60px, 8.4vh, 84px);
}
/* The Ziggy Games logo: two inks, slightly off register */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.bolt {
  width: 30px;
  height: 30px;
  overflow: visible;
}
.bolt-b {
  fill: #3b74e6;
  transform: translate(2.5px, 2.5px);
}
.bolt-a {
  fill: #ef4a2f;
}
.word {
  font: 800 22px/1 'Fraunces', Georgia, serif;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
  letter-spacing: -0.02em;
  color: var(--text);
}
.word .dot {
  color: #ef4a2f;
}
.top nav {
  display: flex;
  gap: clamp(16px, 2.6vw, 36px);
  font-size: 14px;
  letter-spacing: 0.01em;
}
.top nav a {
  text-decoration: none;
  color: var(--dim);
  transition: color 160ms ease;
}
.top nav a:hover {
  color: var(--text);
}

/* ---- opening: the film ------------------------------------------------------- */
.opening {
  --bar: clamp(60px, 8.4vh, 84px);
  --titles: clamp(200px, 27vh, 260px);
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: var(--bar) minmax(0, 1fr) auto;
  background: #060705;
}
.frame {
  grid-row: 2;
  position: relative;
  overflow: hidden;
  min-height: 280px;
  max-height: calc(100vw / 2.1);
  align-self: center;
  width: 100%;
  height: 100%;
  background: #000;
  isolation: isolate;
}
.poster,
.poster img,
.film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.film {
  opacity: 0;
  transition: opacity 900ms ease;
}
.film.on {
  opacity: 1;
}
/* Grain lives inside the frame (absolute, never a fixed full-screen layer). */
.grain {
  position: absolute;
  inset: -40px;
  pointer-events: none;
  opacity: 0.1;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.45);
}

/* Broadcast lower third, kept in step with the shot on screen by film.js */
.card {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  bottom: clamp(16px, 3vh, 30px);
  color: #f4efe3;
  font: 600 15px/1 var(--cond);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: opacity 380ms ease, translate 520ms var(--ease);
}
.card.out {
  opacity: 0;
  translate: -14px 0;
}
.card-top {
  display: flex;
}
.card-top > span {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 9px 13px 8px;
  background: rgba(8, 10, 8, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.card-top > span + span {
  border-left: 1px solid rgba(244, 239, 227, 0.14);
}
.card b {
  font-weight: 600;
  font-size: 1.25em;
  color: #fff;
}
.card .card-hole {
  background: var(--gold);
  color: #16140e;
}
.card .card-hole b {
  color: #16140e;
}
.card-sub {
  display: inline-flex;
  gap: 12px;
  margin-top: 2px;
  padding: 6px 13px 5px;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  background: rgba(8, 10, 8, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(244, 239, 227, 0.78);
}
.card-time {
  color: var(--gold-2);
}

.titles {
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: end;
  gap: 20px clamp(28px, 4vw, 72px);
  padding: clamp(24px, 4vh, 44px) var(--gutter) clamp(34px, 6.5vh, 68px);
}
h1 {
  font-size: clamp(54px, 7.6vw, 124px);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: -0.08em;
}
.deck p {
  margin: 0 0 22px;
  max-width: 40ch;
  color: var(--dim);
  font-size: clamp(16px, 1.25vw, 18px);
  line-height: 1.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 24px;
  background: var(--gold);
  color: #17140d;
  font: 600 16px/1 var(--sans);
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background-color 180ms ease;
}
.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  transition: translate 240ms var(--ease);
}
.btn:hover {
  background: var(--gold-2);
}
.btn:hover svg {
  translate: 4px 0;
}
.btn:active {
  translate: 0 1px;
}

/* ---- note ------------------------------------------------------------------ */
.note {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(80px, 13vw, 180px) var(--gutter);
}
.note p {
  margin: 0;
  max-width: 24ch;
  font: 400 clamp(30px, 3.9vw, 58px) / 1.12 var(--serif);
  font-variation-settings: 'opsz' 72;
  letter-spacing: -0.015em;
}

/* ---- plan: the yardage book ----------------------------------------------- */
.plan {
  background: var(--paper);
  color: var(--ink);
  padding: clamp(64px, 9vw, 128px) var(--gutter) clamp(56px, 7vw, 96px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
  scroll-margin-top: 0;
}
.plan-copy {
  position: sticky;
  top: 40px;
  max-width: 34ch;
}
.plan h2,
.picture h2,
.short h2,
.next h2 {
  font-size: clamp(38px, 4.4vw, 66px);
  line-height: 1;
  margin-bottom: 26px;
}
.plan-copy p {
  margin: 0 0 16px;
  color: var(--ink-2);
}
.book {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 20px);
}
.leaf {
  background: #f4eedf;
  padding: 18px 16px 12px;
  box-shadow: 0 1px 0 rgba(30, 40, 32, 0.08), 0 18px 30px -24px rgba(30, 40, 32, 0.5);
}
.leaf:nth-child(2) {
  translate: 0 36px;
}
.leaf-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(30, 40, 32, 0.22);
}
.leaf-num {
  grid-row: span 2;
  font: 500 58px/0.8 var(--serif);
  font-variation-settings: 'opsz' 96;
}
.leaf-par {
  font: 600 15px/1 var(--cond);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tees {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  font: 500 14px/1.2 var(--cond);
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.tees li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tees li::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tee);
  box-shadow: inset 0 0 0 1px rgba(30, 40, 32, 0.45);
}
.book-note {
  grid-column: 2;
  margin: 44px 0 0;
  font-size: 14px;
  color: var(--ink-2);
}

/* Hole plans (generated by scripts/film/plan-svg.mjs) */
.hole-plan {
  width: 100%;
  height: auto;
  margin-top: 8px;
  overflow: hidden;
}
.hole-plan .trees circle {
  fill: rgba(50, 74, 48, 0.2);
  stroke: rgba(30, 40, 32, 0.55);
  stroke-width: 0.7;
}
.hole-plan .trees .pine {
  fill: rgba(34, 58, 40, 0.3);
}
.hole-plan .native {
  fill: rgba(150, 140, 90, 0.16);
  stroke: rgba(30, 40, 32, 0.4);
  stroke-width: 0.7;
  stroke-dasharray: 2 3;
}
.hole-plan .cart {
  fill: none;
  stroke: rgba(30, 40, 32, 0.45);
  stroke-width: 1;
  stroke-dasharray: 5 3;
}
.hole-plan .draw {
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-linejoin: round;
}
.hole-plan .fw {
  fill: var(--fw);
}
.hole-plan .green {
  fill: var(--grn);
  stroke-width: 1.3;
}
.hole-plan .bunker {
  fill: var(--sand);
}
.hole-plan .water {
  fill: var(--water);
}
.hole-plan .tee {
  fill: #f4eedf;
  stroke: var(--ink);
  stroke-width: 0.9;
}
.hole-plan .play {
  fill: none;
  stroke: var(--pencil);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
}
.hole-plan .play-mask {
  display: none;
}
.hole-plan .lz {
  fill: none;
  stroke: var(--pencil);
  stroke-width: 1.2;
}
.hole-plan .flag path {
  stroke: var(--ink);
  stroke-width: 1.2;
  fill: none;
}
.hole-plan .flag .pennant {
  fill: var(--pencil);
  stroke: none;
}
.hole-plan .flag circle {
  fill: var(--ink);
}
.hole-plan text {
  font: 600 15px var(--cond);
  letter-spacing: 0.04em;
  fill: var(--pencil);
}
.hole-plan .scale path {
  stroke: var(--ink-2);
  stroke-width: 1;
  fill: none;
}
.hole-plan .scale text {
  font-size: 12px;
  fill: var(--ink-2);
  font-weight: 500;
}

/* Draw the plans in when they scroll into view */
@media (prefers-reduced-motion: no-preference) {
  .js .hole-plan .draw {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    fill-opacity: 0;
    transition: stroke-dashoffset 1400ms var(--ease), fill-opacity 700ms ease 900ms;
  }
  .js .hole-plan .play,
  .js .hole-plan .lz,
  .js .hole-plan .flag,
  .js .hole-plan text:not(.scale text) {
    opacity: 0;
    transition: opacity 600ms ease 1300ms;
  }
  .js .leaf.seen .hole-plan .draw {
    stroke-dashoffset: 0;
    fill-opacity: 1;
  }
  .js .leaf.seen .hole-plan .play,
  .js .leaf.seen .hole-plan .lz,
  .js .leaf.seen .hole-plan .flag,
  .js .leaf.seen .hole-plan text {
    opacity: 1;
  }
  .js .leaf:nth-child(2) .hole-plan * {
    transition-delay: 200ms;
  }
}

/* ---- picture ------------------------------------------------------------------ */
.picture {
  padding: 0 0 clamp(80px, 10vw, 150px);
}
.wide {
  margin: 0;
  background: #000;
  padding: clamp(28px, 5vw, 64px) 0 0;
}
.wide img {
  width: 100%;
  height: auto;
  aspect-ratio: 2.4;
  object-fit: cover;
}
.wide figcaption,
.sheet figcaption {
  font: 500 14px/1.3 var(--cond);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.wide figcaption {
  padding: 14px var(--gutter) 0;
}
.picture-copy {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 120px) var(--gutter) clamp(40px, 5vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(28px, 5vw, 80px);
}
.picture-copy h2 {
  grid-row: span 4;
  max-width: 11ch;
}
.picture-copy p {
  margin: 0 0 16px;
  color: var(--dim);
  max-width: 46ch;
}
.picture-copy .btn {
  justify-self: start;
  margin-top: 14px;
}
.fine {
  font-size: 14px;
}
.sheet {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}
.sheet figure {
  margin: 0;
  position: relative;
}
.sheet img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: saturate(0.92);
}
.sheet figcaption {
  display: flex;
  gap: 10px;
  padding-top: 8px;
}
.sheet figcaption span {
  color: var(--gold);
}
/* A grease-pencil circle around the pick of the roll */
.sheet .pick::after {
  content: '';
  position: absolute;
  inset: -9px -8px 20px -10px;
  border: 2px solid var(--pencil);
  border-radius: 46% 54% 50% 50% / 52% 44% 56% 48%;
  rotate: -1.5deg;
  pointer-events: none;
  opacity: 0.9;
}

/* ---- back to the arcade ----------------------------------------------------------- */
.more {
  border-top: 1px solid var(--faint);
  padding: clamp(48px, 7vw, 96px) var(--gutter);
  display: flex;
  justify-content: center;
}
.more-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  font: 400 clamp(24px, 2.6vw, 34px) / 1.1 var(--serif);
  font-variation-settings: 'opsz' 48;
}
.more-link .arrow {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.6;
  transition: translate 240ms var(--ease);
}
.more-link:hover .arrow {
  translate: 5px 0;
}

/* ---- the short: Ziggy Dash ---------------------------------------------------------- */
.short {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 90px) var(--gutter) clamp(80px, 11vw, 160px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
  scroll-margin-top: 20px;
}
.short-screen {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 80px -30px rgba(120, 190, 255, 0.35);
}
.short-screen img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: scale 700ms var(--ease);
}
.short-screen:hover img {
  scale: 1.02;
}
.short-copy p {
  margin: 0 0 26px;
  color: var(--dim);
  max-width: 40ch;
}
.btn-sun {
  background: #ffd84a;
}
.btn-sun:hover {
  background: #ffe27a;
}

/* ---- next ----------------------------------------------------------------------- */
.next {
  border-top: 1px solid var(--faint);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 110px) var(--gutter) clamp(64px, 9vw, 130px);
  text-align: center;
}
.next-line {
  margin: 0 0 18px;
  font: 500 14px/1 var(--cond);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.next h2 {
  font-style: italic;
  font-weight: 400;
  margin-bottom: 14px;
}
.next p:last-child {
  margin: 0;
  color: var(--dim);
}

/* ---- footer --------------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--faint);
  padding: 26px var(--gutter) calc(26px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 28px;
  font-size: 14px;
  color: var(--dim);
}
.foot p {
  margin: 0;
}
.foot a {
  color: var(--text);
  text-underline-offset: 3px;
}

/* ---- opening sequence ------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .frame {
    animation: shutter 1500ms cubic-bezier(0.76, 0, 0.18, 1) 150ms both;
  }
  .titles h1,
  .titles .deck,
  .top {
    animation: lift 1100ms var(--ease) both;
  }
  .top {
    animation-delay: 900ms;
  }
  .titles h1 {
    animation-delay: 1100ms;
  }
  .titles .deck {
    animation-delay: 1250ms;
  }
}
@keyframes shutter {
  from {
    clip-path: inset(49.6% 0 49.6% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes lift {
  from {
    opacity: 0;
    translate: 0 14px;
  }
}

/* ---- tablet --------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .plan {
    grid-template-columns: 1fr;
  }
  .plan-copy {
    position: static;
    max-width: 52ch;
  }
  .book-note {
    grid-column: 1;
  }
}

/* ---- phone --------------------------------------------------------------------- */
@media (max-width: 700px) {
  body {
    font-size: 16px;
  }
  .top nav a:not(.nav-home) {
    display: none;
  }
  .top nav {
    gap: 16px;
    font-size: 13px;
  }
  .opening {
    min-height: 0;
    grid-template-rows: var(--bar) auto auto;
  }
  .frame {
    max-height: none;
    aspect-ratio: 4 / 5;
    min-height: 0;
  }
  .card {
    font-size: 13px;
    left: 14px;
    bottom: 14px;
  }
  .card-top > span {
    padding: 7px 9px 6px;
  }
  .card-sub {
    font-size: 11.5px;
    padding: 5px 9px 4px;
  }
  .titles {
    grid-template-columns: 1fr;
    padding-top: 26px;
  }
  .deck p {
    margin-bottom: 20px;
  }
  .btn {
    width: 100%;
    justify-content: space-between;
  }
  .book {
    grid-template-columns: repeat(3, 82%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 30px;
    scroll-padding: 0 var(--gutter);
    scrollbar-width: none;
  }
  .book::-webkit-scrollbar {
    display: none;
  }
  .leaf {
    scroll-snap-align: start;
  }
  .leaf:nth-child(2) {
    translate: none;
  }
  .book-note {
    margin-top: 10px;
  }
  .picture-copy {
    grid-template-columns: 1fr;
  }
  .picture-copy h2 {
    grid-row: auto;
  }
  .sheet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .short {
    grid-template-columns: 1fr;
  }
}

/* ---- 404 ------------------------------------------------------------------------ */
.lost-main {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 120px var(--gutter) 80px;
  max-width: var(--max);
  margin: 0 auto;
}
.lost h1 {
  font-size: clamp(44px, 7vw, 110px);
  line-height: 0.95;
  max-width: 13ch;
  margin: 22px 0 22px;
}
.lost-card {
  margin: 0;
  display: flex;
  font: 600 14px/1 var(--cond);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lost-card span {
  padding: 9px 13px 8px;
  background: var(--night-2);
  color: var(--dim);
}
.lost-card span:first-child {
  background: var(--gold);
  color: #16140e;
}
.lost-copy {
  margin: 0 0 30px;
  color: var(--dim);
}
