/* V2 shares one centered canvas with its fixed controls. */
body {
  --v2-header-height: 68px;
  --v2-nav-height: 80px;
  --v2-canvas: 480px;
  max-width: var(--v2-canvas);
  margin-inline: auto;
}

.v2-nav,
.cart-page:not(.checkout) #pay {
  max-width: var(--v2-canvas);
}

@media (orientation: landscape) and (max-height: 500px) {
  body {
    --v2-header-height: 52px;
    --v2-nav-height: 52px;
  }

  body:has(.v2-nav) {
    padding-bottom: calc(var(--v2-nav-height) + env(safe-area-inset-bottom));
  }

  body.home .top,
  .top {
    min-height: var(--v2-header-height);
    height: var(--v2-header-height);
    padding-block: 4px;
  }

  .v2-nav {
    min-height: var(--v2-nav-height);
    padding-block: 2px calc(4px + env(safe-area-inset-bottom));
  }

  .v2-nav > a {
    min-height: 44px;
    border-radius: 15px;
    gap: 1px;
  }

  .v2-nav img { width: 20px; height: 20px; }

  .v2-menu .tabs {
    position: static;
    min-height: 0;
    height: auto;
    padding: 4px 16px;
    gap: 8px;
  }

  .v2-menu .tabs .tab {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 14px;
    white-space: nowrap;
    font-size: 11px;
  }

  .v2-menu .tabs .tab img { width: 28px; height: 28px; }
  .v2-menu .tabs .tab span { min-height: 0; }
  .v2-menu .grp { padding-top: 6px; scroll-margin-top: calc(var(--v2-header-height) + 4px); }
  .v2-menu .grp__h,
  .v2-menu .grp:has(.grp__intro) .grp__h { margin-bottom: 8px; font-size: 20px; line-height: 24px; }
  .v2-menu .grp__intro { display: none; }

  .v2-menu .item { min-height: 0; }

  .v2-menu .item__open.item__pic {
    height: min(104px, 22dvh);
    aspect-ratio: auto;
  }

  .v2-menu .item__b { min-height: 0; padding-block: 4px; gap: 2px; }
  .v2-menu .item__open:not(.item__pic) { min-height: 22px; }
  .v2-menu .item__f { min-height: 40px; }
  .v2-menu .item__meta { gap: 0; }

  .sheet__box {
    height: min(480px, 96dvh);
    max-height: 96dvh;
  }

  .sheet__head {
    min-height: 52px;
    height: 52px;
  }

  .sheet__x { top: 4px; }
  .sheet__pic { height: min(112px, 26dvh); aspect-ratio: auto; }
  .sheet__body { gap: 8px; padding-block: 8px; }

  /* The visible title is already in the header. Keep the dialog name for AT. */
  .sheet__n {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sheet__foot {
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  }

  .sheet__add { height: 44px; min-height: 44px; }
}

@media (orientation: landscape) and (max-height: 350px) {
  .v2-menu .item__open.item__pic { height: 19dvh; }
  .v2-menu .item__d { display: none; }
}

@media (orientation: landscape) and (max-height: 500px) and (min-width: 420px) {
  .sheet__box { max-width: min(680px, calc(100% - 24px)); }

  .sheet__scroll:has(.sheet__pic:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    align-items: start;
    gap: 12px;
    padding-inline: 16px;
  }

  .sheet__scroll .sheet__pic {
    width: 100%;
    height: auto;
    max-height: calc(96dvh - 130px);
    aspect-ratio: 4 / 3;
    margin: 8px 0 0;
  }

  .sheet__scroll:has(.sheet__pic:not([hidden])) .sheet__body {
    min-width: 0;
    padding-inline: 0;
  }
}

/* Keep the swipeable rail on touch; a mouse can page through it explicitly. */
.v2-rail--home { margin-inline: 16px; }
.v2-rail--home .v2-categories { margin-inline: 0; }

.v2-rail--menu {
  position: sticky;
  top: var(--v2-header-height);
  z-index: 20;
  background: var(--paper);
}

.v2-menu .v2-rail--menu .tabs { position: static; max-width: none; }

.v2-rail-arrow {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--outline-soft);
  border-radius: 50%;
  color: var(--primary);
  background: var(--paper);
  cursor: pointer;
}

.v2-rail-arrow[aria-disabled="true"] { opacity: .4; cursor: default; }

@media (orientation: landscape) and (max-height: 500px) {
  .v2-rail--menu { position: static; }
}

@media (min-width: 720px) and (min-height: 501px) {
  body.v2-home,
  body.v2-menu {
    --v2-canvas: min(1120px, calc(100% - 48px));
    --v2-header-height: 68px;
  }

  body.has-wide-nav { padding-bottom: 32px; }

  body.v2-home .top,
  body.v2-menu .top {
    position: sticky;
    max-width: none;
    padding-inline: 24px;
  }

  body.has-wide-nav .top > .icon-btn { display: none; }

  .top > .v2-nav {
    position: static;
    width: auto;
    max-width: none;
    min-height: 0;
    transform: none;
    padding: 0;
    margin: 0;
    border: 0;
    gap: 6px;
  }

  .top > .v2-nav > a {
    flex-direction: row;
    width: auto;
    min-height: 44px;
    padding-inline: 12px;
    gap: 6px;
    font-size: 13px;
    line-height: 18px;
    border-radius: 14px;
  }

  .top > .v2-nav img { width: 19px; height: 19px; }
  .top > .v2-nav b { position: static; flex: none; }

  .v2-home .grp,
  .v2-menu .grp { padding-inline: 24px; }

  .v2-home .grid,
  .v2-menu .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .v2-home .v2-promos { margin: 8px 24px 16px; }
  .v2-rail--home { margin-inline: 24px; }

  .v2-home .v2-promos .v2-hero--order {
    min-height: 300px;
    align-items: center;
  }

  .v2-home .v2-promos .v2-hero--order > .v2-hero__copy {
    width: min(52%, 500px);
    padding: 24px 0 28px 32px;
    gap: 10px;
  }

  .v2-home .v2-promos .v2-hero--order h2 {
    font-size: clamp(35px, 4vw, 52px);
    line-height: 1.08;
  }

  .v2-home .v2-promos .v2-hero__eyebrow { font-size: 10px; line-height: 14px; }
  .v2-home .v2-promos .v2-hero--order p { font-size: 14px; line-height: 20px; width: auto; }
  .v2-home .v2-promos .v2-hero__cta { padding-inline: 15px; font-size: 13px; }

  .v2-home .v2-promos .v2-hero--order > img {
    width: clamp(310px, 37vw, 455px);
    height: auto;
    top: auto;
    bottom: -88px;
    right: 0;
  }
}

@media (min-width: 1040px) and (min-height: 501px) {
  .v2-menu .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 720px) and (min-height: 501px) and (any-pointer: fine) {
  .v2-rail.is-scrollable {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 4px;
  }

  .v2-rail--menu.is-scrollable { padding-inline: 12px; }
  /* Padding stays the same with and without arrows so overflow is stable. */
  .v2-menu .v2-rail--menu .tabs { padding-inline: 16px; }
  .v2-rail.is-scrollable > .v2-rail-arrow { display: grid; place-items: center; }

  .v2-rail-arrow:hover:not([aria-disabled="true"]) {
    background: var(--yellow-soft);
    border-color: var(--yellow);
  }
}
