/* Token dari DESIGN.md */
:root {
  --canvas: #f2f4f5;
  --white: #ffffff;
  --ink: #000000;
  --border: #ebebeb;
  --muted: #787574; /* hanya di atas putih: 4.6:1 */
  --stone: #cccccc;
  --violet: #5433eb;
  --slate: #332f2d;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r-card: 28px;
  --r-img: 20px;
  --r-pill: 9999px;

  --shadow-card: rgba(0, 0, 0, .1) 0 4px 6px -1px, rgba(0, 0, 0, .1) 0 2px 4px -2px;
  --shadow-sm: rgba(0, 0, 0, .06) 0 2px 8px 0;
  --shadow-lg: rgba(0, 0, 0, .12) 0 4px 24px 0;
  --shadow-violet: rgba(69, 36, 219, .34) 0 4px 24px 0;

  --gap: 12px;
  --section: 72px;
  --rail: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.38 var(--font);
  letter-spacing: -.031em;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
strong { font-weight: 600; }
code { font-size: .9em; background: var(--canvas); padding: 1px 6px; border-radius: 6px; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
main:focus { outline: none; } /* target fokus program saat pindah halaman, bukan kontrol */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 30;
  background: var(--ink); color: var(--white);
  padding: 12px 18px; border-radius: var(--r-pill);
}
.skip:focus { top: 12px; }

/* ---------- rail navigasi ---------- */
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 10;
  width: var(--rail);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 0;
  background: var(--white);
}
.rail a {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 20px;
}
.rail a:hover, .rail a[aria-current="page"] { background: var(--canvas); }
.rail svg { width: 24px; height: 24px; }
.count {
  position: absolute; top: 4px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--ink); color: var(--white);
  font-size: 11px; font-weight: 500; line-height: 18px; text-align: center; letter-spacing: 0;
}

main {
  margin: 8px 8px 0 calc(var(--rail) + 8px);
  min-height: calc(100vh - 8px);
  padding: 40px 24px 80px;
  background: var(--white);
  border-radius: var(--r-card);
}
.page { max-width: 1200px; margin: 0 auto; }

/* ---------- hero: konstelasi kartu melayang ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.constellation { position: relative; width: min(100%, 760px); height: 300px; }
/*
  Gerak hero (MOTION 2, hanya di sini), tiap lapis punya tugas sendiri:
  - fan-in : kartu menyebar keluar dari wordmark saat beranda dibuka, memperkenalkan produk unggulan
  - bob    : kartu naik-turun pelan dengan fase berbeda, menegaskan konsep "melayang"
  - --px/py: parallax mengikuti kursor (diatur app.js), kartu depan bergeser lebih jauh dari kartu samping
  - --tx/ty: kartu yang disorot miring ke arah kursor, lalu tegak dan membesar
  Semua mati bila pengguna memilih "reduce motion".
*/
@property --bob { syntax: '<length>'; inherits: false; initial-value: 0px; }
.float {
  --rot: 0deg; --px: 0px; --py: 0px; --tx: 0deg; --ty: 0deg;
  position: absolute; width: 150px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 8px 12px;
  background: var(--white);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  text-align: left;
  rotate: var(--rot);
  translate: var(--px) calc(var(--py) + var(--bob));
  transform: perspective(700px) rotateX(var(--ty)) rotateY(var(--tx));
  transition: rotate .45s cubic-bezier(.2, .8, .2, 1), scale .45s cubic-bezier(.2, .8, .2, 1),
              transform .35s ease-out, box-shadow .35s ease;
  animation: fan-in .9s cubic-bezier(.2, .8, .2, 1) calc(var(--i) * 90ms) backwards,
             bob 6s ease-in-out calc(var(--i) * -1.3s) infinite;
  will-change: translate, transform;
}
.float:hover, .float:focus-visible { rotate: 0deg; scale: 1.08; z-index: 5; box-shadow: var(--shadow-lg); }
.float .media { border-radius: var(--r-img); margin-bottom: 8px; }
.float .media img { transition: scale .6s cubic-bezier(.2, .8, .2, 1); }
.float:hover .media img { scale: 1.08; }
@keyframes bob { 50% { --bob: -10px; } }
@keyframes fan-in { from { opacity: 0; translate: var(--from) 150px; scale: .4; rotate: 0deg; } }
.float-name {
  padding: 0 4px; font-size: 14px; font-weight: 600; letter-spacing: -.014em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.float-price { padding: 0 4px; font-size: 12px; color: var(--muted); letter-spacing: -.017em; }
.f0 { left: 0; top: 84px; --rot: -6deg; --i: 1; --from: 280px; }
.f1 { left: 19%; top: 24px; --rot: 3deg; --i: 2; --from: 140px; }
.f2 { left: calc(50% - 85px); top: 0; width: 170px; z-index: 2; --i: 0; --from: 0px; }
.f3 { right: 19%; top: 36px; --rot: -3deg; --i: 3; --from: -140px; }
.f4 { right: 0; top: 96px; --rot: 6deg; --i: 4; --from: -280px; }

.wordmark {
  margin: 16px 0 28px;
  color: var(--violet);
  font-size: clamp(56px, 13vw, 112px);
  font-weight: 600;
  letter-spacing: -.06em;
  line-height: 1;
  overflow-wrap: anywhere;
}

/* ---------- pencarian ---------- */
.search {
  display: flex; align-items: center;
  width: min(100%, 560px);
  padding: 4px 4px 4px 20px;
  background: var(--white);
  border: 1px solid rgba(5, 41, 77, .1);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}
.search:focus-within { outline: 2px solid var(--violet); outline-offset: 3px; }
.search input { flex: 1; min-width: 0; height: 48px; border: 0; background: none; font-size: 16px; }
.search input:focus { outline: none; } /* diganti outline di .search:focus-within */
.search input::placeholder { color: var(--muted); }
.search button {
  flex: none; width: 48px; height: 48px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--violet); color: var(--white);
  box-shadow: var(--shadow-violet);
}
.search button svg { width: 20px; height: 20px; }
.search-row { margin-bottom: 24px; }

/* ---------- pill kategori ---------- */
.pills { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pills.left { justify-content: flex-start; margin: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 6px 16px 6px 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}
.pill:hover { background: var(--canvas); }
.pill-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: var(--c); }
.pill-icon img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- section kategori ---------- */
.sec { margin-top: var(--section); }
.sec-head { margin: 0 0 24px; font-size: 20px; font-weight: 600; letter-spacing: -.05em; line-height: 1.1; }
.sec-head a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.sec-head svg { width: 16px; height: 16px; transition: transform .2s ease; }
.sec-head a:hover svg { transform: translateX(3px); }

.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--gap); }
.split.rev { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.split.rev .feature { order: 2; }

/* ---------- gambar & kartu ---------- */
.media { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--canvas); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media.missing::after {
  content: attr(data-label);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 12px; text-align: center;
  font-size: 12px; letter-spacing: 0; color: var(--ink);
}

.tile { position: relative; display: block; border-radius: var(--r-card); overflow: hidden; }
.tile .media img { transition: transform .3s ease; }
.tile:hover .media img { transform: scale(1.03); }
.tile-label {
  position: absolute; left: 12px; bottom: 12px;
  max-width: calc(100% - 24px);
  display: flex; flex-direction: column;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .92);
  border-radius: 12px;
}
.tile-name { font-size: 14px; font-weight: 600; letter-spacing: -.014em; line-height: 1.25; }
.tile-price { font-size: 12px; letter-spacing: -.017em; }

.feature {
  position: relative; display: block;
  border-radius: var(--r-card); overflow: hidden;
  background: var(--slate); color: var(--white);
}
.feature .media { aspect-ratio: auto; height: 100%; min-height: 320px; background: var(--slate); }
.feature .media::before { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(0, 0, 0, .3); }
.feature .media img { transition: transform .3s ease; }
.feature:hover .media img { transform: scale(1.03); }
.feature .media.missing::after { color: var(--white); }
.feature-text { position: absolute; top: 24px; left: 24px; right: 24px; z-index: 2; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.feature-name { max-width: 12ch; font-size: clamp(26px, 3vw, 38px); font-weight: 600; letter-spacing: -.05em; line-height: 1.05; }

/* rel horizontal + panah carousel */
.rail-wrap { position: relative; }
.hscroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 260px);
  gap: var(--gap);
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  border-radius: var(--r-card);
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; }
.hs-arrow {
  position: absolute; right: 12px; top: 50%; translate: 0 -50%;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-lg);
}
.hs-arrow svg { width: 18px; height: 18px; }

/* ---------- judul halaman & state ---------- */
.page-title { margin: 0 0 32px; font-size: clamp(34px, 5vw, 52px); font-weight: 600; letter-spacing: -.05em; line-height: 1; }
.hint { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.state { max-width: 440px; margin: 72px auto; text-align: center; }
.state h1 { margin: 0 0 8px; font-size: 26px; font-weight: 600; letter-spacing: -.05em; line-height: 1.15; }
.state p { margin: 0 0 24px; color: var(--muted); }
.skeleton { aspect-ratio: 1; border-radius: var(--r-card); background: var(--canvas); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border: 0; border-radius: var(--r-pill);
  background: var(--ink); color: var(--white);
  font-weight: 500;
}
.btn:hover { background: var(--slate); }
.btn:disabled { background: var(--stone); color: var(--ink); cursor: not-allowed; }
.btn.wide { width: 100%; }
.link-btn {
  min-height: 44px; padding: 0 4px;
  border: 0; background: none;
  font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- detail produk ---------- */
.crumbs { margin-bottom: 12px; font-size: 14px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.pdp { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.pdp-media { padding: 8px; background: var(--white); border-radius: var(--r-card); box-shadow: var(--shadow-card); }
.pdp-media .media { border-radius: var(--r-img); }
.pdp-info h1 { margin: 8px 0 12px; font-size: clamp(30px, 4vw, 44px); font-weight: 600; letter-spacing: -.05em; line-height: 1.05; }
.price { margin: 0 0 32px; font-size: 20px; letter-spacing: -.05em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.qty { display: inline-flex; align-items: center; padding: 2px; border: 1px solid var(--border); border-radius: var(--r-pill); }
.qty button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; font-size: 20px; line-height: 1; }
.qty button:hover { background: var(--canvas); }
.qty output { min-width: 28px; text-align: center; }
.status { min-height: 24px; margin: 16px 0 0; font-size: 14px; }
.status a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- keranjang ---------- */
.cart { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.line {
  display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.line:first-child { padding-top: 0; }
.line .media { border-radius: 16px; }
.line-name { font-weight: 500; }
.line-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.line-price { font-size: 14px; color: var(--muted); }
.line-side { display: flex; flex-direction: column; align-items: flex-end; }
.summary { padding: 24px; background: var(--canvas); border-radius: var(--r-card); }
.sum-row { display: flex; justify-content: space-between; margin-bottom: 20px; font-size: 18px; }
.note { margin: 12px 0 0; font-size: 14px; text-align: center; }

/* ---------- form (dipakai checkout & dashboard) ---------- */
:root { --danger: #b3261e; } /* 6.6:1 di atas putih, hanya untuk pesan error dan aksi hapus */
.input, .select {
  width: 100%; height: 48px; padding: 0 20px;
  border: 1px solid #d6d6d6; border-radius: var(--r-pill);
  background: var(--white);
  font-size: 16px;
}
.select { padding-right: 12px; }
.input.area { height: auto; min-height: 96px; padding: 14px 20px; border-radius: var(--r-img); resize: vertical; line-height: 1.4; font: inherit; }
.input[readonly] { background: var(--canvas); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.field label { font-size: 14px; font-weight: 500; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; }
.help { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.field-error { min-height: 20px; margin: 4px 0 12px; font-size: 14px; color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }

.btn-ghost { background: var(--white); color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--canvas); }

/* stok & berat */
.price + .meta { margin: -20px 0 28px; font-size: 14px; }
.meta .low, .line-warn { color: var(--danger); }
.line-warn { margin-top: 4px; font-size: 14px; }
.summary .line-warn { margin: 0 0 4px; }
.tile.sold .media img { opacity: .55; }
.tile-price strong { font-weight: 600; color: var(--danger); }
.qty button:disabled, .btn:disabled { cursor: not-allowed; }
.qty button:disabled { opacity: .35; }

/* deskripsi produk: lebar baris dibatasi supaya enak dibaca */
.desc { max-width: 60ch; margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--border); }
.desc p { margin: 0 0 14px; line-height: 1.6; letter-spacing: -.011em; }

/* ---------- checkout & pesanan ---------- */
.ship { margin: 40px 0 0; padding: 0; border: 0; }
.ship legend { padding: 0; margin-bottom: 16px; }
.ship-opt {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 20px; margin-bottom: 8px;
  border: 1px solid #d6d6d6; border-radius: var(--r-img);
  cursor: pointer;
}
.ship-opt:hover { background: var(--canvas); }
.ship-opt:has(:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ship-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.ship-opt { padding-block: 10px; }
.ship-opt span { flex: 1; }
.ship-opt small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.ship-opt strong { font-weight: 500; }
.sum-row.small { margin-bottom: 8px; font-size: 14px; }

/* lacak pesanan */
.track .sec-head { margin-bottom: 20px; }
.steps { list-style: none; margin: 0 0 24px; padding: 0; }
.steps li { position: relative; padding: 0 0 20px 32px; color: #5f5c5b; } /* 6:1 di atas kanvas */
.steps li::before {
  content: ""; position: absolute; left: 0; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #b9bcbd; background: var(--canvas);
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 8px; top: 21px; bottom: 1px; width: 2px; translate: -50% 0; background: #d3d6d7; }
.steps li.done, .steps li.current { color: var(--ink); }
.steps li.done::before { background: var(--ink); border-color: var(--ink); }
.steps li.done::after { background: var(--ink); }
.steps li.current::before { border-color: var(--violet); background: var(--violet); box-shadow: 0 0 0 4px rgba(84, 51, 235, .18); }
.steps li.current .step-label { font-weight: 600; }
.step-label { display: block; }
.step-time { display: block; font-size: 12px; }
.resi { margin: 0 0 20px; padding: 12px 16px; border-radius: 16px; background: var(--white); font-size: 14px; }
.cancelled { margin: 0 0 20px; color: var(--danger); }
.checkout { max-width: 560px; }
.checkout .sec-head + .field { margin-top: 0; }
.checkout .sec-head:not(:first-child) { margin-top: 40px; }
.mini-lines { list-style: none; margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid #dfe2e3; font-size: 14px; }
.mini-lines li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; }
.note.left { text-align: left; }
.order-id { margin: -16px 0 40px; font-size: 18px; }
.pay-note { margin-bottom: 16px; padding: 20px; border-radius: var(--r-img); background: var(--canvas); line-height: 1.5; }

/* ---------- footer ---------- */
.footer { margin: 8px 8px 0 calc(var(--rail) + 8px); padding: 48px 24px 40px; background: var(--ink); color: var(--white); border-radius: var(--r-card) var(--r-card) 0 0; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 32px 48px; }
.footer-mark { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -.06em; line-height: 1; }
.footer-mark span { color: var(--violet); }
.footer-cols { display: flex; gap: 64px; }
.footer h2 { margin: 0 0 8px; font-size: 12px; font-weight: 500; letter-spacing: -.017em; color: rgba(255, 255, 255, .7); }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li a { display: inline-flex; align-items: center; min-height: 36px; font-size: 14px; }
.footer li a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: rgba(255, 255, 255, .7); }

/* ---------- responsif ---------- */
@media (max-width: 960px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.rev { grid-template-columns: minmax(0, 1fr); }
  .split.rev .feature { order: 0; }
  .pdp, .cart { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 720px) {
  :root { --section: 56px; }
  .rail {
    inset: auto 0 0 0; width: auto; height: 64px;
    flex-direction: row; justify-content: space-around;
    padding: 8px;
    box-shadow: rgba(0, 0, 0, .08) 0 -2px 8px;
  }
  main { margin: 0; min-height: 100vh; padding: 24px 16px 56px; border-radius: 0; }
  .footer { margin: 0; padding: 40px 16px 104px; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .footer-cols { gap: 40px; }

  .constellation { height: 220px; }
  .float { width: 120px; }
  .f0, .f4 { display: none; }
  .f1 { left: 0; }
  .f2 { left: calc(50% - 65px); width: 130px; }
  .f3 { right: 0; }
  .wordmark { margin: 12px 0 24px; }

  .feature .media { min-height: 260px; }
  .feature-text { top: 20px; left: 20px; }
  .line { grid-template-columns: 64px minmax(0, 1fr); }
  .line-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
