/* Oddpetal homepage. Mobile first; the palette follows brand/brand.json. */
:root {
  --cream: #fff8ef;
  --ink: #251e32;
  --ink-soft: #4a3f57;
  --muted: #6c5f78;
  --plum: #6e4f86;
  --coral: #ef8f80;
  --lilac-tint: #efe8f7;
  --coral-tint: #fbe3de;
  --sage-tint: #e6efe8;
  --line: rgb(37 30 50 / 0.14);
  --gutter: 20px;
  --radius-lg: 28px;
  --font-display: ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-text: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
  color: var(--ink);
  background: var(--cream);
  font-family: var(--font-text);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

/* Only matters with very large text settings on narrow screens. */
h1,
h3 {
  overflow-wrap: break-word;
}

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

.wrap {
  width: min(100% - 2 * var(--gutter), 1200px);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 12px;
  font: 700 1.3125rem/1 var(--font-display);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 18px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

/* Intro */

.intro {
  padding-block: 12px 28px;
}

/* Sized so that "Unexpected turns." stays on one line on most phones. */
.intro h1 {
  font: 700 clamp(2.125rem, 10vw - 0.25rem, 3.25rem) / 1 var(--font-display);
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.intro h1 span {
  display: block;
  color: var(--plum);
}

.intro p {
  margin-top: 16px;
  font-size: 1.1875rem;
  color: var(--ink-soft);
}

/* On phones the mark in the header carries the petals. */
.intro-petals {
  display: none;
  color: var(--ink);
}

/* Games: released games from catalog.json first, then its coming-soon slots. */

.games {
  padding-bottom: 64px;
  scroll-margin-top: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Phones: released games span the full width, coming-soon slots sit side by side once the section
   is wide enough for them. The rem-based container query also follows larger text settings. */
.games {
  container: games / inline-size;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px 12px;
  padding: 0;
  list-style: none;
}

@container games (min-width: 17rem) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.game-card:not(.is-upcoming) {
  grid-column: 1 / -1;
}

.card-number {
  position: absolute;
  top: 22px;
  right: 22px;
  font: 700 0.8125rem/1 var(--font-display);
  letter-spacing: 0.08em;
}

/* The key art is a poster; title and play button sit in its quiet sky. overflow: clip (not
   hidden) lets the poster grow with large text instead of cutting it off. */
.game-poster {
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 24px;
  aspect-ratio: 4 / 5;
  max-height: 34rem;
  padding: 24px 20px 32px;
  overflow: hidden;
  overflow: clip;
  border-radius: var(--radius-lg);
  background: linear-gradient(#8fa2f5, #c9b6ee 55%, #f5cdb9);
}

.game-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 26%;
}

.game-icon {
  width: 48px;
  height: 48px;
  border-radius: 24%;
  box-shadow: 0 10px 24px -10px rgb(37 30 50 / 0.6);
}

.game-category {
  margin-top: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.game-title {
  margin-top: 6px;
  font: 700 clamp(2.25rem, 15cqi, 4rem) / 0.95 var(--font-display);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 24px rgb(255 248 239 / 0.55);
}

.game-hook {
  margin-top: 10px;
  font: 600 1.0625rem/1.35 var(--font-display);
}

.game-play {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 10px;
}

.play-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 26rem;
  min-height: 60px;
  padding: 8px 8px 8px 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font: 700 1.125rem/1.2 var(--font-display);
  text-decoration: none;
  box-shadow: 0 16px 32px -16px rgb(37 30 50 / 0.7);
}

/* Stretches the link over the whole poster so the art is clickable too. */
.play-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
}

/* A cream ring keeps the ink focus outline visible on top of the key art. */
.play-link:focus-visible {
  box-shadow:
    0 0 0 3px var(--cream),
    0 16px 32px -16px rgb(37 30 50 / 0.7);
}

.play-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--coral);
  color: var(--ink);
}

.play-icon svg {
  width: 20px;
  height: 20px;
}

.play-host {
  padding-left: 24px;
  font-size: 0.875rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.game-description {
  max-width: 38ch;
  margin-top: 16px;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* Title and number share the top row, so large text wraps instead of running under the number. */
.upcoming-poster {
  container-type: inline-size;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  aspect-ratio: 4 / 5;
  padding: 20px;
  overflow: hidden;
  overflow: clip;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--lilac-tint), var(--coral-tint));
}

.is-upcoming:nth-child(odd) .upcoming-poster {
  background: linear-gradient(160deg, var(--sage-tint), var(--lilac-tint));
}

.upcoming-title {
  min-width: 0;
  max-width: 7ch;
  font: 700 clamp(1.25rem, 13cqi, 3rem) / 1 var(--font-display);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.upcoming-poster .card-number {
  position: static;
  flex: none;
  margin-top: 2px;
}

.upcoming-mark {
  position: absolute;
  right: -10%;
  bottom: -12%;
  width: 82%;
  color: rgb(37 30 50 / 0.3);
  transform: rotate(-10deg);
}

.upcoming-mark path {
  vector-effect: non-scaling-stroke;
}

/* Footer */

.site-footer {
  display: grid;
  gap: 10px;
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 1.125rem/1 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.footer-brand img {
  width: 28px;
  height: 28px;
}

/* Tablets: the released game spans two rows beside the stacked coming-soon slots. */
@media (min-width: 640px) {
  .game-grid {
    gap: 16px;
  }

  .game-card:not(.is-upcoming) {
    grid-column: auto;
    grid-row: span 2;
  }

  .is-upcoming {
    display: flex;
    flex-direction: column;
  }

  /* Without a ratio a minimum height is safe; with one it would force a minimum width. */
  .upcoming-poster {
    flex: 1;
    aspect-ratio: auto;
    min-height: 11rem;
  }

  /* Wide, short slots: keep the outline clear of the title. */
  .upcoming-mark {
    right: -6%;
    bottom: -18%;
    width: min(58%, 12rem);
  }
}

@media (min-width: 720px) {
  :root {
    --gutter: 40px;
  }

  .site-header {
    padding-block: 20px;
  }

  .intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 48px;
    padding-block: 32px 56px;
  }

  /* Studio line on one line where it fits. */
  .intro h1 {
    font-size: clamp(3rem, 4.4vw, 4rem);
  }

  .intro h1 span {
    display: inline;
  }

  .intro-petals {
    display: block;
    width: clamp(100px, 9vw, 136px);
    transform: rotate(-10deg);
  }

  .games {
    padding-bottom: 96px;
  }

  .site-footer {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 32px;
    padding-block: 32px 48px;
  }
}

/* Desktops: one row of equal cards. */
@media (min-width: 960px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
  }

  .game-card:not(.is-upcoming) {
    grid-row: auto;
  }

  .is-upcoming {
    display: block;
  }

  .upcoming-poster {
    aspect-ratio: 4 / 5;
    min-height: 0;
  }

  .upcoming-mark {
    right: -10%;
    bottom: -12%;
    width: 82%;
  }
}

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

  .site-nav a,
  .play-link {
    transition:
      background-color 0.2s ease,
      color 0.2s ease,
      box-shadow 0.2s ease;
  }

  .play-icon {
    transition: transform 0.25s ease;
  }

  .game-art {
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .intro-petals {
    animation: bloom 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  @keyframes bloom {
    from {
      opacity: 0;
      transform: rotate(-40deg) scale(0.85);
    }
  }
}

@media (hover: hover) {
  .site-nav a:hover {
    background: var(--ink);
    color: var(--cream);
    box-shadow: none;
  }

  .play-link:hover {
    background: #3a2f4d;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .play-link:hover .play-icon {
    transform: translate(2px, -2px);
  }

  .game-poster:has(.play-link:hover) .game-art {
    transform: scale(1.03);
  }
}

@media (forced-colors: active) {
  .play-link,
  .site-nav a {
    border: 2px solid ButtonText;
  }
}
