/* ==========================================================
   Mimjaya.id — merah putih, minimalis
   Mobile-first: dasar = mobile, lalu 768px (tablet) & 1024px (desktop)
   ========================================================== */

:root {
  --red: #E11D2E;
  --red-dark: #B8141F;
  --red-soft: #FDECEE;
  --red-tint: #FFF5F6;
  --ink: #1D1D1F;
  --ink-2: #3A3A3C;
  --muted: #8A8A90;
  --line: #EEEEEE;
  --bg: #FFFFFF;
  --surface: #FAFAFA;
  --green: #16A34A;

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 10px rgba(20, 20, 20, .05);
  --shadow: 0 10px 30px rgba(20, 20, 20, .08);
  --shadow-lg: 0 24px 60px rgba(20, 20, 20, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(225, 29, 46, .35); outline-offset: 2px; border-radius: 8px; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 20px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 26px;
  border-radius: 999px;
  font-weight: 600; font-size: 15px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 8px 20px rgba(225, 29, 46, .28); }
.btn--primary:hover { background: var(--red-dark); }
.btn--ghost { background: #fff; border: 1.5px solid var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; }

.icon-btn {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
  transition: background .2s, transform .2s var(--ease), color .2s;
}
.icon-btn:hover { background: var(--red-soft); color: var(--red); }
.icon-btn:active { transform: scale(.94); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red-dark);
  font-size: 13px; font-weight: 500;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(225, 29, 46, .5); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(225, 29, 46, 0); } 100% { box-shadow: 0 0 0 0 rgba(225, 29, 46, 0); } }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__inner { height: var(--header-h); display: flex; align-items: center; gap: 16px; }
.topbar .icon-btn { margin-left: auto; }

.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.logo__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--red); color: #fff;
  font-weight: 700;
}
.logo__text { font-weight: 700; letter-spacing: -.4px; }
.logo__text b { color: var(--red); font-weight: 700; }

.topnav { display: none; }
.topbar .search--top { display: none; }

/* ---------- Search ---------- */
.search {
  display: flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search:focus-within { background: #fff; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search input::placeholder { color: var(--muted); }
.mobile-search { margin-top: 20px; }

/* ---------- Hero ---------- */
.hero { padding-top: 12px; }
.hero__text h1 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.8px; margin: 14px 0 10px; }
.hl { color: var(--red); }
.hero__text p { color: var(--muted); font-size: 15px; }
.hero__cta { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.hero__cta .btn { flex: 1; min-width: 140px; }
.hero__visual { display: none; }

/* ---------- Section ---------- */
.section { margin-top: 32px; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section__title { font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.section__count { font-size: 13px; color: var(--muted); }

/* ---------- Kategori (chip) ---------- */
.categories {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 2px 20px 14px;
  margin-inline: -20px;
  scrollbar-width: none;
}
.categories::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  height: 38px; padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px; color: var(--ink-2);
  transition: all .2s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 500; }

/* ---------- Grid produk ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
  animation: rise .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.card__media { position: relative; aspect-ratio: 1 / 1; background: var(--surface); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card__media img { transform: scale(1.05); }
.card__disc {
  position: absolute; left: 10px; top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 600;
}
.card__body { padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card__cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.card__name {
  font-size: 14px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em;
}
.card__prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; margin-top: auto; padding-top: 4px; }
.price { font-weight: 700; font-size: 15px; color: var(--red); }
.price-old { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.card__cta {
  margin-top: 10px;
  height: 36px;
  border-radius: 10px;
  background: var(--red-soft); color: var(--red-dark);
  font-size: 13px; font-weight: 600;
  display: grid; place-items: center;
  transition: background .2s, color .2s;
}
.card:hover .card__cta { background: var(--red); color: #fff; }

/* skeleton saat memuat */
.card--skeleton { pointer-events: none; animation: none; }
.card--skeleton .card__media,
.card--skeleton .sk { background: linear-gradient(90deg, #F3F3F3 25%, #FAFAFA 50%, #F3F3F3 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.card--skeleton .sk { height: 12px; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Tampilan kosong ---------- */
.empty {
  text-align: center;
  padding: 40px 20px 48px;
  border-radius: var(--radius-lg);
  background: var(--red-tint);
  border: 1.5px dashed #F6C6CB;
  display: flex; flex-direction: column; align-items: center;
}
.empty h3 { font-size: 20px; font-weight: 600; margin-top: 18px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 380px; margin: 8px 0 22px; }
.empty__art { position: relative; width: 120px; height: 110px; }
.empty__box {
  position: absolute; inset: 22px 18px 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: bob 3s ease-in-out infinite;
}
.empty__box::before {
  content: ""; position: absolute; left: 50%; top: -16px;
  width: 34px; height: 30px; margin-left: -17px;
  border: 4px solid var(--red); border-bottom: 0;
  border-radius: 18px 18px 0 0;
}
.empty__box::after {
  content: "M"; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-weight: 700; font-size: 34px; color: var(--red);
}
@keyframes bob { 50% { transform: translateY(-6px); } }
.empty__spark { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--red); opacity: .25; }
.s1 { top: 6px; left: 4px; } .s2 { top: 30px; right: 0; width: 14px; height: 14px; } .s3 { bottom: 10px; left: 0; width: 6px; height: 6px; opacity: .5; }

/* ---------- Cara belanja ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.steps li > span {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--red); color: #fff; font-weight: 700;
}
.steps b { display: block; font-size: 14px; font-weight: 600; }
.steps small { color: var(--muted); font-size: 13px; }

/* ---------- Footer ---------- */
.footer { margin-top: 48px; padding: 24px 0 calc(24px + var(--safe-b)); border-top: 1px solid var(--line); }
.footer__inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.footer p { color: var(--muted); font-size: 13px; }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 20, 20, .45);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Detail produk ---------- */
.detail {
  position: fixed; inset: 0; z-index: 70;
  background: #fff;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .4s var(--ease);
  overflow: hidden;
  visibility: hidden;
}
.detail.is-open { transform: none; visibility: visible; }
.detail__bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; flex-shrink: 0; }
.detail__bar-title { font-size: 17px; font-weight: 600; }
.detail__body { flex: 1; overflow-y: auto; padding: 0 20px calc(24px + var(--safe-b)); }
.detail__media {
  border-radius: var(--radius-lg);
  background: var(--surface);
  aspect-ratio: 1 / 1;
  max-height: 50vh;
  width: 100%;
  overflow: hidden;
}
.detail__media img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s var(--ease); }
.detail__media img.is-loaded { opacity: 1; }
.detail__info { padding-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.detail__cat { font-size: 12px; color: var(--red); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.detail__name { font-size: 24px; font-weight: 600; letter-spacing: -.5px; line-height: 1.25; margin-top: -6px; }
.detail__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.detail__price .price { font-size: 28px; }
.detail__price .price-old { font-size: 15px; }
.disc { padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red-dark); font-size: 12px; font-weight: 600; }
.disc:empty { display: none; }
.detail__desc { color: var(--ink-2); font-size: 14px; line-height: 1.75; white-space: pre-line; }
.detail__points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.detail__points:empty { display: none; }
.detail__points li { position: relative; padding-left: 28px; font-size: 14px; color: var(--ink-2); }
.detail__points li::before {
  content: "✓"; position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--red-soft); color: var(--red);
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.btn--buy { height: 56px; font-size: 16px; margin-top: 6px; }
.detail__note { font-size: 12px; color: var(--muted); text-align: center; margin-top: -4px; }
.label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.share { padding-top: 14px; border-top: 1px solid var(--line); }
.share__row { display: flex; gap: 10px; flex-wrap: wrap; }
.share__btn {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: #fff;
  transition: transform .2s var(--ease), filter .2s;
}
.share__btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.share__btn--wa { background: #25D366; }
.share__btn--fb { background: #1877F2; }
.share__btn--x { background: #111; }
.share__btn--tg { background: #229ED9; }
.share__btn--copy { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 100;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 14px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: all .3s var(--ease);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================
   TABLET ≥ 768px
   ========================================================== */
@media (min-width: 768px) {
  .container { padding-inline: 32px; }
  :root { --header-h: 76px; }
  .mobile-search { display: none; }
  .topbar .search--top { display: flex; flex: 1; max-width: 360px; height: 46px; margin-left: auto; }
  .topbar .icon-btn { margin-left: 0; }

  .hero {
    display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 40px;
    padding-top: 32px;
  }
  .hero__text h1 { font-size: 42px; line-height: 1.15; letter-spacing: -1.2px; margin: 18px 0 14px; }
  .hero__text p { font-size: 16px; max-width: 480px; }
  .hero__cta { margin-top: 28px; }
  .hero__cta .btn { flex: 0 0 auto; }

  .hero__visual { display: block; position: relative; aspect-ratio: 4 / 4.4; max-height: 560px; }
  .hero__blob { position: absolute; inset: 6% 0 0 6%; background: var(--red); border-radius: 40px; }
  .hero__visual img {
    position: absolute; inset: 0 6% 6% 0;
    width: 94%; height: 94%;
    object-fit: cover;
    border-radius: 36px;
    box-shadow: var(--shadow-lg);
  }
  .float-card {
    position: absolute; display: flex; align-items: center; gap: 10px;
    padding: 12px 16px 12px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .95);
    box-shadow: var(--shadow);
    animation: float 5s ease-in-out infinite;
  }
  .float-card b { display: block; font-size: 14px; font-weight: 600; }
  .float-card small { font-size: 12px; color: var(--muted); }
  .float-card__icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--red); color: #fff; font-weight: 700; }
  .float-card--a { left: -24px; bottom: 16%; }
  .float-card--b { right: -8px; top: 10%; animation-delay: -2.5s; }
  @keyframes float { 50% { transform: translateY(-10px); } }

  .section { margin-top: 56px; }
  .section__title { font-size: 26px; }
  .section__head { margin-bottom: 18px; }
  .categories { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; }

  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .card__name { font-size: 15px; }
  .price { font-size: 16px; }

  .empty { padding: 56px 32px 60px; }
  .empty h3 { font-size: 24px; }
  .empty p { font-size: 15px; }

  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .steps li { padding: 20px; }

  .footer__inner { flex-direction: row; justify-content: space-between; }
  .toast { bottom: 32px; }

  /* Detail → modal di tengah */
  .detail {
    inset: auto; top: 50%; left: 50%;
    width: min(980px, calc(100vw - 64px));
    max-height: calc(100vh - 64px);
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, -46%) scale(.96);
    opacity: 0;
    transition: transform .35s var(--ease), opacity .3s var(--ease), visibility 0s .35s;
  }
  .detail.is-open { transform: translate(-50%, -50%); opacity: 1; transition: transform .35s var(--ease), opacity .3s var(--ease); }
  .detail__bar { position: absolute; top: 0; right: 0; z-index: 3; padding: 20px; gap: 10px; }
  .detail__bar [data-close-detail] { order: 2; }
  .detail__bar-title { display: none; }
  .detail__bar [data-close-detail] svg { display: none; }
  .detail__bar [data-close-detail]::before { content: "✕"; font-size: 16px; }
  .detail__body { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; padding: 28px; }
  .detail__media { max-height: none; height: 100%; min-height: 440px; aspect-ratio: auto; }
  .detail__info { padding: 52px 8px 4px 0; }
  .detail__name { font-size: 28px; }
}

/* ==========================================================
   DESKTOP ≥ 1024px
   ========================================================== */
@media (min-width: 1024px) {
  .topnav { display: flex; gap: 6px; margin-left: 28px; }
  .topnav__link { padding: 8px 16px; border-radius: 999px; font-size: 15px; color: var(--muted); font-weight: 500; transition: all .2s; }
  .topnav__link:hover { color: var(--ink); }
  .topnav__link.is-active { color: var(--red-dark); background: var(--red-soft); }
  .hero { gap: 64px; padding-top: 48px; }
  .hero__text h1 { font-size: 54px; }
  .hero__text p { font-size: 17px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
