/* ==========================================================================
   Món Ngon Express - Header v3 "Quầy bếp nổi" (Floating Kitchen Islands)
   Three detached islands: ink brand plate, cream menu rail, action dock.
   ========================================================================== */
.ed-header {
  padding: 12px 12px 0;
  background: none !important;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.ed-header-bar {
  pointer-events: none;
  position: relative;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  gap: 10px !important;
  align-items: stretch !important;
}
.ed-header-bar > * { pointer-events: auto; }
.ed-header.is-hidden { transform: translateY(calc(-100% - 16px)); }

/* Shared island skin */
.ed-header-bar > div:first-child,
.ed-header-bar > [data-header-actions] {
  display: flex;
  align-items: center;
  min-height: 60px;
  border-radius: 20px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 18px 40px -22px rgba(29, 29, 31, .45), 0 2px 6px rgba(29, 29, 31, .06);
  transition: min-height .4s cubic-bezier(.22, 1, .36, 1), border-radius .4s, transform .4s cubic-bezier(.22, 1, .36, 1);
}

/* 1. Brand plate: ink with crimson stamp edge */
.ed-header-bar > div:first-child {
  position: relative;
  padding: 0 18px 0 8px;
  background: #1d1d1f;
  color: #f3ede3;
  overflow: hidden;
}
.ed-header-bar > div:first-child::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #c8232c;
}
.ed-header-bar > div:first-child::after {
  /* perforated ticket edge on the right */
  content: "";
  position: absolute; right: -5px; top: 50%;
  width: 10px; height: 10px; border-radius: 999px;
  transform: translateY(-50%);
  background: var(--background);
}
.ed-header #mobile-menu-button { color: #f3ede3 !important; }
.ed-header #mobile-menu-button:hover { background: rgba(243, 237, 227, .1) !important; }
.ed-brand { color: #f3ede3 !important; gap: 10px !important; }
.ed-brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: #f3ede3 !important; color: #1d1d1f !important;
  box-shadow: none;
  transition: transform .6s cubic-bezier(.34, 1.56, .64, 1), border-radius .5s;
}
.ed-brand:hover .ed-brand-mark { transform: rotate(-12deg); border-radius: 999px; background: #c8232c !important; color: #fff !important; }
.ed-brand > .ed-serif { display: inline-grid !important; grid-template-columns: auto auto; justify-content: start; align-items: baseline; column-gap: .28em; white-space: nowrap; line-height: 1 !important; font-size: 1.32rem !important; }
.ed-brand > .ed-serif > .ed-italic { color: #ff7b74 !important; }
@media (min-width: 1024px) {
  .ed-brand > .ed-serif::after {
    content: "Bếp mở 07:00 – 22:00";
    grid-column: 1 / -1;
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-style: normal;
    font-size: .62rem;
    letter-spacing: .08em;
    color: rgba(243, 237, 227, .55);
  }
  .ed-brand > .ed-serif > .ed-italic { display: inline !important; }
  .ed-header-bar > div:first-child { flex-shrink: 0 !important; }
}

/* 2. Menu rail: cream island, sliding crimson-ink tab */
.ed-header-bar > .ed-nav {
  position: relative !important;
  left: auto !important; transform: none !important;
  margin: 0 auto;
  min-height: 60px;
  border-radius: 20px;
  box-shadow: 0 18px 40px -22px rgba(29, 29, 31, .45), 0 2px 6px rgba(29, 29, 31, .06);
  transition: min-height .4s cubic-bezier(.22, 1, .36, 1), border-radius .4s;
  padding: 6px !important;
  gap: 0 !important;
  background: #f3ede3 !important;
  border: 0 !important;
}
html.dark .ed-header-bar > .ed-nav, html[data-theme="dark"] .ed-header-bar > .ed-nav { background: #23211d !important; }
.ed-nav-ink {
  position: absolute; top: 6px; left: 0;
  height: calc(100% - 12px);
  border-radius: 14px;
  background: #1d1d1f;
  transition: transform .55s cubic-bezier(.34, 1.35, .64, 1), width .55s cubic-bezier(.34, 1.35, .64, 1), opacity .2s;
  pointer-events: none;
}
.ed-nav-ink::after {
  content: ""; position: absolute; left: 50%; bottom: 5px;
  width: 5px; height: 5px; border-radius: 999px; background: #ff5a5f;
  transform: translateX(-50%);
}
html.dark .ed-nav-ink, html[data-theme="dark"] .ed-nav-ink { background: #f3ede3; }
.ed-nav .ed-nav-link {
  position: relative; z-index: 1;
  height: 48px; padding: 0 14px;
  border-radius: 14px !important;
  font-family: var(--ed-serif);
  font-size: .96rem; font-weight: 400; letter-spacing: -.015em;
  color: rgba(29, 29, 31, .72) !important;
  background: transparent !important;
  transition: color .3s ease;
}
html.dark .ed-nav .ed-nav-link, html[data-theme="dark"] .ed-nav .ed-nav-link { color: rgba(243, 237, 227, .7) !important; }
.ed-nav .ed-nav-link:hover { color: #1d1d1f !important; }
.ed-nav.has-ink .ed-nav-link.is-active,
.ed-nav.has-ink .ed-nav-link.is-hover { color: #f3ede3 !important; }
html.dark .ed-nav.has-ink .ed-nav-link.is-active, html.dark .ed-nav.has-ink .ed-nav-link.is-hover,
html[data-theme="dark"] .ed-nav.has-ink .ed-nav-link.is-active, html[data-theme="dark"] .ed-nav.has-ink .ed-nav-link.is-hover { color: #1d1d1f !important; }
.ed-nav.has-ink:has(.is-hover) .ed-nav-link.is-active:not(.is-hover) { color: rgba(29, 29, 31, .72) !important; }
.ed-nav:not(.has-ink) .ed-nav-link.is-active { background: #1d1d1f !important; color: #f3ede3 !important; }

/* 3. Action dock */
.ed-header-bar > [data-header-actions] {
  padding: 0 7px 0 8px;
  gap: 2px !important;
  min-width: 0 !important;
  background: var(--surface);
}
.ed-header [data-header-actions] > button,
.ed-header [data-header-actions] > div > button,
.ed-header [data-header-actions] > a.ed-icon-btn {
  width: 42px !important; height: 42px !important;
  border-radius: 14px !important;
  color: var(--foreground) !important;
  transition: background-color .2s, transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.ed-header [data-header-actions] > button:hover,
.ed-header [data-header-actions] > div > button:hover,
.ed-header [data-header-actions] > a.ed-icon-btn:hover { background: var(--ed-cream, #f3ede3) !important; transform: translateY(-1px); }
.ed-header [data-header-actions] > button:active,
.ed-header [data-header-actions] > a.ed-icon-btn:active { transform: scale(.9); }
.ed-header #gift-toggle { color: #c8232c !important; position: relative; }
.ed-header #gift-toggle::after {
  content: ""; position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 999px;
  background: #c8232c; box-shadow: 0 0 0 2px var(--surface);
  animation: hdr-pulse 2.6s ease-in-out infinite;
}
@keyframes hdr-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }
.ed-header #cart-count { box-shadow: 0 0 0 2px var(--surface); background: #c8232c !important; }
.ed-header #user-menu-container a { border-radius: 14px !important; height: 42px; }
@media (max-width: 1535px) {
  .ed-header #user-menu-container { min-width: 42px !important; }
  .ed-header #user-menu-container a { width: 42px !important; padding: 0 !important; }
  .ed-header #user-menu-container a > span { display: none !important; }
  .ed-header #user-menu-container a > i { display: inline-flex !important; }
}
.ed-header [data-header-actions] > a.ed-pill {
  min-height: 46px !important;
  margin-left: 6px !important;
  padding: 0 6px 0 18px !important;
  border-radius: 14px !important;
  background: #c8232c !important; color: #fff !important;
  font-weight: 600;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
}
.ed-header [data-header-actions] > a.ed-pill:hover { background: #a61b23 !important; }
.ed-header [data-header-actions] > a.ed-pill .ed-pill-dot { width: 34px !important; height: 34px !important; border-radius: 10px !important; background: #fff !important; color: #c8232c !important; }

/* Desktop search reads as a command field */
@media (min-width: 1024px) {
  .ed-header { padding: 16px 24px 0; }
  .ed-header #mne-header-search-btn {
    width: auto !important; padding: 0 8px 0 12px; gap: 8px;
    background: var(--background) !important;
    color: var(--muted) !important;
  }
  .ed-header #mne-header-search-btn::after {
    content: "Tìm món";
    font-size: .82rem;
    padding-right: 6px;
  }
  .ed-header #mne-header-search-btn::before {
    content: "⌘K"; order: 3;
    font: 600 .66rem/1 ui-monospace, monospace;
    padding: 4px 6px; border-radius: 6px;
    background: var(--surface); color: var(--muted);
  }
}

/* Scrolled: islands tighten and lift */
.ed-header.is-scrolled .ed-header-bar > div:first-child,
.ed-header.is-scrolled .ed-header-bar > .ed-nav,
.ed-header.is-scrolled .ed-header-bar > [data-header-actions] { min-height: 52px; border-radius: 16px; }
.ed-header.is-scrolled .ed-nav .ed-nav-link { height: 40px; }
.ed-header.is-scrolled .ed-brand > .ed-serif::after { display: none; }

/* Tablet: nav hidden by markup; keep two islands */
@media (max-width: 1023px) {
  .ed-header-bar { justify-content: space-between !important; }
  .ed-header-bar > .ed-nav { display: none !important; }
}

/* Mobile: brand plate + action dock, hide on scroll down */
@media (max-width: 767px) {
  .ed-header { padding: 10px 10px 0; }
  .ed-header-bar { gap: 8px !important; }
  .ed-header-bar > div:first-child,
  .ed-header-bar > [data-header-actions] { min-height: 54px; border-radius: 18px; }
  .ed-header-bar > div:first-child { padding: 0 14px 0 6px; flex: 1 1 auto; min-width: 0; }
  .ed-brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .ed-brand > .ed-serif { font-size: 1.12rem !important; }
  .ed-header #mobile-menu-button { width: 38px; height: 38px; }
  .ed-header [data-header-actions] > button,
  .ed-header [data-header-actions] > div > button { width: 40px !important; height: 40px !important; border-radius: 12px !important; }
  .ed-header.is-scrolled .ed-header-bar > div:first-child,
  .ed-header.is-scrolled .ed-header-bar > [data-header-actions] { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .ed-header, .ed-nav-ink { transition: none; }
  .ed-header #gift-toggle::after { animation: none; }
}

/* Quick-view + product size chips: name over price, no ragged wraps */
.qv-sizes { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; }
.qv-size {
  flex-direction: column; align-items: flex-start !important; justify-content: center !important;
  gap: 2px !important; min-height: 3.6rem !important; padding: 8px 16px !important; border-radius: 18px !important;
}
.qv-size-name { font-size: .98rem !important; line-height: 1.15; white-space: normal; }
.qv-size-price { font-size: .72rem !important; }
.pd-size { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
