/* Nazford's website: one pond, getting deeper as you scroll. Colours are
   the games' own (packages/studio/lib/src/art/koi_art.dart). */

:root {
  --surface: #145a63;
  --mid: #0d4450;
  --deep: #062631;
  --abyss: #03161c;
  --panel: #0b3943;
  --board: #07303a;
  --rim: #2b7f86;
  --cream: #fff6e9;
  --cream-2: rgba(255, 246, 233, 0.8);
  --cream-3: rgba(255, 246, 233, 0.6);
  --line: rgba(255, 246, 233, 0.13);
  --gold: #ffd36e;
  --gold-ink: #3d2b00;
  --lotus: #f48fb1;
  --petal: #ffc3d8;
  --jade: #45cfae;
  --sky: #5fb2f5;
  --koi: #e5532c;
  --display: "Fredoka", ui-rounded, system-ui, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream-2);
  font: 17px/1.6 var(--body);
  background-color: var(--abyss);
  background-image: linear-gradient(180deg, var(--surface) 0, var(--mid) 100vh, var(--deep) 220vh, var(--abyss) 100%);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--cream); text-decoration-color: rgba(255, 211, 110, 0.5); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--cream);
  letter-spacing: 0.2px;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: clamp(34px, 5vw, 58px); line-height: 1.02; }
h3 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.15; }
p { margin: 0 0 1em; text-wrap: pretty; }
strong { color: var(--cream); font-weight: 650; }
em.soft, .aside {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--petal);
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 700;
}
.skip:focus { top: 12px; }

/* Header: the wordmark and a few links, floating on the water. */
.top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  padding: 20px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: 0.3px;
}
.mark svg { width: 46px; height: 21px; transform: rotate(-14deg); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3)); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--cream-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.top nav a:hover, .top nav a[aria-current] { color: var(--cream); background: rgba(3, 22, 28, 0.35); }
@media (max-width: 560px) {
  .top nav .optional { display: none; }
}

/* The hero: a living pond you can tap. */
.hero {
  position: relative;
  min-height: min(100svh, 980px);
  display: flex;
  align-items: flex-end;
  padding: 120px 0 clamp(56px, 9vh, 104px);
  isolation: isolate;
  overflow: hidden;
}
.hero canvas.pond {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  touch-action: manipulation;
}
.hero::before {
  /* Light falling into the water from the top left. */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 70% at 12% -10%, rgba(191, 247, 240, 0.16), transparent 60%),
    radial-gradient(90% 60% at 100% 110%, rgba(3, 22, 28, 0.55), transparent 70%);
}
.hero::after {
  /* The water deepens toward the page below. */
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 30%;
  z-index: -1;
  background: linear-gradient(180deg, transparent, rgba(13, 68, 80, 0.75));
  pointer-events: none;
}
.hero .wrap { position: relative; }
.hero h1 {
  font-size: clamp(52px, 10vw, 128px);
  line-height: 0.92;
  letter-spacing: -0.5px;
  text-shadow: 0 6px 30px rgba(3, 22, 28, 0.45);
  max-width: 11ch;
}
.hero h1 .aside {
  display: block;
  margin-top: 0.18em;
  font-size: 0.42em;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--gold);
}
.hero .lede {
  margin: 26px 0 30px;
  max-width: 34em;
  font-size: clamp(17px, 1.6vw, 19px);
  color: var(--cream);
  text-shadow: 0 2px 14px rgba(3, 22, 28, 0.6);
}
.hint {
  position: absolute;
  right: var(--gutter);
  bottom: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--cream-3);
  font-size: 15px;
}
.hint::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  box-shadow: 0 0 0 5px rgba(255, 246, 233, 0.08);
  animation: ripple 2.6s ease-out infinite;
}
@keyframes ripple {
  0% { box-shadow: 0 0 0 0 rgba(255, 246, 233, 0.35); }
  100% { box-shadow: 0 0 0 16px rgba(255, 246, 233, 0); }
}
@media (max-width: 720px) { .hint { position: static; margin-top: 28px; } }

/* Buttons. */
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font: 700 16px/1.1 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.gold { background: var(--gold); color: var(--gold-ink); }
.btn.gold:hover { background: #ffdd8a; }
.btn.lotus { background: var(--lotus); color: #4a1328; }
.btn.ghost { color: var(--cream); border-color: rgba(255, 246, 233, 0.32); background: rgba(3, 22, 28, 0.25); }
.btn.ghost:hover { border-color: var(--cream); }
.store {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 52px;
  padding: 7px 22px 8px;
  border-radius: 14px;
  background: #050f12;
  border: 1.5px solid rgba(255, 246, 233, 0.22);
  color: var(--cream);
  text-decoration: none;
  line-height: 1.15;
}
.store small { font-size: 11px; letter-spacing: 0.4px; color: var(--cream-3); }
.store span { font: 600 19px/1.1 var(--display); }
.store:hover { border-color: var(--cream); }
.store.soon { border-style: dashed; background: transparent; cursor: default; }
.store.soon:hover { border-color: rgba(255, 246, 233, 0.22); }

/* Sections. */
section { position: relative; padding: clamp(72px, 11vw, 140px) 0; }
.intro { max-width: 40em; margin-bottom: clamp(36px, 6vw, 64px); }
.intro h2 + p { margin-top: 18px; font-size: clamp(17px, 1.5vw, 19px); }
.intro.center { margin-left: auto; margin-right: auto; text-align: center; }

/* A phone showing real screenshots, fading between them. */
.phone {
  position: relative;
  width: clamp(220px, 25vw, 300px);
  aspect-ratio: 1320 / 2868;
  border-radius: 15% / 7%;
  padding: 3.4%;
  background: linear-gradient(145deg, #2c3c42, #0d1518 45%, #1c272b);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 40px 80px -20px rgba(0, 0, 0, 0.6),
    0 18px 36px -18px rgba(0, 0, 0, 0.5);
  flex: none;
}
.phone .screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12.5% / 5.8%;
  overflow: hidden;
  background: var(--deep);
}
.phone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.phone img.on { opacity: 1; }
.phone .dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -30px;
  display: flex;
  justify-content: center;
  gap: 7px;
}
.phone .dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 246, 233, 0.28);
  cursor: pointer;
}
.phone .dots button[aria-pressed="true"] { background: var(--cream); }
.phone .dots button::after { content: ""; position: absolute; inset: -10px; }
.phone .dots button { position: relative; }

/* A game on the home page: its phone on one side, its story on the other. */
.game {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(32px, 7vw, 96px);
  align-items: center;
}
.game + .game { margin-top: clamp(96px, 14vw, 168px); }
.game.flip { grid-template-columns: 1fr auto; }
.game.flip .phone-col { order: 2; }
.phone-col { position: relative; display: flex; justify-content: center; padding-bottom: 30px; }
.phone-col::before {
  /* A soft glow in the game's colour behind the phone. */
  content: "";
  position: absolute;
  inset: 8% -30% 20%;
  z-index: -1;
  background: radial-gradient(closest-side, var(--glow, rgba(244, 143, 177, 0.28)), transparent);
  filter: blur(10px);
}
.game .badge { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.game .badge img { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); }
.game .badge h3 { font-size: clamp(34px, 4.4vw, 52px); }
.game .badge p { margin: 2px 0 0; color: var(--cream-3); font-size: 15px; }
.game .tagline { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: clamp(20px, 2vw, 24px); margin-bottom: 14px; }
.facts { list-style: none; padding: 0; margin: 22px 0 30px; display: grid; gap: 12px; }
.facts li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.facts li::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 4px;
  background: var(--chip, var(--jade));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}
.facts li:nth-child(2) { --chip: var(--sky); }
.facts li:nth-child(3) { --chip: var(--lotus); }
.facts li:nth-child(4) { --chip: var(--gold); }
.facts li:nth-child(5) { --chip: #b59af0; }
.facts li:nth-child(6) { --chip: #ff8a4c; }
.more { display: inline-block; margin-top: 18px; font-weight: 700; color: var(--gold); text-decoration: none; }
.more:hover { text-decoration: underline; }
@media (max-width: 820px) {
  .game, .game.flip { grid-template-columns: 1fr; }
  .game.flip .phone-col { order: 0; }
}

/* Things we won't do. */
.promises { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 0 clamp(28px, 4vw, 56px); }
.promises > div { border-top: 1px solid var(--line); padding: 26px 0 30px; }
.promises h3 { font-size: 23px; margin-bottom: 10px; }
.promises h3 .aside { font-size: 0.82em; color: var(--cream-3); margin-right: 4px; }
.promises p { margin: 0; color: var(--cream-2); }

/* Languages, each in its own script. */
.langs { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; padding: 0; list-style: none; font-family: var(--display); font-size: clamp(20px, 2.6vw, 30px); color: var(--cream); }
.langs li:nth-child(even) { color: var(--cream-3); }

/* A band with a live demo next to its words. */
.band {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
}
.band.flip { grid-template-columns: 1fr 1.05fr; }
.band.flip > :first-child { order: 2; }
.demo {
  position: relative;
  width: 100%;
  border-radius: 34px;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(191, 247, 240, 0.1), transparent 70%),
    linear-gradient(180deg, rgba(20, 90, 99, 0.6), rgba(6, 38, 49, 0.6));
  border: 1px solid rgba(43, 127, 134, 0.45);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.demo canvas { display: block; width: 100%; height: 100%; }
.demo.blocks { aspect-ratio: 5 / 6.2; max-width: 460px; justify-self: center; }
.demo.sort { aspect-ratio: 6 / 5; }
.demo .caption {
  position: absolute;
  left: 18px;
  bottom: 14px;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--cream-3);
  pointer-events: none;
}
@media (max-width: 820px) {
  .band, .band.flip { grid-template-columns: 1fr; }
  .band.flip > :first-child { order: 0; }
}

/* A switch for the colour-blind shapes. */
.switch { display: inline-flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-weight: 600; color: var(--cream); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 28px; border-radius: 999px; background: rgba(255, 246, 233, 0.18); position: relative; transition: background-color 0.2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--cream); transition: transform 0.2s; }
.switch input:checked + .track { background: var(--jade); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 3px; }

/* The koi field guide. */
.guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.guide figure {
  margin: 0;
  padding: 0 0 18px;
  border-radius: 22px;
  background: rgba(7, 48, 58, 0.55);
  border: 1px solid rgba(43, 127, 134, 0.35);
  overflow: hidden;
}
.guide canvas { display: block; width: 100%; aspect-ratio: 4 / 3; background: radial-gradient(70% 70% at 50% 45%, rgba(20, 90, 99, 0.9), rgba(6, 38, 49, 0.9)); }
.guide figcaption { padding: 12px 18px 0; }
.guide figcaption b { display: block; font: 600 20px/1.2 var(--display); color: var(--cream); }
.guide figcaption span { display: block; margin-top: 4px; font-family: var(--serif); font-style: italic; color: var(--cream-2); font-size: 15.5px; line-height: 1.4; }

/* Feature rows on the game pages. */
.feature {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(32px, 7vw, 96px);
  align-items: center;
}
.feature.flip { grid-template-columns: 1fr auto; }
.feature.flip .phone-col { order: 2; }
.feature .copy { max-width: 34em; }
.feature .copy h2 { margin-bottom: 18px; }
@media (max-width: 820px) {
  .feature, .feature.flip { grid-template-columns: 1fr; }
  .feature.flip .phone-col { order: 0; }
}

/* Small blocks of text in a grid, each marked by a glossy tile. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 30px clamp(24px, 4vw, 48px); }
.tiles > div { position: relative; padding-top: 44px; }
.tiles > div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--t) 70%, white), var(--t) 55%);
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--t) 70%, black), 0 6px 14px rgba(0, 0, 0, 0.25);
}
.tiles > div:nth-child(6n + 1) { --t: #f58db4; }
.tiles > div:nth-child(6n + 2) { --t: #45cfae; }
.tiles > div:nth-child(6n + 3) { --t: #5fb2f5; }
.tiles > div:nth-child(6n + 4) { --t: #ffd150; }
.tiles > div:nth-child(6n + 5) { --t: #b59af0; }
.tiles > div:nth-child(6n + 6) { --t: #ff8a4c; }
.tiles h3 { font-size: 22px; margin-bottom: 8px; }
.tiles p { margin: 0; }

/* A seed, as the game shows it under every run. */
.seed {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(3, 22, 28, 0.5);
  border: 1px solid var(--line);
  font: 600 18px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 1.5px;
  color: var(--cream);
}
.seed small { font: 500 13px/1 var(--body); letter-spacing: 0; color: var(--cream-3); }

/* A quiet note, like the price of things. */
.note {
  max-width: 46em;
  padding: 24px 28px;
  border-radius: 22px;
  background: rgba(3, 22, 28, 0.45);
  border: 1px solid var(--line);
}
.note p:last-child { margin: 0; }

/* The game pages' heroes. */
.hero.game-hero { align-items: center; padding-top: 110px; }
.hero.game-hero .wrap { display: grid; grid-template-columns: 1fr auto; gap: clamp(28px, 6vw, 80px); align-items: center; }
.hero.game-hero h1 { font-size: clamp(56px, 9vw, 112px); max-width: none; }
.hero.game-hero .icon { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); margin-bottom: 22px; }
.hero.game-hero .tagline { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.6vw, 30px); color: var(--gold); margin: 10px 0 0; }
.hero.game-hero .demo.sort { width: min(560px, 46vw); }
.browser-link { margin: 18px 0 0; font-size: 15px; color: var(--cream-2); }
@media (max-width: 900px) {
  .hero.game-hero .wrap { grid-template-columns: 1fr; }
  .hero.game-hero .demo.sort { width: 100%; }
}

/* Footer. */
footer.end { padding: 72px 0 48px; border-top: 1px solid var(--line); background: rgba(3, 22, 28, 0.4); }
footer.end .wrap { display: grid; grid-template-columns: 1.3fr repeat(3, auto); gap: 32px clamp(32px, 6vw, 80px); }
footer.end h4 { margin: 0 0 12px; font: 600 15px/1.2 var(--display); color: var(--cream); letter-spacing: 0.4px; }
footer.end ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
footer.end a { color: var(--cream-2); text-decoration: none; }
footer.end a:hover { color: var(--cream); text-decoration: underline; }
footer.end .mark { font-size: 28px; margin-bottom: 12px; }
footer.end .small { font-size: 14px; color: var(--cream-3); }
@media (max-width: 760px) {
  footer.end .wrap { grid-template-columns: 1fr 1fr; }
  footer.end .wrap > :first-child { grid-column: 1 / -1; }
}

/* Things rise gently into view as you scroll (only with scripts on, and
   never when the visitor asks for less motion). */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .js [data-reveal].in { opacity: 1; transform: none; }
  .js [data-reveal="2"] { transition-delay: 0.12s; }
  .js [data-reveal="3"] { transition-delay: 0.24s; }
}
