/* ============================================================
   HuahinFood V2 — promo & shop component library
   Map to repo as:  /promo-shop.css      (link AFTER /demo-shop.css)
   JS companion:    /promo-shop.js       (ribbon dismiss only)

   Works on:
     • dark demo shops  (body.huahinfood-shop.demo-shop, --shop-* vars)
     • light platform pages  (falls back to --hf-* brand tokens)

   Every colour reads a CSS custom property with a fallback, so a
   page that forgets one link still renders legibly.
   ============================================================ */

/* ---- 1. PROMO RIBBON — dismissible, sits under the chrome ---- */
.hf2-ribbon {
  position: sticky;
  top: var(--platform-main-h, 52px);
  z-index: 28;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  padding-inline: 12px max(12px, env(safe-area-inset-right));
  font-size: var(--hf-t-small, 0.82rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--hf-ink, #1c1814);            /* 5.13:1 worst stop; white scored 1.78 */
  background: linear-gradient(100deg, var(--hf-coral, #e85d4c), var(--hf-sunset, #ffb347));
  box-shadow: 0 4px 16px rgba(232, 93, 76, 0.30);
}

.hf2-ribbon__icon { flex-shrink: 0; font-size: 1rem; line-height: 1; }

.hf2-ribbon__text { flex: 1; min-width: 0; }

.hf2-ribbon__link {
  color: var(--hf-ink, #1c1814);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.hf2-ribbon__close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border: 1px solid rgba(28, 24, 20, 0.34);
  border-radius: var(--hf-r-pill, 999px);
  background: rgba(255, 255, 255, 0.55);
  color: var(--hf-ink, #1c1814);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.hf2-ribbon__close:hover { background: rgba(0, 0, 0, 0.34); }
.hf2-ribbon[hidden] { display: none; }

/* Night variant — for dark bar/night demos */
.hf2-ribbon--night {
  color: var(--hf-neon-coral, #ff5e8a);      /* 6.86:1 on night surface */
  background: var(--hf-night-surface, #17101d);
  border-bottom: 1px solid rgba(255, 94, 138, 0.45);
  box-shadow: 0 4px 20px rgba(255, 94, 138, 0.22);
}

.hf2-ribbon--night .hf2-ribbon__link {
  color: var(--hf-neon-cyan, #4fe0d8);       /* 12.34:1 */
}

.hf2-ribbon--night .hf2-ribbon__close {
  border-color: rgba(255, 94, 138, 0.55);
  background: rgba(255, 94, 138, 0.14);
  color: var(--hf-neon-coral, #ff5e8a);
}

/* ---- 2. THIS WEEK / TONIGHT CARD ---- */
.hf2-week {
  margin: 0 auto 22px;
  padding: 18px;
  border-radius: var(--hf-r-lg, 20px);
  background: var(--shop-bg, var(--hf-sand-deep, #ebe3d6));   /* fallback: no color-mix */
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--shop-surface, var(--hf-teal, #0d5c63)) 92%, var(--shop-accent, var(--hf-coral, #e85d4c)) 8%),
      var(--shop-bg, var(--hf-sand-deep, #ebe3d6)));
  border: 1px solid var(--shop-accent, var(--hf-teal, #0d5c63));
  border-color: rgba(13, 92, 99, 0.32);
  border-color: color-mix(in srgb, var(--shop-accent, var(--hf-teal, #0d5c63)) 32%, transparent);
}

.hf2-week__label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 11px;
  border-radius: var(--hf-r-pill, 999px);
  font-size: var(--hf-t-eyebrow, 0.65rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--shop-bg, #0f1419);
  background: var(--shop-accent-light, var(--hf-sunset, #ffb347));
}

.hf2-week__title {
  font-family: var(--hf-font-display, "Cormorant Garamond", Georgia, serif);
  font-size: var(--hf-t-h3, clamp(1.05rem, 1.5vw + 0.6rem, 1.3rem));
  font-weight: 700;
  color: var(--shop-text, inherit);
}

.hf2-week__note {
  margin-top: 4px;
  font-size: var(--hf-t-small, 0.82rem);
  color: rgba(245, 239, 230, 0.72);
  color: color-mix(in srgb, var(--shop-text, var(--hf-ink, #1c1814)) 72%, transparent);
}

/* ---- 3. EVENTS ROW ---- */
.hf2-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 auto 26px;
  list-style: none;
}

.hf2-event {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  border-radius: var(--hf-r-md, 16px);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.hf2-event__day {
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: var(--hf-r-pill, 999px);
  font-size: var(--hf-t-eyebrow, 0.65rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--shop-accent-light, var(--hf-teal, #0d5c63));
  background: rgba(255, 255, 255, 0.10);
  background: color-mix(in srgb, var(--shop-accent, var(--hf-teal, #0d5c63)) 18%, transparent);
}

.hf2-event__name {
  font-size: var(--hf-t-body, 0.94rem);
  font-weight: 800;
  color: var(--shop-text, inherit);
}

.hf2-event__when {
  font-size: var(--hf-t-caption, 0.75rem);
  font-weight: 700;
  color: var(--shop-accent-light, var(--hf-teal-light, #14808a));
}

.hf2-event__desc {
  font-size: var(--hf-t-caption, 0.75rem);
  color: rgba(245, 239, 230, 0.66);
  color: color-mix(in srgb, var(--shop-text, var(--hf-ink, #1c1814)) 66%, transparent);
}

/* ---- 4. STICKY ORDER BAR ---- */
.hf2-orderbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--shop-bg, var(--hf-cream, #fffdf8));
  background: color-mix(in srgb, var(--shop-bg, var(--hf-cream, #fffdf8)) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--shop-accent, var(--hf-teal, #0d5c63));
  border-top-color: rgba(13, 92, 99, 0.26);
  border-top-color: color-mix(in srgb, var(--shop-accent, var(--hf-teal, #0d5c63)) 26%, transparent);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.22);
}

/* keep page content clear of the fixed bar */
body.hf2-has-orderbar { padding-bottom: 96px; }

/* ---- 5. BUTTONS ---- */
.hf2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--hf-tap, 44px);
  padding: 10px 16px;
  border: 0;
  border-radius: var(--hf-r-pill, 999px);
  font-family: var(--hf-font-body, "Sarabun", sans-serif);
  font-size: var(--hf-t-small, 0.82rem);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.hf2-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.hf2-btn:focus-visible { outline: 3px solid var(--hf-sunset, #ffb347); outline-offset: 2px; }
.hf2-btn--block { width: 100%; }

.hf2-btn--primary {
  color: var(--shop-on-accent, #101010);    /* demo accents score 2.1-3.3 with white */
  background: var(--shop-accent, var(--hf-teal, #0d5c63));
  background: linear-gradient(135deg, var(--shop-accent, var(--hf-teal, #0d5c63)), color-mix(in srgb, var(--shop-accent, var(--hf-teal, #0d5c63)) 72%, #000));
  box-shadow: 0 6px 18px rgba(13, 92, 99, 0.34);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shop-accent, var(--hf-teal, #0d5c63)) 34%, transparent);
}

.hf2-btn--coral {
  color: var(--hf-ink, #1c1814);             /* white scored 1.78 on the sunset end */
  background: linear-gradient(135deg, var(--hf-coral, #e85d4c), var(--hf-sunset, #ffb347));
  box-shadow: 0 6px 18px rgba(232, 93, 76, 0.34);
}

.hf2-btn--line {           /* LINE brand green, used for direct order */
  color: #04240c;                            /* 7.33:1; white scored 2.27 */
  background: #06c740;
}

.hf2-btn--tel {
  color: var(--shop-text, var(--hf-ink, #1c1814));
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(245, 239, 230, 0.26);
  border-color: color-mix(in srgb, var(--shop-text, var(--hf-ink, #1c1814)) 26%, transparent);
}

.hf2-btn--brand {          /* light pages: teal fill + white = 7.7:1 AAA */
  color: #ffffff;
  background: var(--hf-teal, #0d5c63);
}

.hf2-btn--gold {
  color: #140806;
  background: linear-gradient(135deg, var(--hf-gold-light, #e8cc72), var(--hf-gold, #c9a24a));
}

.hf2-btn--ghost {
  color: var(--hf-teal, #0d5c63);
  background: #fff;
  border: 1px solid var(--hf-line-strong, rgba(13, 92, 99, 0.28));
}

.hf2-btn--lg {
  min-height: 52px;
  padding: 14px 26px;
  font-size: var(--hf-t-body, 0.94rem);
}

/* ---- 6. BADGES ---- */
.hf2-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--hf-r-pill, 999px);
  font-size: var(--hf-t-eyebrow, 0.65rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;                               /* on teal below = 7.70:1 */
  background: var(--hf-teal, #0d5c63);
}

.hf2-badge--live {
  background: var(--hf-sunset, #ffb347);
  color: var(--hf-ink, #1c1814);             /* small caps need 4.5:1 */
}

.hf2-badge--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hf-teal, #0d5c63);
  box-shadow: 0 0 0 3px rgba(13, 92, 99, 0.26);
}

.hf2-badge--outline {
  color: var(--shop-accent-light, var(--hf-teal, #0d5c63));
  background: transparent;
  border: 1px solid rgba(13, 92, 99, 0.46);
  border-color: color-mix(in srgb, var(--shop-accent, var(--hf-teal, #0d5c63)) 46%, transparent);
}

/* ---- 7. OWNER BENEFIT GRID ---- */
.hf2-benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hf2-benefit {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--hf-r-md, 16px);
  background: var(--hf-cream, #fffdf8);
  border: 1px solid var(--hf-line, rgba(13, 92, 99, 0.14));
  box-shadow: var(--hf-sh-1, 0 4px 14px rgba(28, 24, 20, 0.07));
}

.hf2-benefit__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--hf-r-sm, 10px);
  font-size: 1.15rem;
  background: var(--hf-teal-veil, rgba(13, 92, 99, 0.08));
}

.hf2-benefit__title {
  display: block;
  font-size: var(--hf-t-body, 0.94rem);
  font-weight: 800;
  color: var(--hf-ink, #1c1814);
}

.hf2-benefit__text {
  display: block;
  margin-top: 3px;
  font-size: var(--hf-t-caption, 0.75rem);
  line-height: 1.45;
  color: var(--hf-muted, #5e564e);
}

/* ---- 8. PHONE MOCK FRAME (pure CSS, no image asset needed) ---- */
.hf2-phone {
  position: relative;
  width: min(268px, 72vw);
  aspect-ratio: 9 / 19;
  margin: 0 auto;
  padding: 10px;
  border-radius: 38px;
  background: linear-gradient(160deg, #2a2a2e, #101013);
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--hf-sh-3, 0 18px 48px rgba(28, 24, 20, 0.16)), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.hf2-phone::before {          /* notch */
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 74px;
  height: 17px;
  border-radius: var(--hf-r-pill, 999px);
  background: #0c0c0f;
}

.hf2-phone__screen {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  background: var(--shop-bg, #0f1419);
  display: flex;
  flex-direction: column;
}

.hf2-phone__shot {
  width: 100%;
  height: 46%;
  object-fit: cover;
  display: block;
}

.hf2-phone__body {
  flex: 1;
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hf2-phone__name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--shop-text, #f5efe6);
}

.hf2-phone__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.7rem;
  color: color-mix(in srgb, var(--shop-text, #f5efe6) 70%, transparent);
}

.hf2-phone__cta {
  margin-top: auto;
  padding: 9px 10px;
  border-radius: var(--hf-r-pill, 999px);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--hf-ink, #1c1814);
  background: linear-gradient(135deg, var(--hf-coral, #e85d4c), var(--hf-sunset, #ffb347));
}

.hf2-phone__chip {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: var(--hf-r-pill, 999px);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--shop-bg, #0f1419);
  background: var(--shop-accent-light, var(--hf-sunset, #ffb347));
}

/* ---- 9. STEP ROWS (how to join) ---- */
.hf2-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: hf2-step;
}

.hf2-steps > li {
  position: relative;
  padding: 16px 16px 16px 58px;
  border-radius: var(--hf-r-md, 16px);
  background: var(--hf-cream, #fffdf8);
  border: 1px solid var(--hf-line, rgba(13, 92, 99, 0.14));
  box-shadow: var(--hf-sh-1, 0 4px 14px rgba(28, 24, 20, 0.07));
}

.hf2-steps > li::before {
  counter-increment: hf2-step;
  content: counter(hf2-step);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  background: var(--hf-teal, #0d5c63);
}

/* ---- 10. COMPARISON TABLE ---- */
.hf2-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--hf-t-small, 0.82rem);
  background: var(--hf-cream, #fffdf8);
  border-radius: var(--hf-r-md, 16px);
  overflow: hidden;
  box-shadow: var(--hf-sh-1, 0 4px 14px rgba(28, 24, 20, 0.07));
}

.hf2-compare caption {
  padding: 0 0 10px;
  font-size: var(--hf-t-caption, 0.75rem);
  color: var(--hf-muted, #5e564e);
  text-align: left;
}

.hf2-compare th,
.hf2-compare td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hf-line, rgba(13, 92, 99, 0.14));
  text-align: left;
  vertical-align: top;
}

.hf2-compare thead th {
  font-size: var(--hf-t-caption, 0.75rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--hf-teal, #0d5c63);
  border-bottom: 0;
}

.hf2-compare tbody th {
  font-weight: 800;
  color: var(--hf-ink, #1c1814);
  width: 38%;
}

.hf2-compare .is-us {
  color: var(--hf-teal, #0d5c63);
  font-weight: 800;
  background: var(--hf-teal-veil, rgba(13, 92, 99, 0.08));
}

/* ---- responsive tightening for 390px ---- */
@media (max-width: 420px) {
  .hf2-events { grid-template-columns: 1fr; }
  .hf2-benefits { grid-template-columns: 1fr; }
  .hf2-orderbar { gap: 6px; padding-inline: 8px; }
  .hf2-btn { padding: 10px 12px; font-size: 0.76rem; }
  .hf2-compare thead { display: none; }
  .hf2-compare tbody th { width: auto; display: block; border-bottom: 0; padding-bottom: 2px; }
  .hf2-compare tbody td { display: block; padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hf2-btn, .hf2-ribbon__close { transition: none; }
  .hf2-btn:hover { transform: none; }
}
