/* Chain Garden website. Colours and type follow the app (Theme.swift). */

:root {
  --ink: #0b1426;
  --panel: #14213d;
  --cell: #1c2b4b;
  --card: #16233f;
  --line: rgba(148, 163, 184, 0.16);
  --text: #ffffff;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --gold: #fbbf24;
  --blue: #3b82f6;
  --green: #34d399;
  --orange: #fb923c;

  /* SF Pro Rounded on Apple devices, the font the game itself uses. */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1160px;

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 800;
}

/* ---------- Tiles: a CSS take on TileRenderer ---------- */

.tile {
  --c: var(--blue);
  --size: 56px;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 22%;
  color: #fff;
  font-weight: 900;
  font-size: calc(var(--size) * 0.46);
  line-height: 1;
  text-shadow: 0 calc(var(--size) * 0.02) calc(var(--size) * 0.03) rgba(0, 0, 0, 0.25);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--c) 80%, #fff), color-mix(in srgb, var(--c) 88%, #000));
  box-shadow:
    inset 0 calc(var(--size) * -0.07) 0 color-mix(in srgb, var(--c) 62%, #000),
    0 calc(var(--size) * 0.06) calc(var(--size) * 0.14) rgba(0, 0, 0, 0.35);
  user-select: none;
}

/* The gloss band sits inside the face, with softer corners. */
.tile::before {
  content: "";
  position: absolute;
  inset: 6% 8% auto;
  height: 32%;
  border-radius: 999px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  pointer-events: none;
}

/* Colour symbol in the top-left corner, as in the app. */
.tile::after {
  content: "";
  position: absolute;
  top: 12%;
  left: 12%;
  width: 14%;
  height: 14%;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}

.tile.green {
  --c: var(--green);
}

.tile.green::after {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.tile.orange {
  --c: var(--orange);
}

.tile.orange::after {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

/* Higher levels get deeper colour and a white ring. */
.tile.l2 {
  --c: color-mix(in srgb, var(--hue, var(--blue)) 94%, #000);
}

.tile.l3 {
  --c: color-mix(in srgb, var(--hue, var(--blue)) 88%, #000);
  outline: calc(var(--size) * 0.05) solid rgba(255, 255, 255, 0.75);
  outline-offset: calc(var(--size) * -0.12);
}

.tile.green.l2,
.tile.green.l3 {
  --hue: var(--green);
}

.tile.orange.l2,
.tile.orange.l3 {
  --hue: var(--orange);
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 5;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  color: var(--soft);
  padding: 8px 12px;
  border-radius: 999px;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--card);
}

@media (max-width: 560px) {
  .nav .hide-sm {
    display: none;
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: clamp(24px, 6vw, 72px) 0 clamp(56px, 9vw, 120px);
  isolation: isolate;
}

/* The board's empty cells, faded out toward the edges. */
.hero::before {
  content: "";
  position: absolute;
  inset: -90px 0 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Crect x='4' y='4' width='56' height='56' rx='12' fill='%231c2b4b'/%3E%3C/svg%3E");
  background-size: 64px 64px;
  background-position: center top;
  opacity: 0.55;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 45%, #000 0%, transparent 75%);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
}

.eyebrow .tile {
  --size: 20px;
}

.hero h1 {
  margin: 22px 0 18px;
  font-size: clamp(44px, 7.4vw, 92px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.hero h1 .line {
  display: block;
}

.hero h1 .accent {
  color: var(--gold);
}

.hero .lede {
  max-width: 30em;
  margin: 0 0 30px;
  font-size: clamp(17px, 1.9vw, 20px);
  color: var(--soft);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}

/* Stand-in until the official App Store badge can link to a live listing. */
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px 11px 18px;
  border-radius: 14px;
  background: #fff;
  color: #000;
  text-decoration: none;
  box-shadow: 0 6px 0 #9aa7bd, 0 14px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.store-btn:hover {
  transform: translateY(2px);
  box-shadow: 0 4px 0 #9aa7bd, 0 10px 24px rgba(0, 0, 0, 0.35);
}

.store-btn svg {
  width: 26px;
  height: 26px;
}

.store-btn small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.store-btn strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.facts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

.facts li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  vertical-align: 2px;
  border-radius: 2px;
  background: var(--green);
}

.facts li:nth-child(2)::before {
  background: var(--blue);
}

.facts li:nth-child(3)::before {
  background: var(--orange);
}

/* Phone with real gameplay, tiles floating off its edge. */
.hero-phone {
  position: relative;
  justify-self: center;
  width: min(100%, 300px);
}

.phone {
  position: relative;
  border-radius: 13% / 6%;
  padding: 3.2%;
  background: linear-gradient(145deg, #2a3754, #070b14 60%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 40px 80px -20px rgba(0, 0, 0, 0.7),
    0 0 120px -30px rgba(59, 130, 246, 0.45);
}

.phone img {
  width: 100%;
  border-radius: 11% / 5.1%;
}

.hero-phone .phone {
  transform: rotate(3deg);
}

.float {
  position: absolute;
  z-index: 2;
  animation: bob 6s ease-in-out infinite;
}

.float.f1 {
  left: -14%;
  top: 14%;
  --size: 64px;
  transform: rotate(-12deg);
}

.float.f2 {
  right: -10%;
  top: 46%;
  --size: 54px;
  animation-delay: -2s;
  transform: rotate(10deg);
}

.float.f3 {
  left: -6%;
  bottom: 12%;
  --size: 76px;
  animation-delay: -4s;
  transform: rotate(-6deg);
}

@keyframes bob {
  50% {
    translate: 0 -12px;
  }
}

@media (max-width: 860px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }

  .hero-phone {
    width: min(78%, 300px);
    margin-top: 12px;
  }

  .float.f1 {
    --size: 50px;
  }

  .float.f2 {
    --size: 44px;
    right: -12%;
  }

  .float.f3 {
    --size: 58px;
  }
}

/* ---------- Section scaffolding ---------- */

section {
  position: relative;
}

.section {
  padding: clamp(64px, 10vw, 128px) 0;
}

.kicker {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section h2 {
  margin: 0 0 18px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.section .intro {
  max-width: 34em;
  margin: 0;
  color: var(--soft);
  font-size: clamp(17px, 1.7vw, 19px);
}

/* ---------- How it works: live chain demo ---------- */

.how {
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.how .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
}

@media (max-width: 860px) {
  .how .wrap {
    grid-template-columns: 1fr;
  }
}

.steps {
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}

.steps li .tile {
  --size: 40px;
}

.steps h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
}

.steps p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.steps li.on {
  background: var(--card);
  border-color: var(--line);
}

.demo {
  position: relative;
  justify-self: center;
  width: min(100%, 420px);
}

.board {
  --n: 5;
  --gap: 2.2%;
  position: relative;
  aspect-ratio: 1;
  padding: 3.5%;
  border-radius: 7%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--line) inset, 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

.board .cells,
.board .layer {
  position: absolute;
  inset: 3.5%;
}

.board .cells {
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: var(--gap);
}

.board .cells span {
  border-radius: 22%;
  background: var(--cell);
}

.board .layer .tile {
  --size: 100%;
  position: absolute;
  width: calc((100% - var(--gap) * 4) / 5);
  height: calc((100% - var(--gap) * 4) / 5);
  font-size: clamp(18px, 5.6vw, 32px);
  left: calc(var(--x) * ((100% - var(--gap) * 4) / 5 + var(--gap)));
  top: calc(var(--y) * ((100% - var(--gap) * 4) / 5 + var(--gap)));
  transition:
    left 0.32s cubic-bezier(0.5, 0, 0.3, 1),
    top 0.32s cubic-bezier(0.5, 0, 0.3, 1),
    transform 0.32s cubic-bezier(0.3, 1.6, 0.5, 1),
    opacity 0.25s;
}

/* A tile's own size is the cell, so the shadows scale with the board. */
.board .layer .tile {
  box-shadow:
    inset 0 -4px 0 color-mix(in srgb, var(--c) 62%, #000),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

.board .layer .tile.l3 {
  outline-width: 3px;
  outline-offset: -8px;
}

.board .tile.lift {
  transform: scale(1.12);
  z-index: 2;
}

.board .tile.pop {
  transform: scale(1.22);
  z-index: 3;
}

.board .tile.gone {
  opacity: 0;
  transform: scale(0.5);
}

.board .tile.ghost {
  opacity: 0.55;
}

.ring {
  position: absolute;
  z-index: 4;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid var(--ring, #fff);
  pointer-events: none;
  left: calc(var(--x) * ((100% - var(--gap) * 4) / 5 + var(--gap)) + (100% - var(--gap) * 4) / 10);
  top: calc(var(--y) * ((100% - var(--gap) * 4) / 5 + var(--gap)) + (100% - var(--gap) * 4) / 10);
  translate: -50% -50%;
  animation: ring 0.7s ease-out forwards;
}

@keyframes ring {
  from {
    scale: 0.4;
    opacity: 1;
  }

  to {
    scale: 2.4;
    opacity: 0;
  }
}

.callout {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 6%;
  translate: -50% 0;
  font-weight: 900;
  font-size: clamp(30px, 8vw, 46px);
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: callout 1.1s ease-out forwards;
}

.callout.combo {
  color: var(--gold);
}

@keyframes callout {
  0% {
    opacity: 0;
    scale: 0.6;
  }

  18% {
    opacity: 1;
    scale: 1.08;
  }

  30% {
    scale: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    translate: -50% -12px;
  }
}

.demo .tray {
  display: flex;
  justify-content: center;
  align-items: center;
  /* Tall enough to hold the waiting piece, which scales with the board. */
  aspect-ratio: 4 / 1;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.demo-controls {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.demo-controls button {
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--soft);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.demo-controls button:hover {
  color: var(--text);
}

/* ---------- Screens ---------- */

.screens-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 18px 40px;
}

.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(220px, 24vw, 262px);
  gap: clamp(18px, 2.4vw, 30px);
  margin-top: 48px;
  padding: 10px var(--gutter) 34px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
}

.strip::-webkit-scrollbar {
  display: none;
}

@media (min-width: 1240px) {
  .strip {
    padding-left: calc((100vw - var(--max)) / 2 + var(--gutter));
    scroll-padding-left: calc((100vw - var(--max)) / 2 + var(--gutter));
  }
}

.strip figure {
  margin: 0;
  scroll-snap-align: start;
}

.strip figure:nth-child(even) {
  margin-top: 40px;
}

.strip .phone {
  border-radius: 14% / 6.5%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 30px 50px -20px rgba(0, 0, 0, 0.7);
}

.strip figcaption {
  margin-top: 16px;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.3;
}

.strip figcaption span {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
}

.strip-nav {
  display: flex;
  gap: 8px;
}

.strip-nav button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.strip-nav button:hover {
  background: var(--cell);
}

.strip-nav svg {
  width: 18px;
  height: 18px;
}

/* ---------- Promises ---------- */

.promises {
  background:
    radial-gradient(ellipse 60% 80% at 0% 100%, rgba(52, 211, 153, 0.08), transparent 70%),
    radial-gradient(ellipse 50% 70% at 100% 0%, rgba(251, 146, 60, 0.08), transparent 70%);
  border-top: 1px solid var(--line);
}

.promise-list {
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(32px, 6vw, 80px);
}

@media (max-width: 720px) {
  .promise-list {
    grid-template-columns: 1fr;
  }
}

.promise-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.promise-list .tile {
  --size: 48px;
}

.promise-list h3 {
  margin: 2px 0 4px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.promise-list p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- Closing call ---------- */

.closer {
  text-align: center;
  padding-bottom: clamp(72px, 10vw, 120px);
}

.closer img {
  width: 112px;
  height: 112px;
  margin: 0 auto 26px;
  border-radius: 25px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 80px -10px rgba(59, 130, 246, 0.5);
}

.closer h2 {
  margin-bottom: 26px;
}

.closer .cta-row {
  justify-content: center;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px 28px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}

.site-footer a {
  text-decoration: none;
  font-weight: 700;
  color: var(--soft);
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Document pages (privacy, terms, support) ---------- */

.doc {
  padding: clamp(28px, 6vw, 64px) 0 clamp(64px, 9vw, 110px);
}

.doc .wrap {
  max-width: 760px;
}

.doc-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 10px;
}

.doc-head .tile {
  --size: 52px;
  flex: none;
}

.doc h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.doc .meta {
  margin: 14px 0 36px;
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
}

.doc .summary {
  margin: 0 0 40px;
  padding: 20px 22px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--soft);
}

.doc .summary strong {
  color: var(--text);
}

.doc h2 {
  margin: 38px 0 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.doc p,
.doc li {
  color: var(--soft);
}

.doc p {
  margin: 0 0 14px;
}

.doc ul {
  padding-left: 1.2em;
  margin: 0 0 14px;
}

.doc li {
  margin-bottom: 6px;
}

.doc a {
  color: var(--gold);
  text-underline-offset: 3px;
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 36px;
  padding: 0;
  list-style: none;
}

.toc a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.toc a:hover {
  color: var(--text);
}

/* Support page FAQ */
.faq {
  margin: 0;
}

.faq details {
  border-top: 1px solid var(--line);
}

.faq details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--cell);
  color: var(--soft);
  font-size: 20px;
  font-weight: 800;
  transition: transform 0.2s;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details > div {
  padding: 0 0 18px;
}

.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 44px;
  padding: 22px 24px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
}

.contact-card p {
  margin: 0;
}

.contact-card strong {
  display: block;
  color: var(--text);
  font-size: 19px;
}

.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 14px;
  background: var(--gold);
  color: var(--ink) !important;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 4px 0 #b4820f;
}

.btn:hover {
  transform: translateY(1px);
  box-shadow: 0 3px 0 #b4820f;
}

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

  .float {
    animation: none;
  }

  .board .layer .tile {
    transition: none;
  }
}
