/* ZIBASA app layer: shell, navigation, motion and shared primitives.
   Built from the approved mockups; tokens live in tokens.css. */

/* ---------- Canvas & typography ---------- */
body,
body.zb-site {
  background: var(--zb-color-canvas, #f6f1eb);
  margin: 0;
}
.zb-ui {
  background:
    radial-gradient(120% 60% at 100% 0%, #fbf3ea 0%, rgba(251, 243, 234, 0) 60%),
    var(--zb-color-canvas);
  color: var(--zb-color-text);
  width: 100%;
}
.zb-ui a {
  color: inherit;
}
/* The hidden attribute always wins over component display rules (e.g. .zb-button's inline-flex),
   so scripts can toggle controls such as the quiz's next/submit buttons. */
.zb-ui [hidden] {
  display: none !important;
}
.zb-ui .zb-visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.zb-ui main {
  padding-bottom: calc(var(--zb-bottom-nav-height) + 40px + var(--zb-safe-bottom));
}
.zb-ui .zb-shell {
  box-sizing: border-box;
  margin-inline: auto;
  max-width: 1240px;
  padding-inline: 20px;
  width: 100%;
}
.zb-ui .zb-kicker {
  align-items: center;
  background: var(--zb-color-peach-soft);
  border-radius: var(--zb-radius-pill);
  color: #a2490a;
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 700;
  gap: 6px;
  padding: 4px 12px;
  width: fit-content;
}
.zb-ui .zb-kicker .zb-icon {
  height: 14px;
  width: 14px;
}
.zb-ui .zb-muted {
  color: var(--zb-color-text-secondary);
}

/* ---------- Wordmark ---------- */
.zb-ui .zb-wordmark {
  align-items: center;
  color: var(--zb-color-text);
  display: inline-flex;
  line-height: 0;
  text-decoration: none;
}
.zb-ui .zb-wordmark-svg {
  display: block;
  height: auto;
  width: 112px;
}
.zb-ui .zb-site-footer .zb-wordmark-svg {
  width: 132px;
}

/* ---------- Header ---------- */
.zb-ui .zb-site-header {
  backdrop-filter: saturate(1.2) blur(14px);
  background: color-mix(in srgb, var(--zb-color-canvas) 86%, transparent);
  border-bottom: 0;
  position: sticky;
  top: 0;
  view-transition-name: zb-site-header;
  width: 100%;
  z-index: 40;
}
.zb-ui .zb-site-header__inner {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-inline: auto;
  max-width: 1240px;
  min-height: 68px;
  padding-block: 10px;
  padding-inline: 20px;
  width: 100%;
  transition:
    min-height var(--zb-motion-normal) var(--zb-ease-out),
    padding var(--zb-motion-normal) var(--zb-ease-out);
}
.zb-ui .zb-site-header.is-compact .zb-site-header__inner {
  min-height: 58px;
  padding-block: 6px;
}
.zb-ui .zb-site-header.is-compact .zb-wordmark-svg {
  width: 100px;
}
.zb-ui .zb-header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}
.zb-ui .zb-header-actions .zb-header-actions__favorites {
  display: none;
}
.zb-ui .zb-round-button {
  align-items: center;
  background: var(--zb-color-glass);
  border: 1px solid var(--zb-color-glass-border);
  border-radius: 50%;
  box-shadow: var(--zb-shadow-soft);
  color: var(--zb-color-text);
  display: inline-flex;
  flex: none;
  height: 46px;
  justify-content: center;
  position: relative;
  text-decoration: none;
  transition:
    transform var(--zb-motion-fast) var(--zb-ease-out),
    background-color var(--zb-motion-fast);
  width: 46px;
}
.zb-ui .zb-round-button:hover {
  background: var(--zb-color-white);
}
.zb-ui .zb-round-button:active {
  transform: scale(0.94);
}
.zb-ui .zb-round-button .zb-icon {
  height: 21px;
  width: 21px;
}
.zb-ui .zb-cart-count {
  align-items: center;
  background: #f26f1f;
  border: 2px solid var(--zb-color-canvas);
  border-radius: var(--zb-radius-pill);
  color: var(--zb-color-white);
  display: flex;
  font-size: 0.625rem;
  font-weight: 800;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding-inline: 4px;
  position: absolute;
  right: -4px;
  top: -4px;
}
.zb-ui .zb-avatar {
  align-items: center;
  background: linear-gradient(145deg, #fde3cf, #f9c9a6);
  border: 2px solid var(--zb-color-white);
  border-radius: 50%;
  box-shadow: var(--zb-shadow-soft);
  color: #7a3a0c;
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 800;
  height: 48px;
  justify-content: center;
  text-decoration: none;
  width: 48px;
}
.zb-ui .zb-avatar--guest {
  background: var(--zb-color-glass);
  border-color: var(--zb-color-glass-border);
  color: var(--zb-color-text);
}
.zb-ui .zb-avatar .zb-icon {
  height: 21px;
  width: 21px;
}
.zb-ui .zb-desktop-nav,
.zb-ui .zb-site-search {
  display: none;
}

/* ---------- Page heading ---------- */
.zb-ui .zb-page-head {
  align-items: flex-end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 8px 0 22px;
}
.zb-ui .zb-page-head__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.zb-ui .zb-page-head__title-row {
  align-items: center;
  display: flex;
  gap: 12px;
}
.zb-ui .zb-page-head__title {
  font-size: clamp(1.85rem, 1.4rem + 2vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
}
.zb-ui .zb-page-head__subtitle {
  color: var(--zb-color-text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  margin: 0;
}
.zb-ui .zb-page-head__aside {
  flex: none;
}
.zb-ui .zb-page-head__back {
  height: 42px;
  width: 42px;
}

/* ---------- Section heading ---------- */
.zb-ui .zb-section-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: 0 0 14px;
}
.zb-ui .zb-section-head__title {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
}
.zb-ui .zb-section-head__link {
  align-items: center;
  color: #c2560b;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 700;
  gap: 2px;
  text-decoration: none;
}
.zb-ui .zb-section-head__link .zb-icon {
  height: 16px;
  width: 16px;
}

/* ---------- Shared surfaces ---------- */
.zb-ui .zb-panel {
  background: var(--zb-color-glass);
  border: 1px solid var(--zb-color-glass-border);
  border-radius: var(--zb-radius-lg);
  box-shadow: var(--zb-shadow-soft);
  padding: 18px;
}
.zb-ui .zb-panel--peach {
  background: linear-gradient(135deg, #fff1e6 0%, #fde3d0 100%);
  border-color: rgba(249, 201, 166, 0.55);
}
.zb-ui .zb-panel--mint {
  background: linear-gradient(135deg, #f1f8ee 0%, #e2f1e3 100%);
  border-color: rgba(173, 214, 180, 0.6);
}
.zb-ui .zb-panel--cream {
  background: linear-gradient(135deg, #fffaf0 0%, #fbf0dc 100%);
  border-color: rgba(240, 220, 184, 0.6);
}
.zb-ui .zb-chip--quiet {
  align-items: center;
  background: var(--zb-color-glass);
  border: 1px solid var(--zb-color-glass-border);
  border-radius: var(--zb-radius-pill);
  color: var(--zb-color-text);
  display: inline-flex;
  font-size: 0.85rem;
  gap: 6px;
  padding: 6px 14px;
  text-decoration: none;
  width: fit-content;
}
.zb-ui .zb-cta {
  align-items: center;
  background: var(--zb-color-primary-action);
  background-image: var(--zb-gradient-cta);
  border: 0;
  border-radius: var(--zb-radius-lg);
  box-shadow: var(--zb-shadow-cta);
  color: var(--zb-color-on-primary-action);
  cursor: pointer;
  display: flex;
  font: 800 1.05rem/1 var(--zb-font-family);
  gap: 10px;
  justify-content: center;
  min-height: 60px;
  padding: 0 22px;
  position: relative;
  text-decoration: none;
  transition:
    transform var(--zb-motion-fast) var(--zb-ease-out),
    box-shadow var(--zb-motion-fast);
  width: 100%;
}
.zb-ui .zb-cta:hover {
  background-image: var(--zb-gradient-cta-hover);
}
.zb-ui .zb-cta:active {
  transform: scale(0.985);
}
.zb-ui .zb-cta .zb-icon {
  height: 22px;
  width: 22px;
}
.zb-ui .zb-cta__end {
  inset-inline-end: 22px;
  position: absolute;
}
.zb-ui .zb-cta[disabled],
.zb-ui .zb-cta[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.55;
}
.zb-ui .zb-notice {
  background: var(--zb-color-cream);
  border: 1px solid rgba(240, 220, 184, 0.7);
  border-radius: var(--zb-radius-md);
  color: #5c4a2d;
  font-size: 0.85rem;
  line-height: 1.8;
  padding: 12px 14px;
}

/* ---------- Bottom navigation (mobile app shell) ---------- */
.zb-ui .zb-bottom-nav {
  align-items: end;
  backdrop-filter: saturate(1.3) blur(18px);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--zb-color-glass-border);
  border-radius: 30px;
  bottom: calc(10px + var(--zb-safe-bottom));
  box-shadow: 0 12px 34px rgba(76, 57, 39, 0.1);
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(5, 1fr);
  inset-inline: 12px;
  margin-inline: auto;
  max-width: 520px;
  padding: 8px 8px 7px;
  position: fixed;
  /* components.css centers the legacy nav with left/translate from 640px; this nav centers with margins. */
  transform: none;
  view-transition-name: zb-bottom-nav;
  width: auto;
  z-index: 50;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .zb-ui .zb-bottom-nav,
  .zb-ui .zb-sticky-cta--bar,
  .zb-ui .zb-site-header {
    background: rgba(255, 255, 255, 0.97);
  }
}
.zb-ui .zb-bottom-nav__item {
  align-items: center;
  background: transparent;
  border-radius: 22px;
  color: #6d665f;
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  font-weight: 600;
  gap: 3px;
  isolation: isolate;
  justify-content: center;
  min-height: 58px;
  position: relative;
  text-decoration: none;
  transition: color var(--zb-motion-normal) var(--zb-ease-out);
}
.zb-ui .zb-bottom-nav__item[aria-current='page'] {
  background: transparent;
  color: #b4500a;
  font-weight: 800;
}
.zb-ui .zb-bottom-nav__pill {
  animation: zb-pill-in var(--zb-motion-normal) var(--zb-ease-out);
  background: #fde6d4;
  border-radius: 22px;
  inset: 0;
  position: absolute;
  view-transition-name: zb-nav-pill;
  z-index: -1;
}
.zb-ui .zb-bottom-nav__glyph {
  display: inline-flex;
  transition: transform var(--zb-motion-normal) var(--zb-ease-out);
}
.zb-ui .zb-bottom-nav__item[aria-current='page'] .zb-bottom-nav__glyph {
  transform: translateY(-1px);
}
.zb-ui .zb-bottom-nav__glyph .zb-icon {
  height: 24px;
  width: 24px;
}
.zb-ui .zb-bottom-nav__item--featured .zb-bottom-nav__glyph {
  align-items: center;
  background: rgba(253, 230, 212, 0.75);
  border: 1px solid rgba(242, 122, 36, 0.18);
  border-radius: 15px;
  height: 34px;
  justify-content: center;
  width: 40px;
}
.zb-ui .zb-bottom-nav__item:focus-visible {
  box-shadow: var(--zb-shadow-focus);
  outline: 0;
}
.zb-ui .zb-bottom-nav__item.is-pending {
  background: rgba(253, 230, 212, 0.55);
}
@keyframes zb-pill-in {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Sticky action bars sit above the bottom navigation and the iOS home indicator. */
.zb-ui .zb-sticky-cta {
  bottom: calc(var(--zb-bottom-nav-height) + 22px + var(--zb-safe-bottom));
  inset-inline: 12px;
  margin-inline: auto;
  max-width: 520px;
  position: fixed;
  z-index: 45;
}
.zb-ui .zb-sticky-cta--bar {
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--zb-color-glass-border);
  border-radius: 26px;
  box-shadow: 0 12px 30px rgba(76, 57, 39, 0.12);
  display: flex;
  gap: 10px;
  padding: 8px;
}

/* ---------- Footer ---------- */
.zb-ui .zb-site-footer {
  border-top: 1px solid rgba(233, 226, 218, 0.7);
  margin-top: 24px;
  padding: 36px 0 calc(var(--zb-bottom-nav-height) + 48px + var(--zb-safe-bottom));
}
.zb-ui .zb-site-footer__inner {
  display: grid;
  gap: 28px;
  padding-bottom: 0;
  padding-top: 0;
}
.zb-ui .zb-site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.zb-ui .zb-site-footer__cols {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.zb-ui .zb-site-footer__cols div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.zb-ui .zb-site-footer__cols h2 {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.zb-ui .zb-site-footer__cols a {
  color: var(--zb-color-text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
}
.zb-ui .zb-site-footer__cols a:hover {
  color: var(--zb-color-text);
}
.zb-ui .zb-site-footer__cols .menu-item {
  list-style: none;
}

/* ---------- Motion: page transitions ---------- */
@view-transition {
  navigation: auto;
}
::view-transition-old(root) {
  animation: zb-page-out var(--zb-motion-page, 220ms) var(--zb-ease-out, ease-out) both;
}
::view-transition-new(root) {
  animation: zb-page-in var(--zb-motion-page, 220ms) var(--zb-ease-out, ease-out) both;
}
::view-transition-group(zb-nav-pill) {
  animation-duration: 240ms;
  animation-timing-function: cubic-bezier(0.22, 0.8, 0.24, 1);
}
@keyframes zb-page-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}
@keyframes zb-page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@supports not (view-transition-name: none) {
  .zb-ui main {
    animation: zb-page-in 240ms var(--zb-ease-out) both;
  }
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
  .zb-ui main,
  .zb-ui .zb-bottom-nav__pill {
    animation: none;
  }
  .zb-ui * {
    scroll-behavior: auto;
    transition-duration: 0ms;
  }
}

/* ---------- Tablet ---------- */
@media (min-width: 768px) {
  .zb-ui .zb-shell {
    padding-inline: 32px;
  }
  .zb-ui .zb-site-header__inner {
    padding-inline: 32px;
  }
  .zb-ui .zb-wordmark-svg {
    width: 126px;
  }
  .zb-ui .zb-site-footer__cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .zb-ui .zb-site-footer {
    padding-top: 24px;
  }
  .zb-ui .zb-site-footer__inner {
    gap: 16px;
  }
  .zb-ui .zb-site-footer__cols {
    border-top: 1px solid rgba(233, 226, 218, 0.8);
    display: block;
    padding-top: 12px;
  }
  .zb-ui .zb-site-footer__cols > div {
    display: none;
  }
  .zb-ui .zb-site-footer__cols > div:last-child {
    display: flex;
  }
  .zb-ui .zb-site-footer__cols > div:last-child > a:not(:last-of-type),
  .zb-ui .zb-site-footer__cols > div:last-child > h2 {
    display: none;
  }
}

/* ---------- Desktop: editorial header, no bottom navigation ---------- */
@media (min-width: 1024px) {
  .zb-ui main {
    padding-bottom: 64px;
  }
  .zb-ui .zb-shell {
    padding-inline: 40px;
  }
  .zb-ui .zb-site-header__inner {
    min-height: 84px;
    padding-inline: 40px;
  }
  .zb-ui .zb-wordmark-svg {
    width: 138px;
  }
  .zb-ui .zb-desktop-nav {
    align-items: center;
    display: flex;
    gap: 28px;
    margin-inline-start: 20px;
  }
  .zb-ui .zb-desktop-nav a {
    color: var(--zb-color-text-secondary);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 6px 0;
    position: relative;
    text-decoration: none;
  }
  .zb-ui .zb-desktop-nav a::after {
    background: #f27a24;
    border-radius: 2px;
    bottom: -2px;
    content: '';
    height: 2px;
    inset-inline: 0;
    position: absolute;
    transform: scaleX(0);
    transition: transform var(--zb-motion-normal) var(--zb-ease-out);
  }
  .zb-ui .zb-desktop-nav a:hover,
  .zb-ui .zb-desktop-nav a[aria-current='page'] {
    color: var(--zb-color-text);
  }
  .zb-ui .zb-desktop-nav a:hover::after,
  .zb-ui .zb-desktop-nav a[aria-current='page']::after {
    transform: scaleX(1);
  }
  .zb-ui .zb-site-search {
    display: flex;
    flex: 1;
    margin-inline-start: auto;
    max-width: 340px;
  }
  .zb-ui .zb-header-actions {
    margin-inline-start: 8px;
  }
  .zb-ui .zb-header-actions .zb-header-actions__favorites {
    display: inline-flex;
  }
  .zb-ui .zb-bottom-nav,
  .zb-ui .zb-bottom-nav__item {
    display: none;
  }
  .zb-ui .zb-sticky-cta {
    bottom: 24px;
  }
  .zb-ui .zb-site-footer {
    padding-bottom: 48px;
  }
  .zb-ui .zb-site-footer__inner {
    grid-template-columns: 1.2fr 2fr;
  }
}
