/* =========================================================
   設計系統 - 機捷12單元觀測站
   ========================================================= */

:root {
  /* 色票 */
  --bg-cream:        #faf8f5;
  --bg-light:        #f5f0e8;
  --bg-white:        #ffffff;
  --bg-card:         #fefefe;
  --bg-dark:         #5d4e37;
  --bg-darker:       #443728;

  --text-primary:    #2c2c2c;
  --text-secondary:  #4a4a4a;
  --text-muted:      #6b6b6b;
  --text-light:      #999999;
  --text-on-dark:    #f5f0e8;
  --text-on-dark-mute:#c9c2b4;

  --accent-gold:     #c9a96e;
  --accent-gold-dk:  #b89968;
  --accent-green:    #4a7c5c;
  --accent-green-dk: #2d5d3f;

  --border-light:    #ebe6da;
  --border:          #d4cfc4;

  --shadow-sm:       0 1px 2px rgba(74,60,40,0.05);
  --shadow:          0 4px 16px rgba(74,60,40,0.08);
  --shadow-lg:       0 10px 30px rgba(74,60,40,0.12);

  --radius-sm:       8px;
  --radius:          16px;
  --radius-lg:       24px;
  --radius-pill:     999px;

  --font-serif:      'Noto Serif TC', 'Source Han Serif TC', '思源宋體', serif;
  --font-sans:       'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', '微軟正黑體', sans-serif;

  --container-w:     1200px;
}

/* =========================================================
   重置與基礎
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color .2s ease; }
button { font: inherit; cursor: pointer; border: 0; background: none; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); letter-spacing: 0.04em; }
h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); letter-spacing: 0.04em; }
h3 { font-size: 1.3rem; letter-spacing: 0.02em; }

.container { max-width: var(--container-w); margin: 0 auto; padding: 0 24px; }

/* 通用 */
.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent-gold);
  font-weight: 500;
  margin-bottom: 18px;
}

.section { padding: 100px 0; }
@media (max-width: 768px) {
  .section { padding: 60px 0; }
}

.section-header { text-align: center; margin-bottom: 56px; }
.section-header h2 { margin: 6px 0 14px; }
.section-header p { color: var(--text-muted); max-width: 560px; margin: 0 auto; }

/* =========================================================
   按鈕
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border-radius: var(--radius-pill);
  transition: all .25s ease;
  white-space: nowrap;
  border: 1.5px solid transparent;
  cursor: pointer;
}
.btn-gold {
  background: var(--accent-gold);
  color: #fff;
}
.btn-gold:hover {
  background: var(--accent-gold-dk);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(201,169,110,0.35);
}
.btn-outline {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  background: transparent;
}
.btn-outline:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
}
.btn-outline-dark {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}
.btn-outline-dark:hover {
  background: var(--accent-gold);
  color: #fff;
}
.btn-light {
  background: #fff;
  color: var(--text-primary);
}
.btn-light:hover { background: var(--bg-light); transform: translateY(-1px); }
.btn-sm { padding: 10px 20px; font-size: 0.85rem; }

.btn .icon { font-size: 1rem; }

/* =========================================================
   Top Nav
   ========================================================= */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 18px 0;
  background: rgba(250,248,245,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: all .3s ease;
}
.site-header.scrolled {
  background: rgba(255,255,255,0.96);
  border-bottom-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}
.site-header.is-hero {
  background: transparent;
  color: #fff;
}
.site-header.is-hero .brand-name,
.site-header.is-hero .main-nav a {
  color: #fff;
}
.site-header.is-hero.scrolled .brand-name,
.site-header.is-hero.scrolled .main-nav a {
  color: var(--text-primary);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
}
.brand-icon {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.main-nav {
  display: flex;
  gap: 36px;
}
.main-nav a {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  position: relative;
  padding: 4px 0;
}
.main-nav a:hover { color: var(--accent-gold); }
@media (max-width: 768px) {
  .main-nav { display: none; }
  .brand-name { font-size: 1rem; }
}

/* =========================================================
   Hero（首頁主視覺）
   ========================================================= */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(40,30,20,0.45) 0%,
    rgba(40,30,20,0.55) 60%,
    rgba(40,30,20,0.7) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 120px 24px 60px;
}
.hero-content .eyebrow { color: rgba(255,255,255,0.85); }
.hero-title {
  color: #fff;
  margin: 0 0 24px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.3);
  font-size: clamp(1.7rem, 5.2vw, 3.6rem);
}
.hero-line {
  display: block;
  white-space: nowrap;
}
.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.92);
  margin-bottom: 40px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
  line-height: 1.8;
}
.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* =========================================================
   建案卡片網格（首頁）
   ========================================================= */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
}
.project-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all .3s ease;
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.project-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-light);
}
.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.project-card:hover .project-card-image img { transform: scale(1.05); }
.badge {
  position: absolute;
  top: 16px; left: 16px;
  background: var(--accent-green);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.badge-corner {
  position: absolute;
  bottom: 16px; right: 16px;
  background: rgba(45,45,45,0.85);
  color: #fff;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
}
.project-card-body {
  padding: 24px 26px 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
}
.project-card-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-primary);
}
.project-card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}
.project-card-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}
.project-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.project-card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-block;
  background: var(--bg-light);
  color: var(--text-secondary);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* =========================================================
   統計區
   ========================================================= */

.section-stats {
  background: var(--bg-darker);
  color: var(--text-on-dark);
  padding: 60px 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  text-align: center;
}
.stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--accent-gold);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.stat span {
  display: block;
  font-size: 0.95rem;
  color: var(--text-on-dark-mute);
  letter-spacing: 0.08em;
}

/* =========================================================
   CTA 區
   ========================================================= */

.section-cta {
  position: relative;
  background: var(--bg-dark);
  color: var(--text-on-dark);
  text-align: center;
  overflow: hidden;
}
.section-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('https://lh3.googleusercontent.com/d/16PAER2gYrTnYbfLG-8UyA_J_VG6DfCYE') center/cover no-repeat;
  opacity: 0.15;
  z-index: 0;
}
.section-cta > .container {
  position: relative;
  z-index: 1;
  max-width: 720px;
}
.section-cta h2 { color: #fff; margin: 6px 0 18px; }
.section-cta > .container > p { color: var(--text-on-dark-mute); margin-bottom: 36px; }
.cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  background: var(--bg-darker);
  color: var(--text-on-dark);
  padding: 70px 0 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.3fr;
  gap: 48px;
  margin-bottom: 48px;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 36px; }
}
.footer-col h4 {
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 20px;
  letter-spacing: 0.08em;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 12px; }
.footer-col a, .footer-col p {
  color: var(--text-on-dark-mute);
  font-size: 0.9rem;
}
.footer-col a:hover { color: var(--accent-gold); }
.footer-brand p { line-height: 1.8; margin-top: 8px; }
.footer-contact li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.footer-contact .ico {
  color: var(--accent-gold);
  flex-shrink: 0;
  margin-top: 2px;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-light);
}
.footer-social {
  display: flex;
  gap: 14px;
}
.footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
}
.footer-social a:hover {
  background: var(--accent-gold);
  color: var(--bg-darker);
}

/* =========================================================
   詳情頁 - 圖片網格
   ========================================================= */

.detail-page { padding-top: 88px; }

.detail-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 48px;
}
.detail-hero .main-img {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background: var(--bg-light);
}
.detail-hero .main-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero .side-imgs {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 16px;
}
.detail-hero .side-imgs .img-box {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-light);
  aspect-ratio: 4 / 3;
}
.detail-hero .side-imgs img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 768px) {
  .detail-hero { grid-template-columns: 1fr; }
  .detail-hero .side-imgs { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
}

/* 詳情頁 - 主資訊區 */
.detail-main {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 48px;
  margin-bottom: 80px;
}
@media (max-width: 1024px) {
  .detail-main { grid-template-columns: 1fr; }
}

.detail-title { font-size: 2.4rem; margin-bottom: 8px; }
.detail-subtitle { color: var(--text-muted); margin-bottom: 18px; }
.detail-address {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.detail-stats {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
  text-align: center;
}
.detail-stats .ico {
  font-size: 1.4rem;
  color: var(--accent-gold);
  margin-bottom: 8px;
  line-height: 1;
}
.detail-stats strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.detail-stats span {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 36px; }

.detail-section { margin-bottom: 40px; }
.detail-section h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border-light);
}
.detail-section p { color: var(--text-secondary); line-height: 1.9; }

.info-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 4px 32px;
}
.info-list li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-light);
  align-items: baseline;
}
.info-list .lbl {
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.info-list .val {
  color: var(--text-primary);
  font-weight: 500;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.feature-grid .feat {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.feature-grid .feat::before {
  content: '✓';
  color: var(--accent-gold);
  font-weight: bold;
}

/* 右側 sticky CTA */
.detail-cta {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 32px;
  position: sticky;
  top: 100px;
  height: fit-content;
}
.detail-cta h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.detail-cta p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.7;
}
.detail-cta .btn { width: 100%; justify-content: center; margin-bottom: 12px; }
.detail-cta-divider {
  margin: 20px 0 16px;
  font-size: 0.85rem;
  color: var(--text-light);
  text-align: center;
}
.social-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.social-row a {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all .25s ease;
}
.social-row a:hover { background: var(--accent-gold); color: #fff; }

/* 圖庫網格（詳情頁底部） */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.gallery-grid .img-box {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  transition: all .3s ease;
}
.gallery-grid .img-box:hover { transform: scale(1.02); box-shadow: var(--shadow); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; }

/* 地圖 */
.detail-map {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-light);
  margin-top: 16px;
}
.detail-map iframe { width: 100%; height: 100%; border: 0; }

/* 麵包屑 */
.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumb a:hover { color: var(--accent-gold); }
.breadcrumb .sep { color: var(--text-light); }
.breadcrumb .current { color: var(--text-primary); }

/* =========================================================
   Lightbox（點圖放大）
   ========================================================= */

img.zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: inherit;
  line-height: 1;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}
.lightbox-prev:hover { transform: translateY(-50%) scale(1.05); }
.lightbox-next:hover { transform: translateY(-50%) scale(1.05); }
.lightbox-close {
  top: 20px; right: 24px;
  width: 46px; height: 46px;
  font-size: 1.6rem;
}
.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  font-size: 2rem;
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  background: rgba(0,0,0,0.55);
  padding: 8px 18px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}
@media (max-width: 640px) {
  .lightbox { padding: 40px 8px; }
  .lightbox-prev { left: 8px; width: 44px; height: 44px; font-size: 1.6rem; }
  .lightbox-next { right: 8px; width: 44px; height: 44px; font-size: 1.6rem; }
  .lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
}

/* =========================================================
   載入指示器（防 FOUC）
   ========================================================= */

body[data-loading] main,
body[data-loading] .hero,
body[data-loading] .section,
body[data-loading] .site-footer { visibility: hidden; }

body[data-loading]::after {
  content: '';
  position: fixed;
  top: 50%; left: 50%;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: dl-spin 0.9s linear infinite;
  z-index: 99999;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }
