/* Rose Sabre
   A dark plum-purple ground, lilac-white type and a rose-red blade, with soft lavender for anything
   quieter. Imbue (tall, hairline, blade-thin at display sizes) speaks for the studio; Atkinson
   Hyperlegible Next carries everything you read. Pictures and buttons get soft, rounded corners;
   the studio's own type stays sharp and flat. The color belongs to the games: their title cards and
   screenshots are the only pictures on the page. */

:root {
  color-scheme: dark;

  --ground: #231234;
  --ink: #f7f0fc;
  --rose: #ff5c8a;
  --lavender: #c2b0de;
  --raised: #33204a;

  --display: 'Imbue', 'Didot', 'Bodoni 72', serif;
  --text: 'Atkinson Hyperlegible Next', system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --wide: 76rem;

  /* Big pictures round a little more than small ones, so the corners look alike at any size. */
  --round-big: clamp(14px, 1.6vw, 22px);
  --round: 12px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2, h3, ul, ol, figure { margin: 0; }
ul { list-style: none; padding: 0; }

a {
  color: var(--rose);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 3px;
  border-radius: 4px;
}

cite { font-style: italic; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ the ident */

.ident {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: center;
  gap: clamp(36px, 7vh, 72px);
  padding: 6vh var(--gutter);
  text-align: center;
}

.mark {
  position: relative;
  font-family: var(--display);
  font-weight: 250;
  font-optical-sizing: auto;
  font-size: clamp(6rem, min(40vw, 30vh), 22rem);
  line-height: 0.8;
  letter-spacing: -0.01em;
}

/* The reel is filmed white on near-black, so it's lightened onto the ground, which drops the black
   out, and its edges feather in case a browser shows that black a little lighter than it is. The
   frame is cropped to the band the logo moves through (9% to 85% of the way down), runs the full
   width of the page and, on a phone, past its sides, the way it does in Cozysters. */
.ident { --reel-w: min(190vw, 112vh, 112svh); }
.studio {
  justify-self: stretch;
  display: grid;
  justify-items: center;
}
.reel {
  position: relative;
  justify-self: stretch;
  margin-inline: calc(-1 * var(--gutter));
  height: calc(var(--reel-w) * 0.4275);
  overflow: hidden;
}
.reel-video,
.reel-still {
  position: absolute;
  left: 50%;
  top: calc(var(--reel-w) * -0.050625);
  width: var(--reel-w);
  height: auto;
  aspect-ratio: 16 / 9;
  transform: translateX(-50%);
  mix-blend-mode: lighten;
  -webkit-mask-image: radial-gradient(closest-side, #000 80%, transparent);
  mask-image: radial-gradient(closest-side, #000 80%, transparent);
  pointer-events: none;
}
.reel-video { display: none; }

/* The motto sits just under the wordmark, in the same spaced capitals, quieter and smaller, and
   sized off the reel so the two stay locked together at any width. The trailing letter-space is
   handed back so it centers under the name. */
.motto {
  margin-top: calc(var(--reel-w) * 0.01);
  margin-right: -0.3em;
  font-family: var(--display);
  font-weight: 450;
  font-size: max(0.875rem, calc(var(--reel-w) * 0.018));
  line-height: 1.2;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--lavender);
}

.mark-piece { display: block; }

/* The cut runs from 80% of the way down at the left edge to 30% at the right. Both polygons
   overshoot the box so nothing that pokes past the line box gets trimmed. */
.mark-upper {
  position: absolute;
  inset: 0;
  clip-path: polygon(-10% -20%, 110% -20%, 110% 25%, -10% 85%);
  transform: translate(0.03em, -0.008em);
}
.mark-lower {
  clip-path: polygon(-10% 85%, 110% 25%, 110% 120%, -10% 120%);
}

/* The blade's trace overshoots the wordmark by 8% on each side; its viewBox is 116 wide so the
   line lands exactly on the clip edge. */
.mark-cut {
  position: absolute;
  top: 0;
  left: -8%;
  width: 116%;
  height: 100%;
  fill: var(--rose);
  overflow: visible;
}

/* The 404 page: the ident, and the way back. */
.lost { display: grid; gap: 16px; }
.lost h1 {
  font-family: var(--display);
  font-weight: 350;
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  line-height: 1.1;
}

/* The games, each on its store card, as a row that wraps when there are more of them. */
.games-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px clamp(16px, 2.5vw, 32px);
}
.games-list li { width: clamp(150px, 42vw, 280px); }

.game {
  display: grid;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.game img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--round);
  background: var(--raised);
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: outline-color 0.15s;
}
.game-kind { font-size: 1rem; line-height: 1.35; color: var(--lavender); }
.game:hover img { outline-color: var(--rose); }
.game:hover .game-kind { color: var(--ink); }

/* The reel plays, and the games arrive a beat after it starts, so nobody waits on it. The page's
   script keeps the still out of the way while the reel plays, swaps it in for the reel's last
   frame (they match exactly) once it ends, and fades it in if the reel can't play at all (an
   iPhone in Low Power Mode won't). Without the script, the still comes in on a timer, well after
   the reel would have ended. The motto fades in with the name: the script marks the moment the
   name starts to appear in the reel, and the motto comes up over the same 0.4 seconds. Without the
   script it comes in on a timer, about when the name would. On the 404 page, the blade passes, then the top half slides along
   the cut. */
@media (prefers-reduced-motion: no-preference) {
  .reel-video { display: block; }
  .reel-still { animation: arrive 0.8s ease-out 5.5s both; }
  .reel-watched .reel-still { animation: none; opacity: 0; }
  .reel-done .reel-video,
  .reel-stuck .reel-video { display: none; }
  .reel-done .reel-still { opacity: 1; }
  .reel-stuck .reel-still { opacity: 1; animation: arrive 0.8s ease-out both; }
  .motto { animation: arrive 0.4s ease-out 2.5s both; }
  .reel-watched ~ .motto { animation: none; opacity: 0; }
  .reel-named ~ .motto,
  .reel-done ~ .motto { opacity: 1; animation: arrive 0.4s ease-out both; }
  .reel-stuck ~ .motto { opacity: 1; animation: arrive 0.8s ease-out both; }
  .mark-cut { animation: slash 0.42s cubic-bezier(0.75, 0, 0.2, 1) 0.45s both; }
  .mark-upper { animation: slide 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.8s both; }
  .games { animation: arrive 0.4s ease-out 0.15s both; }
}

@keyframes slash {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes slide {
  from { transform: none; }
}
@keyframes arrive {
  from { opacity: 0; }
}

/* ------------------------------------------------------------------ features */

.feature {
  max-width: var(--wide);
  margin: clamp(40px, 8vw, 96px) auto 0;
  padding: 0 var(--gutter);
  scroll-margin-top: clamp(16px, 3vw, 32px);
}
/* Space between games sits outside each one, so a thumbnail lands right on the title card. */
.feature + .feature { margin-top: clamp(96px, 14vw, 176px); }

/* The game's opening title card, over its key art. */
.title-card {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  border-radius: var(--round-big);
}
.title-card-cozysters { background: #8c4f86; }
.title-card-cozyty { background: #1f2a3a; }

.title-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.title-card-cozysters img { object-position: 30% 50%; }
.title-card-cozyty img { object-position: 50% 70%; }

.card-title {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  padding-top: 8cqi;
}

/* The wordmarks as the games draw them: "Cozy" in Pacifico and the rest in Baloo 2, over a thick
   ink stroke. Cozysters' second half is cream; Cozyty's is mint. */
.game-mark { line-height: 0; }
.title-card-cozysters .game-mark { width: 46cqi; }
.title-card-cozyty .game-mark { width: 34cqi; }
.game-mark svg {
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 6px 10px rgba(20, 8, 30, 0.35));
}
.game-mark text {
  paint-order: stroke;
  stroke: #221d45;
  stroke-width: 15px;
  stroke-linejoin: round;
  font-family: 'Baloo 2', ui-rounded, system-ui, sans-serif;
}
.game-mark .w-cozy { font-family: 'Pacifico', cursive; font-size: 104px; fill: #ffd36b; }
.game-mark .w-sters,
.game-mark .w-ty { font-size: 114px; font-weight: 800; letter-spacing: -0.01em; }
.game-mark .w-sters { fill: #fff6e6; }
.game-mark .w-ty { fill: #7fe0c4; }

/* What it is on the left; where to get it on the right. */
.feature-body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px clamp(32px, 6vw, 96px);
  padding-top: clamp(28px, 4vw, 48px);
}

.pitch { display: grid; gap: 20px; align-content: start; max-width: 38rem; }

.tagline {
  font-family: var(--display);
  font-weight: 350;
  font-size: clamp(2rem, 1.4rem + 2vw, 3.25rem);
  line-height: 1.05;
  text-wrap: balance;
}

.more {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-weight: 700;
}

/* A link that's just a mark, like Bluesky's butterfly, sits on the same line as the words around it. */
.icon-link {
  display: inline-flex;
  align-self: center;
  border-radius: 4px;
}
/* Bluesky's own blue, the one place a brand gets its color. */
.icon-link-bluesky { color: #1185fe; }
.icon-link svg { width: 1.3em; height: 1.3em; fill: currentColor; }
.icon-link:hover { color: var(--ink); }

.get { display: grid; gap: 14px; align-content: start; }

.get-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

/* One price per game, rounded to the dollar, however each store happens to price it. */
.get-title,
.price {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.1;
}

.stores { display: grid; gap: 10px; }

/* Each store is one button: its mark, where it is, then what it plays on. The marks are drawn in
   the button's own ink, so they turn with it on hover. */
.store {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 16px;
  padding: 14px 18px;
  border-radius: var(--round);
  background: var(--raised);
  color: var(--ink);
  text-decoration: none;
}
.store-logo {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  fill: currentColor;
}
.store-name,
.store-for { grid-column: 2; }
.store-name { font-weight: 700; }
.store-for { color: var(--lavender); font-size: 1rem; }
.store:hover { background: var(--rose); color: var(--ground); }
.store:hover .store-for { color: var(--ground); }

.stills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
  padding-top: clamp(40px, 5vw, 64px);
}
.stills img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--round);
  background: var(--raised);
}
.stills figcaption {
  padding-top: 10px;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--lavender);
}

/* ------------------------------------------------------------------ about */

.about {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(112px, 16vw, 200px) var(--gutter) 0;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px clamp(32px, 6vw, 96px);
}

.about-title {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.5rem, 1.75rem + 3vw, 4.5rem);
  line-height: 1;
}

.about-body { display: grid; gap: 18px; max-width: 38rem; }

.about-lead {
  font-family: var(--display);
  font-weight: 350;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  line-height: 1.2;
}

/* ------------------------------------------------------------------ footer */

.foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 128px) var(--gutter) 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 0.875rem;
  color: var(--lavender);
}
.foot-links { display: flex; gap: 20px; }

/* ------------------------------------------------------------------ narrow screens */

@media (max-width: 860px) {
  .feature-body, .about { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .title-card img { aspect-ratio: 4 / 3; }
  .title-card-cozysters .game-mark { width: 64cqi; }
  .title-card-cozyty .game-mark { width: 48cqi; }

  /* The stills become a row you swipe through, with the next one peeking in. */
  .stills {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .stills li { scroll-snap-align: start; }
}
