:root {
  --gutter: clamp(16px, 3.4vw, 52px);
  --cell-pad: clamp(18px, 1.8vw, 28px);
  --cell-info-pad-x: clamp(18px, 1.7vw, 26px);
  --ink: #16181c;
  --soft: #68717d;
  --paper: #f4f6fa;
  --white: #fff;
  --blue: #113c9f;
  --rule: #d5deec;
  --rounded: "M PLUS Rounded 1c", ui-rounded, "Hiragino Maru Gothic ProN", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--rounded);
  -webkit-font-smoothing: antialiased;
}

body.shop-page { padding-bottom: 0; }
.shop-page .site-footer { position: static; }

button { color: inherit; font: inherit; }
img { display: block; max-width: 100%; }

main {
  width: calc(100% - (2 * var(--gutter)));
  max-width: 1580px;
  margin: clamp(12px, 1.6vw, 24px) auto clamp(92px, 10vw, 150px);
}

.shop-title-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.shop-group + .shop-group { margin-top: clamp(26px, 3vw, 46px); }
.shop-section-title-mobile,
.shop-mobile-subsection { display: none; }

.shop-group h2 {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
  color: var(--blue);
  font: 600 .68rem/1 var(--rounded);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.shop-group h2::after {
  height: 1px;
  flex: 1;
  background: var(--blue);
  content: "";
}

.product-grid,
.shop-combined-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--blue);
}

.shop-combined-grid > .product-grid { display: contents; }

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 0;
  background: var(--white);
}

.product-card:not(.product-card--empty) { cursor: zoom-in; }

.product-card--empty {
  position: relative;
  z-index: 1;
  margin: 0 -1px -1px 0;
  background: var(--paper);
  pointer-events: none;
}

.product-gallery {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  align-self: start;
  aspect-ratio: 1;
}
.product-image-link {
  position: absolute;
  inset: var(--cell-pad);
  display: block;
  color: inherit;
  cursor: zoom-in;
  text-decoration: none;
}

.product-image-link:focus-visible { outline: 0; }
.product-card:has(.product-image-link:focus-visible) h3 a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: .24em;
}

.product-card figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  width: 100%;
  min-height: 0;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: visible;
  background: var(--white);
}

/* Keep image intrinsic sizes out of grid track sizing, including without JS. */
.product-gallery > figure {
  position: absolute;
  inset: var(--cell-pad);
  width: auto;
  height: auto;
}

.product-card img {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.product-card img[hidden] { display: none; }
.product-gallery.is-ready figure img {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity .52s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .52s;
}

.product-gallery.is-ready figure img.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.gallery-controls {
  position: absolute;
  inset: var(--cell-pad);
  z-index: 2;
  display: none;
  pointer-events: none;
}

.product-gallery.is-ready .gallery-controls { display: block; }

.gallery-controls button {
  position: absolute;
  top: 50%;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: 600 1.65rem/1 var(--rounded);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity .2s ease, border-color .2s ease;
}

.gallery-controls [data-gallery-prev] { left: 0; }
.gallery-controls [data-gallery-next] { right: 0; }
.product-gallery:hover .gallery-controls button,
.product-gallery:focus-within .gallery-controls button { opacity: 1; pointer-events: auto; }
.gallery-controls button:hover,
.gallery-controls button:focus-visible { border-color: var(--blue); }

.product-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  row-gap: 7px;
  align-items: start;
  align-content: start;
  min-width: 0;
  padding: clamp(13px, 1.2vw, 18px) var(--cell-info-pad-x) clamp(11px, 1vw, 15px);
  border-top: 1px solid var(--blue);
}

.product-kind {
  display: none;
}

.product-card h3 {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font: 600 clamp(.85rem, .9vw, .98rem)/1.4 var(--rounded);
  letter-spacing: -.005em;
}

.product-card h3 a { color: inherit; text-decoration: none; }
.product-card h3 a:hover,
.product-card h3 a:focus-visible { color: var(--blue); text-decoration: underline; text-underline-offset: .24em; }

.product-price {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  color: var(--ink);
  font-size: clamp(.78rem, .82vw, .9rem);
  font-weight: 400;
  letter-spacing: .01em;
}

.product-card > .buy-placeholder { display: none; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

html.has-product-modal { overflow: hidden; }

.product-modal {
  width: min(1500px, calc(100vw - 64px));
  height: min(860px, calc(100svh - 56px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  outline: 0;
  overflow: visible;
  background: transparent;
  opacity: 0;
  transform: translateY(28px) scale(.975);
  transition: opacity 180ms linear, transform 460ms cubic-bezier(.16, 1, .3, 1);
}

.product-modal::backdrop {
  background: rgb(244 246 250 / .82);
  backdrop-filter: blur(5px);
}

.product-modal[open].is-visible {
  opacity: 1;
  transform: none;
}

.product-modal__surface {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 1px;
  background: var(--blue);
  box-shadow: 0 28px 80px rgb(17 36 73 / .16);
}

.product-modal__close {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  min-width: 64px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--blue);
  background: var(--white);
  color: var(--blue);
  cursor: pointer;
  font: 600 .66rem/1 var(--rounded);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.product-modal__close:hover,
.product-modal__close:focus-visible {
  background: var(--blue);
  color: var(--white);
}

.product-modal__layout {
  display: grid;
  grid-template-areas: "media copy";
  grid-template-columns: minmax(0, 1.28fr) minmax(380px, .72fr);
  gap: 1px;
  width: 100%;
  height: 100%;
}

.product-modal__thumbs {
  grid-area: thumbs;
  display: none;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--paper);
  scrollbar-color: var(--rule) transparent;
  scrollbar-width: thin;
}

.product-modal__thumb {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 0;
  background: var(--white);
  cursor: pointer;
}

.product-modal__thumb:hover,
.product-modal__thumb:focus-visible,
.product-modal__thumb[aria-current="true"] { border-color: var(--blue); }

.product-modal__thumb:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: -3px;
}

.product-modal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-modal__media,
.product-modal__copy {
  min-width: 0;
  min-height: 0;
  background: var(--white);
}

.product-modal__media { grid-area: media; }

.product-modal__gallery {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.product-modal__gallery figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  width: 100%;
  height: 100%;
  padding: clamp(28px, 4vw, 62px);
  margin: 0;
  overflow: hidden;
}

.product-modal__gallery figure img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms cubic-bezier(.4, 0, .2, 1), visibility 0s linear 320ms;
}

.product-modal__gallery figure img.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.product-modal__layout[data-product="room307-memory-boy-cd"]
  .product-modal__gallery figure img[data-gallery-item="0"],
.product-modal__layout[data-product="room307-memory-boy-cd"]
  .product-modal__gallery figure img[data-gallery-item="2"] {
  transform: scale(1.52);
}

.product-modal__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: 300 1.35rem/1 var(--rounded);
  transform: translateY(-50%);
}

.product-modal__arrow:hover,
.product-modal__arrow:focus-visible { background: rgb(17 60 159 / .08); }
.product-modal__arrow--previous { left: 16px; }
.product-modal__arrow--next { right: 16px; }

.product-modal__count {
  position: absolute;
  bottom: 20px;
  left: 22px;
  z-index: 2;
  color: var(--blue);
  font: 600 .65rem/1 var(--rounded);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.product-modal__copy {
  grid-area: copy;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.product-modal__details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.product-modal__purchase,
.product-modal__information { padding: clamp(26px, 3vw, 40px); }

.product-modal__kind {
  margin: 0 0 12px;
  color: var(--blue);
  font: 600 .66rem/1 var(--rounded);
  letter-spacing: .09em;
  text-transform: uppercase;
}

.product-modal__copy h2 {
  margin: 0;
  color: var(--ink);
  font: 600 clamp(1.6rem, 2.3vw, 2.1rem)/1.16 var(--rounded);
  letter-spacing: -.025em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.product-modal__price {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: .9rem;
}

.product-modal__options {
  padding: 0;
  margin: 26px 0 0;
  border: 0;
}

.product-modal__options legend,
.product-modal__notes h3 {
  margin: 0 0 11px;
  color: var(--blue);
  font: 600 .66rem/1 var(--rounded);
  letter-spacing: .09em;
  text-transform: uppercase;
}

.product-modal__options > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-modal__options button {
  min-width: 44px;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--blue);
  background: var(--white);
  cursor: pointer;
  font: 600 .7rem/1 var(--rounded);
}

.product-modal__options button[aria-pressed="true"] {
  background: var(--blue);
  color: var(--white);
}

.product-modal__options button:disabled {
  cursor: not-allowed;
  opacity: .35;
  text-decoration: line-through;
}

.product-modal__buy {
  width: 100%;
  min-height: 46px;
  margin: 0;
  border: 1px solid var(--blue);
  background: var(--white);
  color: rgb(22 24 28 / .52);
  cursor: not-allowed;
  font: 600 .72rem/1 var(--rounded);
  letter-spacing: .055em;
  text-transform: uppercase;
}

.product-modal__buy:not(:disabled) {
  background: var(--blue);
  color: var(--white);
  cursor: pointer;
}

.product-modal__buy:not(:disabled):hover,
.product-modal__buy:not(:disabled):focus-visible {
  background: var(--ink);
}

.product-modal__information {
  flex: 1;
  border-top: 1px solid var(--blue);
}

.product-modal__action-footer {
  flex: 0 0 auto;
  padding: 20px clamp(26px, 3vw, 40px);
  border-top: 1px solid var(--blue);
  background: var(--white);
}
.product-modal__view-cart { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; color: var(--blue); font-size: .75rem; text-underline-offset: .2em; }
.product-modal__cart-message { margin: 0; font-size: .75rem; line-height: 1.4; overflow-wrap: anywhere; }
.product-modal__cart-message:empty { display: none; }
.product-modal__buy.is-added { animation: cart-added-confirm 480ms cubic-bezier(.2,.7,.2,1); }
.cart-add-flight { position: fixed; z-index: 20; width: 64px; height: 64px; object-fit: contain; pointer-events: none; background: #fff; border: 1px solid var(--blue); }
@keyframes cart-added-confirm { 0% { transform: scale(.97); } 55% { transform: scale(1.025); } 100% { transform: scale(1); } }

.product-modal__rail-count {
  display: none;
}

.product-modal__description,
.product-modal__notes {
  margin: 0;
  color: var(--ink);
  font-size: .86rem;
  line-height: 1.6;
}

.product-modal__description p { margin: 0 0 1em; }
.product-modal__description p:last-child { margin-bottom: 0; }
.product-modal__notes { margin-top: 24px; }
.product-modal__notes ul { padding-left: 1.1em; margin: 0; }
.product-modal__notes li + li { margin-top: 5px; }

@media (max-width: 70rem) {
  .product-grid,
  .shop-combined-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-controls { inset: 0; }
  .gallery-controls button {
    width: 34px;
    height: 44px;
    font-size: 1.3rem;
    font-weight: 300;
  }
  .gallery-controls [data-gallery-prev] { left: 2px; }
  .gallery-controls [data-gallery-next] { right: 2px; }
  .shop-combined-grid {
    display: block;
    padding: 0;
    background: transparent;
  }
  .shop-combined-grid > .product-grid { display: grid; }
  .shop-group + .shop-group { margin-top: 48px; }
  .shop-section-title-desktop { display: none; }
  .shop-section-title-mobile { display: inline; }
  .shop-mobile-subsection {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 16px;
    margin: 32px 0 16px;
    padding: 0;
    color: var(--blue);
    font: 600 .68rem/1 var(--rounded);
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  .shop-mobile-subsection::after {
    height: 1px;
    flex: 1;
    background: var(--blue);
    content: "";
  }

  .product-modal {
    width: calc(100vw - 12px);
    height: calc(100svh - 12px);
    max-height: none;
    overflow: hidden;
  }

  .product-modal__surface { height: 100%; min-height: 0; }
  .product-modal__layout {
    display: grid;
    grid-template-areas:
      "media"
      "copy";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(140px, 32svh, 320px) minmax(0, 1fr);
    height: 100%;
  }
  .product-modal__thumbs {
    flex-direction: row;
    gap: 8px;
    padding: 7px 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .product-modal__thumb {
    width: 48px;
    height: 48px;
    padding: 4px;
  }
  .product-modal__media { min-height: 0; }
  .product-modal__gallery figure { padding: 18px 24px; }
  .product-modal__close { top: 10px; left: 10px; }
  .product-modal__copy {
    overflow: hidden;
  }
  .product-modal__purchase,
  .product-modal__information { padding: 18px 20px; }
  .product-modal__copy h2 { font-size: clamp(1.45rem, 7vw, 1.9rem); }
  .product-modal__kind { margin-bottom: 8px; }
  .product-modal__price { margin-top: 8px; }
  .product-modal__options { margin-top: 16px; }
  .product-modal__action-footer { padding: 14px 20px 18px; }
  .product-modal__description,
  .product-modal__notes { font-size: .8rem; line-height: 1.5; }
  .product-modal__notes { margin-top: 16px; }
  .product-modal__count { bottom: 13px; left: 16px; }
  .product-modal__layout[data-product="room307-memory-boy-cd"]
    .product-modal__gallery figure img[data-gallery-item="0"],
  .product-modal__layout[data-product="room307-memory-boy-cd"]
    .product-modal__gallery figure img[data-gallery-item="2"] { transform: scale(1.72); }
}

@media (max-width: 60rem) and (max-height: 32rem) and (orientation: landscape) {
  .product-modal {
    width: calc(100vw - 12px);
    height: calc(100svh - 12px);
    overflow: hidden;
  }
  .product-modal__layout {
    grid-template-areas: "media copy";
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .product-modal__media { min-height: 0; }
  .product-modal__purchase,
  .product-modal__information { padding: 16px 20px; }
  .product-modal__copy h2 { font-size: 1.45rem; }
  .product-modal__action-footer { padding: 12px 20px; }
}

@media (hover: none) {
  .gallery-controls button { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .product-modal__buy.is-added { animation: none; }
  .product-gallery.is-ready figure img,
  .gallery-controls button,
  .product-modal,
  .product-modal__gallery figure img { transition: none; }
}
