/*
 * partyhq.tv, the public site. It wears the game's look so a visitor sees the product before they open it: the
 * PartyHQ sky (blue to purple with still scan lines), cream sticker panels with an ink outline and a hard ink shadow,
 * Lilita One for display and Fredoka for sentences. The colours are the game's tokens, copied from
 * apps/web/src/app.css (@theme) and the PARTYHQ look in apps/web/src/ui/looks.ts; change them there first.
 */

@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/lilita-one-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/fredoka-latin-wght-normal.woff2') format('woff2');
}

:root {
  /* The site has one look in light and dark mode. Declaring both schemes (and setting every colour ourselves) is
     what keeps Safari's Adaptive Dark Mode and Chrome's auto-dark from repainting it; see index.html. */
  color-scheme: light dark;
  --ink: #2a1438;
  --ink-soft: #644d78;
  --cream: #fff5e1;
  --paper: #fffdf7;
  --oat: #f3e2c3;
  --pumpkin: #ff7a1a;
  --gold: #ffc93c;
  --sky: #37b6e9;
  --grape: #7b4bd6;
  --leaf: #4fc24a;
  --cranberry: #d81e5b;

  --sky-1: #1c6fcf;
  --sky-2: #3a63d6;
  --sky-3: #5b56d7;
  --sky-4: #7b4bd6;

  --display: 'Lilita One', 'Fredoka', ui-rounded, system-ui, sans-serif;
  --sans: 'Fredoka', ui-rounded, system-ui, sans-serif;

  --shadow-sm: 0 3px 0 0 var(--ink);
  --shadow: 0 6px 0 0 var(--ink);
  --shadow-lg: 0 10px 0 0 var(--ink);
  --page: min(72rem, 100% - 2.5rem);
}

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

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

html {
  background: var(--sky-2);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--sky-2);
}

/* The sky: fixed behind everything, so the page scrolls over one continuous backdrop. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(180deg, rgb(255 255 255 / 0.07) 0 2px, transparent 2px 12px),
    linear-gradient(180deg, var(--sky-1), var(--sky-2) 35%, var(--sky-3) 68%, var(--sky-4));
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

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

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--display);
  text-decoration: none;
}

.skip:focus {
  top: 1rem;
}

/* Cream words on the sky carry the game's ink outline, as the app's titles do. */
.title,
.brand span {
  color: var(--cream);
  --ol: 0.055em;
  text-shadow:
    var(--ol) 0 0 var(--ink),
    calc(var(--ol) * 0.87) calc(var(--ol) * 0.5) 0 var(--ink),
    calc(var(--ol) * 0.5) calc(var(--ol) * 0.87) 0 var(--ink),
    0 var(--ol) 0 var(--ink),
    calc(var(--ol) * -0.5) calc(var(--ol) * 0.87) 0 var(--ink),
    calc(var(--ol) * -0.87) calc(var(--ol) * 0.5) 0 var(--ink),
    calc(var(--ol) * -1) 0 0 var(--ink),
    calc(var(--ol) * -0.87) calc(var(--ol) * -0.5) 0 var(--ink),
    calc(var(--ol) * -0.5) calc(var(--ol) * -0.87) 0 var(--ink),
    0 calc(var(--ol) * -1) 0 var(--ink),
    calc(var(--ol) * 0.5) calc(var(--ol) * -0.87) 0 var(--ink),
    calc(var(--ol) * 0.87) calc(var(--ol) * -0.5) 0 var(--ink),
    0 calc(var(--ol) * 2.2) 0 var(--ink);
}

/* --- The kit: buttons, panels, chips. ---------------------------------------------------------------------------- */

.btn {
  --drop: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0 1.4rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--pumpkin);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 var(--drop) 0 0 var(--ink);
  transition:
    translate 75ms,
    box-shadow 75ms,
    filter 75ms;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn:active {
  translate: 0 calc(var(--drop) - 1px);
  box-shadow: 0 1px 0 0 var(--ink);
}

.btn-plain {
  background: var(--paper);
}

.btn-sm {
  --drop: 4px;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-width: 2.5px;
  font-size: 1rem;
}

.btn-lg {
  --drop: 6px;
  min-height: 4rem;
  padding: 0 1.75rem;
  font-size: 1.45rem;
}

.panel {
  border: 3px solid var(--ink);
  border-radius: 1.75rem;
  background: var(--cream);
  box-shadow: var(--shadow);
}

.chip {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.2;
  box-shadow: var(--shadow-sm);
}

.chip-gold {
  background: var(--gold);
}

.chip-sky {
  background: var(--sky);
}

/* The language picker: a plain-pill select, its arrow drawn in ink on the side the text ends. */
.language-picker {
  appearance: none;
  min-height: 2.75rem;
  padding-block: 0;
  padding-inline: 1rem 2.1rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%) calc(100% - 1.1rem) 52% / 0.4rem 0.4rem no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--ink) 50%) calc(100% - 0.75rem) 52% / 0.4rem 0.4rem no-repeat,
    var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.language-picker option {
  background: var(--paper);
  color: var(--ink);
}

[dir='rtl'] .language-picker {
  background-position:
    0.75rem 52%,
    1.1rem 52%,
    0 0;
}

/* --- Header and footer. ------------------------------------------------------------------------------------------ */

.top {
  width: var(--page);
  margin: 0 auto;
  padding: 1.1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

/* On a phone the logo has the first line to itself, and joining and the language share the second. */
@media (max-width: 39.99rem) {
  .top nav {
    width: 100%;
    justify-content: space-between;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1;
  text-decoration: none;
}

.brand img {
  width: auto;
  height: 1.3em;
}

.top nav,
.bottom nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link {
  display: none;
  padding: 0.5rem 0.4rem;
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.1rem;
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.hide-narrow {
  display: none;
}

.bottom {
  width: var(--page);
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  color: var(--cream);
}

.brand-small {
  font-size: 1.5rem;
}

.bottom nav a {
  font-family: var(--display);
  text-decoration: none;
}

.bottom nav a:hover {
  text-decoration: underline;
}

.footer-languages {
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  font-size: 0.95rem;
}

.footer-languages a {
  font-family: var(--sans);
  font-weight: 600;
}

.bottom p {
  font-size: 0.95rem;
}

/* --- The hero: the pitch, and the three screens stacked like stickers. ------------------------------------------- */

/* The hero: on a phone the video comes straight after the headline; wider, the pitch sits above a big video. */
.hero {
  width: var(--page);
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
  display: grid;
  grid-template-areas: 'top' 'video' 'pitch';
  gap: 1.75rem;
}

.hero-top {
  grid-area: top;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.hero-pitch {
  grid-area: pitch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.5rem);
  line-height: 1;
}

.lede {
  max-width: 36rem;
  color: var(--cream);
  font-size: 1.25rem;
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1rem;
  padding-bottom: 6px;
}

.aside {
  color: var(--cream);
  opacity: 0.9;
  font-size: 1rem;
}

/* The hero's video: the party, framed as a sticker. */
.hero-video {
  grid-area: video;
  margin: 0;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 1.75rem;
  background: var(--ink);
  box-shadow: var(--shadow-lg);
}

.hero-video video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* A TV: an ink bezel round the screenshot, on a short stand. */
.tv {
  position: relative;
  margin: 0;
  padding: clamp(0.45rem, 1.4vw, 0.85rem);
  border-radius: clamp(1rem, 2.5vw, 1.6rem);
  background: var(--ink);
  box-shadow: var(--shadow-lg);
}

.tv img,
.tv video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: clamp(0.4rem, 1vw, 0.7rem);
  background: var(--ink-soft);
}

.tv::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1.6rem;
  width: 22%;
  height: 1.6rem;
  translate: -50% 0;
  background: var(--ink);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}

/* --- Sections. ---------------------------------------------------------------------------------------------------- */

.band {
  width: var(--page);
  margin: 0 auto;
  padding: 3.5rem 0;
}

.band > .title {
  margin-bottom: 2rem;
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
}

.screens {
  display: grid;
  gap: 1.75rem;
}

.screen-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1.6rem;
}

.screen-copy {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.screen-copy h3 {
  font-size: 1.75rem;
}

.screen-copy p {
  color: var(--ink-soft);
}

.shot {
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 1.1rem;
  background: var(--ink);
}

.shot img {
  width: 100%;
  object-fit: cover;
}

.shot-tv img {
  aspect-ratio: 16 / 9;
}

/* A phone shot in a card shows its top half, the part with the content. */
.shot-phone img {
  aspect-ratio: 16 / 11;
  object-position: top;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.75rem;
  counter-reset: none;
}

.steps li {
  position: relative;
  padding: 2.25rem 1.4rem 1.6rem;
}

.steps h3 {
  margin-bottom: 0.4rem;
  font-size: 1.6rem;
}

.steps p {
  color: var(--ink-soft);
}

.step-number {
  position: absolute;
  top: -1.4rem;
  inset-inline-start: 1.2rem;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.steps li:nth-child(2) .step-number {
  background: var(--sky);
}

.steps li:nth-child(3) .step-number {
  background: var(--pumpkin);
}

.steps li:nth-child(4) .step-number {
  background: var(--leaf);
}

.games {
  display: grid;
  gap: 3rem 3.5rem;
  align-items: center;
}

.games-copy {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.games-copy .title {
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
}

.game-names,
.languages {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.game-names li {
  padding: 0.35rem 0.85rem;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--display);
  line-height: 1.2;
  box-shadow: var(--shadow-sm);
}

.game-names li:nth-child(5n + 1) {
  background: var(--gold);
}

.game-names li:nth-child(5n + 2) {
  background: var(--sky);
}

.game-names li:nth-child(5n + 4) {
  background: var(--oat);
}

/* The library's explainers: two TVs, each with its game's name on a chip under the stand. */
.explainers {
  display: grid;
  gap: 2.75rem 1.75rem;
}

.explainer {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.25rem;
}

.explainer .tv {
  width: 100%;
}

.explainer:nth-child(1) .tv {
  rotate: -1.5deg;
}

.explainer:nth-child(2) .tv {
  rotate: 1.5deg;
}

.more-games {
  color: var(--cream);
  font-family: var(--display);
  font-size: 1.2rem;
}

.screen-copy .chip {
  align-self: flex-start;
  font-size: 0.9rem;
}

.bento {
  display: grid;
  gap: 1.5rem;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.6rem 1.5rem;
}

.tile h3 {
  font-size: 1.7rem;
}

.tile-copy {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tile-sky {
  background: var(--sky);
}

.tile-gold {
  background: var(--gold);
}

.tile-pumpkin {
  background: var(--pumpkin);
}

.tile-grape {
  background: var(--grape);
  color: var(--paper);
}

.languages {
  margin-top: 0.5rem;
  gap: 0.45rem;
}

.languages li {
  padding: 0.15rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.95rem;
  font-weight: 600;
}

.finale {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1.5rem 3.25rem;
  text-align: center;
  background: var(--gold);
  box-shadow: var(--shadow-lg);
}

.finale h2 {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
}

.finale p {
  max-width: 30rem;
  font-size: 1.25rem;
}

.finale .actions {
  justify-content: center;
  margin-top: 0.75rem;
}

/* --- Wider screens. ----------------------------------------------------------------------------------------------- */

@media (min-width: 40rem) {
  .hide-narrow {
    display: inline-flex;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 2.75rem;
  }

  .bento {
    grid-template-columns: repeat(2, 1fr);
  }

  .tile-wide,
  .tile-full {
    grid-column: 1 / -1;
  }
}

@media (min-width: 56rem) {
  .nav-link {
    display: inline-block;
  }

  .hero {
    grid-template-areas: 'top' 'pitch' 'video';
    justify-items: center;
    padding-top: 2rem;
    padding-bottom: 5rem;
    text-align: center;
  }

  .hero-top,
  .hero-pitch {
    align-items: center;
  }

  .hero-pitch .lede {
    max-width: 46rem;
  }

  .hero-pitch .actions {
    justify-content: center;
  }

  .hero-video {
    width: min(100%, 64rem);
    margin-top: 1rem;
  }

  /* The TV across the top, the two phones side by side under it; each card puts its shot beside its words. */
  .screens {
    grid-template-columns: 1fr 1fr;
  }

  .screen-card {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
  }

  .screen-tv {
    grid-column: 1 / -1;
  }

  .screen-tv .shot {
    flex: 1.7 1 0;
  }

  .screen-card .screen-copy {
    flex: 1 1 0;
  }

  .screen-card .shot-phone {
    flex: 0 0 44%;
  }

  .screens .shot-phone img {
    aspect-ratio: 390 / 600;
  }

  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  .games {
    grid-template-columns: 1fr 1.2fr;
  }

  .bento {
    grid-template-columns: repeat(3, 1fr);
  }

  .tile-wide {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }

  .tile-wide .tile-copy {
    flex: 1 1 0;
  }

  .tile-wide .shot {
    flex: 1.4 1 0;
  }

  .tile-full {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
  }

  .tile-full .tile-copy {
    flex: 1 1 0;
  }

  .tile-full .shot {
    flex: 1.6 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }
}
