/* ==========================================================================
   Block Lark — theme (colours and textures sampled from the game's icon, store art and screenshots).
   Identity: a warm patchwork quilt. Linen ground, stitched seams, gingham / dot / leaf fabrics,
   and the deep indigo of the app icon for the "back of the quilt" (Tech inside).
   ========================================================================== */

:root {
  /* Ground and text */
  --page: #F4ECDE;          /* linen, from the board and screenshot background */
  --page-deep: #ECE0CB;     /* empty board linen */
  --ink: #3B2A20;           /* score text brown */
  --ink-soft: #654F40;      /* 6.4:1 on --page */
  --seam: #7B4B2E;          /* stitched frame brown */
  --link: #A42E45;

  /* Bands */
  --band: #B23A50;          /* gingham red, darkened so cream text passes 4.5:1 */
  --band-ink: #FDF6EC;
  --dark: #272A55;          /* app icon indigo */
  --dark-ink: #FDF6EC;
  --dark-soft: rgba(253, 246, 236, 0.78);
  --focus: #272A55;

  /* Fabrics */
  --red: #D9475E;
  --mustard: #EFBF3E;
  --blue: #3D7CC2;
  --leaf: #5E9F54;
  --plum: #9A78CF;
  --orange: #EC8A35;
  --cocoa: #A26A45;

  --check: rgba(255, 255, 255, 0.24);
  --stitch-light: rgba(255, 255, 255, 0.78);
}

/* ---------- Linen and seams ---------- */
body {
  background-image:
    repeating-linear-gradient(0deg, rgba(123, 75, 46, 0.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(123, 75, 46, 0.03) 0 1px, transparent 1px 4px);
}

/* Gingham band with a stitched hem, like the banner on the store screenshots. */
.bar, .cta {
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 50%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.07) 50%, transparent 50%);
  background-size: 22px 22px;
}
.bar { border-bottom: 4px solid var(--seam); }
.bar::after, .cta::before, .cta::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px dashed rgba(253, 246, 236, 0.75);
  pointer-events: none;
}
.bar::after { bottom: 7px; }
.cta { position: relative; border-block: 4px solid var(--seam); }
.cta::before { top: 8px; }
.cta::after { bottom: 8px; }

/* Section seams: every block of the page is sewn to the next. */
.modes, .gallery { position: relative; }
.gallery { background-color: var(--page-deep); border-top: 2px dashed rgba(123, 75, 46, 0.45); }
.tech { position: relative; border-top: 4px solid var(--seam); }
.tech::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  border-top: 2px dashed rgba(253, 246, 236, 0.35);
}

.hero__icon { box-shadow: 0 10px 24px -10px rgba(39, 42, 85, 0.55); }
.hero__tagline { color: var(--seam); }

/* ---------- Fabrics (shared by the board, the tray, the mode patches and the feature swatches) ---------- */
.fab { position: relative; background-color: var(--red); }
.fab--r, .fab--b {
  background-image:
    linear-gradient(90deg, var(--check) 50%, transparent 50%),
    linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 10px 10px;
}
.fab--r { background-color: var(--red); }
.fab--b { background-color: var(--blue); }
.fab--y {
  background-color: var(--mustard);
  background-image: radial-gradient(rgba(255, 255, 255, 0.62) 1.6px, transparent 2.2px);
  background-size: 9px 9px;
}
.fab--g {
  background-color: var(--leaf);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0 2px, transparent 2px 7px);
}
.fab--p {
  background-color: var(--plum);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.5) 1.4px, transparent 2px),
    radial-gradient(rgba(255, 255, 255, 0.28) 1.4px, transparent 2px);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.fab--o {
  background-color: var(--orange);
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.26) 0 2px, transparent 2px 5px);
}
.fab--c {
  background-color: var(--cocoa);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%);
  background-size: 10px 10px;
}

/* ---------- Hero board ---------- */
.hero__visual { position: relative; }
.quilt { position: relative; max-width: 470px; margin-inline: auto; }
.quilt__board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(3px, 0.6vw, 5px);
  padding: clamp(12px, 2vw, 18px);
  background-color: var(--page-deep);
  border: 4px solid var(--seam);
  border-radius: 20px;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.6) inset, 0 24px 48px -24px rgba(91, 56, 34, 0.55);
  transform: rotate(-2deg);
}
.quilt__board::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px dashed rgba(123, 75, 46, 0.55);
  border-radius: 14px;
  pointer-events: none;
}
.quilt .cell { aspect-ratio: 1; border-radius: 5px; }
.quilt .cell--empty {
  background: #DDCDB2;
  box-shadow: inset 0 2px 3px rgba(91, 56, 34, 0.22);
}
.quilt .fab {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.17), inset 0 2px 0 rgba(255, 255, 255, 0.32);
}
.quilt .fab::after {
  content: "";
  position: absolute;
  inset: 17%;
  border: 1.5px dashed var(--stitch-light);
  border-radius: 3px;
}

/* Tray: the three pieces waiting under the board, as in the game. */
.quilt__tray {
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-height: 92px;
  margin-top: 26px;
}
.piece { display: inline-grid; gap: 2px; }
.piece--w1 { grid-template-columns: repeat(1, 20px); }
.piece--w2 { grid-template-columns: repeat(2, 20px); }
.piece--w3 { grid-template-columns: repeat(3, 20px); }
.quilt .piece .cell { width: 20px; border-radius: 3px; }
.quilt .piece .fab::after { inset: 20%; border-width: 1px; }
.cell--gap { visibility: hidden; }

/* Sewing buttons pinned beside the board (the game's own decoration). */
.hero__visual::before, .hero__visual::after {
  content: "";
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 38%, #4A3226 0 3.5px, transparent 4px),
    radial-gradient(circle at 62% 38%, #4A3226 0 3.5px, transparent 4px),
    radial-gradient(circle at 38% 62%, #4A3226 0 3.5px, transparent 4px),
    radial-gradient(circle at 62% 62%, #4A3226 0 3.5px, transparent 4px),
    var(--red);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 6px 12px -6px rgba(59, 42, 32, 0.6);
}
.hero__visual::before { left: -6px; bottom: 64px; }
.hero__visual::after {
  right: -4px;
  top: -18px;
  width: 38px;
  height: 38px;
  background:
    radial-gradient(circle at 38% 38%, #F4ECDE 0 3px, transparent 3.5px),
    radial-gradient(circle at 62% 38%, #F4ECDE 0 3px, transparent 3.5px),
    radial-gradient(circle at 38% 62%, #F4ECDE 0 3px, transparent 3.5px),
    radial-gradient(circle at 62% 62%, #F4ECDE 0 3px, transparent 3.5px),
    #5A3B2B;
}

/* The one orchestrated moment: sew the piece in, then unpick the finished row. */
.piece { transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.3s ease; }
.piece.is-lifting { transform: translateY(-12px) scale(1.12); }
.piece.is-placed { opacity: 0; transform: translateY(-56px) scale(0.6); }

.quilt .cell.is-sewn { animation: bl-sew 0.42s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.quilt .cell.is-sewn::after { animation: bl-stitch 0.45s 0.12s ease-out both; }
.quilt .cell.is-unstitching { animation: bl-unpick 0.5s ease-in forwards; }
.quilt .cell.is-cleared { animation: bl-settle 0.4s ease-out both; }

@keyframes bl-sew {
  from { transform: scale(0.35); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes bl-stitch {
  from { transform: scale(1.5); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes bl-unpick {
  0% { transform: none; filter: brightness(1); }
  35% { transform: scale(1.1); filter: brightness(1.35); }
  100% { transform: scale(0.1) rotate(-14deg); opacity: 0; }
}
@keyframes bl-settle {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Mode patches: three fabrics sewn into one quilt block ---------- */
.patches {
  border: 4px solid var(--seam);
  border-radius: 22px;
  overflow: hidden;
  background: #FBF5EA;
  box-shadow: 0 22px 40px -30px rgba(91, 56, 34, 0.6);
}
.patch + .patch { border-left: 2px dashed rgba(123, 75, 46, 0.55); }
.patch__fabric { border-bottom: 2px dashed rgba(123, 75, 46, 0.55); }
.patch--classic .patch__fabric {
  background-color: var(--red);
  background-image:
    linear-gradient(90deg, var(--check) 50%, transparent 50%),
    linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 16px 16px;
}
.patch--run .patch__fabric {
  background-color: var(--leaf);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0 3px, transparent 3px 12px);
}
.patch--daily .patch__fabric {
  background-color: var(--mustard);
  background-image: radial-gradient(rgba(255, 255, 255, 0.65) 2.4px, transparent 3px);
  background-size: 14px 14px;
}

/* ---------- Feature notes: a fabric swatch marks each one ---------- */
.note { border-top: 2px dashed rgba(123, 75, 46, 0.4); }
.note__title::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.17);
  background-color: var(--red);
}
.note--gravity .note__title::before { background-color: var(--plum); }
.note--fair .note__title::before { background-color: var(--mustard); }
.note--offline .note__title::before { background-color: var(--leaf); }
.note--cloud .note__title::before { background-color: var(--blue); }
.note--devices .note__title::before { background-color: var(--orange); }
.note--languages .note__title::before { background-color: var(--red); }

/* ---------- Gallery: prints pinned on linen ---------- */
.shot img {
  width: 100%;
  border-radius: 14px;
  border: 6px solid #FFFBF3;
  box-shadow: 0 0 0 2px rgba(123, 75, 46, 0.35), 0 18px 32px -20px rgba(91, 56, 34, 0.6);
}

/* ---------- Tech inside ---------- */
.spec { border-top: 2px dashed rgba(253, 246, 236, 0.28); }
.tech .section-title { color: var(--dark-ink); }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .patch + .patch { border-left: 0; border-top: 2px dashed rgba(123, 75, 46, 0.55); }
  .patch__fabric { height: 44px; }
  .quilt__board { transform: none; border-radius: 16px; }
  .hero__visual::before { left: -4px; bottom: 54px; width: 36px; height: 36px; }
  .hero__visual::after { right: 0; top: -14px; width: 30px; height: 30px; }
}
