/* 不經 Tailwind 編譯的樣式，由 lib/enqueue-assets.php 在 build/index.css 之後載入，
 * 修改後不需 npm run build；同名 class 會覆蓋 build/index.css 的設定。
 */

/* === Header 圖示（header.php .header-icons）===
 * 圖示 SVG 是「圓形＋下方文字」，上方補一段與文字等高的留白，讓圓形對齊 header 中線（與 logo、漢堡選單同高）。
 * max-width: none：避免手機版空間不足時圖示被壓成 0 寬、擠出畫面。
 */

/* 左右兩側等寬、logo 置中於畫面；畫面過窄時 logo 先縮小，兩側不被壓縮 */
.header-side {
  flex: 1 1 0;
}

.header-logo {
  flex: 0 1 auto;
  min-width: 0;
}

.header-icons {
  align-items: flex-start;
  padding-top: 14px;
}

.header-icons img {
  max-width: none;
}

/* threads.svg 原檔 42×53，放大到與 instagram.svg（44px 寬）一樣大 */
.header-icons .header-icon-threads {
  width: 44px;
  height: auto;
}

/* map.svg 原檔 61×62，縮到與其他圖示（56px 高）一樣高 */
.header-icons .header-icon-map {
  width: auto;
  height: 56px;
}

/* === 手機右側「台湾おさんぽマップ」按鈕（header.php .side-map-button）===
 * 只在手機顯示，固定貼齊畫面右緣、垂直置中；
 * z-index 低於 header（z-30），漢堡選單打開時會被遮住。
 */
.side-map-button {
  display: none;
}

@media (max-width: 767px) {
  .side-map-button {
    display: block;
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 20;
    transform: translateY(-50%);
  }

  .side-map-button img {
    width: 36px;
    height: auto;
  }

  /* 內容左右各再往內 24px（加上原本的 px-4 共 40px），避開右側 36px 寬的按鈕；左右對稱維持置中。
   * 特設頁（.map-page）用 header-map.php，沒有這顆按鈕，不需要。 */
  main:not(.map-page) {
    padding-right: 24px;
    padding-left: 24px;
  }

  /* 首頁輪播維持滿版，抵銷上面的內距 */
  main .fv-carousel {
    margin-right: -24px;
    margin-left: -24px;
  }

  /* 輪播滿版，但標籤與標題跟其他內文一樣距畫面邊緣 40px，避開右側按鈕 */
  main .fv-carousel__label {
    left: 40px;
  }

  main .fv-carousel__title {
    padding-right: 40px;
    padding-left: 40px;
  }
}

@media (max-width: 767px) {
  .header-icons {
    padding-top: 11.5px;
  }

  .header-icons img {
    width: 36px;
    height: auto;
  }
}

/* === 區塊標題（.section-title）：灰字＋左側圖示 === */
.section-title {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  background: none;
  border-radius: 0;
  color: #4d4d4d;
  font-weight: 300;
  letter-spacing: 0.2em;
}

.section-title::before {
  content: "";
  flex: none;
  width: 32px;
  height: 34px;
  background: url("../images/title_icon.svg") center / contain no-repeat;
}

/* 手機首頁：標題與下方內容拉近 10px（mb-16 的 64px → 54px）；字從 30px 縮到 24px，長的特輯名稱比較不會換行 */
@media (max-width: 767px) {
  .home .section-title {
    font-size: 24px;
    letter-spacing: 0.12em;
  }

  .home .section-title.mb-16 {
    margin-bottom: 54px;
  }

  .home .section-title::before {
    width: 26px;
    height: 28px;
  }
}

/* === 文章縮圖圓角：模板上的 rounded-[20px] 統一改為 5px === */
img.rounded-\[20px\] {
  border-radius: 5px;
}

/* === footer === */
.site-footer {
  padding-top: 48px;
  padding-bottom: 32px;
  letter-spacing: 0.05em;
}

/* 欄位區與版權之間 */
.site-footer .flex-wrap {
  margin-bottom: 24px;
}

/* 大標：粗一階（400 → 500） */
.site-footer h3 {
  margin-bottom: 16px;
  font-weight: 500;
}

/* 選單項目：細一階（300 → 200），行距加大 */
.site-footer #menu-footer1 li,
.site-footer #menu-footer2 li {
  font-weight: 200;
  line-height: 2;
}

/* SNS 圖示間距 */
.site-footer .flex-nowrap li {
  padding-right: 16px;
}

/* === 首頁輪播（template-parts/carousel.php）=== */

.fv-carousel {
  position: relative;
}

/* 外框圓角：卡片不貼齊螢幕邊緣（≥1152px）時才加 */
@media (min-width: 1152px) {
  .fv-carousel__slide {
    border-radius: 8px;
  }
}

/* 左右按鈕：灰底圓形 arrow.svg（朝左），下一張旋轉 180 度 */
.fv-carousel .swiper-button-prev,
.fv-carousel .swiper-button-next {
  width: 41px;
  height: 41px;
  margin-top: -20.5px;
  background: url("../images/arrow.svg") center / contain no-repeat;
}

.fv-carousel .swiper-button-next {
  transform: rotate(180deg);
}

.fv-carousel .swiper-button-prev::after,
.fv-carousel .swiper-button-next::after,
.fv-carousel .swiper-button-prev svg,
.fv-carousel .swiper-button-next svg {
  display: none;
}

/* 畫面夠寬時按鈕移到卡片外側（41px 按鈕 + 20px 間距） */
@media (min-width: 1280px) {
  .fv-carousel .swiper-button-prev {
    left: -61px;
  }

  .fv-carousel .swiper-button-next {
    right: -61px;
  }
}

/* 標籤：灰底白字 */
.fv-carousel__label {
  position: absolute;
  top: 0;
  left: 16px;
  padding: 10px 20px;
  background: #4d4d4d;
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

/* 標題 */
.fv-carousel__title {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0 16px 24px;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.85;
  letter-spacing: 0.1em;
  text-align: left;
}

@media (min-width: 768px) {
  .fv-carousel__label {
    left: 40px;
  }

  .fv-carousel__title {
    padding: 0 40px 40px;
    font-size: 20px;
  }
}

/* 手機版文字區：288px → 180px，標題最多 3 行，避免撞到上方標籤。
 * 底部留白改用 margin：line-clamp 截掉的行會露在 padding 裡。 */
@media (max-width: 767px) {
  .fv-carousel__panel {
    height: 180px;
  }

  .fv-carousel__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    padding-bottom: 0;
    margin-bottom: 24px;
  }

  /* 照片固定 200px 高，箭頭對準照片中間，不壓到下方標籤 */
  .fv-carousel__panel + img {
    height: 200px;
  }

  /* 手機不放左右按鈕，改用下方點點提示可以滑動（src/js/carousel-dots.js） */
  .fv-carousel .swiper-button-prev,
  .fv-carousel .swiper-button-next {
    display: none;
  }

  .fv-carousel__dots {
    display: flex;
    justify-content: center;
    margin-top: 12px;
  }
}

/* 電腦版用左右按鈕，不顯示點點 */
@media (min-width: 768px) {
  .fv-carousel__dots {
    display: none;
  }
}

/* 點擊範圍 24px，看得到的圓點 8px，目前這張拉長成 20px */
.fv-carousel__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.fv-carousel__dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  transition: background-color 0.2s, width 0.2s;
}

.fv-carousel__dot.is-active::before {
  width: 20px;
  border-radius: 4px;
  background: #4d4d4d;
}

/* === Coupon 卡片（template-parts/coupon-card.php）===
 * 外框是固定比例的 SVG 背景，文字與照片以百分比定位在外框上。
 * 卡片寬度 < 440px 用 coupon_mb.svg（無 COUPON 欄），≥ 440px 用 coupon.svg。
 */
/* 首頁這一排的父層是置中排版（items-center），要撐滿整列，否則 container-type 會讓寬度算成 0 */
.coupon-list {
  align-self: stretch;
}

.coupon-item {
  container-type: inline-size;
}

.coupon-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 506px;
  margin: 0 auto;
  aspect-ratio: 416 / 225;
  background: url("../images/coupon_mb.svg") center / 100% 100% no-repeat;
  color: #d1684f;
  transition: transform 0.2s ease;
}

.coupon-card:hover {
  transform: translateY(-2px);
}

.coupon-card__text {
  position: absolute;
  top: 12.4%;
  bottom: 12.4%;
  left: 6.7%;
  width: 42%;
  overflow: hidden;
}

.coupon-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: clamp(14px, 4.2cqw, 18px);
  line-height: 1.5;
  letter-spacing: 0.1em;
}

.coupon-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  /* 分隔線放在說明的上緣；放在標題下緣的話，line-clamp 截掉的第 3 行會露在 padding 裡 */
  margin-top: 0.5em;
  padding-top: 0.7em;
  border-top: 2px solid #d1684f;
  font-size: clamp(12px, 3.4cqw, 14px);
  line-height: 1.7;
  letter-spacing: 0.08em;
}

.coupon-card__photo {
  position: absolute;
  top: 12.4%;
  left: 52.6%;
  width: 40.6%;
  height: 75.1%;
}

.coupon-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@container (min-width: 440px) {
  .coupon-card {
    aspect-ratio: 506 / 224;
    background-image: url("../images/coupon.svg");
  }

  .coupon-card__text {
    top: 15%;
    bottom: 12.5%;
    left: 24.1%;
    width: 28.1%;
  }

  .coupon-card__title {
    font-size: clamp(14px, 3.2cqw, 18px);
  }

  .coupon-card__excerpt {
    font-size: clamp(12px, 2.6cqw, 14px);
  }

  .coupon-card__photo {
    top: 12.5%;
    left: 56.7%;
    width: 32.8%;
    height: 74.1%;
  }
}

/* === 作者頁（author.php）：頭像＋名字＋簡介 === */
.author-profile {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.author-profile__avatar {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 50%;
}

.author-profile__bio {
  margin-top: 16px;
  color: #4d4d4d;
  line-height: 1.9;
  letter-spacing: 0.05em;
}

@media (max-width: 767px) {
  .author-profile {
    flex-direction: column;
    align-items: center;
    text-align: left;
  }
}
