/* ============================================================
   TOMOTOMO FRIENDS — COMPONENTS
   Komponen reusable: button, card, badge, progress, CTA.
   ============================================================ */

/* ──────────────────────────────────────────
   BUTTONS
────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  padding: 14px 28px;
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform  var(--dur-fast) var(--ease-bounce),
    box-shadow var(--dur-fast) ease,
    filter     var(--dur-fast) ease,
    background var(--dur-fast) ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
  min-width: 0;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.btn:hover {
  transform: translateY(-4px) scale(1.04);
  filter: brightness(1.1);
}

.btn:active {
  transform: translateY(-1px) scale(.98);
}

/* Primary — yellow */
.btn-primary {
  background: var(--clr-yellow);
  color: #1a1a00;
  box-shadow: 0 6px 0 #b8a000, var(--shadow-glow-yellow);
}
.btn-primary:hover {
  box-shadow: 0 8px 0 #b8a000, 0 12px 36px rgba(255,224,64,.4);
}
.btn-primary:active {
  box-shadow: 0 2px 0 #b8a000;
}

/* Secondary — outline */
.btn-secondary {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 2px solid rgba(255,255,255,.3);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.6);
}

/* Ghost — transparent */
.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,.8);
  border: 2px solid rgba(255,255,255,.2);
}
.btn-ghost:hover {
  color: #fff;
  border-color: rgba(255,255,255,.5);
}

/* Sizes */
.btn-sm { padding: 10px 20px; font-size: 13px; }
.btn-lg { padding: 18px 40px; font-size: 18px; }

/* ──────────────────────────────────────────
   STICKY MOBILE CTA — "Mulai Petualangan"
   Muncul setelah hero, hanya di mobile.
────────────────────────────────────────── */

:root {
  --cta-mobile-h: 54px;
  --cta-mobile-gap: 12px;
  --cta-mobile-stack-offset: calc(10px + var(--cta-mobile-h) + var(--cta-mobile-gap));
}

.cta-adventure {
  display: none; /* shown via JS when scrolled past hero */
  position: fixed;
  bottom: calc(16px + var(--safe-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: calc(var(--z-sticky) + 1);
  padding: 15px 32px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--clr-yellow) 0%, var(--clr-orange) 100%);
  color: #1a1000;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1px;
  text-decoration: none;
  box-shadow: 0 6px 0 #9a5c00, 0 12px 32px rgba(255,179,71,.45);
  border: none;
  cursor: pointer;
  justify-content: center;
  text-align: center;
  white-space: normal;
  min-height: var(--touch-min);
  box-sizing: border-box;
  max-width: calc(100vw - 16px - var(--safe-left, 0px) - var(--safe-right, 0px));
  transition:
    transform    var(--dur-mid) var(--ease-bounce),
    box-shadow   var(--dur-fast) ease,
    opacity      var(--dur-mid) ease;
  animation: slideUp var(--dur-mid) var(--ease-bounce) both;
}

.cta-adventure.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  animation: ctaSlideUp var(--dur-mid) var(--ease-bounce) both;
}

.cta-adventure:hover {
  transform: translateX(-50%) translateY(-4px);
  box-shadow: 0 10px 0 #9a5c00, 0 18px 40px rgba(255,179,71,.55);
}

.cta-adventure:active {
  transform: translateX(-50%) translateY(0);
  box-shadow: 0 3px 0 #9a5c00;
}

.cta-adventure .cta-icon {
  font-size: 18px;
  animation: floatY 1.8s ease-in-out infinite;
}

@keyframes ctaSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(40px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Only show on mobile */
@media (min-width: 681px) {
  .cta-adventure { display: none !important; }
}

@media (max-width: 680px) {
  .cta-adventure {
    display: flex;
    position: fixed; /* must re-declare: .tap-feedback sets position:relative later in cascade */
    left: 50%;
    right: auto;
    justify-content: center;
    width: min(336px, calc(100vw - 24px - var(--safe-left, 0px) - var(--safe-right, 0px)));
    min-height: var(--cta-mobile-h);
    padding: 12px 18px;
    font-size: 14px;
    line-height: 1.15;
    bottom: calc(10px + var(--safe-bottom, 0px));
    transform: translateX(-50%) translateY(calc(100% + 18px));
    opacity: 0;
    pointer-events: none;
  }

  .cta-adventure.visible {
    transform: translateX(-50%) translateY(0);
  }

  .cta-adventure:hover {
    transform: translateX(-50%) translateY(-2px);
  }

  .cta-adventure .cta-icon {
    font-size: 16px;
  }
}

@media (max-width: 430px) {
  .cta-adventure {
    width: calc(100vw - 20px - var(--safe-left, 0px) - var(--safe-right, 0px));
    font-size: 13px;
    letter-spacing: .6px;
  }
}

@media (max-width: 390px) {
  .cta-adventure {
    width: calc(100vw - 16px - var(--safe-left, 0px) - var(--safe-right, 0px));
    font-size: 12.5px;
    letter-spacing: .45px;
    padding: 11px 14px;
  }
}

/* ──────────────────────────────────────────
   SECTION PROGRESS INDICATOR
   Dots di sisi kanan layar, setiap titik = 1 section.
────────────────────────────────────────── */

.section-progress {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-sticky);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  pointer-events: none;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  border: 1.5px solid rgba(255,255,255,.35);
  cursor: pointer;
  pointer-events: all;
  position: relative;
  transition:
    background  var(--dur-fast) ease,
    transform   var(--dur-fast) var(--ease-spring),
    border-color var(--dur-fast) ease;
  /* tooltip */
}

.progress-dot::before {
  content: attr(data-label);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  max-width: 140px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease;
}

.progress-dot:hover::before {
  opacity: 1;
}

.progress-dot.active {
  background: var(--clr-yellow);
  border-color: var(--clr-yellow);
  transform: scale(1.45);
  box-shadow: 0 0 10px rgba(255,224,64,.6);
}

/* Hide on phone and small tablet widths to avoid overlay crowding */
@media (max-width: 860px) {
  .section-progress { display: none; }
}

/* ──────────────────────────────────────────
   BADGE
────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 100%;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.badge-new    { background: var(--clr-pink); color: #fff; }
.badge-hot    { background: var(--clr-orange); color: #fff; }
.badge-edu    { background: var(--clr-cyan); color: #003d4a; }
.badge-music  { background: var(--clr-green); color: #0a2200; }

/* ──────────────────────────────────────────
   CARD BASE
────────────────────────────────────────── */

.card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  backdrop-filter: blur(10px);
  transition:
    background   var(--dur-mid) ease,
    border-color var(--dur-mid) ease,
    transform    var(--dur-mid) var(--ease-bounce);
}

.card:hover {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,224,64,.2);
  transform: translateY(-4px);
}

/* ──────────────────────────────────────────
   SECTION TITLE (generic)
────────────────────────────────────────── */

.sec-title-generic {
  font-family: var(--font-display);
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.05;
  letter-spacing: 2px;
  -webkit-text-stroke: 3px rgba(0,0,0,.6);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 rgba(0,0,0,.5);
  margin-bottom: var(--sp-lg);
}

/* ──────────────────────────────────────────
   INTERACTIVE FEEDBACK — tap/click ripple
────────────────────────────────────────── */

.tap-feedback {
  position: relative;
  overflow: hidden;
}

.tap-feedback::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,.15);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
  pointer-events: none;
}

.tap-feedback:active::after {
  opacity: 1;
  transform: scale(1);
}

/* Fix: .tap-feedback sets position:relative which breaks position:fixed on the CTA */
.cta-adventure { position: fixed; }

/* Consistent tap feedback (safe, no pseudo-element conflict) */
.tap-press {
  -webkit-tap-highlight-color: transparent;
  transition: filter var(--dur-instant) ease, opacity var(--dur-instant) ease;
}

.tap-press:active {
  filter: brightness(.93);
  opacity: .97;
}
