/* ============================================================
   components.css — buttons, cards, swatches, drawer, modal,
   accordion, forms, toast
   ============================================================ */

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 14px 26px; font-weight: 600; font-size: .98rem;
  transition: transform .18s var(--ease), background .2s var(--ease),
              color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--ink); color: var(--cream); }
.btn--primary:hover { background: var(--clay); box-shadow: var(--shadow); }
.btn--ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--cream); }
.btn--block { width: 100%; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: transparent; border: 0;
  font-size: 1.05rem; color: var(--ink);
  transition: background .2s var(--ease), transform .16s var(--ease);
}
.icon-btn:hover { background: var(--sand); }
.icon-btn:active { transform: scale(.9); }

/* ---------- CART BUTTON ---------- */
.cart-btn {
  position: relative; margin-left: 4px;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: transparent; border: 1px solid var(--line);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .16s var(--ease);
}
.cart-btn:hover { background: var(--white); border-color: var(--taupe); }
.cart-btn:active { transform: scale(.94); }
.cart-btn__count {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--clay); color: var(--white);
  font-size: .72rem; font-weight: 700; border-radius: 999px;
  display: grid; place-items: center;
  /* Never animate from scale(0) (Emil) — a badge that grows from nothing looks
     unnatural; start small + transparent and pop in. */
  transform: scale(.5); opacity: 0;
  transition: transform .22s var(--ease), opacity .22s var(--ease);
}
.cart-btn__count.is-visible { transform: scale(1); opacity: 1; }

/* ---------- RATING / PRICE ---------- */
.rating { display: inline-flex; align-items: center; gap: 10px; margin: 18px 0 6px; }
.rating--center { justify-content: center; margin-top: 16px; }
.rating__stars { color: var(--clay); letter-spacing: 2px; }
.rating__text { font-size: .92rem; color: var(--ink-soft); }

.price { display: flex; align-items: center; gap: 12px; margin: 14px 0 26px; }
.price__now { font-family: var(--font-serif); font-size: 1.9rem; font-weight: 600; }
.price__was { color: var(--taupe-deep); text-decoration: line-through; font-size: 1.1rem; }
.badge {
  background: var(--clay); color: var(--white);
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}

/* ---------- SHADE SELECT (hero) ---------- */
.shade-select { margin-bottom: 26px; }
.shade-select__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.shade-select__current { font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--white);
  outline: 1px solid rgba(0,0,0,.08);
  cursor: pointer; transition: transform .18s var(--ease), border-color .2s var(--ease);
  padding: 0;
}
.swatch[aria-checked="true"] { border-color: var(--ink); }
.swatch:active { transform: scale(.96); }

/* ---------- QUANTITY ---------- */
.buy { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--white);
}
.qty__btn {
  width: 44px; height: 100%; min-height: 48px; border: 0; background: transparent;
  font-size: 1.2rem; color: var(--ink); border-radius: 999px;
  transition: background .2s var(--ease), transform .16s var(--ease);
}
.qty__btn:hover { background: var(--sand); }
.qty__btn:active { transform: scale(.9); }
.qty__value { min-width: 34px; text-align: center; font-weight: 600; }
.buy__add { flex: 1; min-width: 200px; }

/* ---------- BENEFIT CARDS ---------- */
.benefit {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 24px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.benefit:hover { box-shadow: var(--shadow); }
.benefit__icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 16px;
  background: var(--sand); color: var(--clay-deep);
}
.benefit__icon svg { width: 24px; height: 24px; }
.benefit h3 { margin-bottom: 6px; }
.benefit p { color: var(--ink-soft); font-size: .96rem; }

/* ---------- SHADE CARDS ---------- */
.shade-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  cursor: pointer; text-align: left; width: 100%;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.shade-card:hover { box-shadow: var(--shadow-sm); }
.shade-card:active { transform: scale(.99); }
.shade-card.is-active { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.shade-card__dot {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  outline: 1px solid rgba(0,0,0,.08); box-shadow: inset 0 0 0 2px var(--white);
}
.shade-card__code { font-weight: 600; }
.shade-card__name { font-size: .88rem; color: var(--ink-soft); }

/* ---------- INGREDIENTS ---------- */
.ingredients { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 4px; }
.ingredient {
  /* Fixed name column so the tag + description align across every row —
     an `auto` column made each row's second column start at a different x. */
  display: grid; grid-template-columns: 160px 1fr; gap: 4px 20px;
  padding: 18px 0; border-top: 1px solid var(--line);
}
@media (max-width: 420px) {
  .ingredient { grid-template-columns: 1fr; gap: 2px; }
  .ingredient__name { grid-row: auto; margin-bottom: 4px; }
}
.ingredient:last-child { border-bottom: 1px solid var(--line); }
.ingredient__name { font-family: var(--font-serif); font-size: 1.15rem; grid-row: span 2; align-self: start; }
.ingredient__tag { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--clay-deep); font-weight: 600; }
.ingredient__desc { color: var(--ink-soft); font-size: .96rem; }

/* ---------- STEPS ---------- */
.step {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 22px; position: relative;
  counter-increment: step;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-serif); font-size: 1.6rem; color: var(--clay);
  display: block; margin-bottom: 12px;
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--ink-soft); font-size: .95rem; }

/* ---------- REVIEW CARDS ---------- */
.review {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.review__stars { color: var(--clay); letter-spacing: 2px; }
.review__body { font-size: 1.02rem; }
.review__by { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.review__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; color: var(--white);
  background: var(--taupe-deep);
}
.review__name { font-weight: 600; font-size: .92rem; }
.review__meta { font-size: .8rem; color: var(--ink-soft); }

/* ---------- ACCORDION ---------- */
.accordion { max-width: 760px; margin: 0 auto; }
.acc-item { border-bottom: 1px solid var(--line); }
.acc-trigger {
  width: 100%; text-align: left; background: none; border: 0;
  padding: 22px 0; display: flex; justify-content: space-between; align-items: center; gap: 20px;
  font-size: 1.1rem; font-weight: 500; font-family: var(--font-serif);
  transition: color .2s var(--ease);
}
.acc-trigger:hover { color: var(--clay-deep); }
.acc-trigger:hover .acc-trigger__icon { color: var(--clay-deep); }
.acc-trigger__icon { flex: none; color: var(--clay); transition: transform .3s var(--ease), color .2s var(--ease); font-size: 1.4rem; line-height: 1; }
.acc-trigger[aria-expanded="true"] .acc-trigger__icon { transform: rotate(45deg); }
.acc-panel {
  overflow: hidden; max-height: 0;
  transition: max-height .35s var(--ease);
}
.acc-panel__inner { padding: 0 0 22px; color: var(--ink-soft); }

/* ---------- OVERLAY ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(43, 38, 34, .45); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .3s var(--ease);
}
.overlay.is-visible { opacity: 1; }

/* ---------- DRAWER ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 160;
  width: min(420px, 92vw); background: var(--cream);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--dur) var(--ease-drawer);
  box-shadow: var(--shadow-lg);
}
.drawer.is-open { transform: none; }
.drawer__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 22px 16px; border-bottom: 1px solid var(--line);
}
.drawer__head h2 { font-size: 1.4rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 8px 22px; }
.drawer__empty {
  flex: 1; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 22px; color: var(--ink-soft);
}
.drawer.is-empty .drawer__empty { display: flex; }
.drawer.is-empty .drawer__body,
.drawer.is-empty .drawer__foot { display: none; }
.drawer__foot { padding: 18px 22px 24px; border-top: 1px solid var(--line); }
.drawer__row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.drawer__row strong { font-family: var(--font-serif); font-size: 1.3rem; }
.drawer__note { font-size: .82rem; color: var(--ink-soft); margin-bottom: 16px; }

/* ---------- CART LINE ---------- */
.cart-line {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.cart-line__thumb {
  width: 56px; height: 66px; border-radius: 10px; overflow: hidden;
  /* gradient stays as a graceful base if the product image ever fails to load */
  background: linear-gradient(150deg, var(--sand), var(--taupe));
  outline: 1px solid rgba(0,0,0,.06);
}
.cart-line__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-line__thumb img[data-broken] { display: none; }
.cart-line__title { font-weight: 600; font-size: .96rem; }
.cart-line__shade { font-size: .84rem; color: var(--ink-soft); margin-bottom: 8px; }
.cart-line__qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.cart-line__qty button { width: 38px; height: 38px; border: 0; background: none; font-size: 1rem; border-radius: 999px; transition: background .2s var(--ease), transform .16s var(--ease); }
.cart-line__qty button:hover { background: var(--sand); }
.cart-line__qty button:active { transform: scale(.9); }
.cart-line__qty span { min-width: 24px; text-align: center; font-size: .9rem; font-weight: 600; }
.cart-line__price { font-weight: 600; }
.cart-line__remove { background: none; border: 0; color: var(--ink-soft); font-size: .8rem; text-decoration: underline; padding: 4px 0; margin-top: 6px; }
.cart-line__remove:hover { color: var(--clay); }
.cart-line__col-r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }

/* ---------- MODAL ---------- */
.modal {
  position: fixed; inset: 0; z-index: 170;
  display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(43, 38, 34, .5); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .3s var(--ease);
}
.modal.is-open { display: flex; }
.modal.is-visible { opacity: 1; }
.modal__panel {
  width: min(560px, 100%); max-height: 92vh; overflow: hidden;
  background: var(--cream); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateY(16px) scale(.98); transition: transform var(--dur) var(--ease);
}
.modal.is-visible .modal__panel { transform: none; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal__body { padding: 24px 26px 28px; overflow-y: auto; }

/* steps bar */
.steps-bar { display: flex; align-items: center; gap: 10px; }
.steps-bar__dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: .82rem; font-weight: 700;
  background: var(--sand); color: var(--taupe-deep); transition: background .3s var(--ease), color .3s var(--ease);
}
.steps-bar__dot.is-active { background: var(--ink); color: var(--cream); }
.steps-bar__dot.is-done { background: var(--clay); color: var(--white); }
.steps-bar__line { width: 34px; height: 2px; background: var(--line); }

/* ---------- FORMS ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.input {
  width: 100%; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input:focus { outline: none; border-color: var(--taupe); box-shadow: 0 0 0 3px rgba(176, 106, 82, .14); }
.input[aria-invalid="true"] { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(176, 106, 82, .16); }
.field__error { color: var(--clay-deep); font-size: .8rem; margin-top: 5px; min-height: 1em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checkout-title { font-size: 1.6rem; margin-bottom: 4px; }
.checkout-sub { color: var(--ink-soft); font-size: .95rem; margin-bottom: 20px; }
.checkout-actions { display: flex; gap: 12px; margin-top: 22px; }
.checkout-actions .btn { flex: 1; }

.order-summary {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px;
}
.order-summary__row { display: flex; justify-content: space-between; padding: 6px 0; font-size: .92rem; }
.order-summary__row--total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-weight: 700; font-size: 1.05rem; }
.order-summary__row--total span:last-child { font-family: var(--font-serif); }

.demo-note {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--sand); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .82rem; color: var(--ink-soft); margin-top: 16px;
}

/* success */
.success { text-align: center; padding: 12px 0; }
.success__check {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; background: var(--clay); color: var(--white); font-size: 1.8rem;
  animation: pop .5s var(--ease);
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success h3 { font-size: 1.7rem; margin-bottom: 8px; }
.success p { color: var(--ink-soft); }
.success__order { font-weight: 600; color: var(--ink); }

/* ---------- NEWSLETTER FORM ---------- */
.newsletter__form { margin-top: 26px; }
.newsletter__form .field { display: flex; gap: 10px; margin: 0; }
.newsletter__form .input { background: rgba(255,255,255,.06); border-color: rgba(246,241,234,.25); color: var(--cream); }
.newsletter__form .input::placeholder { color: rgba(246,241,234,.5); }
.newsletter__form .input:focus { border-color: var(--cream); box-shadow: 0 0 0 3px rgba(246,241,234,.14); }
.newsletter__form .btn--primary { background: var(--cream); color: var(--ink); }
.newsletter__form .btn--primary:hover { background: var(--clay); color: var(--cream); }
.form-msg { min-height: 1.2em; margin-top: 12px; font-size: .9rem; }
.form-msg.is-ok { color: #a7d9b0; }
.form-msg.is-err { color: #f0b3a0; }
@media (max-width: 460px) { .newsletter__form .field { flex-direction: column; } }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  z-index: 200; background: var(--ink); color: var(--cream);
  padding: 13px 20px; border-radius: 999px; font-size: .92rem; font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .3s var(--ease), transform .3s var(--ease);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.field-row--small { grid-template-columns: 1fr 1fr; }

/* ---------- HOVER-ONLY transforms ----------
   Gated so touch devices (which fire :hover on tap) don't leave cards
   stuck in a lifted/scaled state after a tap. */
@media (hover: hover) and (pointer: fine) {
  .swatch:hover { transform: scale(1.08); }
  .benefit:hover { transform: translateY(-4px); }
  .shade-card:hover { transform: translateY(-3px); }
}
