/* ==========================================================================
   WikiLock — shared base (reset + shared cart/search layers + motion)
   Không chứa nhận diện thương hiệu: mỗi phương án tự định nghĩa token riêng.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.wk-lock { overflow: hidden; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure { margin: 0; }
address { font-style: normal; }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: #111; color: #fff; }

.wk-container {
  width: min(100% - 40px, 1320px);
  margin-inline: auto;
}
@media (max-width: 640px) {
  .wk-container { width: calc(100% - 32px); }
}

.wk-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 11000;
  padding: 10px 16px;
  background: #111; color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform .2s ease;
}
.skip-link:focus { transform: none; }

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */
.wk-i {
  width: 1.25em; height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wk-i--fill { fill: currentColor; stroke: none; }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity .8s cubic-bezier(.22, 1, .36, 1) var(--reveal-delay, 0ms),
    transform .8s cubic-bezier(.22, 1, .36, 1) var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.wk-toast-wrap {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 12000;
  display: grid;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.wk-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: #141414;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  animation: wk-toast-in .32s cubic-bezier(.22, 1, .36, 1) both;
}
.wk-toast.is-out { animation: wk-toast-out .25s ease both; }
.wk-toast .wk-i { color: #9ae6b4; }
@keyframes wk-toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes wk-toast-out { to { opacity: 0; transform: translateY(10px); } }

/* --------------------------------------------------------------------------
   Shared layers (cart drawer + search)
   Override the custom properties per concept.
   -------------------------------------------------------------------------- */
.wk-layer {
  --wk-surface: #fff;
  --wk-ink: #141414;
  --wk-muted: #6f6f6f;
  --wk-line: #e7e5e0;
  --wk-accent: #141414;
  --wk-on-accent: #fff;
  --wk-soft: #f6f4ef;
  --wk-radius: 18px;

  position: fixed;
  inset: 0;
  z-index: 10000;
  visibility: hidden;
  pointer-events: none;
}
.wk-layer.is-open { visibility: visible; pointer-events: auto; }

.wk-layer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, .48);
  opacity: 0;
  transition: opacity .4s ease;
  backdrop-filter: blur(2px);
}
.wk-layer.is-open .wk-layer__scrim { opacity: 1; }

.wk-drawer {
  position: absolute;
  top: 0; right: 0;
  display: flex;
  flex-direction: column;
  width: min(440px, 94vw);
  height: 100%;
  background: var(--wk-surface);
  color: var(--wk-ink);
  transform: translateX(102%);
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
  box-shadow: -24px 0 80px rgba(0, 0, 0, .18);
}
.wk-layer.is-open .wk-drawer { transform: none; }

.wk-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--wk-line);
}
.wk-drawer__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.wk-drawer__title span { color: var(--wk-muted); font-weight: 500; }
.wk-drawer__close {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--wk-line);
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.wk-drawer__close:hover { background: var(--wk-soft); transform: rotate(90deg); }

.wk-drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 24px;
}

.wk-drawer__foot {
  padding: 18px 24px calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--wk-line);
  background: var(--wk-surface);
}
.wk-drawer__sum {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--wk-muted);
}
.wk-drawer__sum strong {
  color: var(--wk-ink);
  font-size: 22px;
  letter-spacing: -.02em;
}
.wk-drawer__note {
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--wk-muted);
}
.wk-drawer__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 999px;
  background: var(--wk-accent);
  color: var(--wk-on-accent);
  font-size: 15px;
  font-weight: 700;
  transition: transform .2s ease, opacity .2s ease;
}
.wk-drawer__cta:hover { transform: translateY(-2px); opacity: .92; }

/* cart lines */
.wk-line {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--wk-line);
}
.wk-line__img {
  display: grid;
  place-items: center;
  width: 76px; height: 76px;
  padding: 6px;
  border-radius: 12px;
  background: var(--wk-soft);
}
.wk-line__img img { width: 100%; height: 100%; object-fit: contain; }
.wk-line__name {
  display: block;
  margin-bottom: 3px;
  padding-right: 26px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.wk-line__meta { font-size: 12px; color: var(--wk-muted); }
.wk-line__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.wk-line__price { font-size: 14px; font-weight: 700; }
.wk-line__del {
  position: absolute;
  top: 16px; right: 0;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  color: var(--wk-muted);
  transition: color .2s ease;
}
.wk-line__del:hover { color: #c0392b; }

.wk-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--wk-line);
  border-radius: 999px;
  overflow: hidden;
}
.wk-qty button {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  color: var(--wk-ink);
  transition: background .2s ease;
}
.wk-qty button:hover { background: var(--wk-soft); }
.wk-qty span { min-width: 26px; text-align: center; font-size: 13px; font-weight: 600; }

.wk-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 64px 12px;
  text-align: center;
  color: var(--wk-muted);
}
.wk-empty .wk-i { width: 38px; height: 38px; opacity: .5; }
.wk-empty strong { color: var(--wk-ink); font-size: 16px; }
.wk-empty a {
  margin-top: 6px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--wk-accent);
  color: var(--wk-on-accent);
  font-size: 13px;
  font-weight: 700;
}

/* search layer */
.wk-search {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  padding: clamp(16px, 6vh, 80px) 16px;
  background: rgba(10, 10, 10, .5);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .3s ease;
  overflow-y: auto;
}
.wk-layer.is-open .wk-search { opacity: 1; }
.wk-search__panel {
  width: min(860px, 100%);
  height: max-content;
  background: var(--wk-surface);
  color: var(--wk-ink);
  border-radius: var(--wk-radius);
  padding: clamp(18px, 3vw, 34px);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .3);
  transform: translateY(-14px) scale(.985);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.wk-layer.is-open .wk-search__panel { transform: none; }

.wk-search__form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--wk-line);
}
.wk-search__form .wk-i { width: 22px; height: 22px; color: var(--wk-muted); }
.wk-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 500;
}
.wk-search__input::placeholder { color: var(--wk-muted); opacity: .7; }
.wk-search__close {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--wk-line);
}

.wk-search__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 4px;
  font-size: 12.5px;
  color: var(--wk-muted);
}
.wk-search__tag {
  padding: 7px 13px;
  border: 1px solid var(--wk-line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--wk-ink);
  transition: border-color .2s ease, background .2s ease;
}
.wk-search__tag:hover { background: var(--wk-soft); }

.wk-search__results {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.wk-sr-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 8px;
  border-radius: 12px;
  transition: background .2s ease;
}
.wk-sr-item:hover { background: var(--wk-soft); }
.wk-sr-item img {
  width: 58px; height: 58px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}
.wk-sr-item__name { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.wk-sr-item__cat { display: block; font-size: 12px; color: var(--wk-muted); }
.wk-sr-item__price { font-size: 13px; font-weight: 700; white-space: nowrap; }
.wk-search__empty { padding: 26px 4px; color: var(--wk-muted); font-size: 14px; }
.wk-search__all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

@media (max-width: 560px) {
  .wk-drawer { width: 100%; }
  .wk-drawer__head { padding: 18px 18px; }
  .wk-drawer__body { padding: 4px 18px; }
  .wk-drawer__foot { padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); }
  .wk-search { padding: 0; }
  .wk-search__panel { border-radius: 0; min-height: 100%; }
}
