/* SHENYO V5.23 — local-only responsive improvements for storefront and works.
   Preserves backend, product media, album data and checkout behavior. */

/* All storefront-style headers: when a real, uploaded logo is in use, hide
   the adjacent wordmark on phones. Retain the wordmark if no image exists. */
@media (max-width: 600px) {
  .headin > .logo:has(> .site-logo-image:not(.hidden)) > #site-wordmark {
    display: none !important;
  }
  .headin > .logo {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
  }
  .headin > .logo > .site-logo-image:not(.hidden) {
    display: block;
    width: auto;
    height: auto;
    max-height: 44px;
    max-width: min(154px, 42vw);
    flex: 0 1 auto;
    object-fit: contain;
  }
  .headin > .actions { flex: 0 0 auto; min-width: 0; }
  .headin { width: 100%; min-width: 0; box-sizing: border-box; gap: 5px; }
  /* The portfolio has more text links than the storefront: keep them usable. */
  #showcase-site-header .actions { gap: 4px; }
  #showcase-site-header .actions .admin-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0 !important;
    padding: 0 2px;
    border: 0;
    min-width: 34px;
  }
  #showcase-site-header .actions .admin-link::after {
    content: '會員';
    font-size: 11px;
    font-weight: 700;
  }
  #showcase-site-header .sc-works-link { font-size: 11px; }
  .headin, .head, .showcase-container { max-width: 100%; }
}

/* Make the mobile homepage intentionally two columns, matching the desktop
   composition instead of stacking text above the slideshow. Use contain for
   uploaded hero photography so no part of the designed image is cut off. */
@media (max-width: 650px) {
  .wrap > .hero {
    display: grid;
    grid-template-columns: minmax(0, 45%) minmax(0, 55%);
    min-height: 240px;
    height: auto;
    width: auto;
    max-width: calc(100% + 28px);
    overflow: hidden;
    align-items: stretch;
  }
  .wrap > .hero .hero-copy {
    min-width: 0;
    width: 100%;
    padding: 19px 11px 20px 17px;
    justify-content: center;
    box-sizing: border-box;
  }
  .wrap > .hero #hero-title {
    font-size: clamp(17px, 4.8vw, 27px);
    line-height: 1.32;
    letter-spacing: 0;
    margin: 0 0 9px;
    overflow-wrap: anywhere;
  }
  .wrap > .hero #hero-desc {
    font-size: clamp(10px, 2.65vw, 13px);
    line-height: 1.58;
    margin: 0 0 14px;
    overflow-wrap: anywhere;
  }
  .wrap > .hero #hero-eyebrow {
    font-size: 9px;
    line-height: 1.45;
    letter-spacing: .1em;
    overflow-wrap: anywhere;
    margin-bottom: 8px;
  }
  .wrap > .hero .primary {
    font-size: clamp(10px, 2.6vw, 12px);
    min-height: 35px;
    max-width: 100%;
    padding: 8px 10px;
    text-align: center;
    white-space: normal;
    line-height: 1.3;
  }
  .wrap > .hero .hero-slide-dots {
    gap: 4px;
    margin-top: 9px;
    min-height: 5px;
    max-width: 100%;
    flex-wrap: wrap;
  }
  .wrap > .hero .hero-slide-dots button { width: 15px; height: 5px; }
  .wrap > .hero .hero-slide-dots button.on { width: 24px; }
  .wrap > .hero .hero-image {
    min-width: 0;
    width: 100%;
    min-height: 240px;
    height: 100%;
    align-self: stretch;
    overflow: hidden;
  }
  .wrap > .hero .hero-image.hero-has-photo .hero-banner-photo {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    object-position: center;
  }
  .wrap > .hero .hero-image .hero-obj { width: min(118px, 25vw); height: min(118px, 25vw); }
}
@media (max-width: 359px) {
  .wrap > .hero { grid-template-columns: minmax(0, 47%) minmax(0, 53%); }
  .wrap > .hero .hero-copy { padding: 15px 8px 16px 12px; }
  .wrap > .hero #hero-title { font-size: 17px; }
  .wrap > .hero #hero-desc { font-size: 10px; }
  .wrap > .hero .primary { padding: 7px 8px; }
}

/* Works gallery: cap both preview cards and their image frames to the
   available content area, regardless of an admin-defined desktop card size. */
@media (max-width: 650px) {
  .showcase-container { width: 100%; min-width: 0; padding-inline: 14px; }
  .showcase-layout { width: 100%; min-width: 0; grid-template-columns: minmax(0,1fr); }
  .showcase-main, .showcase-grid, .showcase-node-gallery, .sc-craft-feature { min-width: 0; max-width: 100%; }
  .showcase-grid, .showcase-grid.sc-level-brand, .showcase-grid.sc-level-type {
    grid-template-columns: repeat(2,minmax(0,1fr));
    width: 100%;
    gap: 14px 10px;
  }
  .showcase-grid .sc-card, .showcase-grid .sc-card-photo {
    display: block;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  .showcase-grid .sc-card-photo { aspect-ratio: 1 / 1; overflow: hidden; }
  .showcase-grid .sc-card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
  }
  .showcase-grid .sc-card-title { max-width: 100%; overflow-wrap: anywhere; }
  .showcase-sidebar #showcase-tree { flex-wrap: wrap; overflow-x: visible; }
  .sc-craft-carousel {
    width: min(100%, 380px);
    max-width: 100%;
    margin-inline: auto;
  }
  .sc-craft-photo-frame {
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: min(75svh, 380px);
    overflow: hidden;
  }
  .sc-craft-photo-frame img {
    width: 100%; height: 100%; max-width: 100%; max-height: 100%;
    object-fit: contain;
  }
  .showcase-node-gallery>div,
  .showcase-node-gallery.sc-brand-gallery>div {grid-template-columns: repeat(2,minmax(0,1fr));width:100%;max-width:100%;}
  .showcase-node-gallery img { width: 100%; max-width: 100%; height:auto; object-fit:contain; }
  .sc-modal-backdrop { padding: 10px; }
  .sc-dialog { width: 100%; max-width: 100%; padding: 27px 12px; }
  .sc-detail, .sc-detail-photos, .sc-detail-image { min-width: 0; max-width: 100%; }
}
