/* ==========================================================================
   mobile.css — 手機／平板版（< 992px）重新編排
   所有規則都包在 max-width 斷點內，桌機版（≥ 992px）完全不受影響。
   ========================================================================== */

@media (max-width: 991.98px) {
  :root {
    --nav-h: 72px; /* 手機版導覽列高度（原本 112px，縮小讓內容多一點空間） */
  }

  /* ---------- 導覽列 ---------- */
  #templatemo_main_nav.navbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  #templatemo_main_nav > .container {
    min-height: 48px !important;
    padding-left: 1rem;
    padding-right: 0.5rem;
  }

  #templatemo_main_nav .navbar-brand {
    margin-left: 0 !important;
    font-size: clamp(16px, 5vw, 24px) !important;
    letter-spacing: 0.25em !important;
    min-width: 0;
  }

  #templatemo_main_nav .navbar-brand img {
    height: 32px !important;
    margin-right: 12px;
  }

  /* 桌機版的選單／社群／語言在手機上收起，改用抽屜 */
  #templatemo_main_nav > .container > .d-flex.flex-column {
    display: none !important;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }

  .nav-toggle:hover,
  .nav-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
  }

  .nav-toggle:focus-visible {
    outline: 2px solid rgb(216, 48, 140);
    outline-offset: 2px;
  }

  /* 三條線圖示 */
  .nav-toggle-bar,
  .nav-toggle-bar::before,
  .nav-toggle-bar::after {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }

  .nav-toggle-bar {
    position: relative;
  }

  .nav-toggle-bar::before,
  .nav-toggle-bar::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .nav-toggle-bar::before { top: -7px; }
  .nav-toggle-bar::after { top: 7px; }

  /* ---------- 抽屜選單（popover，位於最上層） ---------- */
  .mobile-nav {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(85vw, 340px);
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 1rem 1.25rem 2rem;
    border: 0;
    background: #000;
    color: #fff;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
    z-index: 10000; /* 只給不支援 popover 的瀏覽器用 */
  }

  .mobile-nav:popover-open {
    display: flex;
  }

  .mobile-nav.is-open {
    display: flex;
  }

  .mobile-nav::backdrop {
    background: rgba(0, 0, 0, 0.55);
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
  }

  .mobile-nav-title {
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 600;
    letter-spacing: 0.3em;
    font-size: 16px !important;
  }

  .mobile-nav-close {
    width: 48px;
    height: 48px;
    margin-right: -0.5rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 32px !important;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-nav-close:hover,
  .mobile-nav-close:focus-visible {
    background: rgba(255, 255, 255, 0.12);
  }

  .mobile-nav-list,
  .mobile-nav-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mobile-nav-list > li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .mobile-nav-list a,
  .mobile-nav-group > summary {
    display: flex;
    align-items: center;
    min-height: 52px;
    color: #fff;
    text-decoration: none;
    font-size: 18px !important;
    cursor: pointer;
  }

  .mobile-nav-list a:hover,
  .mobile-nav-list a:focus-visible,
  .mobile-nav-group > summary:hover {
    color: rgb(216, 48, 140);
  }

  .mobile-nav-group > summary {
    justify-content: space-between;
    list-style: none;
  }

  .mobile-nav-group > summary::-webkit-details-marker {
    display: none;
  }

  /* 展開提示箭頭 */
  .mobile-nav-group > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
  }

  .mobile-nav-group[open] > summary::after {
    transform: rotate(-135deg);
  }

  .mobile-nav-group ul {
    padding: 0 0 0.5rem 1rem;
  }

  .mobile-nav-group ul a {
    min-height: 44px;
    font-size: 16px !important;
    color: #ccc;
  }

  .mobile-nav-social {
    display: flex;
    gap: 0.5rem;
  }

  .mobile-nav-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: #fff;
    font-size: 26px !important;
  }

  .mobile-nav-social a:hover {
    color: rgb(216, 48, 140);
  }

  .mobile-nav-lang {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
  }

  .mobile-nav-lang .lang-btn {
    flex: 1;
    min-height: 44px;
    margin: 0;
    padding: 0 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-nav-lang .lang-btn.active-lang {
    border-color: rgb(216, 48, 140);
    background: rgb(216, 48, 140);
    cursor: default;
  }

  /* ---------- 導覽列下方的起始位置（配合較矮的導覽列） ---------- */
  .video-top-spacing {
    margin-top: var(--nav-h) !important;
  }

  .text-section {
    margin-top: var(--nav-h) !important;
  }

  .page-contact .form-container {
    margin-top: calc(var(--nav-h) + 40px) !important;
    margin-left: 16px !important;
    margin-right: 16px !important;
  }

  .page-redeem-chart .redeem-title {
    margin-top: calc(var(--nav-h) + 32px) !important;
  }

  .page-shop .container.py-5 {
    padding-top: calc(var(--nav-h) + 16px) !important;
  }

  .page-shop .col-lg-3 h1.h2 {
    margin-top: 16px;
  }

  .page-shop .col-lg-9 {
    padding-top: 16px;
  }

  .page-shop-single .col-lg-5 .card.mb-3 {
    margin-top: calc(var(--nav-h) + 16px) !important;
  }

  .page-shop-single .col-lg-5.mt-5,
  .page-shop-single .col-lg-7.mt-5 {
    margin-top: 1.5rem !important;
  }

  .page-shop-single .btn.btn-success.btn-lg {
    margin-top: 24px !important;
  }

  /* ---------- 頁尾連結：加大可點範圍 ---------- */
  #custom_footer ul.custom-footer-link-list li {
    padding-top: 0;
  }

  #custom_footer ul.custom-footer-link-list a {
    display: inline-block;
    padding: 8px 12px;
  }
}

/* ---------- 手機（≤ 768px）：版面改單欄 ---------- */
@media (max-width: 768px) {
  /* 首頁服務介紹：圖片在上、文字在下，一律靠左 */
  .highlight-section {
    margin: 48px auto;
    gap: 56px;
  }

  .highlight-row,
  .highlight-row.reverse {
    gap: 20px;
  }

  .highlight-image,
  .highlight-text,
  .highlight-row.reverse .highlight-text {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
  }

  .highlight-row.reverse .highlight-text {
    text-align: left;
  }

  .highlight-text h2 {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
    margin-bottom: 0.5rem;
  }

  .highlight-image:hover {
    transform: none;
  }

  /* 作品集：兩欄縮圖 */
  .image-section {
    margin-top: 100px;
    margin-bottom: 64px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .image-item {
    flex: 1 1 calc((100% - var(--gap)) / 2) !important;
    max-width: calc((100% - var(--gap)) / 2);
  }

  .text-section {
    height: 340px;
  }

  .section-content {
    padding: 0 8px;
  }

  .lightbox-close {
    top: 8px;
    right: 12px;
    width: 48px;
    height: 48px;
  }

  /* 商品輪播箭頭收進畫面內，避免水平捲動 */
  .carousel-control-prev {
    left: 4px !important;
  }

  .carousel-control-next {
    right: 4px !important;
  }

  /* 商店卡片：兩欄 */
  .page-shop .col-lg-9 .row > .col-12 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-left: 6px;
    padding-right: 6px;
  }

  .page-shop .card.h-100 {
    min-height: 0;
  }

  .page-shop .card-img-top-wrapper {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .page-shop .card-body {
    height: auto;
    padding: 12px 8px;
  }

  .page-shop .card-body a.h2 {
    font-size: 16px !important;
    margin-top: 4px;
  }

  .page-shop .card-text {
    font-size: 14px !important;
    margin-bottom: 4px !important;
  }

  /* 商品頁：減少大片留白 */
  .page-shop-single .card-body {
    padding: 20px !important;
  }

  .page-shop-single section.bg-light .container.pb-5 {
    padding-bottom: 1rem !important;
  }
}

/* 觸控裝置：hover 放大效果不需要 */
@media (max-width: 991.98px) and (hover: none) {
  .image-item:hover img,
  .image-item:hover video,
  .card:hover .card-img-top {
    transform: none;
  }
}
