/* Kept out of the desktop layout; enabled only in the mobile layout below. */
.packaging-mobile-marquee {
  display: none;
}

.footer-social-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.footer-contact-group {
  display: contents;
}

.packaging-backdrop-mobile {
  display: none !important;
}

@keyframes packaging-marquee-left {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

/* Use the opening's static regular-weight face for all three mobile copy groups. */
@font-face {
  font-family: MobileVerticalCopy;
  src: url("fonts/mobile-vertical-copy-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@media (max-width: 640px) {
  .brand-intro__vertical,
  #about .about-story > .side-lines,
  .brand-motto {
    font: 400 15px/1.5 MobileVerticalCopy, "Noto Serif TC", serif !important;
    letter-spacing: 6.95px !important;
    gap: 36px !important;
    color: #6F3332 !important;
  }
  #about .about-note {
    display: none !important;
  }

  #about .about-title {
    padding-bottom: 12px !important;
  }

  #about .about-story > .side-lines {
    margin: 50px 0 !important;
  }

  #about .about-first-copy + .about-row {
    margin-top: 14px !important;
  }

  .packaging-backdrop-desktop {
    display: none !important;
  }

  .packaging-backdrop-mobile {
    display: block !important;
    /* Keep the source image's translucent edge pixels outside the viewport. */
    width: calc(100vw + 4px) !important;
    margin-left: -22px !important;
  }

  .packaging-backdrop,
  .packaging-shade {
    transform: translateY(257px) !important;
  }

  .packaging .heading {
    margin-top: 78px !important;
  }

  .packaging .heading .en,
  .packaging .heading .zh {
    color: #6f3332 !important;
  }

  .packaging .heading .en {
    line-height: 1.35 !important;
  }

  .packaging .heading .zh {
    margin-top: 16px !important;
    font-size: 23px !important;
  }

  .packaging .heading .tick {
    margin: 18px auto !important;
    filter: brightness(0) saturate(100%) invert(22%) sepia(24%) saturate(1454%) hue-rotate(315deg) brightness(88%) contrast(91%) !important;
  }

  .packaging-shade {
    width: 100vw !important;
    height: 667px !important;
    max-width: none !important;
    object-fit: fill !important;
  }

  .packaging-copy {
    width: calc(100vw - 78px) !important;
    margin-top: 137px !important;
    margin-bottom: 60px !important;
    padding: 0 !important;
    font-family: NotoSerifTC, serif;
    font-size: 12px !important;
    font-weight: 400;
    line-height: 2.1 !important;
    letter-spacing: .12em !important;
  }

  .brand-motto {
    height: 430px !important;
    min-height: 0 !important;
    align-items: center !important;
    /* Balance the visible whitespace between the adjacent photographs. */
    padding-top: 40px !important;
    padding-bottom: 0 !important;
  }

  #reservation {
    padding-bottom: 90px !important;
  }

  footer .foot-logo {
    order: 1 !important;
  }

  footer {
    gap: 20px !important;
    padding-top: 36px !important;
    padding-bottom: 24px !important;
    padding-left: 39px !important;
    padding-right: 39px !important;
  }

  footer::before {
    left: 39px !important;
    right: 39px !important;
    border-top-width: 1px !important;
  }

  footer .footer-info,
  footer .footer-left,
  footer .footer-right {
    gap: 18px !important;
  }

  footer .footer-contact-group {
    display: flex;
    flex-direction: column;
    align-self: center;
    order: 2;
    width: 100%;
    gap: 20px;
    /* Center the visible text group while retaining its optical column offsets. */
    transform: translateX(5px);
  }

  footer .footer-row {
    grid-template-columns: 100px minmax(0, 1fr) !important;
    column-gap: 0 !important;
    align-items: start !important;
  }

  footer .footer-row > .foot-label,
  footer .footer-row > div,
  footer .footer-address-link,
  footer .footer-row small {
    min-width: 0;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
  }

  footer .footer-row > div {
    width: 100% !important;
  }

  footer .footer-row > .foot-label {
    font-size: 15.5px !important;
    transform: translateX(-3px) !important;
  }

  footer .footer-left .footer-row:nth-child(2) > .foot-label {
    transform: translate(-3px, 5px) !important;
  }

  footer .footer-left .footer-row > div,
  footer .footer-right > .footer-row:first-child > div {
    color: #000 !important;
    transform: translateX(-3px) !important;
  }

  footer .footer-left .footer-row:nth-child(2) > div {
    font-size: 16px !important;
    text-indent: 0;
  }

  footer .footer-right > .footer-row:nth-child(2) > div {
    color: #81797a !important;
  }

  footer .footer-row > .footer-social {
    column-gap: 14px !important;
    font-size: 14px !important;
    justify-content: flex-start !important;
    transform: translateX(-3px) !important;
  }

  footer .footer-social-item {
    gap: 4px;
  }

  footer .footer-social-item:first-child {
    transform: none;
  }

  footer .footer-social img {
    width: 22px !important;
    height: 22px !important;
  }

  footer .footer-row small,
  footer .footer-address-link small {
    color: #81797a !important;
    font-size: 10.2px !important;
  }

  footer .footer-left .footer-row:nth-child(2) small {
    transform: none !important;
    text-indent: 0;
  }

  footer .foot-logo {
    width: 84px !important;
    height: 121px !important;
    margin: 9px auto 25px !important;
    transform: translateX(17px) !important;
  }

  footer .footer-address-link {
    display: block;
    width: 100%;
    letter-spacing: 0 !important;
  }

  footer .footer-address-number {
    white-space: nowrap;
  }

  footer .footer-address-venue {
    display: block;
    /* Hang the full-width bracket so its visible edge aligns with 401. */
    text-indent: -.5em;
  }

  footer .footer-left {
    order: 2 !important;
  }

  footer .footer-right {
    order: 3 !important;
  }

  footer .foot-copy {
    order: 4 !important;
    width: 100% !important;
    align-self: center !important;
    text-align: center !important;
    color: #6f3332 !important;
    transform: none !important;
  }

  footer .foot-copy small {
    font-size: 9px !important;
    transform: translateY(-10px) !important;
  }

  .packaging-copy p {
    color: #fff !important;
  }

  .packaging .pack-grid {
    display: none !important;
  }

  .packaging-mobile-marquee {
    position: relative;
    z-index: 2;
    display: block !important;
    width: 100vw;
    margin: 0 0 28px -20px;
    padding-top: 40px;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
  }

  .packaging-mobile-marquee.is-dragging {
    cursor: grabbing;
  }

  .packaging-mobile-marquee__track {
    position: relative;
    z-index: 1;
    display: flex;
    width: max-content;
    will-change: transform;
    animation: packaging-marquee-left 38s linear infinite;
  }

  .packaging-mobile-marquee__group {
    display: flex;
    flex: none;
    gap: 10px;
    padding-right: 10px;
  }

  .packaging-mobile-marquee__group img {
    display: block;
    flex: 0 0 47.462625vw;
    width: 47.462625vw;
    max-width: 196.79625px;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    -webkit-user-drag: none;
  }

  .packaging-mobile-marquee.is-reveal-ready .packaging-mobile-marquee__group img {
    -webkit-mask-image: linear-gradient(110deg, #000 47%, transparent 53%);
    mask-image: linear-gradient(110deg, #000 47%, transparent 53%);
    -webkit-mask-size: 400% 100%;
    mask-size: 400% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: 100% 0;
    mask-position: 100% 0;
    filter: blur(8px);
    transition: -webkit-mask-position 3.2s cubic-bezier(.22, .61, .36, 1),
      mask-position 3.2s cubic-bezier(.22, .61, .36, 1),
      filter 1.7s cubic-bezier(.22, .61, .36, 1);
  }

  .packaging-mobile-marquee.is-revealed .packaging-mobile-marquee__group img {
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
    filter: none;
  }

  .hero-book {
    transition: opacity .12s linear !important;
  }

  html.mobile-booking-hidden .hero-book {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .hero-book .rule {
    transition: transform 1.2s cubic-bezier(.22, .61, .36, 1) !important;
  }

  #products .product-hover-detail:after {
    font-size: 14.5px !important;
  }

  #products .product-progress {
    width: calc((100vw - 95px) * 1.1) !important;
    margin-inline: auto !important;
  }

  #products .product-progress:before {
    transform: translateX(var(--product-progress-mobile-x, 0px)) !important;
  }

  #products .product-hover-detail .product-hover-rule {
    width: 34px !important;
    height: 3px !important;
    background: url("資產 41.png") center / contain no-repeat !important;
    opacity: 1 !important;
  }

  .story-banner .experience-title .en,
  .experience .banner .experience-title .en {
    font-size: 26px !important;
    line-height: 1.35 !important;
  }

  .story-banner .experience-title .zh,
  .experience .banner .experience-title .zh {
    font-size: 23px !important;
    line-height: 1.6 !important;
    letter-spacing: .4em !important;
  }

  .story-banner .experience-title img.experience-rule:first-of-type,
  .experience .banner .experience-title img.experience-rule:first-of-type {
    top: 46% !important;
  }

  .story-banner .experience-title img.experience-rule:last-of-type,
  .experience .banner .experience-title img.experience-rule:last-of-type {
    top: 63% !important;
  }

  #about .story-esg-heading h2 {
    font-size: 16px !important;
  }

  footer .foot-logo {
    grid-row: 1 !important;
  }

  footer .footer-left {
    grid-row: 2 !important;
  }

  footer .footer-right {
    grid-row: 3 !important;
  }

  #products .product-side-en {
    left: calc(50% - 46px) !important;
  }

  #products .product-side-zh {
    left: calc(50% + 6px) !important;
    top: 80px !important;
    gap: 13px !important;
  }

  #products .product-meta {
    display: none !important;
  }

  #products .cards-window {
    margin-top: 40px !important;
    height: min(calc((100vw - 95px) * 1.65), 462px) !important;
    padding-inline: calc((100vw - (100vw - 95px) * 1.1) / 2) !important;
    clip-path: none !important;
  }

  #products .card {
    flex-basis: calc((100vw - 95px) * 1.1) !important;
    width: calc((100vw - 95px) * 1.1) !important;
  }

  #products .cards-window .card img {
    cursor: zoom-in;
  }

  #products .cards-window .card.is-hovered img {
    filter: none !important;
  }

  #products .cards-window .product-title-copy small {
    top: 25px !important;
  }

  #products .product-hover-detail:after {
    font-size: 14.2px !important;
  }

  #products .product-hover-detail .product-hover-rule {
    width: 44.18px !important;
    height: 11.61px !important;
    margin-top: 4.75px !important;
    background: url("readmore-button.svg") center / contain no-repeat !important;
  }

  .product-lightbox[hidden] {
    display: none !important;
  }

  .product-lightbox {
    position: fixed;
    z-index: 1200;
    inset: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 28px 0;
    background: #000;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  .product-lightbox__panel {
    box-sizing: border-box;
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    width: 76vw;
    max-width: 380px;
    height: auto;
    aspect-ratio: 2 / 3;
    min-height: 0;
    max-height: calc(100vh - 190px);
    overflow: hidden;
    touch-action: none;
    padding: 28px 10px 20px;
    background: #fff;
    color: #171514;
    text-align: center;
  }

  .product-lightbox__number {
    flex: none;
    margin: 0;
    color: #6F3332;
    font: 13.8px/1.4 Crimson, Georgia, serif;
  }

  .product-lightbox__name-zh {
    flex: none;
    margin: 20px 0 0;
    color: #6F3332;
    font: 400 21.85px/1.5 "Noto Serif TC", serif;
    letter-spacing: .18em;
  }

  .product-lightbox__name-en {
    flex: none;
    margin: 0;
    color: #6F3332;
    font: 14.95px/1.4 Crimson, Georgia, serif;
    letter-spacing: .02em;
  }

  .product-lightbox__number,
  .product-lightbox__name-zh,
  .product-lightbox__name-en {
    width: 100%;
    text-align: center;
  }

  .product-lightbox__number {
    transform: translateY(15px);
  }

  .product-lightbox__name-zh {
    transform: translateY(5px);
  }

  .product-lightbox__name-en {
    transform: translateY(10px);
  }

  .product-lightbox__divider {
    flex: none;
    width: 90%;
    height: 0;
    margin: 33px 0 20px;
    border-top: .15px solid rgba(111, 51, 50, .5);
  }

  .product-lightbox__description {
    box-sizing: border-box;
    width: 90%;
    margin: 0 auto;
    color: #81797a;
    font: 400 13.5px/2.25 "Noto Serif TC", serif;
    letter-spacing: .16em;
    text-align: center;
    text-wrap: balance;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .product-lightbox__close {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 46px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: #fff;
    font: 16px/1 Crimson, Georgia, serif;
    cursor: pointer;
    transform: translateY(30px) scale(1.05);
  }

  .product-lightbox__close img {
    display: block;
    width: 38px;
    height: 46px;
    object-fit: contain;
  }

  .product-lightbox__close span {
    transform: translate(-10px, -5px);
  }

  .product-lightbox__close:focus-visible {
    outline: none;
  }

  .product-lightbox__close:focus-visible span {
    text-decoration: underline;
    text-underline-offset: 5px;
  }
}

/* Match the Play Film opening fade; replay whenever the dialog is shown. */
@keyframes product-lightbox-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .product-lightbox:not([hidden]) {
    animation: product-lightbox-fade-in 1.3s cubic-bezier(.22, .61, .36, 1) both;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .packaging-mobile-marquee__track {
    animation: none !important;
  }

  .packaging-mobile-marquee.is-reveal-ready .packaging-mobile-marquee__group img {
    -webkit-mask-image: none !important;
    mask-image: none !important;
    transition: none !important;
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .hero-book,
  .hero-book .rule {
    transition: none !important;
  }
}

/* Reveal the three vertical motto lines as they enter the mobile viewport. */
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .brand-motto span.isuru-reveal-text {
    opacity: 0 !important;
    filter: blur(7px) !important;
    transition: opacity 1.9s ease, filter 1.9s cubic-bezier(.22, .61, .36, 1) !important;
    will-change: opacity, filter;
  }

  .brand-motto span.isuru-reveal-text:nth-child(2) {
    transition-delay: .12s !important;
  }

  .brand-motto span.isuru-reveal-text:nth-child(3) {
    transition-delay: .24s !important;
  }

  .brand-motto span.isuru-reveal-text.is-revealed {
    opacity: 1 !important;
    filter: blur(0) !important;
  }
}
