/**
 * 響應式樣式 (RWD)
 * @package mytheme
 */

/* Hero 首圖 RWD 切換 */
.hero-img-desktop {
  display: block;
  width: 100%;
  height: auto;
}

.hero-img-mobile {
  display: none;
  width: 100%;
  height: auto;
}

.menu-toggle {
}

.hamburger-icon {
  position: relative;
}

/* 大螢幕設備 (max-width: 1440px) */
@media (max-width: 1440px) {
  .container {
    margin: 0 auto;
    justify-items: center;
  }
}

/* 平板設備 (max-width: 1024px) */
@media (max-width: 1024px) {
}

/* ========================================
   行動版 Header & 漢堡選單 (max-width: 992px)
   ======================================== */
@media (max-width: 1024px) {
  /* 手機版估價諮詢按鈕 */
  .mobile-cta {
    display: inline-block;
    margin-left: auto;
    margin-right: 8px;
    padding: 2px 14px;
    font-size: 12px;
    color: #53bf6f;
    border: 1px solid #53bf6f;
    border-radius: 60px;
    text-decoration: none;
    white-space: nowrap;
    transition:
      background 0.2s ease,
      color 0.2s ease;
  }

  .mobile-cta:hover {
    background: #53bf6f;
    color: #fff;
  }

  /* 顯示漢堡按鈕 */
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    z-index: 1001;
    background-color: var(--color-primary);
  }

  /* 漢堡圖示：三條線 */
  .hamburger-icon,
  .hamburger-icon::before,
  .hamburger-icon::after {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #fff;
    transition: background-color 0.3s ease, transform 0.3s ease;
  }

  .hamburger-icon {
    position: relative;
  }

  .hamburger-icon::before,
  .hamburger-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .hamburger-icon::before {
    top: -6px;
  }

  .hamburger-icon::after {
    top: 6px;
  }

  /* 展開時：背景改為 #316EAC，內部三條線隱藏，改用 SVG 背景圖 */
  .menu-toggle[aria-expanded="true"] {
    background-color: #316eac;
    background-image: url("../images/menu-toggle-open.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
  }

  .menu-toggle[aria-expanded="true"] .hamburger-icon,
  .menu-toggle[aria-expanded="true"] .hamburger-icon::before,
  .menu-toggle[aria-expanded="true"] .hamburger-icon::after {
    background-color: transparent;
    transform: none;
  }

  /* Header 高度調整 */
  .site-header {
    height: 45px;
  }

  .site-logo img.custom-logo {
    max-height: 42px !important;
  }

  /* 遮罩層 */
  .slide-menu-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
    z-index: 997;
  }

  .slide-menu-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* 頂部下拉選單：由 header 下方滿版滑出 */
  .slide-menu {
    display: block;
    position: fixed;
    top: 45px;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    z-index: 998;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-top: 0;
    border-top: none;
    border-bottom: none;
  }

  .slide-menu.active {
    max-height: 100vh;
  }

  /* 隱藏內建關閉鈕：漢堡按鈕本身已切換為 open 圖示 */
  .slide-menu-header {
    display: none;
  }

  /* 選單項目 */
  .slide-menu-list {
    list-style: none;
    margin: 0;
    padding: 15px 0;
    text-align: center;
  }

  .slide-menu-list li {
    border-bottom: 1px solid #c0c0c0;
  }

  .slide-menu-list li:last-child {
    border-bottom: none;
  }

  .slide-menu-list a {
    display: block;
    padding: 18px 20px;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .slide-menu-list a:hover,
  .slide-menu-list .current-menu-item > a,
  .slide-menu-list .current_page_item > a {
    background: transparent;
    color: var(--color-primary);
    font-weight: 600;
  }

  /* body margin 配合 header 高度 */
  body {
    margin-top: 45px;
  }
}

/* 手機設備 (max-width: 480px) */
@media (max-width: 480px) {
  .container {
    position: relative;
    width: 100%;
    max-width: 327px;
    padding: 0;
    margin: 0 auto;
  }

  /* Banner 調整 */
  .banner-section {
    padding: 0;
    min-height: auto;
  }

  .banner-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-md);
  }

  .banner-description {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-lg);
  }

  .banner-content {
    padding: 0;
  }

  .hero-img-desktop {
    display: none;
  }

  .hero-img-mobile {
    display: block;
  }

  /* Section 調整 */
  section {
    padding: 0;
  }

  /* Grid 調整 */
  .features-grid,
  .articles-grid,
  .team-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* 按鈕調整 */
  .btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
  }

  .btn-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-base);
  }

  /* 行動導覽 */
  .thankyou-actions,
  .error-actions {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .thankyou-actions .btn,
  .error-actions .btn {
    width: 100%;
  }

  /* 表格調整 */
  table {
    font-size: var(--font-size-sm);
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* 麵包屑導航 */
  .breadcrumb {
    font-size: 0.75rem;
    padding: var(--spacing-sm);
  }

  /* 圖片調整 */
  .article-card__image {
    height: 9.375rem;
  }

  /* 404 / 感謝頁 */
  .error-icon {
    font-size: 4rem;
  }

  .error-title {
    font-size: var(--font-size-2xl);
  }

  .thankyou-icon {
    font-size: 3rem;
  }

  .thankyou-title {
    font-size: var(--font-size-2xl);
  }

  /* Social Icons */
  .social-icons {
    justify-content: center;
  }

  /* Info Items */
  .info-item {
    text-align: center;
  }

  /* Google Map */
  .contact-map iframe {
    height: 18.75rem;
  }

  /* 聯絡頁面、文章列表和關於我們 */
  .contact-hero,
  .archive-hero,
  .about-hero-section {
    padding: var(--spacing-2xl) 0;
    margin-bottom: var(--spacing-2xl);
  }

  .contact-hero h1,
  .archive-hero h1,
  .about-hero-section h1 {
    font-size: var(--font-size-3xl);
  }

  .contact-hero p,
  .archive-hero p,
  .about-hero-section p {
    font-size: var(--font-size-base);
  }
}

/* 打印樣式 */
@media print {
  body {
    background: white;
    color: black;
  }

  .site-header,
  .site-footer,
  .menu-toggle,
  .breadcrumb,
  .pagination-wrapper,
  .error-actions,
  .thankyou-actions {
    display: none;
  }

  a {
    text-decoration: underline;
  }

  img {
    max-width: 100%;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    page-break-after: avoid;
  }

  p,
  li {
    page-break-inside: avoid;
  }
}
