/* Home page for mapzzle.com: hero, the two playable demos and the feature grid.
   Loads on top of theme.css, which holds the colours, type and page chrome
   shared with the written pages. */

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  background:
    radial-gradient(120% 90% at 18% 0%, rgba(255, 255, 255, 0.22), transparent 60%),
    linear-gradient(160deg, var(--teal) 0%, #178a8c 45%, var(--teal-deep) 100%);
  color: #fff;
  padding: 28px 0 clamp(56px, 8vw, 96px);
  overflow: hidden;
}

.hero .topbar { margin-bottom: clamp(32px, 6vw, 64px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  grid-template-rows: auto auto;
  column-gap: clamp(32px, 5vw, 64px);
  row-gap: 28px;
  align-items: center;
}
.hero-copy { grid-column: 1; grid-row: 1; align-self: end; }
.hero-cta { grid-column: 1; grid-row: 2; align-self: start; }
.hero-board-col { grid-column: 2; grid-row: 1 / span 2; }

.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 4rem);
  font-weight: 600;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.hero-lead {
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
  color: rgba(255, 255, 255, 0.92);
  max-width: 34rem;
  margin-bottom: 1.6rem;
}

.hero-points {
  list-style: none;
  margin: 0 0 1.8rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.hero-points li {
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

/* Store buttons. At launch, replace each .store-btn with the official
   App Store / Google Play badge and point its href at the real listing. */
.stores { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px 11px 17px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(8, 44, 48, 0.42);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: default;
}
.store-btn svg { flex: none; opacity: 0.9; }
.store-btn b { display: block; font-weight: 600; font-size: 1.02rem; line-height: 1.2; }
.store-btn small { display: block; font-size: 0.76rem; opacity: 0.8; letter-spacing: 0.04em; }

.notify { font-size: 0.92rem; color: rgba(255, 255, 255, 0.82); margin: 0; }
.notify a { color: #fff; }

/* Board card: the mint panel the game draws its map on */
.board-card {
  background: var(--sea);
  border-radius: 28px;
  padding: clamp(14px, 2vw, 22px);
  box-shadow: 0 26px 60px -22px rgba(4, 40, 44, 0.55);
}
.hero .board-card { box-shadow: 0 30px 70px -20px rgba(2, 30, 36, 0.6); }

/* ── Board SVG ───────────────────────────────────────────────────────────── */

.board { display: block; width: 100%; height: auto; }
.board path {
  stroke: #fff;
  stroke-width: var(--bw, 3);
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center;
}
.board .slot { fill: var(--slot); cursor: pointer; }
.board .slot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.c0 { fill: var(--p0); } .c1 { fill: var(--p1); } .c2 { fill: var(--p2); }
.c3 { fill: var(--p3); } .c4 { fill: var(--p4); } .c5 { fill: var(--p5); }
.c6 { fill: var(--p6); }

.hero-board path { transition: transform 620ms cubic-bezier(.2,.9,.25,1), opacity 320ms ease; }

@keyframes piecePop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.09); }
  100% { transform: scale(1); }
}
.board path.just-placed { animation: piecePop 420ms ease-out; }

/* ── Sections ────────────────────────────────────────────────────────────── */

section { padding: clamp(56px, 8vw, 92px) 0; }
.section-head { max-width: 42rem; margin-bottom: clamp(28px, 4vw, 44px); }
.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-bottom: 0.7rem; color: var(--title); }
.section-head p { color: var(--muted); font-size: 1.06rem; margin: 0; }

.band-soft { background: var(--surface); border-block: 1px solid var(--line); }

/* ── Demo cards ──────────────────────────────────────────────────────────── */

.demo {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(16px, 2.4vw, 26px);
  box-shadow: 0 18px 40px -28px rgba(10, 60, 56, 0.5);
}
.band-soft .demo { background: var(--mint); }

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
  min-height: 46px;
}
.demo-prompt { font-size: 1.12rem; font-weight: 500; margin: 0; flex: 1 1 15rem; }
.demo-prompt strong { color: var(--accent); font-weight: 600; }
.demo-stat {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-soft);
  background: rgba(52, 211, 153, 0.16);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.95rem;
}

.board-wrap { position: relative; }
/* The demos keep the game's mint sea behind the board in either color scheme. */
.demo .board-wrap {
  background: var(--sea);
  border-radius: 18px;
  padding: clamp(8px, 1.4vw, 16px);
}
.board-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Jigsaw tray: a plain row, not the app's scrolling carousel */
.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  min-height: 112px;
  align-content: flex-start;
}
.tray-piece {
  flex: 0 0 auto;
  width: clamp(86px, 13vw, 116px);
  padding: 8px 6px 6px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: grab;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.tray-piece:hover { background: rgba(52, 211, 153, 0.12); transform: translateY(-2px); }
.tray-piece:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tray-piece[aria-pressed="true"] { border-color: var(--accent); background: rgba(52, 211, 153, 0.16); }
.tray-piece svg { width: 100%; height: 58px; overflow: visible; }
.tray-piece svg path { stroke: #fff; stroke-width: 6; stroke-linejoin: round;
  filter: drop-shadow(0 2px 2px rgba(12, 60, 56, 0.28)); }
.tray-piece span { font-size: 0.78rem; line-height: 1.2; color: var(--muted); text-align: center; }
.tray-empty { color: var(--muted); font-size: 0.95rem; align-self: center; margin: 0 auto; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.tray-piece.wrong { animation: nudge 260ms ease-in-out 2; }

.drag-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 10px 14px rgba(10, 60, 56, 0.4));
}
.drag-ghost path { stroke: #fff; stroke-width: 4; stroke-linejoin: round; }

/* Quiz */
.quiz-board { touch-action: pan-y; cursor: crosshair; }
.quiz-board.is-done { cursor: default; }
.hold-ring circle { fill: none; stroke-linecap: round; }
.answer-line { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 10 9; opacity: 0.9; }
.answer-dot { stroke: #fff; stroke-width: 3; }
.reveal-label {
  font: 600 34px 'Fredoka', sans-serif;
  fill: #10403a;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 7;
  stroke-linejoin: round;
  text-anchor: middle;
}
.board path.reveal { stroke: #10403a; stroke-width: 6; }

.score-pop {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, 10%);
  font-weight: 600;
  font-size: 1.3rem;
  color: #0f5a52;
  text-shadow: 0 2px 0 #fff, 0 0 10px #fff;
  pointer-events: none;
  animation: floatUp 1400ms ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 70%) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, 30%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -45%) scale(1); }
}

.demo-result {
  margin: 16px 0 0;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(52, 211, 153, 0.14);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.demo-result p { margin: 0; flex: 1 1 18rem; font-weight: 500; }
.demo-result[hidden] { display: none; }

/* ── Feature grid ────────────────────────────────────────────────────────── */

.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-card);
  padding: 22px 22px 24px;
}
.band-soft .card { background: var(--mint); }
.card h3 { font-size: 1.18rem; margin-bottom: 0.5rem; color: var(--title); }
.card p { margin: 0; color: var(--muted); font-size: 0.99rem; }
.card .dot {
  display: inline-block;
  width: 34px; height: 34px;
  border-radius: 11px;
  margin-bottom: 12px;
}

.modes { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.mode-card { position: relative; overflow: hidden; }
.mode-card .tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0e4f47;
  background: var(--primary);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.mode-card.quiz .tag { background: var(--secondary); }

.numbers {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 8px;
}
.number { text-align: center; padding: 18px 10px; background: var(--surface);
  border: 2px solid var(--line); border-radius: 20px; }
.band-soft .number { background: var(--mint); }
.number b { display: block; font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 600; color: var(--title); }
.number span { font-size: 0.92rem; color: var(--muted); }

/* ── Closing CTA + footer ────────────────────────────────────────────────── */

.closing {
  background: linear-gradient(160deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: #fff;
  text-align: center;
}
.closing h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); margin-bottom: 0.8rem; }
.closing p { color: rgba(255, 255, 255, 0.9); max-width: 36rem; margin: 0 auto 1.6rem; }
.closing .stores { justify-content: center; }
.closing .notify { text-align: center; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; display: flex; flex-direction: column; }
  .hero-copy { order: 1; }
  .hero-board-col { order: 2; }
  .hero-cta { order: 3; }
}

@media (max-width: 640px) {
  .demo { padding: 14px 12px 16px; border-radius: 20px; }
  .demo-prompt { font-size: 1rem; }
  .demo-bar { gap: 8px 12px; margin-bottom: 10px; }
  .tray { gap: 6px; justify-content: center; }
  .tray-piece { width: clamp(78px, 29vw, 104px); }
  .score-pop { font-size: 1.1rem; }
}
