/* A height-aware desktop composition. Keep native type, controls and document
   scrolling; do not scale the page or constrain the checkout to a clipped box. */
/* Share the legacy shell's 10px gutter, including short pages. Switching
   routes must not move the centered header when a scrollbar appears. */
html { scrollbar-gutter: stable; }
html::-webkit-scrollbar { width: 10px; height: 10px; }

@media (min-width: 960px) {
  .header { height: 72px; }
  .product-stage {
    min-height: clamp(120px, calc(100dvh - 650px), 350px);
    padding: 12px 24px 20px 0;
    gap: 24px;
  }
  .product-copy .section-index { margin-bottom: 4px; line-height: 16px; font-size: 10px; }
  .product-copy h1 { font-size: clamp(38px, calc(10dvh - 47px), 60px); line-height: 1.12; }
  .product-description { margin-top: 8px; font-size: 13px; line-height: 1.5; }
  .logo-viewport { height: clamp(112px, calc(50dvh - 313px), 240px); }
  .logo-object { width: clamp(112px, calc(50dvh - 313px), 240px); height: clamp(112px, calc(50dvh - 313px), 240px); }

  #purchase { padding: 20px 24px; border-radius: 20px; }
  #purchase .purchase-layout { gap: 28px; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); }
  #purchase .checkout-prep { padding-left: 28px; gap: 12px; }
  #purchase .section-heading { margin-bottom: 14px; }
  #purchase .section-heading h2, #purchase .setup-heading h2 { font-size: 18px; line-height: 1.4; }
  #purchase .option-list { gap: 10px; }
  #purchase .option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    min-height: 78px;
    padding: 14px 16px;
    border-radius: 12px;
  }
  #purchase .selection-outline { border-radius: 12px; }
  #purchase .option-top { grid-column: 2; grid-row: 1; width: auto; margin: 0; gap: 10px; flex-direction: row-reverse; }
  #purchase .option-copy { grid-column: 1; grid-row: 1; }
  #purchase .option-copy strong { font-size: 14px; line-height: 1.5; }
  #purchase .option-price { font-size: 23px; line-height: 1.2; }
  #purchase .option-price .yen { font-size: 13px; }
  #purchase .sold-out-label { font-size: 11px; }
  #purchase .setup-heading p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
  #purchase .lookup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; gap: 16px; }
  #purchase .lookup-grid .field label { margin-bottom: 6px; }
  #purchase .product-input-slot { min-height: 120px; padding-top: 12px; }
  #purchase .product-input-slot .invite-boxes input { height: 44px; font-size: 21px; }
  #purchase .product-input-slot .field-hint { margin-top: 6px; }
  #purchase .checkout-summary { margin-top: auto; padding-top: 12px; }
  #purchase .summary-selection { gap: 16px; }
  #purchase .checkout-summary .selected-product { min-height: 68px; }
  #purchase .checkout-summary .selected-product strong { margin-top: 4px; }
  #purchase .checkout-summary .quantity-control { flex-direction: row; gap: 10px; }
  #purchase .checkout-summary .stepper { height: 44px; }
  #purchase .checkout-summary .stepper button { height: 36px; }
  #purchase .payment-methods { margin-top: 12px; }
  #purchase .payment-methods legend { margin-bottom: 8px; }
  #purchase .payment-method { min-height: 52px; padding: 8px; }
  #purchase .payment-method-options:has(.payment-method-balance) .payment-method { min-height: 84px; padding: 8px 6px; }
  #purchase .purchase-consent { margin-top: 12px; padding-top: 6px; }
  #purchase .checkout-action { margin-top: 6px; gap: 16px; }
  #purchase .checkout-action .total-block { min-height: 52px; }
  #purchase .checkout-action .primary-button { height: 44px; min-width: 120px; }
  #purchase .checkout-summary #total { font-size: 30px; }
  .site-footer.simple-footer { margin-top: 32px; min-height: 72px; padding: 12px 0 16px; }
  .review-view { margin-top: 24px; }
}

@media (min-width: 960px) and (max-width: 1160px) {
  .header-right { top: 64px; max-height: calc(100dvh - 80px); }
  #purchase .purchase-layout { gap: 20px; grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr); }
  #purchase .checkout-prep { padding-left: 20px; }
  #purchase .option { padding: 12px; column-gap: 8px; }
  #purchase .option-top { gap: 8px; }
  #purchase .option-price { font-size: 21px; }
  #purchase .quantity-control > .muted-label { max-width: 4em; }
}

@media (min-width: 960px) and (max-height: 700px) {
  .header { height: 56px; }
  .product-stage { min-height: 0; grid-template-columns: minmax(0, 1fr) 60px; padding: 4px 0; }
  .product-copy { display: flex; align-items: center; gap: 20px; min-width: 0; }
  .product-copy .section-index { display: none; }
  .product-copy h1 { font-size: 30px; flex: none; }
  .product-description { margin: 0; font-size: 12px; }
  .logo-viewport { height: 48px; }
  .logo-object { width: 48px; height: 48px; }
  #purchase { padding-block: 16px; }
  #purchase .checkout-prep { gap: 8px; }
  #purchase .section-heading { margin-bottom: 10px; }
  #purchase .product-input-slot { min-height: 114px; }
  #purchase .setup-heading > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  #purchase .setup-heading p { margin: 0; font-size: 12px; }
}

/* Wider monitors get usable space and a reading scale, rather than a small
   checkout island. The height budget keeps short windows compact. Both axes
   grow continuously from the existing composition without page zoom. */
@media (min-width: 1600px) {
  body { --wide-room: clamp(0px, min(calc(1vw - 16px), calc(5dvh - 47.5px)), 8px); }
  .wrap { width: min(1920px, calc(100% - 220px)); }
  .header { height: calc(72px + var(--wide-room) * 2); }
  .header-link, .login-link, .language-toggle { font-size: calc(12.8px + var(--wide-room) * .3); }
  .product-nav .product-tab { font-size: calc(16px + var(--wide-room) * .25); }
  .product-stage { min-height: clamp(120px, calc(100dvh - 650px - var(--wide-room) * 10), calc(350px - var(--wide-room) * 6.25)); }
  .product-copy h1 { font-size: clamp(38px, calc(10dvh - 47px + var(--wide-room) * 2), calc(60px + var(--wide-room) * 2)); }
  .product-description { font-size: calc(13px + var(--wide-room) * .5); }
  #purchase { padding: calc(20px + var(--wide-room) * 1.5) calc(24px + var(--wide-room) * 2); }
  #purchase .purchase-layout { gap: calc(28px + var(--wide-room)); }
  #purchase .checkout-prep { padding-left: calc(28px + var(--wide-room)); gap: calc(12px + var(--wide-room)); }
  #purchase .section-heading { margin-bottom: calc(14px + var(--wide-room)); }
  #purchase .section-heading h2, #purchase .setup-heading h2 { font-size: calc(18px + var(--wide-room) * .5); }
  #purchase .section-heading > span, #purchase .setup-heading p,
  #purchase .field-hint { font-size: calc(13px + var(--wide-room) * .25); }
  #purchase .option-list { gap: calc(10px + var(--wide-room) * .75); }
  #purchase .option { min-height: calc(78px + var(--wide-room) * 4); padding: calc(14px + var(--wide-room)) calc(16px + var(--wide-room)); }
  #purchase .option-copy strong { font-size: calc(14px + var(--wide-room) * .5); }
  #purchase .option-price { font-size: calc(23px + var(--wide-room)); }
  #purchase .sold-out-label { font-size: calc(11px + var(--wide-room) * .375); }
  #purchase .lookup-grid .field label, #purchase .delivery-field label,
  #purchase .invite-field legend { font-size: calc(14px + var(--wide-room) * .25); }
  #purchase .lookup-grid .input-wrap, #purchase .delivery-field .input-wrap:not(.multiline-wrap),
  #purchase .product-input-slot .invite-boxes input { height: calc(44px + var(--wide-room)); }
  #purchase .lookup-grid .input-wrap input, #purchase .lookup-grid .input-wrap input::placeholder,
  #purchase .delivery-field .input-wrap input { font-size: calc(14px + var(--wide-room) * .25); }
  #purchase .product-input-slot { min-height: calc(120px + var(--wide-room) * 3); }
  #purchase .checkout-summary { padding-top: calc(12px + var(--wide-room)); }
  #purchase .checkout-summary .selected-product { min-height: calc(68px + var(--wide-room) * 2.5); }
  #purchase .checkout-summary .selected-product strong { font-size: calc(14px + var(--wide-room) * .5); }
  #purchase .muted-label, #purchase .payment-methods legend,
  #purchase #selection-total-label { font-size: calc(13px + var(--wide-room) * .25); }
  #purchase .payment-methods { margin-top: calc(12px + var(--wide-room)); }
  #purchase .payment-method { min-height: calc(52px + var(--wide-room) * 2); gap: calc(8px + var(--wide-room) * .5); }
  #purchase .payment-method-options:has(.payment-method-balance) .payment-method { min-height: calc(84px + var(--wide-room) * 2); }
  #purchase .payment-method-options .payment-method > span, #purchase .wallet-option-copy > strong { font-size: calc(14px + var(--wide-room) * .25); }
  #purchase .payment-method-options .wallet-option-amount { font-size: calc(13px + var(--wide-room) * .25); }
  #purchase .payment-method > img, #purchase .payment-method > svg:not(.channel-check),
  #purchase .payment-method-options:has(.payment-method-balance) .payment-method > img,
  #purchase .payment-method-options:has(.payment-method-balance) .payment-method > svg:not(.channel-check) { width: calc(22px + var(--wide-room) * .75); height: calc(22px + var(--wide-room) * .75); }
  #purchase .purchase-consent { margin-top: calc(12px + var(--wide-room)); font-size: calc(12px + var(--wide-room) * .25); }
  #purchase .checkout-action { margin-top: calc(6px + var(--wide-room)); }
  #purchase .checkout-action .primary-button { height: calc(44px + var(--wide-room)); min-width: calc(120px + var(--wide-room) * 4); }
  #purchase .checkout-summary #total { font-size: calc(30px + var(--wide-room)); }
  #purchase .checkout-summary #total.is-long { font-size: calc(28px + var(--wide-room) * .5); }
  #purchase #selection-fee-note { font-size: calc(12px + var(--wide-room) * .25); }
}

@media (min-width: 1600px) and (max-height: 700px) {
  .header { height: 56px; }
  .product-stage { min-height: 0; }
  .product-copy h1 { font-size: 30px; }
  #purchase { padding-block: 16px; }
  #purchase .checkout-prep { gap: 8px; }
  #purchase .section-heading { margin-bottom: 10px; }
  #purchase .product-input-slot { min-height: 114px; }
}

/* At exceptionally short desktop heights the persistent product tabs already
   identify the selection. Reclaim the decorative hero, not the field space. */
@media (min-width: 960px) and (max-height: 620px) {
  .product-stage { display: none; }
}

@media (min-width: 960px) and (min-height: 701px) and (max-height: 850px) {
  .product-stage { padding-top: 8px; padding-bottom: 12px; }
  .product-copy .section-index { display: none; }
  .logo-viewport { height: 100px; }
  .logo-object { width: 100px; height: 100px; }
}

/* Keep stock attached to the quantity picker. Its two rows fit within the
   existing desktop summary slot, so changing inventory does not move the CTA. */
#purchase .checkout-summary .quantity-control {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: end;
  gap: 4px 10px;
  height: auto;
}
#purchase .quantity-control > .muted-label { grid-column: 1; grid-row: 1; }
#purchase .quantity-control > .stepper { grid-column: 2; grid-row: 1; }
#purchase .quantity-stock {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 760px) {
  #purchase .checkout-summary .quantity-control { grid-template-columns: auto; }
  #purchase .quantity-control > .stepper,
  #purchase .quantity-stock { grid-column: 1; }
}
