/* SHENYO V5.22 — responsive storefront and consistent product CTAs.
   Visual-only changes. No inventory, checkout, cart, member or database logic. */

/* Equal-height grid tiles: keep the purchase/quote action at the same vertical
   position for every product within its grid row, without truncating the name. */
#catalog #grid > .tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#catalog #grid > .tile > .photo {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}
#catalog #grid > .tile > .details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}
#catalog #grid .details > .brandline,
#catalog #grid .details > h3,
#catalog #grid .details > .sub,
#catalog #grid .details > .price {
  overflow-wrap: anywhere;
}
#catalog #grid .details > .small-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex: 0 0 auto;
  min-height: 39px;
  margin-top: auto;
  text-align: center;
  max-width: 100%;
  white-space: normal;
}

/* Mobile layout must fit the physical viewport, not a wider desktop canvas. */
@media (max-width: 790px) {
  html, body {
    max-width: 100%;
    overflow-x: clip;
  }
  .head, .headin, .wrap, .shop, .catalog-content,
  #catalog, #grid, #brand-tabs, #coupon-section {
    max-width: 100%;
    min-width: 0;
  }
  .headin {
    box-sizing: border-box;
    width: 100%;
  }
  .headin > .logo {
    min-width: 0;
    flex: 1 1 0;
    overflow: hidden;
  }
  .headin .logo #site-wordmark {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .headin .logo .site-logo-image {
    min-width: 0;
    flex-shrink: 1;
  }
  .headin > .actions {
    flex: 0 0 auto;
    min-width: 0;
  }
  #catalog #grid, #catalog .shop.no-filters #grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  #catalog #grid > .tile .details > h3 {
    min-height: calc(1.45em * 2);
  }
  #catalog #grid > .tile .brandline {
    min-height: calc(1.5em * 2);
  }
  #catalog #grid > .tile .details > .sub {
    min-height: 1.6em;
  }
  #catalog #grid .details > .price {
    margin-bottom: 12px;
  }
  /* Brand shortcuts should wrap in the viewport, not force a horizontal bar. */
  .shop-shortcuts {
    flex-wrap: wrap;
    overflow: visible;
    width: 100%;
    max-width: 100%;
  }
  .shop-shortcuts > .short {
    white-space: normal;
    text-align: center;
  }
  .nav-mega-inner {max-width: 100%;}
  .nav-mega-columns {min-width: 0;}
  .modal, .drawer {max-width: 100vw;}
}

@media (max-width: 480px) {
  .headin {gap: 4px; padding-inline: 12px;}
  .headin > .actions {gap: 1px;}
  .headin > .actions .i-btn {
    width: 32px;
    height: 36px;
    flex: 0 0 32px;
  }
  /* Preserve member access but shorten the label on narrow phone screens. */
  .headin > .actions #admin-entry {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    font-size: 0 !important;
    white-space: nowrap;
  }
  .headin > .actions #admin-entry::after {
    content: '會員';
    font-size: 11px;
    font-weight: 750;
  }
  .headin .logo .seal {flex-shrink: 0;}
  .headin .logo .site-logo-image {
    max-width: min(130px, 37vw);
    max-height: 42px;
    height: auto;
  }
  .headin .logo #site-wordmark {max-width: 100%;}
  .headin .logo #site-name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .headin .logo #site-subtitle {font-size: 7px;letter-spacing: .05em;}
  .shop-shortcuts {gap: 7px; padding-top: 16px;}
  .shop-shortcuts > .short {padding: 9px 11px; font-size: 12px;}
  #catalog .shop, #catalog .catalog-content {min-width: 0; width: 100%;}
  #catalog #grid, #catalog .shop.no-filters #grid {
    gap: 24px 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #catalog #grid > .tile > .details {padding: 12px 1px 0;}
  #catalog #grid .details > .price {
    font-size: 12px;
    line-height: 1.65;
    overflow-wrap: anywhere;
  }
  #catalog #grid .details > .small-act {
    padding: 9px 11px;
    min-height: 38px;
    font-size: 12px;
  }
}

@media (max-width: 359px) {
  .headin .logo {gap: 6px;}
  .headin .logo .seal {width: 28px;height: 28px;font-size: 17px;}
  .headin .logo #site-name {font-size: 12px;letter-spacing: 0;}
}
