/* =========================================================================
   ZAD — zadcookies.ma/order
   Palette: cream #f8fce1 · olive #456957 · caramel #dea981 · tissue red (photo-only)
   Typography: Cormorant Garamond (display) + DM Sans (body) · WOFF2 self-hosted
   Principle: the product is sexy, the UI is quiet.
   ========================================================================= */

/* ---------- Fonts (self-hosted, latin + latin-ext covered by the variable file) ---------- */

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/cormorant-garamond.woff2') format('woff2');
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/fonts/dm-sans.woff2') format('woff2');
}

/* ---------- Reset + base ---------- */

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

html, body {
  margin: 0;
  padding: 0;
}

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

body {
  background: #f8fce1;
  color: #456957;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 88px; /* clear space for the sticky cart bar on mobile */
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

:focus-visible {
  outline: 2px solid #dea981;
  outline-offset: 2px;
}

hr.hairline        { border: 0; border-top: 1px solid rgba(222, 169, 129, 0.6); margin: 0; }
hr.hairline-thin   { border: 0; border-top: 1px solid rgba(222, 169, 129, 0.3); margin: 0; }

/* ---------- Layout shell ---------- */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

.page > section { padding: 48px 0; }

@media (min-width: 720px) {
  .page { padding: 0 24px; }
  .page > section { padding: 64px 0; }
}

/* ---------- Language toggle (top-right chrome) ---------- */

.lang-toggle {
  position: absolute;
  top: 16px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 13px;
  z-index: 10;
}

.lang-btn {
  color: #dea981;
  padding: 12px;
  min-width: 44px;
  min-height: 44px;
  line-height: 20px;
  transition: color 150ms ease;
  border-bottom: 1px solid transparent;
}

.lang-btn[aria-pressed="true"] {
  color: #456957;
  border-bottom-color: #456957;
}

.lang-btn:hover { color: #456957; }

.lang-sep {
  color: #dea981;
  opacity: 0.6;
  font-weight: 400;
  font-size: 13px;
  line-height: 1;
}

/* ---------- Section headings (reused across sections) ---------- */

.section-heading {
  font-family: 'Cormorant Garamond';
  font-weight: 700;
  font-size: 28px;
  color: #456957;
  margin: 0 0 16px 0;
  line-height: 1.3;
}

@media (min-width: 720px) {
  .section-heading { font-size: 32px; }
}

.section-sub {
  margin: 0 0 24px 0;
  font-size: 15px;
  color: rgba(69, 105, 87, 0.75);
}

/* ---------- Section 1 · Hero ---------- */

.hero {
  padding-top: 48px !important;
  text-align: center;
}

.hero-wordmark {
  width: min(60%, 320px);
  aspect-ratio: 226.9 / 87;
  margin: 0 auto 16px;
}

.hero-descriptor {
  font-family: 'Cormorant Garamond';
  font-weight: 400;
  font-size: 22px;
  line-height: 1.35;
  color: #456957;
  margin: 0 auto 8px;
  max-width: 520px;
}

@media (min-width: 720px) {
  .hero-descriptor { font-size: 24px; }
}

.hero-badge {
  font-family: 'DM Sans';
  font-weight: 400;
  font-size: 13px;
  color: #dea981;
  margin: 0 auto 24px;
  max-width: 520px;
}

.hero-photo {
  border-radius: 8px;
  margin: 0 auto;
  max-height: 60vh;
  object-fit: cover;
  width: 100%;
}

.scroll-hint {
  font-family: 'DM Sans';
  font-size: 12px;
  color: rgba(69, 105, 87, 0.65);
  margin: 8px 0 0;
}

/* ---------- Section 2 · Story strip ---------- */

.story-strip {
  text-align: center;
}

.story-strip p {
  font-family: 'Cormorant Garamond';
  font-weight: 400;
  font-size: 20px;
  line-height: 1.4;
  color: #456957;
  max-width: 520px;
  margin: 0 auto 4px;
}

@media (min-width: 720px) {
  .story-strip p { font-size: 22px; }
}

/* ---------- Section 3 · Products ---------- */

/*
 * Grid strategy — photography does the work, UI stays out of the way.
 *   Mobile (< 640px):  single column. Each card gets ~335px, photos breathe.
 *   Tablet (≥ 640px):  2 cols; Mix spans full width (hero option).
 *   Desktop (≥ 1024px): 3 cols; Mix still spans full width.
 * No card borders — whitespace separates. Design-spec §4: "Cream carries depth."
 */

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 640px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 48px 32px; }
  .product-card.is-mix { grid-column: 1 / -1; }
}

@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .product-card.is-mix { grid-column: 1 / -1; }
}

.product-card {
  display: flex;
  flex-direction: column;
  background: transparent;
  /* no border, no shadow — whitespace is the separator */
}

.product-card-photo {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  border-radius: 6px;
}

/* Mix Box always hero-cropped — wider, more of the six-creams story lands */
.product-card.is-mix .product-card-photo {
  aspect-ratio: 16 / 9;
}

.product-card-body {
  padding: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name-dominant {
  font-family: 'Cormorant Garamond';
  font-weight: 400;
  font-size: 24px;
  color: #456957;
  line-height: 1.15;
  letter-spacing: -0.005em;
}

.product-card.is-mix .product-name-dominant {
  font-size: 28px;
}

.product-name-secondary {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  color: rgba(69, 105, 87, 0.55);
  line-height: 1.2;
  margin-top: 2px;
}

.product-mix-tag {
  display: inline-block;
  font-family: 'DM Sans';
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(69, 105, 87, 0.55);
  margin-top: 6px;
}

.product-tasting-note {
  font-family: 'DM Sans';
  font-size: 14px;
  line-height: 1.5;
  color: rgba(69, 105, 87, 0.7);
  margin: 10px 0 0;
  max-width: 42em;
}

/* Single row per size: label + price on the left, stepper on the right.
   Hairline divider between box-of-6 row and box-of-12 row only — never after the last one. */
.size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(222, 169, 129, 0.25);
}

.size-row:first-of-type {
  margin-top: 16px;
}

.size-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.size-label {
  font-family: 'DM Sans';
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(69, 105, 87, 0.6);
  text-transform: uppercase;
}

.size-price {
  font-family: 'Cormorant Garamond';
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  color: #456957;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Stepper: olive-outlined circular buttons. Quiet, not caramel-shout. */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.qty-btn {
  width: 48px;
  height: 48px;
  background: transparent;
  color: #456957;
  border: 1.5px solid #456957;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease, opacity 150ms ease;
}

.qty-btn:hover:not(:disabled) { background: rgba(69, 105, 87, 0.06); }
.qty-btn:disabled { opacity: 0.25; cursor: default; border-color: rgba(69, 105, 87, 0.4); }

.qty-readout {
  min-width: 20px;
  text-align: center;
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 17px;
  color: #456957;
  font-variant-numeric: tabular-nums;
}

/* ---------- Section 4 · Cart summary ---------- */

.cart-summary {
  padding-top: 48px !important;
}

.cart-summary .hairline { margin-bottom: 32px; }

.cart-lines {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: 'DM Sans';
  font-size: 15px;
  color: #456957;
  padding: 6px 0;
  font-variant-numeric: tabular-nums;
}

.cart-line-qty { color: rgba(69, 105, 87, 0.7); }

.cart-totals { margin: 16px 0; }

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
}

.cart-total-label {
  font-family: 'DM Sans';
  font-weight: 400;
  font-size: 15px;
  color: rgba(69, 105, 87, 0.75);
}

.cart-total-value {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 18px;
  color: #456957;
  font-variant-numeric: tabular-nums;
}

.cart-total-row:first-child .cart-total-value {
  font-size: 16px;
  font-weight: 500;
}

.cart-delivery-note {
  font-family: 'DM Sans';
  font-size: 14px;
  color: rgba(69, 105, 87, 0.65);
  font-style: italic;
  margin-top: 16px;
}

/* ---------- Form common ---------- */

.order-form > section { padding: 48px 0; }

.field-label {
  display: block;
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 14px;
  color: #456957;
  margin-top: 16px;
  margin-bottom: 6px;
}

.required-marker { color: #dea981; }

.field-helper, .field-instruction {
  font-family: 'DM Sans';
  font-size: 13px;
  color: rgba(69, 105, 87, 0.7);
  margin: 6px 0 0;
  line-height: 1.45;
}

.field-instruction {
  font-size: 15px;
  color: #456957;
  margin-bottom: 16px;
}

.field-error {
  font-family: 'DM Sans';
  font-size: 13px;
  color: #dea981;
  margin: 6px 0 0;
  line-height: 1.45;
}

.field-error::before {
  content: "⚠ ";
  color: #dea981;
  margin-right: 2px;
}

input[type="text"],
input[type="tel"],
textarea {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(69, 105, 87, 0.3);
  border-radius: 4px;
  padding: 14px 14px;
  font-family: 'DM Sans';
  font-size: 16px;           /* 16px to prevent iOS zoom on focus */
  color: #456957;
  min-height: 48px;
  transition: border-color 150ms ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #456957;
}

input::placeholder, textarea::placeholder {
  color: rgba(69, 105, 87, 0.4);
}

textarea { resize: vertical; min-height: 90px; line-height: 1.45; }

/* ---------- Section 5 · Date chips ---------- */

.date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.date-chip {
  padding: 14px 20px;
  min-height: 56px;
  border: 1px solid #456957;
  border-radius: 6px;
  background: transparent;
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 15px;
  color: #456957;
  white-space: nowrap;
  transition: background 150ms ease;
}

.date-chip[aria-checked="true"] {
  background: #dea981;
  color: #456957;
  border-color: #dea981;
}

/* ---------- Section 6 · Map ---------- */

.link-btn {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 15px;
  color: #456957;
  border-bottom: 1px solid #456957;
  padding: 8px 0;
  margin-bottom: 16px;
  display: inline-block;
}

.map {
  width: 100%;
  height: 280px;
  border: 1px solid #dea981;
  border-radius: 8px;
  overflow: hidden;
  /* Google Maps handles muting via its style JSON — no CSS filter needed. */
}

@media (min-width: 720px) {
  .map { height: 360px; }
}

/* Placeholder state when the Google Maps API key hasn't been set yet.
   Keeps the preview usable for everything other than map interactions. */
.map.map-disabled {
  background: rgba(222, 169, 129, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.map-disabled-inner { padding: 24px; max-width: 400px; }
.map-disabled-inner p {
  font-family: 'DM Sans';
  font-size: 14px;
  color: rgba(69, 105, 87, 0.75);
  margin: 0 0 8px;
}
.map-disabled-hint { font-size: 12px !important; color: rgba(69, 105, 87, 0.55) !important; }
.map-disabled-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: rgba(69, 105, 87, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
}

.pin-address {
  font-family: 'DM Sans';
  font-size: 14px;
  color: #456957;
  margin: 12px 0 0;
  line-height: 1.5;
}
.pin-address-label {
  color: rgba(69, 105, 87, 0.6);
  font-weight: 500;
}

/* Autocomplete dropdown — Google injects a .pac-container into the body.
   Style it to match the brand so it doesn't stand out as a Google artifact. */
.pac-container {
  font-family: 'DM Sans', system-ui, sans-serif;
  border: 1px solid rgba(69, 105, 87, 0.2);
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(69, 105, 87, 0.08);
  background: #f8fce1;
  margin-top: 0;
}
.pac-item {
  padding: 10px 14px;
  font-size: 14px;
  color: #456957;
  border-top: 1px solid rgba(222, 169, 129, 0.2);
  cursor: pointer;
}
.pac-item:first-child { border-top: none; }
.pac-item:hover { background: rgba(222, 169, 129, 0.12); }
.pac-item-query { color: #456957; font-weight: 500; font-size: 14px; }
.pac-matched { color: #456957; font-weight: 700; }
.pac-icon { display: none; }
.pac-logo::after { opacity: 0.5; }

/* ---------- Section 8 · Event code collapsible ---------- */

.event-code-trigger {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 14px;
  color: #456957;
  border-bottom: 1px solid #456957;
  padding: 8px 0;
}

.event-code-panel { margin-top: 16px; }

/* ---------- Section 9 · Submit ---------- */

.submit-wrap {
  padding: 48px 0;
  text-align: center;
}

.primary-btn {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 32px;
  min-height: 56px;
  background: #dea981;
  color: #456957;
  border-radius: 6px;
  font-family: 'Cormorant Garamond';
  font-weight: 700;
  font-size: 20px;
  transition: box-shadow 150ms ease, opacity 150ms ease;
}

.primary-btn:hover { box-shadow: 0 0 0 1px #456957 inset; }

.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.primary-btn.is-loading { cursor: wait; }

.primary-btn .spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(69, 105, 87, 0.3);
  border-top-color: #456957;
  border-radius: 50%;
  vertical-align: -3px;
  margin-right: 8px;
  animation: zad-spin 700ms linear infinite;
}

@keyframes zad-spin { to { transform: rotate(360deg); } }

.submit-error {
  font-family: 'DM Sans';
  font-size: 14px;
  color: #dea981;
  margin: 0 0 8px;
  text-align: center;
}

.submit-error-link { text-align: center; margin: 0 0 12px; }
.submit-error-link a {
  color: #dea981;
  border-bottom: 1px solid #dea981;
  padding-bottom: 1px;
}

/* ---------- Footer ---------- */

.footer {
  padding: 48px 0 64px;
  text-align: center;
}

.footer-line1 {
  font-family: 'Cormorant Garamond';
  font-weight: 400;
  font-size: 18px;
  color: #456957;
  margin: 32px 0 8px;
}

.footer-line2 {
  font-family: 'DM Sans';
  font-size: 14px;
  color: #456957;
  margin: 0 0 8px;
}

.footer-line2 a {
  text-decoration: none;
  border-bottom: 1px solid rgba(69, 105, 87, 0.3);
}

.footer-line3 {
  font-family: 'DM Sans';
  font-size: 14px;
  color: rgba(69, 105, 87, 0.65);
  font-style: italic;
  margin: 0;
}

/* ---------- Sticky mobile cart bar ---------- */

.sticky-cart {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: #f8fce1;
  border-top: 1px solid #dea981;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  transform: translateY(100%);
  transition: transform 200ms ease-in;
  z-index: 20;
}

.sticky-cart[data-visible="true"] { transform: translateY(0); }

@media (min-width: 720px) {
  .sticky-cart { display: none; }
  body { padding-bottom: 0; }
}

.sticky-cart-summary {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 15px;
  color: #456957;
  font-variant-numeric: tabular-nums;
}

.sticky-cart-btn {
  background: #dea981;
  color: #456957;
  border-radius: 4px;
  padding: 10px 16px;
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 14px;
  min-height: 44px;
}

/* ---------- Confirmation ---------- */

.confirmation {
  padding: 64px 0 !important;
  text-align: left;
}

.confirmation-heading {
  font-family: 'Cormorant Garamond';
  font-weight: 700;
  font-size: 32px;
  color: #456957;
  margin: 0 0 24px;
  line-height: 1.2;
}

@media (min-width: 720px) {
  .confirmation-heading { font-size: 40px; }
}

.check-glyph {
  color: #dea981;
  font-size: 36px;
  margin-right: 8px;
}

.order-ref {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 16px;
  color: #456957;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.order-ref code {
  font-family: 'DM Sans';
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #456957;
}

.copy-btn {
  font-family: 'DM Sans';
  font-size: 13px;
  color: #dea981;
  border-bottom: 1px solid #dea981;
  padding: 2px 0;
}

.order-summary {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 18px;
  color: #456957;
  margin: 0 0 32px;
  font-variant-numeric: tabular-nums;
}

.confirmation-body, .confirmation-payment {
  font-family: 'DM Sans';
  font-size: 16px;
  color: #456957;
  line-height: 1.55;
  margin: 0 0 16px;
  max-width: 540px;
}

.confirmation-questions { margin-top: 32px; }
.confirmation-questions a {
  font-family: 'DM Sans';
  font-weight: 500;
  font-size: 15px;
  color: #dea981;
  border-bottom: 1px solid #dea981;
  padding-bottom: 1px;
}

/* ---------- Fade transitions for form → confirmation swap ---------- */

.fade-out {
  opacity: 0;
  transition: opacity 200ms ease-out;
  pointer-events: none;
}

.fade-in {
  animation: zad-fade-in 200ms ease-in forwards;
}

@keyframes zad-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Accessibility: reduced motion ---------- */

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