/* =========================================================
   IIPE 2027 - Welcome section + Explore band + Coin mini game
   Dimuat SETELAH home.css. Hapus blok welcome/explore lama di home.css.
   ========================================================= */

/* ===== WELCOME (desktop) ===== */
.welcome {
  position: relative;
  max-width: 1330px;
  margin: 0 auto;
  padding: 4% 0 3%;
  background: #FFFFDA;
  overflow: hidden;
  font-family: 'Funnel Display', system-ui, sans-serif;
  color: #5B3CC4;

  /* font game (score, hint, teks respawn). Ganti di sini saja: */
  --game-font: 'IIPE Pixel', monospace;  --gs: 1.3;   /* Jersey 10: kecil, jadi diperbesar 1.3x */
  /* --game-font: 'Press Start 2P', monospace;  --gs: .75;   <- opsi lain */
}
.welcome img { display: block; height: auto; image-rendering: pixelated; }

.corner-tl { position: absolute; top: 0; left: 0;  width: 23.7%; }
.corner-tr { position: absolute; top: 0; right: 0; width: 23.9%; }

/* box + koin dekorasi (tidak bisa diklik) */
.prop { position: absolute; }
.prop-box  { width: 100%; }
.prop-coin { position: absolute; left: 50%; top: 0; width: 48%;
             transform: translate(-50%, -62%); z-index: 1;
             animation: bob 2.4s steps(4) infinite; }
.prop-l { left: 4.5%; top: 33%; width: 14%; }
.prop-r { right: 4%;  top: 21%; width: 13.5%; }

.welcome-inner { position: relative; z-index: 2; text-align: center; }
.welcome-title { margin: 0 auto; width: 39%; }
.welcome-title img { width: 100%; }
.welcome-text {
  width: 54%;
  margin: 3.5% auto 0;
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.5;
  font-weight: 400;
}
.welcome-text p { margin: 0 0 1.2em; }

/* ===== EXPLORE BAND (desktop) ===== */
.explore {
  position: relative;
  width: 86.5%;
  margin: 3% auto 0;
  aspect-ratio: 1150 / 230;
}
.explore-platform { position: absolute; inset: 0; width: 100%; height: 100%; }

.explore-label {
  position: absolute; left: 5%; top: 6%;
  width: 19%; margin: 0; padding: .5% 1%;
  background: #8F7BFF; color: #fff;
  font-size: clamp(9px, 1vw, 13px);
  line-height: 1.15; text-transform: uppercase; letter-spacing: .03em;
}
.explore-title { position: absolute; left: 5%; top: 40%; width: 25%; }
.explore-sun   { position: absolute; left: 22%; top: -8%; width: 16%; z-index: 1; }

.explore-buttons {
  position: absolute; left: 41%; top: 24%; width: 57%;
  display: flex; gap: 1.5%;
}
.explore-buttons a { flex: 1; display: block; transition: transform .12s steps(2); }
.explore-buttons a:hover  { transform: translateY(-3px); }
.explore-buttons a:active { transform: translateY(2px); }
.explore-buttons a:focus-visible { outline: 3px solid #5B3CC4; outline-offset: 3px; }
.explore-buttons img { width: 100%; }

/* ===== ARCADE: box klik + score (desktop: di bawah band) ===== */
.arcade {
  position: relative;               /* tanpa z-index: biar teks Respawn bisa di atas koin */
  width: 86.5%;
  margin: 2.5% auto 0;
  padding-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
}
.arcade::after {                       /* "lantai" bergaya platform */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background: repeating-linear-gradient(90deg, #8CE38B 0 40px, #C2F08A 40px 80px);
}

.coin-box {
  grid-column: 2;
  position: relative;
  display: block;
  z-index: 2;
  width: clamp(84px, 9vw, 128px);
  padding: 0; border: 0; background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.coin-box img.box-img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.coin-box:hover .box-img { transform: translateY(-4px); }
.coin-box:focus-visible { outline: 3px solid #5B3CC4; outline-offset: 4px; }
.box-img { transition: transform .12s steps(2); }

/* score */
.score {
  grid-column: 1;
  position: relative; z-index: 2;
  justify-self: end;
  margin: 0 7% 6px 0;
  padding: .45em .9em .5em;
  background: #5B3CC4; color: #FFFFDA;
  border: 3px solid #C2F08A;
  box-shadow: 0 4px 0 #3B2290;
  font-family: var(--game-font);
  font-weight: 400;
  line-height: 1.1;
  user-select: none;
}
.score-now  { display: flex; align-items: center; gap: .4em; font-size: calc(clamp(16px, 1.6vw, 22px) * var(--gs)); }
.score-now img { width: 1.1em; height: 1.1em; }
.score-best { margin-top: .2em; font-size: calc(clamp(10px, .95vw, 13px) * var(--gs)); color: #C2F08A; letter-spacing: .04em; }
.score.bump { animation: bump .15s steps(2); }

/* hint "click here" */
.hint {
  position: absolute; left: calc(100% + 18px); top: 38%;
  padding: .3em .6em .35em;
  background: #5B3CC4; color: #FFFFDA;
  border: 3px solid #C2F08A;
  box-shadow: 0 3px 0 #3B2290;
  font: 400 calc(clamp(11px, 1.1vw, 15px) * var(--gs))/1 var(--game-font);
  white-space: nowrap; pointer-events: none;
  animation: hintHop 1s steps(2) infinite;
}
.hint::before, .hint::after {          /* panah ke kiri (menunjuk ke box koin) */
  content: ""; position: absolute; top: 50%; width: 0; height: 0;
  border-style: solid; border-color: transparent;
}
.hint::before {                          /* garis luar lime */
  right: 100%; margin-top: -12px;
  border-width: 12px 14px 12px 0;
  border-right-color: #C2F08A;
}
.hint::after {                           /* isi ungu, menutup garis kiri label */
  right: calc(100% - 3px); margin-top: -9px;
  border-width: 9px 11px 9px 0;
  border-right-color: #5B3CC4;
}
.played .hint { display: none; }

/* box "mengangguk" sesekali saat belum/sudah lama tidak diklik */
.welcome:not(.played) .box-img { animation: nudge 3.2s steps(1) infinite; }
.is-hit .box-img { animation: boxHit .18s steps(3) !important; }

/* layer koin + easter egg */
.coin-layer {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}
.coin-fly {
  position: absolute;
  width: clamp(36px, 3.6vw, 56px);
  height: auto;
  transform: translate(-50%, 0);
  animation: coinUp .9s ease-out forwards;
  will-change: transform, opacity;
}
.coin-fly.coin-rainbow { animation: coinUp .9s ease-out forwards, rainbow .5s linear infinite; }

.coin-egg {                           /* di dalam .arcade: muncul tepat di atas box */
  position: absolute; left: 50%; bottom: calc(100% + 6px);
  z-index: 8;                           /* di atas layer koin (z 5) */
  transform: translate(-50%, -50%);
  width: max-content; max-width: 90vw;
  font: 400 calc(clamp(26px, 4.5vw, 58px) * var(--gs))/1.1 var(--game-font);
  color: #FFFFDA; text-align: center;
  text-shadow: 3px 3px 0 #5B3CC4, -3px 3px 0 #5B3CC4, 3px -3px 0 #5B3CC4, -3px -3px 0 #5B3CC4,
    0 3px 0 #5B3CC4, 0 -3px 0 #5B3CC4, 3px 0 0 #5B3CC4, -3px 0 0 #5B3CC4;
  opacity: 0; pointer-events: none;
}
.coin-egg.show { animation: eggPop 1.8s steps(12) forwards; }

/* ===== MOBILE ===== */
@media (max-width: 720px) {
  .welcome { padding: 18% 0 0; }
  .corner-tl, .corner-tr { width: 34%; }
  .prop { display: none; }

  .welcome-title { width: 80%; }
  .welcome-text  { width: 88%; font-size: 15px; margin-top: 6%; }

  /* urutan: label / title / tombol / (box + platform) */
  .explore {
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: auto;
    margin: 8% 0 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "label"
      "title"
      "buttons";
    justify-items: center;
    row-gap: 14px;
    padding: 0 8% 46vw;
  }
  .explore > :not(.explore-platform) {
    position: relative;
    inset: auto;
    margin: 0;
    z-index: 1;
  }
  .explore .explore-sun { display: none; }

  .explore-label {
    grid-area: label;
    box-sizing: border-box;
    width: auto; max-width: 100%;
    font-size: 11px; padding: 6px 12px;
    text-align: center;
  }
  .explore-title { grid-area: title; width: 72%; margin-top: 6%; justify-self: center; }
  .explore-buttons {
    grid-area: buttons;
    width: 100%;
    flex-direction: column; align-items: center; gap: 10px;
  }
  .explore-buttons a { flex: none; width: 50%; }

  .explore .explore-platform {
    position: absolute;
    top: auto; bottom: 0; left: 50%;
    width: 140%; max-width: none; height: auto;
    transform: translateX(-50%);
    z-index: 0;
  }

  /* arcade: box berdiri di atas platform, score di kirinya */
  .arcade {
    position: absolute; left: 0; right: 0; bottom: 0;
    width: auto; height: 0; margin: 0; padding: 0;
    display: block;
  }
  .arcade::after { display: none; }
  .coin-box {
    position: absolute;
    left: 50%; bottom: 12vw;           /* sesuaikan: menapak di platform */
    width: 26vw;
    transform: translateX(-50%);
  }
  .score {
    position: absolute;
    left: 6vw; bottom: 15vw;
    margin: 0;
  }
  .coin-box .hint { font-size: calc(12px * var(--gs)); }
  .coin-fly { width: 12vw; }
  .coin-egg { bottom: 40vw; font-size: calc(9vw * var(--gs)); }
}

/* ===== KEYFRAMES ===== */
@keyframes bob { 50% { transform: translate(-50%, -70%); } }
@keyframes boxHit { 50% { transform: translateY(6px) scale(1.04, .94); } }
@keyframes nudge {
  0%, 82%, 100% { transform: translateY(0); }
  88% { transform: translateY(-8px); }
  94% { transform: translateY(0); }
}
@keyframes hintHop { 50% { transform: translateX(-4px); } }
@keyframes bump { 50% { transform: scale(1.1); } }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }
@keyframes eggPop {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  25%  { transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}
@keyframes coinUp {
  0%   { transform: translate(-50%, 0) scale(.6); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), var(--dy)) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .prop-coin, .hint, .score.bump { animation: none; }
  .welcome:not(.played) .box-img { animation: none; }
  .is-hit .box-img { animation: none !important; }
  .coin-fly, .coin-fly.coin-rainbow { animation: coinUp .01s forwards; }
  .coin-egg.show { animation-duration: 1.8s; animation-timing-function: linear; }
}