/* Chain website. Colours and fonts follow the game's candy theme (packages/shell/src/theme.ts). */

@font-face {
  font-family: 'Fredoka';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/fredoka-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/fredoka-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/nunito-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-weight: 800;
  font-display: swap;
  src: url('fonts/nunito-800.woff2') format('woff2');
}

:root {
  --bg-top: #7b5cff;
  --bg-bottom: #4426c9;
  --night: #1c1147;
  --panel: #3a22a8;
  --panel-edge: #2a1782;
  --well: #4e30c8;
  --text: #ffffff;
  --text-sub: #d6ccff;
  --accent: #ffd23f;
  --accent-text: #4a3200;
  --accent-edge: #c79f1f;
  --red: #ff4d6d;
  --orange: #ff9f1c;
  --yellow: #ffd23f;
  --green: #3ddc97;
  --blue: #33a1fd;
  --pink: #ff6fd8;
  --display: 'Fredoka', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  --radius: 22px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

body {
  margin: 0;
  font-family: var(--body);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg-bottom);
  background-image:
    radial-gradient(1.5px 1.5px at 22px 38px, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(1px 1px at 140px 96px, rgba(255, 255, 255, 0.45), transparent 60%),
    radial-gradient(1.5px 1.5px at 200px 210px, rgba(255, 244, 196, 0.5), transparent 60%),
    radial-gradient(1px 1px at 80px 180px, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom) 70%);
  background-size: 240px 240px, 240px 240px, 240px 240px, 240px 240px, 100% 100%;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}
a:hover {
  color: #ffe58a;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(34px, 6vw, 56px);
}
h2 {
  font-size: clamp(26px, 4vw, 38px);
}
h3 {
  font-size: 21px;
}
p {
  margin: 0 0 1em;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 14px;
  border-radius: 10px;
  z-index: 10;
}
.skip:focus {
  left: 8px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}
.wrap.narrow {
  max-width: 760px;
}

/* ---------- header / footer ---------- */
.site-header {
  padding: 18px 0;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
}
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}
.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 12px;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.site-footer {
  margin-top: 72px;
  padding: 28px 0 40px;
  background: rgba(20, 8, 70, 0.35);
  color: var(--text-sub);
  font-size: 15px;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  justify-content: space-between;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.site-footer a {
  color: var(--text-sub);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 16px;
  border: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 5px 0 var(--accent-edge);
}
.btn.primary:hover {
  color: var(--accent-text);
  transform: translateY(-1px);
}
.btn.secondary {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 5px 0 var(--panel-edge);
}
.btn.secondary:hover {
  color: var(--text);
  transform: translateY(-1px);
}
.btn.soon {
  background: rgba(20, 8, 70, 0.4);
  color: var(--text);
  border: 2px dashed rgba(255, 255, 255, 0.35);
  cursor: default;
  font-size: 17px;
}
.btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ---------- hero ---------- */
.hero {
  padding: 28px 0 48px;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
.tiles-logo {
  display: flex;
  gap: 8px;
  margin: 0 0 22px;
  flex-wrap: nowrap;
}
.tiles-logo span {
  --tc: var(--red);
  width: clamp(48px, 9vw, 74px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 24%;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 5vw, 40px);
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 78%, #fff), var(--tc));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--tc) 70%, #000);
  position: relative;
  text-shadow: 0 2px 0 rgba(26, 13, 64, 0.25);
}
.tiles-logo span + span::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  width: 8px;
  height: 18%;
  transform: translateY(-50%);
  background: #f3eeff;
  border-radius: 4px;
}
.tagline {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(21px, 3vw, 27px);
  color: var(--text-sub);
  margin: 0 0 12px;
}
.lede {
  font-size: 18px;
  max-width: 34em;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

/* ---------- phone frames ---------- */
.phone {
  margin: 0;
  width: 100%;
  max-width: 300px;
  justify-self: center;
  border-radius: 40px;
  padding: 10px;
  background: #140846;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.12),
    0 30px 60px rgba(14, 4, 60, 0.55);
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 30px;
}
.hero .phone {
  transform: rotate(3deg);
}

/* ---------- sections ---------- */
section {
  padding: 48px 0;
}
.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 30px;
}
.section-head p {
  color: var(--text-sub);
}

/* how to play + demo */
.how {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: center;
}
.rules {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}
.rules li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(58, 34, 168, 0.65);
  border-radius: 18px;
  padding: 14px 16px;
}
.rules b {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--display);
}
.eg {
  font-family: var(--display);
  white-space: nowrap;
}
.eg.ok {
  color: var(--green);
}
.eg.no {
  color: #ff8fa3;
}

.demo {
  background: var(--panel);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 8px 0 var(--panel-edge);
  max-width: 420px;
  width: 100%;
  justify-self: center;
}
.demo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.demo-head h3 {
  margin: 0;
}
.demo-reset {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 16px;
  border-radius: 12px;
}
.board {
  position: relative;
  aspect-ratio: 1;
}
.board svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.board svg polyline {
  fill: none;
  stroke: #e8b92e;
  stroke-width: 16;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.board .grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6%;
  padding: 3%;
}
.tile {
  border: none;
  border-radius: 24%;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 7vw, 40px);
  color: #fff;
  background: var(--well);
  box-shadow: 0 6px 0 var(--panel-edge);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
  position: relative;
  z-index: 1;
}
.tile:hover {
  transform: translateY(-2px);
}
.tile.on {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 6px 0 var(--accent-edge);
}
.tile.head {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.tile.bad {
  animation: shake 0.3s ease;
}
@keyframes shake {
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
.demo-msg {
  min-height: 3.2em;
  margin: 16px 0 0;
  text-align: center;
  color: var(--text-sub);
}
.demo-msg.good {
  color: var(--green);
}
.demo-msg.bad {
  color: #ff8fa3;
}
.board.won .tile.on {
  background: var(--green);
  color: #08351f;
  box-shadow: 0 6px 0 #22a06b;
}
.board.won svg polyline {
  stroke: #22a06b;
}

/* features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature {
  background: rgba(58, 34, 168, 0.7);
  border-radius: var(--radius);
  padding: 22px;
}
.feature .ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: var(--c, var(--accent));
  color: #fff;
}
.feature .ico svg {
  width: 26px;
  height: 26px;
}
.feature p {
  color: var(--text-sub);
  margin: 0;
}

/* screenshots */
.shots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 1fr);
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px 4px 18px;
}
.shots figure {
  scroll-snap-align: center;
  margin: 0;
  text-align: center;
}
.shots .phone {
  max-width: 240px;
  margin: 0 auto 12px;
}
.shots figcaption {
  color: var(--text-sub);
  font-weight: 800;
}

.closing {
  text-align: center;
  background: rgba(28, 17, 71, 0.55);
  border-radius: 30px;
  padding: 40px 24px;
}
.closing .cta-row {
  justify-content: center;
}

/* ---------- text pages (privacy, support) ---------- */
.page {
  padding: 16px 0 0;
}
.page .card {
  background: rgba(28, 17, 71, 0.6);
  border-radius: 26px;
  padding: clamp(22px, 5vw, 40px);
}
.page h2 {
  font-size: 25px;
  margin-top: 1.6em;
}
.page h3 {
  margin-top: 1.4em;
}
.page ul {
  padding-left: 1.2em;
}
.page li {
  margin-bottom: 0.45em;
}
.updated {
  color: var(--text-sub);
  font-size: 15px;
}
.table-scroll {
  overflow-x: auto;
  margin: 0 0 1em;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 15px;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
th {
  font-family: var(--display);
  color: var(--text-sub);
}
details {
  background: rgba(58, 34, 168, 0.55);
  border-radius: 16px;
  padding: 4px 18px;
  margin-bottom: 10px;
}
summary {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  padding: 12px 0;
}
details p:last-child {
  margin-bottom: 14px;
}
.contact {
  text-align: center;
  margin-top: 32px;
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .hero .wrap,
  .how {
    grid-template-columns: 1fr;
  }
  .hero .phone {
    max-width: 260px;
    transform: none;
  }
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  body {
    font-size: 16px;
  }
  .wrap {
    padding: 0 16px;
  }
  .features {
    grid-template-columns: 1fr;
  }
  .nav .hide-small {
    display: none;
  }
  .tiles-logo {
    gap: 6px;
  }
  .tiles-logo span + span::before {
    width: 6px;
  }
  .cta-row .btn {
    width: 100%;
  }
  .shots {
    grid-auto-columns: 72%;
  }
  /* Tables become one card per row, each cell labelled from data-label. */
  .table-scroll table,
  .table-scroll tbody,
  .table-scroll tr,
  .table-scroll td {
    display: block;
    min-width: 0;
  }
  .table-scroll thead {
    position: absolute;
    left: -9999px;
  }
  .table-scroll tr {
    background: rgba(58, 34, 168, 0.55);
    border-radius: 14px;
    padding: 6px 0;
    margin-bottom: 10px;
  }
  .table-scroll td {
    border: none;
    padding: 6px 14px;
  }
  .table-scroll td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--display);
    font-weight: 600;
    color: var(--text-sub);
    font-size: 13px;
  }
}
