/* ==========================================================================
   page-locations.css — 展售據點 專屬樣式（依設計稿 279:14075）
   區塊：
     1. 內頁 Hero（高度 / 文字位置覆寫共用樣式）
     2. .locations-info — 雙據點資訊（左 2 卡 + 右地圖卡，整體灰底圓角）
     3. .locations-contact — 聯絡我們（左說明卡 + 右行動卡）
   Hero 與共用組件樣式在 component.css，不在此檔。
   ========================================================================== */

/* 本頁 Hero 固定高 284px、文字頂端 y=140px（覆蓋 component.css 預設） */
.page-hero {
  height: 284px;
  padding-top: 140px;
}

/* ==========================================================================
   1. 雙據點資訊區
   ========================================================================== */
.locations-info {
  position: relative;
  padding: var(--spacing-3xl) 0;
  overflow: hidden;
}

/* 右下汽車剪影浮水印：跟著 section 右下、跨越「據點面板 + 聯絡我們」整段 */
.locations-info__watermark {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 80.1875rem; /* 1283px */
  max-width: 70vw;
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* 灰色大面板：1369×699 圓角 20 */
.locations-info__panel {
  position: relative;
  z-index: 1;
  padding: 2.625rem 3.5rem; /* ≈ 42 / 56 */
  background-color: #eee;
  border-radius: 20px;
}

/* 左 + 右：兩欄佈局 */
.locations-info__layout {
  display: grid;
  grid-template-columns: minmax(0, 813fr) minmax(0, 401fr);
  gap: 3rem; /* 48px */
  align-items: stretch;
}

/* === 左：兩張據點卡 === */
.locations-info__stores {
  display: flex;
  flex-direction: column;
  gap: 2.625rem; /* 42px */
}

/* 單張據點卡：button 重設 + 白底圓角 20 + 陰影；hover/active 改黑邊 */
.store-card {
  display: flex;
  align-items: center;
  gap: 1.75rem; /* 28px */
  width: 100%;
  padding: 2.5rem 2.25rem; /* ≈ 40 / 36 */
  background-color: var(--bg-color);
  border: 1px solid transparent;
  border-radius: 20px;
  box-shadow: 4px 4px 11.9px rgba(0, 0, 0, 0.25);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-base);
}

.store-card:hover,
.store-card:focus-visible,
.store-card.is-active {
  border-color: #141414;
  outline: none;
}

/* body：span 需要區塊化排版 */
.store-card__body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* 24px */
  flex: 1;
  min-width: 0;
}

.store-card__image {
  display: block;
}

/* 圖：265×190、左側陰影 */
.store-card__image {
  flex-shrink: 0;
  width: 16.5625rem; /* 265 */
  aspect-ratio: 265 / 190;
  background-size: cover;
  background-position: center;
  box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.25);
}

.store-card__name {
  display: block;
  font-size: var(--font-size-2xl); /* 24px */
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-dark);
  line-height: 1;
}

.store-card__desc {
  display: block;
  font-size: var(--font-size-xl); /* 20px */
  font-weight: var(--font-weight-normal);
  color: var(--text-color);
  line-height: 1.2;
}

/* 地址列：黑色漸層 + 釘 icon + 白字（純展示，整卡為按鈕） */
.store-card__address {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 49px;
  padding: 0;
  background-image: linear-gradient(
    0deg,
    #141414 33%,
    #4c4c4c 156%,
    #7a7a7a 228%
  );
  border-radius: 8px;
  color: var(--text-color-inverse);
  font-size: var(--font-size-xl);
}

.store-card__pin {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* === 右：地圖卡 + 導航 === */
.locations-info__map {
  display: flex;
  align-items: stretch;
}

.locations-map {
  position: relative;
  flex: 1;
  aspect-ratio: 401 / 582;
  border-radius: 20px;
  box-shadow: 0 4px 11.8px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.locations-map__iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background-color: #ddd;
  opacity: 1;
  transition: opacity 0.35s ease;
}

/* 切換時暫時降低 iframe 透明度，由 JS 加/移除 .is-loading */
.locations-map.is-loading .locations-map__iframe {
  opacity: 0;
}

/* loader 遮罩：覆蓋整張地圖，is-loading 時可見 */
.locations-map__loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(238, 238, 238, 0.85);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
  pointer-events: none;
  z-index: 1;
}

.locations-map.is-loading .locations-map__loader {
  opacity: 1;
  visibility: visible;
}

/* 圓形 spinner：紅色細邊框 + 旋轉 */
.locations-map__spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(168, 20, 29, 0.2);
  border-top-color: var(--color-primary-dark);
  border-radius: 50%;
  animation: locations-map-spin 0.8s linear infinite;
}

@keyframes locations-map-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .locations-map__iframe,
  .locations-map__loader {
    transition: none;
  }

  .locations-map__spinner {
    animation: none;
  }
}

/* 導航按鈕：黑色漸層膠囊 303×46，疊在地圖右下 */
.locations-map__nav {
  position: absolute;
  left: 49px;
  bottom: 31px; /* 582 - 505 - 46 = 31 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 303px;
  max-width: calc(100% - 49px);
  height: 46px;
  background-image: linear-gradient(
    0deg,
    #141414 33%,
    #4c4c4c 156%,
    #7a7a7a 228%
  );
  border-radius: 60px;
  color: var(--text-color-inverse);
  font-size: var(--font-size-xl);
  text-decoration: none;
  transition: filter var(--transition-base);
}

.locations-map__nav:hover {
  filter: brightness(1.15);
}

/* ==========================================================================
   2. 聯絡我們區（與雙據點共用 .locations-info section）
   ========================================================================== */

/* 左 576 + 右 740，gap 58；與上方面板間距用 margin-top */
.locations-contact__grid {
  position: relative;
  z-index: 1; /* 確保疊在浮水印之上 */
  display: grid;
  grid-template-columns: minmax(0, 576fr) minmax(0, 740fr);
  gap: 3.625rem; /* 58px */
  align-items: stretch;
  margin-top: var(--spacing-2xl);
}

/* === 左：說明卡 === */
.contact-intro {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 178px;
  padding: var(--spacing-xl);
  background-color: var(--text-color);
  background-size: cover;
  background-position: center;
  border-radius: 20px;
  overflow: hidden;
}

.contact-intro__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.contact-intro__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
}

.contact-intro__title {
  margin: 0;
  font-size: var(--font-size-2xl); /* 24px */
  font-weight: var(--font-weight-medium);
  color: var(--text-color-inverse);
  line-height: 1;
}

.contact-intro__lead {
  margin: 0;
  font-size: var(--font-size-xl); /* 20px */
  font-weight: var(--font-weight-normal);
  color: var(--color-accent); /* #FFAE00 */
  line-height: 1.2;
}

/* === 右：行動卡（黑色漸層底 + 電話/LINE 按鈕） === */
.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem; /* 24px */
  min-height: 178px;
  padding: var(--spacing-xl);
  background-image: linear-gradient(
    0deg,
    #141414 33%,
    #4c4c4c 156%,
    #7a7a7a 228%
  );
  border-radius: 20px;
}

.contact-actions__text {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-normal);
  color: var(--text-color-inverse);
  line-height: 1.2;
  text-align: center;
}

.contact-actions__buttons {
  display: flex;
  align-items: center;
  gap: 2.625rem; /* 42px */
  width: 100%;
  justify-content: center;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 var(--spacing-lg);
  border-radius: 10px;
  font-size: var(--font-size-xl);
  text-decoration: none;
  transition: filter var(--transition-base);
}

.contact-btn:hover {
  filter: brightness(1.1);
}

.contact-btn img {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* 電話：白底黑字 */
.contact-btn--phone {
  min-width: 270px;
  background-color: var(--bg-color);
  color: #1e1e1e;
}

/* LINE：紅底白字 + 黑色說明區 */
.contact-btn--line {
  min-width: 292px;
  background-color: var(--color-primary-dark);
  color: var(--text-color-inverse);
  gap: 11px;
  padding: 0 1rem 0 var(--spacing-md);
}

.contact-btn__id {
  padding-right: 8px;
}

.contact-btn__hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 116px;
  height: 20px;
  padding: 0 var(--spacing-sm);
  background-image: linear-gradient(to left, #000 0%, rgba(0, 0, 0, 0.3) 100%);
  font-size: var(--font-size-sm); /* 14px */
  white-space: nowrap;
}

/* ==========================================================================
   RWD
   ========================================================================== */

/* ≤1200：地圖縮窄 → 改單欄、上下排 */
@media (max-width: 75rem) {
  .locations-info__layout {
    grid-template-columns: 1fr;
    gap: 2.625rem;
  }

  .locations-map {
    aspect-ratio: 1 / 1;
  }

  .locations-map__nav {
    left: 50%;
    transform: translateX(-50%);
    bottom: 1.25rem;
  }
}

/* ≤992：聯絡區改單欄 */
@media (max-width: 62rem) {
  .locations-contact__grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    justify-items: center;
  }
}

/* ≤768：據點卡內部直排（圖在上、內容在下） */
@media (max-width: 48rem) {
  .store-card {
    flex-direction: column;
    align-items: stretch;
    padding: var(--spacing-lg);
  }

  .store-card__image {
    width: 100%;
    aspect-ratio: 16 / 10;
  }

  .locations-info__panel {
    padding: var(--spacing-lg);
  }

  .contact-actions__buttons {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .contact-btn--phone,
  .contact-btn--line {
    width: 100%;
    min-width: none;
  }
}

/* ≤480：依手機設計稿校正字級 / 圓角 / icon（只調數值，不動結構） */
@media (max-width: 30rem) {
  .locations-info {
    padding: 24px 0;
  }
  .locations-info__layout {
    gap: 28px;
  }
  .locations-info__panel {
    padding: 11.5px 18.5px;
  }
  .locations-info__stores {
    gap: 20px;
  }
  .store-card__body {
    gap: 8px;
  }
  /* Hero 高度依設計稿手機版車圖（覆蓋本頁桌機 284px） */
  .page-hero {
    height: 8.875rem; /* 142px */
    padding-top: 3.125rem; /* 50px */
  }

  /* 店卡：設計圓角 16px、padding 收斂 */
  .store-card {
    border-radius: 16px;
    padding: var(--spacing-md);
    gap: var(--spacing-md); /* 圖↔內容 16px */
  }

  /* 店照：設計 142px 高 */
  .store-card__image {
    aspect-ratio: 265 / 142;
    border-radius: 0.5rem;
  }

  /* 店名：設計 13px line-height 22px、weight 600 */
  .store-card__name {
    font-size: var(--font-size-base); /* 13px */
    line-height: 1.692; /* 22px */
    font-weight: var(--font-weight-semibold); /* 600 */
  }

  /* 描述：設計 12px #000 */
  .store-card__desc {
    font-size: 0.75rem; /* 12px */
  }

  /* 地址條：設計圓角 4px、字 13px line-height 22px、POI icon 20px */
  .store-card__address {
    border-radius: var(--border-radius-sm); /* 4px */
    font-size: var(--font-size-base); /* 13px */
    line-height: 1.692; /* 22px */
    height: 37px;
    margin-top: 12px;
  }

  .store-card__address img,
  .contact-btn img {
    width: 20px;
    height: 20px;
  }

  /* 導航膠囊鈕字 13px */
  .locations-map__nav {
    font-size: var(--font-size-base); /* 13px */
    height: 28px;
  }

  .contact-intro__body {
    max-width: 168px;
  }

  .contact-intro {
    max-width: 286px;
    height: 112px;
    min-height: auto;
    width: 100%;
  }
  .contact-actions {
    max-width: 286px;
  }

  /* 聯絡我們標題：設計 13px 600 */
  .contact-intro__title {
    font-size: var(--font-size-base); /* 13px */
    font-weight: var(--font-weight-semibold);
  }

  /* 黃字內文：設計 13px line-height 22px */
  .contact-intro__lead,
  .contact-actions__text {
    font-size: var(--font-size-base); /* 13px */
    line-height: 1.692; /* 22px */
  }

  /* 電話 / LINE 條：設計圓角 4px、字 13px */
  .contact-btn {
    border-radius: var(--border-radius-sm); /* 4px */
    font-size: var(--font-size-base); /* 13px */
    min-width: auto;
    height: 32px;
  }
}
