/* =========================================================================
   XIEBAOBAO — premium Asian handmade food brand
   Brand system + shared components (used across every page)
   ========================================================================= */

:root {
  /* Palette */
  --ivory:        #F7F3EA;   /* warm ivory background */
  --ivory-deep:   #F0E9D8;   /* slightly deeper ivory for alt sections */
  --beige:        #E9E0CE;   /* soft beige */
  --forest:       #24382C;   /* deep forest green */
  --forest-2:     #2E4A38;   /* forest, lighter */
  --olive:        #6B7A52;   /* muted olive */
  --olive-soft:   #8A9A6B;   /* soft olive */
  --caramel:      #B07D4E;   /* caramel brown */
  --caramel-deep: #A86F3D;
  --ink:          #2A2A26;   /* near-black text */
  --muted:        #6E6A5F;   /* muted body text */
  --line:         rgba(42, 42, 38, 0.12);   /* subtle borders */
  --line-soft:    rgba(42, 42, 38, 0.07);

  /* Type */
  --serif: "Fraunces", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Rhythm */
  --maxw: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 18px 50px -28px rgba(36, 56, 44, 0.35);
  --shadow-soft: 0 10px 30px -20px rgba(36, 56, 44, 0.3);
  --header-h: 74px;
}

/* ------------------------------------------------------------------ Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.06; letter-spacing: -0.01em; margin: 0; color: var(--forest); }

/* --------------------------------------------------------------- Layout */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 9vw, 130px); }
.section--tight { padding-block: clamp(48px, 6vw, 90px); }
.section--ivory-deep { background: var(--ivory-deep); }
.section--forest { background: var(--forest); color: var(--ivory); }
.section--forest h2, .section--forest h3 { color: var(--ivory); }

.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--caramel-deep);
  margin: 0 0 18px;
}
.section--forest .eyebrow { color: var(--olive-soft); }

.lede { color: var(--muted); font-size: clamp(17px, 1.4vw, 19px); max-width: 56ch; }
.section--forest .lede { color: rgba(247, 243, 234, 0.78); }

.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 64px); }
.section-head h2 { font-size: clamp(32px, 4.4vw, 54px); }
.section-head--center { margin-inline: auto; text-align: center; }

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px; border-radius: 999px;
  font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: 0.01em;
  border: 1px solid transparent; transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--forest); color: var(--ivory); }
.btn--primary:hover { background: var(--forest-2); }
.btn--caramel { background: var(--caramel); color: #fff; }
.btn--caramel:hover { background: var(--caramel-deep); }
.btn--ghost { background: transparent; color: var(--forest); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--forest); }
.btn--light { background: var(--ivory); color: var(--forest); }
.btn--light:hover { background: #fff; }
.btn--sm { padding: 10px 18px; font-size: 14px; }
.btn--block { width: 100%; justify-content: center; }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--forest); }
.link-arrow svg { transition: transform .2s ease; }
.link-arrow:hover svg { transform: translateX(4px); }

/* --------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(247, 243, 234, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
.site-header.is-scrolled { border-color: var(--line); box-shadow: 0 8px 30px -24px rgba(36,56,44,.5); }
.site-header__inner { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-right: auto; line-height: 1; }
.brand__mark { font-family: var(--serif); font-weight: 600; font-size: 24px; color: var(--forest); letter-spacing: -0.02em; }
.brand__mark span { color: var(--caramel); }
.brand__logo { height: 34px; width: auto; display: block; }
.brand__tag { display: none; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.nav { display: flex; align-items: center; gap: 30px; }
.nav a { font-size: 15px; font-weight: 500; color: var(--ink); position: relative; padding-block: 6px; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--forest); transform: scaleX(0); transform-origin: left; transition: transform .22s ease; }
.nav a:hover::after { transform: scaleX(1); }

.header__actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 999px; background: transparent; border: 1px solid var(--line); color: var(--forest); position: relative; }
.icon-btn:hover { border-color: var(--forest); }
.cart-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--caramel); color: #fff; font-size: 11px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.cart-count.is-active { display: inline-flex; }

.nav-toggle { display: none; width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: transparent; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.nav-toggle span { width: 18px; height: 2px; background: var(--forest); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }

/* --------------------------------------------------------------- Hero */
.hero { padding-top: clamp(28px, 4vw, 56px); padding-bottom: clamp(48px, 7vw, 100px); }
.hero__grid { display: grid; grid-template-columns: 1.02fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.hero__title { font-size: clamp(52px, 9vw, 118px); line-height: 0.92; letter-spacing: -0.03em; margin: 18px 0 22px; }
.hero__title em { font-style: italic; color: var(--caramel); }
.hero__sub { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 44ch; margin-bottom: 32px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; }
.hero__media { position: relative; }
.hero__media img { width: 100%; height: clamp(420px, 60vw, 640px); object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.hero__badge {
  position: absolute; left: -18px; bottom: 28px;
  background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow-soft); max-width: 220px;
}
.hero__badge strong { font-family: var(--serif); font-size: 21px; color: var(--forest); display: block; }
.hero__badge span { font-size: 13px; color: var(--muted); }
.hero__trust { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.hero__trust div span { display: block; }
.hero__trust .n { font-family: var(--serif); font-size: 26px; color: var(--forest); }
.hero__trust .l { font-size: 13px; color: var(--muted); letter-spacing: .02em; }

/* ----------------------------------------------------- Collection cards */
.card-grid { display: grid; gap: clamp(18px, 2.4vw, 28px); }
.card-grid--4 { grid-template-columns: repeat(4, 1fr); }
.card-grid--3 { grid-template-columns: repeat(3, 1fr); }
.card-grid--2 { grid-template-columns: repeat(2, 1fr); }

.collection-card {
  background: var(--ivory); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.collection-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--line); }
.collection-card__media { aspect-ratio: 4 / 5; overflow: hidden; }
.collection-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.collection-card:hover .collection-card__media img { transform: scale(1.05); }
.collection-card__body { padding: 22px 22px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.collection-card__body h3 { font-size: 24px; }
.collection-card__desc { color: var(--muted); font-size: 15px; flex: 1; }
.collection-card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { font-family: var(--serif); font-size: 20px; color: var(--forest); }
.price small { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 500; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--caramel-deep); background: var(--beige); padding: 5px 11px; border-radius: 999px; }

/* --------------------------------------------------- Quality promise */
.promise-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2vw, 24px); }
.promise {
  background: var(--ivory); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 30px 26px; display: flex; flex-direction: column; gap: 14px;
}
.promise__icon { width: 52px; height: 52px; border-radius: 14px; background: var(--beige); color: var(--forest); display: flex; align-items: center; justify-content: center; }
.promise h3 { font-size: 21px; }
.promise p { color: var(--muted); font-size: 15px; margin: 0; }

/* ------------------------------------------------- Farm-to-you timeline */
.timeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; counter-reset: step; }
.timeline__step { position: relative; padding: 26px 16px 0; text-align: center; }
.timeline__step::before {
  content: ""; position: absolute; top: 12px; left: 50%; right: -50%; height: 2px;
  background: repeating-linear-gradient(90deg, var(--olive-soft) 0 6px, transparent 6px 12px);
}
.timeline__step:last-child::before { display: none; }
.timeline__dot { width: 26px; height: 26px; border-radius: 999px; background: var(--forest); color: var(--ivory); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; position: relative; z-index: 1; }
.timeline__step h4 { font-family: var(--sans); font-size: 15px; font-weight: 700; color: var(--ink); }
.timeline__step p { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* ---------------------------------------------------- Split feature (story/wholesale) */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.feature--reverse .feature__media { order: 2; }
.feature__media img { width: 100%; height: clamp(360px, 46vw, 560px); object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.feature__body h2 { font-size: clamp(30px, 4vw, 48px); margin-bottom: 20px; }
.feature__body p { color: var(--muted); margin-bottom: 26px; }
.section--forest .feature__body p { color: rgba(247,243,234,.78); }

/* -------------------------------------------------------- Newsletter */
.newsletter { text-align: center; }
.newsletter h2 { font-size: clamp(30px, 4.6vw, 52px); }
.newsletter p { color: rgba(247,243,234,.78); margin: 14px auto 30px; max-width: 46ch; }
.newsletter__form { display: flex; gap: 10px; max-width: 480px; margin: 0 auto; }
.newsletter__form input {
  flex: 1; padding: 15px 20px; border-radius: 999px; border: 1px solid rgba(247,243,234,.28);
  background: rgba(247,243,234,.06); color: var(--ivory); font-size: 15px; font-family: var(--sans);
}
.newsletter__form input::placeholder { color: rgba(247,243,234,.55); }
.newsletter__form input:focus { outline: none; border-color: var(--olive-soft); }
.newsletter__note { font-size: 13px; color: rgba(247,243,234,.5); margin-top: 16px; }
.form-msg { font-size: 14px; margin-top: 14px; min-height: 20px; }

/* ------------------------------------------------------------ Footer */
.site-footer { background: var(--forest); color: rgba(247,243,234,.8); padding-block: clamp(56px, 7vw, 90px); }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer__brand .brand__mark { color: var(--ivory); }
.footer__brand p { font-size: 15px; max-width: 32ch; margin-top: 14px; }
.footer h4 { font-family: var(--sans); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--olive-soft); margin-bottom: 16px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer ul a { font-size: 15px; color: rgba(247,243,234,.8); }
.footer ul a:hover { color: var(--ivory); }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 48px; padding-top: 24px; border-top: 1px solid rgba(247,243,234,.14); font-size: 13px; color: rgba(247,243,234,.55); }

/* ------------------------------------------------------ Cart drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(36,56,44,.45); opacity: 0; visibility: hidden; transition: opacity .28s ease, visibility .28s ease; z-index: 90; }
.drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 92vw);
  background: var(--ivory); box-shadow: -20px 0 60px -30px rgba(0,0,0,.5);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.4,0,.2,1);
  z-index: 100; display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.drawer__head h3 { font-size: 22px; }
.drawer__close { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 20px; color: var(--forest); }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.drawer__foot { padding: 20px 24px; border-top: 1px solid var(--line); }
.drawer__empty { color: var(--muted); text-align: center; padding: 40px 0; }
.cart-line { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.cart-line img { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; }
.cart-line__title { font-weight: 600; font-size: 15px; }
.cart-line__meta { font-size: 13px; color: var(--muted); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.qty button { width: 28px; height: 28px; border: none; background: transparent; color: var(--forest); font-size: 16px; }
.qty span { min-width: 24px; text-align: center; font-size: 14px; font-weight: 600; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.cart-total .price { font-size: 24px; }

/* -------------------------------------------------- Mobile nav panel */
.mobile-nav { position: fixed; inset: 0; z-index: 80; background: var(--ivory); transform: translateY(-100%); transition: transform .32s ease; padding: calc(var(--header-h) + 20px) var(--gutter) 40px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.mobile-nav.is-open { transform: translateY(0); }
.mobile-nav a { font-family: var(--serif); font-size: 30px; color: var(--forest); padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.mobile-nav .btn { margin-top: 24px; }

/* --------------------------------------------------------- Responsive */
@media (max-width: 1000px) {
  .card-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .promise-grid { grid-template-columns: repeat(2, 1fr); }
  .timeline { grid-template-columns: repeat(3, 1fr); row-gap: 30px; }
  .timeline__step:nth-child(3)::before { display: none; }
}
@media (max-width: 860px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }
  .brand__tag { display: none; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
  .hero__media img { height: clamp(320px, 70vw, 460px); }
  .feature { grid-template-columns: 1fr; }
  .feature--reverse .feature__media { order: -1; }
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .card-grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .card-grid--4, .card-grid--2, .card-grid--3 { grid-template-columns: 1fr; }
  .promise-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .timeline__step::before { display: none !important; }
  .hero__badge { left: 0; }
  .newsletter__form { flex-direction: column; }
  .footer__grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------- Utilities/anim */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }
.center { text-align: center; }
.mt-lg { margin-top: clamp(36px, 5vw, 60px); }
