/* NARON masthead: a restrained, single-row evolution of the bakery's warm identity.
   DESIGN_VARIANCE: 5; MOTION_INTENSITY: 3; VISUAL_DENSITY: 3.
   Existing layer scale: search backdrop 49, masthead 50, navigation backdrop 90,
   drawer 100, keyboard skip link 110. */
:root {
  --masthead-surface: var(--paper);
  --masthead-text: #543726;
  --masthead-muted: #705542;
  --masthead-line: #e5d7c7;
  --masthead-hover: #f3eadd;
  --masthead-accent: #794724;
  --masthead-accent-hover: #63391f;
  --masthead-on-accent: #fff8f0;
  --masthead-count: #fff8f0;
  --masthead-count-ink: #714121;
}

.skip-link { z-index: 110; }

.masthead-scroll-sentinel {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 0.0625rem;
  height: 0.0625rem;
  pointer-events: none;
}

.site-masthead {
  container: naron-masthead / inline-size;
  border-block-end: 1px solid var(--masthead-line);
  background: var(--masthead-surface);
  color: var(--masthead-text);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.site-masthead.is-scrolled {
  border-block-end-color: color-mix(in srgb, var(--masthead-line) 70%, transparent);
  box-shadow: 0 0.25rem 1.5rem rgba(84, 55, 38, 0.06);
}

@supports ((backdrop-filter: blur(0.75rem)) or (-webkit-backdrop-filter: blur(0.75rem))) {
  .site-masthead {
    backdrop-filter: blur(0.75rem) saturate(112%);
    -webkit-backdrop-filter: blur(0.75rem) saturate(112%);
  }
  .site-masthead.is-scrolled {
    background: color-mix(in srgb, var(--masthead-surface) 86%, transparent);
  }
}

.masthead-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.75rem;
  max-width: var(--measure);
  min-height: 4.75rem;
  margin-inline: auto;
  padding: 0.75rem 2rem;
}

.masthead-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 0;
  max-width: 100%;
  padding-inline-end: 1.75rem;
  border-inline-end: 1px solid var(--masthead-line);
}

.masthead-wordmark { display: block; min-width: 0; }
.masthead-logo {
  display: block;
  width: 9rem;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.25rem, 1.25vw, 1rem);
  min-width: 0;
}

.primary-nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding-inline: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--masthead-muted);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.primary-nav-item::after {
  content: "";
  position: absolute;
  inset-inline: 0.5rem;
  inset-block-end: 0.1875rem;
  height: 0.125rem;
  border-radius: 1rem;
  background: var(--masthead-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 160ms var(--ease-out);
}

.primary-nav-item:hover { color: var(--masthead-accent); }
.primary-nav-item:hover::after { transform: scaleX(0.45); }
.primary-nav-item.is-active { color: var(--masthead-accent); font-weight: 650; }
.primary-nav-item.is-active::after { transform: scaleX(1); }

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.masthead-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--masthead-text);
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.masthead-icon-button:hover,
.masthead-icon-button[aria-expanded="true"] {
  border-color: var(--masthead-line);
  background: var(--masthead-hover);
}

.masthead-account,
.masthead-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.5;
  white-space: nowrap;
}

.masthead-account { color: var(--masthead-text); }
.masthead-account:hover,
.masthead-account[aria-current="page"] {
  background: var(--masthead-hover);
  border-color: var(--masthead-line);
}

.masthead-cart {
  background: var(--masthead-accent);
  color: var(--masthead-on-accent);
  border-color: var(--masthead-accent);
  padding-inline: 0.875rem;
}
.masthead-cart:hover {
  background: var(--masthead-accent-hover);
  color: var(--masthead-on-accent);
  border-color: var(--masthead-accent-hover);
}
.masthead-cart:active,
.masthead-icon-button:active { transform: scale(0.97); }

.masthead-cart .basket-count {
  min-width: 1.375rem;
  height: auto;
  min-height: 1.375rem;
  padding: 0.125rem 0.3125rem;
  border-radius: var(--radius-sm);
  background: var(--masthead-count);
  color: var(--masthead-count-ink);
  font-size: 0.75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.masthead-menu { display: none; flex-direction: column; gap: 0.4375rem; }
.masthead-menu span {
  display: block;
  width: 1.25rem;
  height: 0.09375rem;
  margin: 0;
  background: currentColor;
}
.masthead-menu span:first-child { margin: 0; }

/* Keep the utility area quiet; full labels remain in the navigation drawer. */
.masthead-actions .masthead-account { padding-inline: .625rem; }
.masthead-actions .masthead-account span,
.masthead-actions .masthead-cart-label { display: none; }
.masthead-actions .masthead-cart {
  position: relative;
  padding: .625rem;
  background: transparent;
  border-color: transparent;
  color: var(--masthead-text);
}
.masthead-actions .masthead-cart:hover {
  background: var(--masthead-hover);
  border-color: var(--masthead-line);
}
.masthead-actions .masthead-cart .basket-count {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: -.125rem;
  background: var(--masthead-accent);
  color: var(--masthead-on-accent);
  min-width: 1.125rem;
  min-height: 1.125rem;
  padding: 0 .25rem;
  border-radius: 50%;
  font-size: .65rem;
}
.masthead-actions .masthead-cart .basket-count:empty { display: none; }

.masthead-search-panel {
  inset-inline: 1rem;
  inset-block-start: calc(100% + 0.75rem);
  max-width: 36rem;
  padding: 1.25rem;
  border-color: var(--masthead-line);
  border-radius: var(--radius-lg);
  background: var(--masthead-surface);
  color: var(--masthead-text);
  box-shadow: 0 1rem 3rem rgba(84, 55, 38, 0.14);
}
.masthead-search-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 0.75rem;
}
.masthead-search-heading label {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.masthead-search-panel .header-search-fields { gap: 0.625rem; }
.masthead-search-panel input {
  min-height: 3rem;
  padding: 0.625rem 0.875rem;
  border-color: var(--masthead-muted);
  border-radius: var(--radius-md);
  background: var(--masthead-surface);
  color: var(--masthead-text);
}
.masthead-search-panel input::placeholder { color: var(--masthead-muted); opacity: 1; }
.masthead-search-panel button[type="submit"] {
  border: 1px solid var(--masthead-accent);
  border-radius: var(--radius-md);
  background: var(--masthead-accent);
  color: var(--masthead-on-accent);
  padding-inline: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.masthead-search-panel button[type="submit"]:hover { background: var(--masthead-accent-hover); }

.masthead-drawer {
  width: 22rem;
  max-width: calc(100vw - 2rem);
  padding: 1.25rem;
  border-inline-start-color: var(--masthead-line);
  background: var(--masthead-surface);
  color: var(--masthead-text);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -0.75rem 0 3rem rgba(84, 55, 38, 0.12);
}
.masthead-drawer .nav-drawer-head {
  gap: 1rem;
  margin-block-end: 1.25rem;
  padding-block-end: 1.25rem;
  border-color: var(--masthead-line);
}
.masthead-drawer .masthead-brand { padding: 0; border: 0; }
.masthead-drawer .masthead-logo { width: 8rem; }
.masthead-drawer .nav-drawer-links { gap: 0.375rem; }
.masthead-drawer .nav-drawer-item {
  display: flex;
  align-items: center;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  color: var(--masthead-text);
  font-size: 1rem;
  line-height: 1.6;
}
.masthead-drawer .nav-drawer-item:hover,
.masthead-drawer .nav-drawer-item.is-active {
  background: var(--masthead-hover);
  color: var(--masthead-accent);
}
.masthead-drawer-actions {
  display: grid;
  gap: 0.625rem;
  margin-block-start: auto;
  padding-block-start: 1.25rem;
  margin-block-end: env(safe-area-inset-bottom, 0rem);
  border-block-start: 1px solid var(--masthead-line);
}
.masthead-drawer-actions .masthead-account { border-color: var(--masthead-line); }

.site-masthead :focus-visible,
.masthead-drawer :focus-visible {
  outline: 2px solid var(--masthead-accent);
  outline-offset: 3px;
}

@media (max-width: 69.999rem) {
  .masthead-inner { gap: 1.25rem; }
  .masthead-brand { padding-inline-end: 1.25rem; }
  .masthead-logo { width: 9rem; }
  .masthead-actions .masthead-account { padding-inline: 0.625rem; }
  .masthead-actions .masthead-account span { display: none; }
  .primary-nav { gap: 0.25rem; }
}

@media (max-width: 63.999rem) {
  .masthead-inner { grid-template-columns: auto 1fr; }
  .masthead-brand { border: 0; padding: 0; }
  .primary-nav { display: none; }
  .masthead-actions { justify-self: end; }
  .masthead-menu { display: inline-flex; flex-direction: column; gap: 0.4375rem; }
}

@media (max-width: 49.999rem) {
  .masthead-inner {
    grid-template-columns: minmax(2.75rem, 1fr) auto minmax(2.75rem, 1fr);
    min-height: 4.25rem;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  .masthead-brand { grid-column: 2; grid-row: 1; }
  .masthead-logo { width: min(8.5rem, calc(100vw - 9rem)); }
  .masthead-actions { display: contents; }
  .masthead-actions .masthead-account,
  .masthead-actions .masthead-cart { display: none; }
  .header-search-toggle { grid-column: 1; grid-row: 1; justify-self: start; margin: 0; }
  .masthead-menu { grid-column: 3; grid-row: 1; justify-self: end; }
  .masthead-search-panel { padding: 1rem; }
  .masthead-search-panel .header-search-fields { gap: 0.5rem; }
  .masthead-search-panel button[type="submit"] { padding-inline: 0.75rem; }
}

/* Font-relative container queries also collapse the navigation for text zoom. */
@container naron-masthead (max-width: 63.999rem) {
  .masthead-inner { grid-template-columns: auto 1fr; }
  .masthead-brand { border: 0; padding: 0; }
  .primary-nav { display: none; }
  .masthead-actions { justify-self: end; }
  .masthead-menu { display: inline-flex; flex-direction: column; gap: 0.4375rem; }
}

@container naron-masthead (max-width: 49.999rem) {
  .masthead-inner {
    grid-template-columns: minmax(2.75rem, 1fr) auto minmax(2.75rem, 1fr);
    min-height: 4.25rem;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }
  .masthead-brand { grid-column: 2; grid-row: 1; }
  .masthead-logo { width: min(8.5rem, calc(100vw - 9rem)); }
  .masthead-actions { display: contents; }
  .masthead-actions .masthead-account,
  .masthead-actions .masthead-cart { display: none; }
  .header-search-toggle { grid-column: 1; grid-row: 1; justify-self: start; margin: 0; }
  .masthead-menu { grid-column: 3; grid-row: 1; justify-self: end; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --masthead-text: #f8e9d9;
    --masthead-muted: #dfc8b2;
    --masthead-line: #705648;
    --masthead-hover: #49372e;
    --masthead-accent: #f2d8ba;
    --masthead-accent-hover: #f7e6cc;
    --masthead-on-accent: #33251c;
    --masthead-count: #33251c;
    --masthead-count-ink: #f7e6cc;
  }
  .masthead-search-panel { box-shadow: 0 1rem 3rem rgba(27, 18, 14, 0.35); }
  .masthead-drawer { box-shadow: -0.75rem 0 3rem rgba(27, 18, 14, 0.35); }
  .site-masthead.is-scrolled { box-shadow: 0 0.25rem 1.5rem rgba(27, 18, 14, 0.18); }
}

@media (prefers-reduced-transparency: reduce) {
  .site-masthead,
  .site-masthead.is-scrolled {
    background: var(--masthead-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-masthead,
  .site-masthead *,
  .site-masthead *::after,
  .masthead-drawer *,
  .masthead-drawer,
  .nav-drawer-backdrop { transition: none; }
  .masthead-cart:active,
  .masthead-icon-button:active { transform: none; }
}
