/* PiVille website. Colours and shapes come straight from the game's UI kit
   (scripts/battle/ui_kit.gd): cream cards with a raised bottom edge, brown ink,
   coral / sky / mint / gold accents. */

@font-face { font-family: "Fredoka"; src: url("assets/fonts/Fredoka.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "FredokaHebrew"; src: url("assets/fonts/FredokaHebrew.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("assets/fonts/Nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "RubikHebrew"; src: url("assets/fonts/RubikHebrew.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --ink: #5b3f2c;
  --ink-soft: #7a5e46;
  --sand: #f2e7cf;
  --cream: #fffdf6;
  --cream-low: #f7edd9;
  --edge: #dcc79e;
  --tan: #e8d9b8;
  --coral: #ee7a64;
  --coral-edge: #c95a45;
  --sky: #4fa8d8;
  --sky-edge: #3b7fa8;
  --sky-top: #5fb4e2;
  --sky-low: #bfe5f4;
  --mint: #4db37e;
  --green: #3b9a64;
  --green-edge: #2a7148;
  --gold: #f5b83d;
  --gold-edge: #d9932a;
  --purple: #8f7ad9;
  --display: "Fredoka", "FredokaHebrew", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito", "RubikHebrew", system-ui, sans-serif;
  --r: 22px;
  --lift: 0 6px 0 var(--edge), 0 14px 28px rgba(107, 79, 58, .14);
}
:root:lang(he) {
  --display: "FredokaHebrew", "Fredoka", system-ui, sans-serif;
  --body: "RubikHebrew", "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font: 500 18px/1.6 var(--body);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 .5em; font-weight: 600; }
h2 { font-size: clamp(32px, 4.6vw, 52px); }
h3 { font-size: 22px; }
p { margin: 0 0 1em; }
a { color: var(--sky-edge); font-weight: 700; }
em { font-style: normal; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--ink-soft); }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--cream); padding: 8px 14px; border-radius: 12px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
:focus-visible { outline: 3px solid var(--sky-edge); outline-offset: 3px; border-radius: 10px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, (100% - 1180px) / 2);
  background: rgba(255, 253, 246, .88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 0 rgba(220, 199, 158, .7);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 26px/1 var(--display); }
.brand img { border-radius: 12px; box-shadow: 0 3px 0 var(--edge); }
.brand.small { font-size: 20px; }
.brand.small img { border-radius: 8px; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { color: var(--ink); text-decoration: none; font: 600 17px/1 var(--display); padding: 10px 14px; border-radius: 999px; transition: background .2s; }
.nav a:hover { background: var(--cream-low); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 17px/1 var(--display); color: var(--ink);
  background: var(--cream); border: 0; border-radius: 999px;
  padding: 11px 18px; cursor: pointer;
  box-shadow: 0 4px 0 var(--edge);
  transition: transform .12s, box-shadow .12s, background .2s;
}
.pill:hover { transform: translateY(-1px); }
.pill:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.pill.on { background: #e3f3e8; color: #237447; box-shadow: 0 4px 0 var(--green); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 20px/1.1 var(--display); text-decoration: none;
  padding: 15px 26px; border-radius: 18px; border: 0;
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(4px); }
.btn-ink { background: var(--ink); color: var(--cream); box-shadow: 0 6px 0 #3a281c; cursor: default; }
.btn-ink:hover { transform: none; }
.btn-ink span { display: flex; flex-direction: column; }
.btn-ink small { font-size: 13px; opacity: .8; font-weight: 500; }
.btn-gold { background: var(--gold); color: var(--ink); box-shadow: 0 6px 0 var(--gold-edge); }
.btn-gold:active { box-shadow: 0 2px 0 var(--gold-edge); }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative;
  background: linear-gradient(#5fb4e2 0%, #8fcdec 45%, #bfe5f4 100%);
  padding-top: 40px;
  overflow: hidden;
  isolation: isolate;
}
.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.sun { position: absolute; width: 440px; top: -120px; inset-inline-end: -90px; animation: spin 80s linear infinite; opacity: .95; }
:root[dir="rtl"] .sun { animation-direction: reverse; }
@keyframes spin { to { rotate: 360deg; } }
.cloud { position: absolute; background: #fff; border-radius: 999px; opacity: .92; animation: drift 60s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 55%; height: 140%; top: -60%; left: 15%; }
.cloud::after { width: 40%; height: 110%; top: -40%; left: 50%; }
.c1 { width: 190px; height: 56px; top: 60px; left: -10%; }
.c2 { width: 140px; height: 42px; top: 190px; left: 30%; animation-duration: 85s; animation-delay: -30s; }
.c3 { width: 220px; height: 60px; top: 320px; left: 60%; animation-duration: 95s; animation-delay: -60s; opacity: .7; }
.c4 { width: 120px; height: 36px; top: 110px; left: 75%; animation-duration: 70s; animation-delay: -15s; }
@keyframes drift { from { translate: -30vw 0; } to { translate: 130vw 0; } }
.coin { position: absolute; width: 46px; filter: drop-shadow(0 4px 0 rgba(201, 138, 30, .5)); animation: float 5s ease-in-out infinite; }
.k1 { top: 22%; inset-inline-start: 6%; }
.k2 { top: 62%; inset-inline-start: 46%; width: 34px; animation-delay: -2s; }
.k3 { top: 14%; inset-inline-start: 52%; width: 28px; animation-delay: -3.5s; }
@keyframes float { 50% { translate: 0 -16px; rotate: 12deg; } }

.hero-inner { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; padding-bottom: 40px; }
.eyebrow {
  display: inline-block; background: rgba(255, 253, 246, .85); border-radius: 999px;
  padding: 6px 16px; font: 600 15px/1.3 var(--display); box-shadow: 0 3px 0 rgba(59, 127, 168, .35);
}
h1 { font-size: clamp(44px, 6.6vw, 84px); color: var(--ink); font-weight: 700; margin-top: .3em; text-shadow: 0 3px 0 rgba(255, 255, 255, .6); }
h1 em { color: var(--coral); display: inline-block; animation: wobble 3.5s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { rotate: 0deg; } 10% { rotate: -4deg; } 20% { rotate: 3deg; } 30% { rotate: 0deg; } }
.lead { font-size: 20px; max-width: 34em; font-weight: 600; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; align-items: center; }

.hero-shot { position: relative; }
.hero-shot .device { rotate: 2deg; }
:root[dir="rtl"] .hero-shot .device { rotate: -2deg; }

.device {
  margin: 0;
  background: #2f2620; padding: 10px; border-radius: 30px;
  box-shadow: 0 8px 0 #1e1813, 0 24px 50px rgba(40, 30, 20, .28);
  position: relative;
}
.device img { border-radius: 20px; width: 100%; height: auto; aspect-ratio: 1688 / 780; object-fit: cover; background: var(--cream-low); }
.device figcaption { color: var(--cream); font: 600 16px/1.3 var(--display); text-align: center; padding: 10px 6px 4px; }
.tilt-l { rotate: -2deg; } .tilt-r { rotate: 2deg; }

.bubble {
  position: absolute; background: var(--cream); color: var(--ink);
  font: 700 22px/1.2 var(--display); padding: 12px 20px; border-radius: 20px;
  box-shadow: 0 5px 0 var(--edge);
}
.bubble::after { content: ""; position: absolute; width: 22px; height: 22px; background: var(--cream); rotate: 45deg; bottom: -8px; inset-inline-start: 26px; border-radius: 4px; box-shadow: 4px 4px 0 var(--edge); z-index: -1; }
.bubble-hero { top: -26px; inset-inline-start: -18px; rotate: -6deg; animation: float 4s ease-in-out infinite; }

.hill { position: relative; height: 270px; }
.hill svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lineup {
  position: relative; display: flex; justify-content: center; align-items: flex-end; gap: clamp(4px, 3vw, 40px);
  margin-top: -262px; padding-bottom: 8px;
}
.hero::after { content: ""; display: block; height: 40px; background: #4db37e; margin-top: -8px; }

.char { background: none; border: 0; padding: 0; cursor: pointer; position: relative; transition: transform .2s; -webkit-tap-highlight-color: transparent; }
.char img { height: 210px; width: auto; filter: drop-shadow(0 10px 6px rgba(30, 60, 30, .25)); }
.char.big img { height: 230px; }
.char:hover { transform: translateY(-8px) rotate(-2deg); }
.char.jump { animation: jump .55s cubic-bezier(.3, .6, .4, 1); }
@keyframes jump { 30% { transform: translateY(-34px) scale(1.04, .96); } 60% { transform: translateY(0) scale(1.06, .92); } 100% { transform: none; } }

/* ---------------------------------------------------------------- bands */
.band { padding: 96px 0; position: relative; }
.band-sand { background: var(--sand); }
.band-cream { background: var(--cream-low); }
.band-sky { background: linear-gradient(#bfe5f4, #dff2fa); }
.band-green { background: var(--green); color: var(--cream); }
.band-coral { background: var(--coral); color: var(--cream); }
.band::before { /* scalloped top edge, like the game's raised cards */
  content: ""; position: absolute; top: -22px; left: 0; right: 0; height: 24px;
  background: radial-gradient(circle at 24px 24px, var(--bg, transparent) 23px, transparent 24px) 0 0 / 48px 24px repeat-x;
}
.band-sand::before { --bg: var(--sand); }
.band-cream::before { --bg: var(--cream-low); }
.band-sky::before { --bg: #bfe5f4; }
.band-green::before { --bg: var(--green); }
.band-coral::before { --bg: var(--coral); }
#battle::before { display: none; }

.sec-head { text-align: center; max-width: 760px; margin: 0 auto 48px; }
.sec-head p { font-size: 20px; }
.sec-head.light h2, .light h2 { color: var(--cream); text-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.tag {
  display: inline-block; font: 600 15px/1 var(--display); letter-spacing: .02em;
  padding: 9px 16px; border-radius: 999px; margin-bottom: 16px;
}
.tag-coral { background: #fde3dc; color: var(--coral-edge); }
.tag-gold { background: #fff0c9; color: #9a6514; }
.tag-sky { background: #dbeffa; color: var(--sky-edge); }
.tag-green { background: #e3f3e8; color: #237447; }
.tag-cream { background: var(--cream); color: var(--ink); }

.card { background: var(--cream); color: var(--ink); border-radius: var(--r); padding: 26px; box-shadow: var(--lift); }

/* battle steps */
.steps { list-style: none; padding: 0; margin: 0 0 80px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; counter-reset: s; }
.step { text-align: center; position: relative; counter-increment: s; transition: transform .2s; }
.step:hover { transform: translateY(-6px) rotate(-1deg); }
.step::before { content: counter(s); position: absolute; top: 14px; inset-inline-start: 16px; font: 700 15px/26px var(--display); width: 26px; height: 26px; border-radius: 50%; background: var(--cream-low); color: var(--ink-soft); }
.step h3 { margin-top: 14px; }
.step p { margin: 0; font-size: 16px; color: var(--ink-soft); }
.step-ico { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; }
.step-ico img { width: 40px; }
.step-ico b { font: 700 46px/1 var(--display); color: var(--ink); }
.ico-gold { background: var(--gold); box-shadow: 0 5px 0 var(--gold-edge); }
.ico-coral { background: var(--coral); box-shadow: 0 5px 0 var(--coral-edge); }
.ico-sky { background: var(--sky); box-shadow: 0 5px 0 var(--sky-edge); }
.ico-mint { background: var(--mint); box-shadow: 0 5px 0 var(--green-edge); }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; }
.split-rev { grid-template-columns: .8fr 1.2fr; }
.h3-big { font-size: 32px; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0 22px; }
.level {
  background: var(--cream); border-radius: 18px; padding: 18px 10px; text-align: center;
  box-shadow: 0 5px 0 var(--edge); display: flex; flex-direction: column; gap: 4px;
}
.level b { font: 600 22px/1.1 var(--display); }
.level > span { color: var(--ink-soft); font-weight: 700; }
.level em { display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin: 6px auto 0; background: #fff0c9; border-radius: 999px; padding: 5px 12px; font: 600 15px/1 var(--display); }
.level em img { width: 20px; }
.level:nth-child(1) { box-shadow: 0 5px 0 var(--mint); }
.level:nth-child(2) { box-shadow: 0 5px 0 var(--gold-edge); }
.level:nth-child(3) { box-shadow: 0 5px 0 var(--coral); }

/* bramble */
.bramble-side { position: relative; display: grid; place-items: center; padding-top: 110px; }
.bramble-img { width: min(320px, 70%); filter: drop-shadow(0 18px 10px rgba(59, 127, 168, .25)); }
.bob { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 -12px; } }
.bubble-big { top: 0; inset-inline-start: 0; max-width: 300px; font-size: 24px; }
.bramble-side::after { content: ""; position: absolute; bottom: -18px; width: 70%; height: 40px; background: #9ed685; border-radius: 50%; z-index: -1; box-shadow: 0 6px 0 #7cbf62; }
.bramble-side { isolation: isolate; }
.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.tabs.center { justify-content: center; margin-top: 0; }

/* heroes */
.parade { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; margin-bottom: 26px; }
.parade .char { display: flex; flex-direction: column; align-items: center; padding: 18px 10px 12px; }
.parade .char::before { content: ""; position: absolute; bottom: 30px; width: 120px; height: 34px; border-radius: 50%; background: #9ed685; box-shadow: 0 5px 0 #7cbf62; z-index: -1; }
.parade { isolation: isolate; }
.parade .char img { height: 200px; }
.name { font: 600 18px/1 var(--display); background: var(--cream); padding: 7px 14px; border-radius: 999px; box-shadow: 0 3px 0 var(--edge); margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 48px; }
.chip { background: var(--cream); border-radius: 999px; padding: 8px 16px; font: 600 16px/1 var(--display); box-shadow: 0 3px 0 var(--edge); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.duo .device:first-child { rotate: -1.5deg; } .duo .device:last-child { rotate: 1.5deg; }

/* town */
.place-panel { display: grid; grid-template-columns: 1.6fr 1fr; gap: 30px; align-items: center; margin: 30px 0 40px; }
.place-card h3 { font-size: 30px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbs button { padding: 0; border: 3px solid transparent; border-radius: 12px; overflow: hidden; width: 104px; cursor: pointer; background: none; box-shadow: 0 3px 0 var(--edge); }
.thumbs button.on { border-color: var(--mint); }
.thumbs img { aspect-ratio: 1688 / 780; object-fit: cover; }
#placeShot, #trainShot { transition: opacity .25s; }
.fade { opacity: 0 !important; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feat h3 { margin-top: 12px; }
.feat p { margin: 0; color: var(--ink-soft); font-size: 17px; }
.feat-ico { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--cream-low); font-size: 32px; box-shadow: 0 4px 0 var(--edge); }

/* home */
.ticks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-inline-start: 38px; font-weight: 700; }
.ticks li::before { content: "✓"; position: absolute; inset-inline-start: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--mint); color: #fff; display: grid; place-items: center; font-size: 15px; box-shadow: 0 3px 0 var(--green-edge); }
.stack { position: relative; padding-bottom: 90px; }
.stack .small { position: absolute; width: 62%; bottom: 0; inset-inline-start: -30px; }

/* friends */
.band-coral .grid3 { margin-bottom: 56px; }
.code { display: flex; gap: 8px; }
.code span { width: 46px; height: 56px; display: grid; place-items: center; font: 700 30px/1 var(--display); background: var(--cream-low); border-radius: 12px; box-shadow: 0 4px 0 var(--edge); }
.code span:nth-child(odd) { rotate: -4deg; } .code span:nth-child(even) { rotate: 3deg; }
.chat { display: flex; flex-direction: column; gap: 6px; }
.msg { align-self: flex-start; background: var(--cream-low); padding: 6px 13px; border-radius: 14px 14px 14px 4px; font: 600 15px/1.2 var(--display); }
:root[dir="rtl"] .msg { border-radius: 14px 14px 4px 14px; }
.msg.me { align-self: flex-end; background: #dbeffa; color: var(--sky-edge); border-radius: 14px 14px 4px 14px; }
:root[dir="rtl"] .msg.me { border-radius: 14px 14px 14px 4px; }
.device.wide { max-width: 980px; margin: 0 auto; rotate: -1deg; }

/* final */
.final { background: linear-gradient(#bfe5f4, #5fb4e2); padding: 100px 0 0; text-align: center; overflow: hidden; position: relative; }
.final::before { content: ""; position: absolute; top: -22px; left: 0; right: 0; height: 24px; background: radial-gradient(circle at 24px 24px, #bfe5f4 23px, transparent 24px) 0 0 / 48px 24px repeat-x; }
.final-icon { width: 140px; margin: 0 auto 20px; border-radius: 32px; box-shadow: 0 8px 0 rgba(59, 127, 168, .5); animation: bob 3s ease-in-out infinite; }
.final p { font-size: 22px; font-weight: 700; }
.final-chars { display: flex; justify-content: center; align-items: flex-end; gap: 20px; margin-top: 30px; }
.final-chars img { height: 170px; width: auto; margin-bottom: -20px; }
.final-chars img:nth-child(2) { height: 200px; }

.foot { background: var(--green-edge); color: var(--cream); padding: 30px 0; }
.foot-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; justify-content: space-between; }
.foot .brand { color: var(--cream); }
.foot a { color: var(--cream); }

/* speech bubble when tapping a hero */
.say {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--cream); color: var(--ink); font: 700 20px/1.2 var(--display);
  padding: 10px 18px; border-radius: 18px; box-shadow: 0 5px 0 var(--edge), 0 10px 24px rgba(0, 0, 0, .15);
  opacity: 0; translate: -50% 10px; transition: opacity .2s, translate .2s; white-space: nowrap;
}
.say.show { opacity: 1; translate: -50% 0; }

/* reveal on scroll */
.reveal { opacity: 0; translate: 0 26px; transition: opacity .6s ease, translate .6s ease; }
.reveal.in { opacity: 1; translate: 0 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .nav { display: none; }
  .lang-btn { margin-inline-start: auto; }
  .hero-inner, .split, .split-rev, .place-panel { grid-template-columns: 1fr; }
  .hero-inner { gap: 40px; text-align: center; }
  .cta-row { justify-content: center; }
  .lead { margin-inline: auto; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .bramble-side { max-width: 420px; margin: 0 auto; }
  .stack { max-width: 640px; margin: 0 auto; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .band { padding: 72px 0; }
  .brand { font-size: 22px; }
  .brand img { width: 38px; height: 38px; }
  .pill { padding: 9px 14px; font-size: 16px; }
  .steps, .grid3, .duo { grid-template-columns: 1fr; }
  .levels { gap: 8px; }
  .level b { font-size: 18px; }
  .level em { padding: 5px 8px; font-size: 13px; }
  .char img { height: 130px; }
  .char.big img { height: 150px; }
  .hide-sm { display: none; }
  .lineup { margin-top: -186px; }
  .hill { height: 190px; }
  .sun { width: 340px; top: -120px; inset-inline-end: -120px; }
  .parade .char img { height: 150px; }
  .parade { gap: 4px 10px; }
  .device { padding: 6px; border-radius: 18px; }
  .device img { border-radius: 13px; }
  .stack { padding-bottom: 0; display: grid; gap: 22px; }
  .stack .small { position: static; width: 100%; }
  .bubble-hero { font-size: 18px; top: -30px; inset-inline-start: 0; }
  .final-chars img { height: 120px; } .final-chars img:nth-child(2) { height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; translate: none; }
}

/* contrast: cream text on the coloured bands stays bold and large */
.band-coral { background: #e2654f; }
.band-coral::before { --bg: #e2654f; }
.sec-head.light p { font-weight: 700; }
@media (max-width: 640px) { .coin { display: none; } }
