/*
 * The app's look (src/constants/theme.ts): warm paper and deep ink, grape for your own
 * moves, sunshine for bingos. Display type is Bricolage Grotesque, served from here.
 */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/bricolage-grotesque-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/bricolage-grotesque-800.woff2') format('woff2');
}

:root {
  --text: #1d1a2f;
  --text-secondary: #6e6a7c;
  --background: #f7f4ee;
  --surface: #ffffff;
  --border: #e5e0d6;
  --primary: #6b4eff;
  --primary-edge: #4e33d9;
  --on-primary: #ffffff;
  --tile: #ffffff;
  --tile-edge: #e2dcd0;
  --bingo: #ffcf3f;
  --bingo-edge: #e0a800;
  --on-bingo: #1d1a2f;
  --card-shadow: 0 1px 2px rgba(29, 26, 47, 0.05), 0 6px 16px rgba(29, 26, 47, 0.05);
  --display:
    'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f2fa;
    --text-secondary: #a39eb4;
    --background: #14121c;
    --surface: #1f1c2a;
    --border: #322d44;
    --primary-edge: #4a30d0;
    --tile: #242132;
    --tile-edge: #0c0b12;
    --bingo: #ffd23f;
    --bingo-edge: #c99a0e;
    --card-shadow: none;
  }
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.8px;
}
p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}
[hidden] {
  display: none !important;
}

/* Tiles: the app's game pieces, standing on a solid edge. */
.tiles {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--tile);
  box-shadow: 0 3px 0 var(--tile-edge);
  color: var(--text);
  font-family: var(--display);
  font-weight: 800;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.tagline {
  color: var(--text-secondary);
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.2px;
}
/* Nine tiles fill the width on a phone (29 px at 360 px) and stop at 40 px on wider
   screens. B-I-N-G-O is a full line, so it stands in the bingo colour. */
.wordmark {
  --size: min(40px, calc((100vw - 96px) / 9));
  gap: 6px;
}
.wordmark .tile {
  width: var(--size);
  height: var(--size);
  border-radius: calc(var(--size) * 0.24);
  font-size: calc(var(--size) * 0.58);
}
.wordmark .tile:nth-child(1) {
  transform: rotate(-4deg);
}
.wordmark .tile:nth-child(2) {
  transform: rotate(3deg);
}
.wordmark .tile:nth-child(3) {
  transform: rotate(-2deg);
}
.wordmark .tile:nth-child(4) {
  transform: rotate(2deg);
}
.wordmark .tile:nth-child(5) {
  transform: rotate(-3deg);
}
.wordmark .tile:nth-child(6) {
  transform: rotate(4deg);
}
.wordmark .tile:nth-child(7) {
  transform: rotate(-2deg);
}
.wordmark .tile:nth-child(8) {
  transform: rotate(3deg);
}
.wordmark .tile:nth-child(9) {
  transform: rotate(-5deg);
}

/*
 * The app's entrance (src/components/wordmark.tsx): each tile rises 25 px into place
 * while fading in, 60 ms after the one before, on the Springs.pop spring (damping 11,
 * stiffness 220, mass 1, sampled into linear() over 0.9 s); the subtitle fades in
 * 120 ms after the last tile. `translate` leaves the tiles' tilt (`transform`) alone.
 */
.wordmark .tile {
  /* Browsers without linear() (Safari before 17.2) keep this simpler bounce. */
  animation: tile-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation: tile-in 0.9s
    linear(
      0,
      0.041,
      0.148,
      0.302,
      0.48,
      0.663,
      0.837,
      0.989,
      1.112,
      1.202,
      1.258,
      1.283,
      1.281,
      1.257,
      1.218,
      1.169,
      1.117,
      1.066,
      1.02,
      0.981,
      0.952,
      0.932,
      0.921,
      0.919,
      0.923,
      0.933,
      0.946,
      0.961,
      0.975,
      0.989,
      1.001,
      1.011,
      1.018,
      1.022,
      1.023,
      1.023,
      1.02,
      1.017,
      1.013,
      1.009,
      1.005,
      1.001,
      0.998,
      0.996,
      0.994,
      1
    )
    both;
}
.wordmark .tile:nth-child(2) {
  animation-delay: 60ms;
}
.wordmark .tile:nth-child(3) {
  animation-delay: 120ms;
}
.wordmark .tile:nth-child(4) {
  animation-delay: 180ms;
}
.wordmark .tile:nth-child(5) {
  animation-delay: 240ms;
}
.wordmark .tile:nth-child(6) {
  animation-delay: 300ms;
}
.wordmark .tile:nth-child(7) {
  animation-delay: 360ms;
}
.wordmark .tile:nth-child(8) {
  animation-delay: 420ms;
}
.wordmark .tile:nth-child(9) {
  animation-delay: 480ms;
}
.brand .tagline {
  animation: fade-in 0.3s ease-out 0.66s both;
}
@keyframes tile-in {
  from {
    translate: 0 25px;
    opacity: 0;
  }
  to {
    translate: 0 0;
    opacity: 1;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark .tile,
  .brand .tagline {
    animation: none;
  }
}
.tile.flipped {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 3px 0 var(--primary-edge);
  color: var(--on-primary);
}
.tile.bingo {
  background: var(--bingo);
  border-color: var(--bingo);
  box-shadow: 0 3px 0 var(--bingo-edge);
  color: var(--on-bingo);
}

.card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 16px 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
.code .tile {
  width: 52px;
  height: 60px;
  border-width: 2px;
  border-radius: 13px;
  font-size: 30px;
}

a.button {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: var(--primary);
  box-shadow: 0 3px 0 var(--primary-edge);
  color: var(--on-primary);
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
}
a.button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--primary-edge);
}
