/* Match the live shop sign: crop its blank plank through CSS, without
   stretching or changing the artwork. The source is already a homepage asset. */
.stage .section-nav {
  top: max(18px, env(safe-area-inset-top));
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.stage .section-nav button {
  position: relative;
  min-width: 0;
  min-height: 50px;
  padding: 12px 21px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(2px 1px, 24% 0, 51% 1px, 78% 0, calc(100% - 3px) 1px, 100% 4px, calc(100% - 1px) 52%, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 1px), 66% 100%, 38% calc(100% - 1px), 3px 100%, 0 calc(100% - 4px), 1px 48%, 0 4px);
  background: linear-gradient(#522c1c14, #2e160c52), url('./assets/optimized/03-shop-golden-800-delivery.webp?v=67a83eebee46') -220px -185px / 680px auto;
  background-color: #835035;
  color: #fff3d9;
  font: 500 17px/1.3 var(--serif);
  text-shadow: 0 1px 2px #30170e;
  box-shadow: inset 0 2px #dba77899, inset 0 -3px #3d2418, inset 0 0 0 1px #482a1b;
  cursor: pointer;
  transition: filter 150ms ease;
}
.stage .section-nav button::before,
.stage .section-nav button::after {
  content: '';
  position: absolute;
  top: calc(50% - 2px);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #2e211b;
  box-shadow: inset 0 1px #a48b6b, 0 1px 1px #28170e;
}
.stage .section-nav button::before { left: 6px; }
.stage .section-nav button::after { right: 6px; }
.stage .section-nav .village-return {
  clip-path: polygon(14px 1px, 42% 0, 70% 1px, calc(100% - 3px) 0, 100% 3px, calc(100% - 1px) 52%, 100% calc(100% - 4px), calc(100% - 4px) 100%, 58% calc(100% - 1px), 14px 100%, 0 51%);
  padding-left: 27px;
}
.stage .section-nav .village-return::before { left: 15px; }
.stage .section-nav .village-return span { margin-right: 5px; }
.stage .section-nav [aria-current="page"] {
  background: linear-gradient(#7b330a99, #491e0fbb), url('./assets/optimized/03-shop-golden-800-delivery.webp?v=67a83eebee46') -220px -185px / 680px auto;
  color: #ffe5a6;
  font-weight: 650;
  text-shadow: 0 1px 2px #291208;
  box-shadow: inset 0 2px #edc06d, inset 0 -3px #37190d, inset 0 0 0 1px #b77c3d;
}
.stage .section-nav button:hover { filter: brightness(1.1); }
.stage .section-nav button:focus-visible { outline: 3px solid #fff0bc; outline-offset: -5px; }

/* Two compact rows keep all four destinations visible on a narrow phone. */
@media (max-width: 700px) and (max-aspect-ratio: 1/1) {
  .stage .section-nav {
    top: max(10px, env(safe-area-inset-top));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 6px;
    width: calc(100vw - 24px);
    max-width: 460px;
  }
  .stage .section-nav .village-return {
    grid-column: 1 / -1;
    justify-self: center;
    padding: 10px 23px 10px 29px;
    min-height: 44px;
    font-size: 15px;
  }
  .stage .section-nav button {
    min-height: 48px;
    padding: 8px 5px 8px 9px;
    font-size: 13px;
    white-space: normal;
  }
  .stage .section-nav button::before { left: 3px; }
  .stage .section-nav button::after { right: 3px; }
  .stage .section-nav button::before, .stage .section-nav button::after { width: 2px; height: 2px; }
  .stage .section-nav .village-return::before { left: 15px; }
  .stage .object-stage[data-object] {
    top: max(128px, calc(env(safe-area-inset-top) + 118px));
    bottom: max(10px, env(safe-area-inset-bottom));
    translate: -50% 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .stage .object-stage[data-object="flavors"] .flavors-heading { padding: 0 5px; }
}
@media (max-width: 360px) and (max-aspect-ratio: 1/1) {
  .stage .section-nav { width: calc(100vw - 16px); column-gap: 4px; }
  .stage .section-nav button { padding-inline: 2px; font-size: 12px; }
  .stage .section-nav button:not(.village-return)::before, .stage .section-nav button:not(.village-return)::after { display: none; }
}

/* A short landscape window keeps the menu in one row. */
@media (max-height: 550px) and (min-aspect-ratio: 1/1) {
  .stage .section-nav { top: max(8px, env(safe-area-inset-top)); gap: 6px; }
  .stage .section-nav button { min-height: 44px; padding: 9px 13px; font-size: 13px; }
  .stage .section-nav .village-return { padding-left: 24px; }
}

/* A very short narrow landscape viewport cannot keep all five labels in one
   row. Give the return action its own line and let the four destinations use
   equal-width, fully readable cells. */
@media (max-height: 550px) and (min-aspect-ratio: 1/1) and (max-width: 480px) {
  .stage .section-nav {
    top: max(8px, env(safe-area-inset-top));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: calc(100vw - 16px);
    max-width: none;
  }
  .stage .section-nav .village-return {
    grid-column: 1 / -1;
    justify-self: center;
    min-height: 36px;
    padding: 6px 18px 6px 24px;
    font-size: 12px;
  }
  .stage .section-nav button {
    min-height: 38px;
    padding: 5px 2px;
    font-size: 11px;
    line-height: 1.05;
    white-space: normal;
  }
  .stage .section-nav button:not(.village-return)::before,
  .stage .section-nav button:not(.village-return)::after { display: none; }
  .stage .object-stage[data-object] {
    top: 92px;
  }
}
@media (prefers-reduced-motion: reduce) { .stage .section-nav button { transition: none; } }
@media (forced-colors: active) {
  .stage .section-nav button { background: ButtonFace; color: ButtonText; border: 1px solid ButtonText; box-shadow: none; text-shadow: none; }
  .stage .section-nav [aria-current="page"] { background: Highlight; color: HighlightText; }
  .stage .section-nav button:focus-visible { outline-color: Highlight; }
}

/* Sibling controls stay still while the section content animates or scrolls. */
.stage .section-step {
  position: absolute;
  top: calc(50% + 25px);
  translate: 0 -50%;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  padding: 0 0 5px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(#522c1c14, #2e160c52), url('./assets/optimized/03-shop-golden-800-delivery.webp?v=67a83eebee46') -220px -185px / 680px auto;
  background-color: #835035;
  color: #fff3d9;
  font: 500 43px/1 var(--serif);
  text-shadow: 0 1px 2px #30170e;
  box-shadow: inset 0 2px #dba77899, inset 0 -3px #3d2418, inset 0 0 0 1px #482a1b;
  cursor: pointer;
}
.stage .section-previous {
  left: max(16px, env(safe-area-inset-left));
  clip-path: polygon(12px 1px, calc(100% - 2px) 0, 100% 3px, calc(100% - 1px) calc(100% - 3px), 12px 100%, 0 51%);
  padding-left: 5px;
}
.stage .section-next {
  right: max(16px, env(safe-area-inset-right));
  clip-path: polygon(2px 0, calc(100% - 12px) 1px, 100% 51%, calc(100% - 12px) 100%, 0 calc(100% - 3px), 1px 3px);
  padding-right: 5px;
}
.stage .section-step:hover { filter: brightness(1.15); }
.stage .section-step:focus-visible { outline: 3px solid #fff0bc; outline-offset: -5px; }
@media (min-width: 701px) and (min-height: 551px) {
  .stage .section-step {
    width: 72px;
    height: 80px;
    font-size: 56px;
    color: #fff0bc;
    background-size: auto, 900px auto;
    background-position: 0 0, -295px -240px;
    box-shadow: inset 0 2px #edc08c, inset 0 -4px #3d2418, inset 0 0 0 1px #482a1b;
  }
  .stage .section-previous { left: max(clamp(28px, 5vw, 96px), env(safe-area-inset-left)); }
  .stage .section-next { right: max(clamp(28px, 5vw, 96px), env(safe-area-inset-right)); }
  .stage .object-stage[data-object="flavors"] { width: min(1100px, calc(100vw - 168px)); }
}
/* Phones and short windows reserve a clear lower row for both arrows. */
@media (max-width: 700px) and (max-aspect-ratio: 1/1), (max-height: 550px) {
  .stage .section-step {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    translate: none;
    height: 48px;
    font-size: 36px;
  }
  .stage .object-stage[data-object] {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 64px));
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }
}
@media (forced-colors: active) {
  .stage .section-step { background: ButtonFace; color: ButtonText; border: 1px solid ButtonText; box-shadow: none; text-shadow: none; }
  .stage .section-step:focus-visible { outline-color: Highlight; }
}

/* One mobile policy: home and the current chapter. The wooden arrows retain
   the complete section sequence. nav specificity supersedes older per-section
   compact menus without affecting the desktop navigation. */
@media (max-width:700px), (max-width:1000px) and (max-height:550px) and (pointer:coarse) {
  .stage[data-state] nav.section-nav {
    display:flex;
    justify-content:space-between;
    align-items:stretch;
    top:max(8px,env(safe-area-inset-top));
    width:calc(100vw - 24px);
    max-width:none;
    gap:12px;
  }
  .stage[data-state] nav.section-nav button { display:none; }
  .stage[data-state] nav.section-nav :is(.village-return,[aria-current="page"]) {
    display:block;
    min-height:44px;
    width:auto;
    padding:8px 14px;
    font-size:14px;
    line-height:1.3;
    white-space:nowrap;
  }
  .stage[data-state] nav.section-nav .village-return { padding-left:24px; }
  .stage[data-state] .object-stage:is([data-object="flavors"],[data-object="ingredients"],[data-object="contacts"]) {
    top:max(62px,calc(env(safe-area-inset-top) + 54px));
  }
  .stage[data-state] .buy-heading { top:max(64px,calc(env(safe-area-inset-top) + 56px)); }
}
