/* =========================================================
   SAENGÉ — Reusable components
   ========================================================= */

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--color-text);
  --btn-fg: var(--color-on-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.95rem 1.6rem;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-radius: var(--radius-pill);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--duration-normal) var(--ease-spring),
    box-shadow var(--duration-normal) var(--ease-out-expo);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, oklch(100% 0 0 / 0.18), transparent);
  transform: translateX(-130%);
  transition: transform var(--duration-slow) var(--ease-out-expo);
  z-index: -1;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:hover::after {
  transform: translateX(130%);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  --btn-bg: var(--color-rose-deep);
  --btn-fg: var(--color-on-dark);
  box-shadow: 0 8px 24px oklch(60% 0.15 16 / 0.3);
}

.btn--gold {
  background: var(--grad-gold);
  --btn-fg: oklch(30% 0.05 60);
  box-shadow: var(--shadow-gold);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  border: 1.5px solid oklch(70% 0.04 20 / 0.5);
}

.btn--ghost:hover {
  border-color: var(--color-rose-deep);
  background: var(--color-surface);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

/* ---------- Promo bar ---------- */
.promo {
  position: relative;
  z-index: var(--z-promo);
  background: var(--color-text);
  color: var(--color-on-dark);
  text-align: center;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem var(--gutter);
  overflow: hidden;
}

.promo__track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  flex-wrap: wrap;
}

.promo strong {
  color: var(--color-gold);
  font-weight: 700;
}

.promo code {
  font-family: var(--font-body);
  letter-spacing: 0.18em;
  padding: 0.1em 0.55em;
  border: 1px dashed oklch(100% 0 0 / 0.4);
  border-radius: 6px;
  font-weight: 600;
}

.promo__close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--color-on-dark);
  opacity: 0.75;
  transition: opacity var(--duration-fast), background var(--duration-fast);
}

.promo__close:hover {
  opacity: 1;
  background: oklch(100% 0 0 / 0.12);
}

.promo[hidden] {
  display: none;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: oklch(99% 0.01 20 / 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition:
    border-color var(--duration-normal),
    box-shadow var(--duration-normal),
    background var(--duration-normal);
}

.header.is-scrolled {
  border-bottom-color: oklch(80% 0.03 20 / 0.5);
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-md);
  min-height: var(--header-h);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-self: start;
}

.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grad-petal);
  color: var(--color-on-dark);
  font-size: 1rem;
  box-shadow: var(--shadow-xs);
}

.nav {
  justify-self: center;
}

.nav__list {
  display: flex;
  gap: var(--space-md);
}

.nav__link {
  position: relative;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.4rem 0;
  color: var(--color-text-soft);
  transition: color var(--duration-fast);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background: var(--color-rose-deep);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.nav__link:hover,
.nav__link[aria-current="page"] {
  color: var(--color-text);
}

.nav__link:hover::after,
.nav__link[aria-current="page"]::after {
  transform: scaleX(1);
}

.header__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-soft);
  transition: background var(--duration-fast), color var(--duration-fast);
}

.icon-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.icon-btn .icon {
  width: 19px;
  height: 19px;
}

.cart-btn {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  border-radius: 999px;
  background: var(--color-rose-deep);
  color: var(--color-on-dark);
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  transform: scale(0);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.cart-count.is-active {
  transform: scale(1);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  place-items: center;
}

.nav-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--duration-normal), opacity var(--duration-fast);
}

.nav-toggle .bar + .bar {
  margin-top: 5px;
}

/* ---------- Cart drawer ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: oklch(30% 0.04 20 / 0.4);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal), visibility var(--duration-normal);
  z-index: var(--z-cart);
}

.overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cart {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(420px, 100vw);
  background: var(--color-surface);
  z-index: calc(var(--z-cart) + 1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-out-expo);
  box-shadow: var(--shadow-lg);
}

.cart.is-open {
  transform: none;
}

.cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-surface-2);
}

.cart__head h2 {
  font-size: var(--text-xl);
}

.cart__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.cart__empty {
  margin: auto;
  text-align: center;
  color: var(--color-text-muted);
  display: grid;
  gap: var(--space-sm);
  place-items: center;
}

.cart__empty svg {
  width: 56px;
  height: 56px;
  opacity: 0.4;
}

.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-surface-2);
}

.cart-line__thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--grad-bloom);
  display: grid;
  place-items: center;
}

.cart-line__thumb svg {
  width: 30px;
  height: 46px;
}

.cart-line__name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.cart-line__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-surface-2);
  border-radius: var(--radius-pill);
  margin-top: 0.4rem;
}

.qty button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--color-text-soft);
  font-size: 1rem;
}

.qty button:hover {
  color: var(--color-rose-deep);
}

.qty span {
  min-width: 22px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
}

.cart-line__price {
  font-weight: 600;
  font-size: var(--text-sm);
}

.cart__foot {
  padding: var(--space-md);
  border-top: 1px solid var(--color-surface-2);
  display: grid;
  gap: var(--space-sm);
}

.cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--text-lg);
}

.cart__total strong {
  font-family: var(--font-display);
  font-size: var(--text-xl);
}

.cart__note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 150%);
  background: var(--color-text);
  color: var(--color-on-dark);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: transform var(--duration-slow) var(--ease-spring);
  pointer-events: none;
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

.toast svg {
  width: 18px;
  height: 18px;
  color: var(--color-gold);
}
