/* ===========================================================
   COMPONENTS
=========================================================== */

/* --- Top utility bar --- */
.topbar {
  background: var(--color-primary);
  color: var(--brand-beige);
  font-size: var(--fs-xs);
  letter-spacing: 0.03em;
  text-align: center;
  padding: var(--sp-2) var(--sp-4);
}
.topbar strong, .topbar b { color: var(--brand-ivory); }

/* --- Site header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg-off);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-h);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.logo {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: baseline;
  gap: var(--sp-1);
  white-space: nowrap;
}
.logo span { color: var(--color-accent); font-size: 1.3em; line-height: 0; }

.nav-main {
  display: flex;
  gap: var(--sp-6);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.nav-main a {
  position: relative;
  padding: var(--sp-2) 0;
  color: var(--color-text-muted);
  transition: color .2s var(--ease);
}
.nav-main a::after {
  content: '';
  position: absolute; left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--color-sage);
  transition: width .25s var(--ease);
}
.nav-main a:hover, .nav-main a.is-active { color: var(--color-primary); }
.nav-main a:hover::after, .nav-main a.is-active::after { width: 100%; }

.header-actions { display: flex; align-items: center; gap: var(--sp-2); }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  border-radius: var(--radius-pill);
  color: var(--color-primary);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--wash-sage); }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; }

.cart-count {
  position: absolute;
  top: 4px; right: 2px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 10px;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-bg-off);
}

.nav-toggle {
  display: none;
  width: var(--tap); height: var(--tap);
  border-radius: var(--radius-sm);
}
.nav-toggle span, .nav-toggle::before, .nav-toggle::after {
  content: '';
  display: block;
  width: 22px; height: 2px;
  background: var(--color-primary);
  margin: 5px auto;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 13px 28px;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-pill);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--color-primary-deep); box-shadow: var(--shadow-md); }

.btn-accent {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-accent:hover { background: var(--brand-wood); color: var(--brand-ivory); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: var(--color-on-primary); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-primary); }

.btn-sage {
  background: var(--brand-olive);
  color: var(--brand-ivory);
}
.btn-sage:hover { background: var(--color-primary); }

.btn-danger { background: var(--color-danger); color: var(--brand-ivory); }
.btn-danger:hover { background: #8E3A26; }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 8px 18px; font-size: var(--fs-xs); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* --- Badges / chips --- */
.badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--wash-sage);
  color: var(--brand-olive);
}
.badge-accent { background: var(--color-accent); color: var(--color-on-accent); }
.badge-new { background: var(--wash-wood); color: var(--color-primary); }
.badge-out { background: var(--brand-light-beige); color: var(--color-text-muted); }

.status-pill {
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  text-transform: capitalize;
  white-space: nowrap;
}
.status-pending    { background: var(--wash-terracotta); color: #8E5427; }
.status-processing { background: var(--wash-wood); color: var(--color-primary); }
.status-shipped    { background: var(--wash-sage); color: var(--brand-olive); }
.status-delivered  { background: var(--brand-olive); color: var(--brand-ivory); }
.status-cancelled  { background: rgba(169, 75, 52, 0.14); color: var(--color-danger); }

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--brand-light-beige); }

.product-card__media {
  position: relative;
  aspect-ratio: 4/3.2;
  background: var(--color-surface-2);
  overflow: hidden;
}
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.product-card:hover .product-card__media img { transform: scale(1.06); }
.product-card__badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 60px); }

.product-card__body { padding: var(--sp-4) var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.product-card__cat { font-size: var(--fs-xs); color: var(--brand-olive); font-weight: 600; letter-spacing: .04em; }
.product-card__title { font-family: var(--font-display); font-size: var(--fs-md); color: var(--color-heading); font-weight: 600; }
.product-card__price { margin-top: auto; display: flex; align-items: baseline; gap: var(--sp-2); padding-top: var(--sp-2); flex-wrap: wrap; }
.product-card__price .now { font-weight: 700; font-size: var(--fs-md); color: var(--color-heading); }
.product-card__price .was { font-size: var(--fs-sm); color: var(--color-text-muted); text-decoration: line-through; }

.product-card__cta { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.product-card__cta .btn { flex: 1 1 auto; }

/* --- Forms --- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--color-heading); }
.field .hint { font-size: var(--fs-xs); color: var(--color-text-muted); }
.field .error-text { font-size: var(--fs-xs); color: var(--color-danger); display: none; }
.field.has-error .error-text { display: block; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--color-danger); }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--color-bg-off);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: max(16px, var(--fs-base)); /* stops iOS zoom-on-focus */
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--color-text-muted); opacity: .85; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-sage);
  box-shadow: 0 0 0 3px var(--wash-sage);
}
textarea { resize: vertical; min-height: 90px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); width: 17px; height: 17px; }

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--color-bg-off);
}
.qty-stepper button {
  width: 38px; height: 38px;
  font-size: var(--fs-md);
  color: var(--color-primary);
  transition: background .2s;
}
.qty-stepper button:hover { background: var(--color-surface-2); }
.qty-stepper input {
  width: 40px; text-align: center;
  border: none; background: transparent;
  min-height: 0;
  padding: 0;
}
.qty-stepper input:focus { box-shadow: none; }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  max-width: min(92vw, 420px);
  background: var(--color-primary-deep);
  color: var(--brand-beige);
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* --- Stepper (checkout) --- */
.checkout-steps {
  display: flex;
  justify-content: center;
  gap: var(--sp-7);
  margin-bottom: var(--sp-7);
  flex-wrap: wrap;
}
.checkout-steps .step { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--color-text-muted); font-weight: 600; }
.checkout-steps .step .num {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs);
}
.checkout-steps .step.is-active { color: var(--color-primary); }
.checkout-steps .step.is-active .num { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
.checkout-steps .step.is-done .num { background: var(--brand-olive); border-color: var(--brand-olive); color: var(--brand-ivory); }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--sp-9) var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
}
.empty-state svg { width: 64px; height: 64px; stroke: var(--color-sage); opacity: .7; }
.empty-state p { color: var(--color-text-muted); max-width: 44ch; }

/* --- Breadcrumb --- */
.breadcrumb { font-size: var(--fs-xs); color: var(--color-text-muted); display: flex; gap: 6px; margin-bottom: var(--sp-5); flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--color-primary); }

/* --- Footer --- */
.site-footer { background: var(--color-primary); color: var(--brand-beige); margin-top: var(--sp-9); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1.5fr;
  gap: var(--sp-6) var(--sp-5);
  padding: var(--sp-8) 0 var(--sp-6);
}
.footer-grid h4 { color: var(--brand-ivory); font-size: var(--fs-sm); letter-spacing: .04em; margin-bottom: var(--sp-4); font-family: var(--font-body); }
.footer-grid ul { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-grid a { color: var(--brand-beige); font-size: var(--fs-sm); opacity: .88; transition: opacity .2s; }
.footer-grid a:hover { opacity: 1; text-decoration: underline; }
.footer-brand p { color: var(--brand-beige); opacity: .82; font-size: var(--fs-sm); margin-top: var(--sp-3); max-width: 42ch; }
.site-footer .icon-btn { color: var(--brand-beige); }
.site-footer .icon-btn:hover { background: var(--wash-light); color: var(--brand-ivory); }
/* --- Footer brand column --- */
.tagline {
  color: var(--brand-beige);
  opacity: .82;
  font-size: var(--fs-sm);
  margin-top: var(--sp-3);
  max-width: 36ch;
}

.footer-contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}
.footer-contact-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--wash-line);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-beige);
  opacity: 1;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.footer-contact-link:hover {
  background: var(--brand-ivory);
  border-color: var(--brand-ivory);
  color: var(--color-primary);
  text-decoration: none;
}
.footer-contact-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

/* --- Footer newsletter column --- */
.footer-newsletter p {
  color: var(--brand-beige);
  opacity: .82;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
  max-width: 34ch;
}
.footer-newsletter-form {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.footer-newsletter-form input {
  flex: 1 1 160px;
  min-width: 0;
  min-height: 42px;
  padding: 10px 16px;
  background: var(--brand-ivory);
  border: 1.5px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--color-text);
}
.footer-newsletter-form input::placeholder { color: var(--color-text-muted); }
.footer-newsletter-form input:focus {
  border-color: var(--brand-beige);
  box-shadow: 0 0 0 3px var(--wash-light);
}
.footer-newsletter-form button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.footer-newsletter-form button:hover { background: var(--brand-ivory); color: var(--color-primary); }

.footer-social {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.footer-social a {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--wash-line);
  color: var(--brand-beige);
  opacity: 1;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.footer-social a:hover {
  background: var(--brand-ivory);
  border-color: var(--brand-ivory);
  color: var(--color-primary);
  text-decoration: none;
}
.footer-social svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.footer-bottom {
  border-top: 1px solid var(--wash-line);
  padding: var(--sp-4) 0;
  font-size: var(--fs-xs);
  opacity: .75;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.footer-bottom a:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .footer-bottom { justify-content: center; text-align: center; }
}

/* --- Auth tabs --- */
.auth-tabs { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-6); background: var(--color-surface-2); padding: 4px; border-radius: var(--radius-pill); }
.auth-tabs button { flex: 1; min-height: 40px; padding: 10px; border-radius: var(--radius-pill); font-weight: 600; font-size: var(--fs-sm); color: var(--color-primary); }
.auth-tabs button.is-active { background: var(--color-primary); color: var(--color-on-primary); }

.is-disabled { opacity: 0.5; pointer-events: none; }

/* --- Header responsive behaviour ---
   Declared here (not layout.css) because components.css loads later:
   media queries add no specificity, so the last matching rule wins.

   The primary nav carries ten top-level items, which cannot share a row
   with the logo and the account/cart icons. From 1024px up the header
   becomes two rows: brand + actions, then the nav beneath it. Below that
   the nav collapses into the drawer. --- */
@media (min-width: 1080px) {
  :root { --header-h: 116px; }
  .site-header .container {
    flex-wrap: wrap;
    align-content: center;
    row-gap: var(--sp-1);
    padding-top: var(--sp-2);
    padding-bottom: var(--sp-2);
  }
  .site-header .container > .logo { order: 1; }
  .site-header .container > .header-actions { order: 2; margin-left: auto; }
  .site-header .container > .nav-main {
    order: 3;
    flex: 0 0 100%;
    justify-content: center;
    gap: var(--sp-5);
    border-top: 1px solid var(--color-border-soft);
    padding-top: var(--sp-1);
    min-width: 0;
  }
}

/* Tighten the nav row before it runs out of room */
@media (min-width: 1080px) and (max-width: 1240px) {
  .site-header .container > .nav-main { gap: var(--sp-4); }
  .nav-main a,
  .mega-nav__item > a,
  .mega-nav__trigger { font-size: 12px; }
}

@media (max-width: 1079px) {
  .nav-main,
  .nav-main.mega-nav { display: none !important; }
  .nav-toggle { display: block; }
}

@media (max-width: 560px) {
  .topbar { font-size: 11px; padding: var(--sp-2) var(--sp-3); }
  .site-header .container { gap: var(--sp-2); }
  .header-actions { gap: 0; }
  .btn { padding: 12px 22px; }
}

/* Very narrow phones — keep the header on one line */
@media (max-width: 400px) {
  .container { padding: 0 var(--sp-3); }
  .logo { font-size: var(--fs-base); }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn svg { width: 18px; height: 18px; }
  .nav-toggle { width: 38px; height: 38px; }
  .btn { padding: 11px 18px; }
}

/* --- Footer + checkout stepper responsive (kept here for the same
       cascade reason as the nav rules above) --- */
@media (max-width: 1080px) {
  /* brand + newsletter take a full row each, the three link lists share one */
  .footer-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-6) var(--sp-5); }
  .footer-brand, .footer-newsletter { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .checkout-steps { gap: var(--sp-4); }
  .checkout-steps .step span:not(.num) { display: none; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--sp-5); padding: var(--sp-7) 0 var(--sp-5); }
  .footer-brand p { max-width: none; }
}

/* ===========================================================
   TRUST STRIP
   Five short proof points between the page and the footer.
   Sits on beige so it reads as a band, not another card row.
=========================================================== */
.trust-strip {
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--sp-6) 0;
}
.trust-strip .container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-5);
}
.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
}
.trust-item__icon {
  width: 46px; height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  background: var(--color-bg-off);
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
}
.trust-item__icon svg {
  width: 22px; height: 22px;
  fill: none;                 /* the markup ships no fill — without this they render solid */
  stroke: var(--brand-olive);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trust-item__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-heading);
}
.trust-item__sub {
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  max-width: 22ch;
}

@media (max-width: 900px) {
  .trust-strip .container { grid-template-columns: repeat(3, 1fr); gap: var(--sp-5) var(--sp-4); }
}
@media (max-width: 560px) {
  .trust-strip { padding: var(--sp-5) 0; }
  .trust-strip .container { grid-template-columns: repeat(2, 1fr); gap: var(--sp-5) var(--sp-3); }
  .trust-item__icon { width: 40px; height: 40px; flex: 0 0 40px; }
  .trust-item__icon svg { width: 19px; height: 19px; }
}
