/* =============================================
   磺溪生活流域
   Brand: Gold #C9A227 · Deep Green #1A3D2B
   Style: Organic Biophilic · Editorial
   ============================================= */

:root {
  /* Brand Colors — sampled from logo */
  --gold:         #C9A227;
  --gold-light:   #E3BA45;
  --gold-dim:     #8C6E14;
  --green-deep:   #1A3D2B;
  --green-mid:    #2D6A4F;
  --green-light:  #52B788;

  /* Neutrals */
  --cream:        #F4EFE3;
  --cream-dark:   #EAE3D0;
  --sand:         #C8B89A;
  --text:         #1C2B22;
  --text-muted:   #4D6358;
  --dark:         #0D2318;
  --dark-mid:     #122B1E;
  --dark-text:    #E8F0EB;

  /* Tokens */
  --radius:     12px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(26,61,43,0.10);
  --shadow-md:  0 8px 40px rgba(26,61,43,0.18);
  --trans:      220ms ease;

  --serif: 'Noto Serif TC', Georgia, serif;
  --sans:  'Noto Sans TC', system-ui, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
strong { font-weight: 600; color: var(--green-deep); }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}
.section { padding: 100px 0; }

/* ---- Typography ---- */
.section-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.section-label.light { color: #d4b84a; }

.section-heading {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--green-deep);
  margin-bottom: 56px;
  letter-spacing: -0.01em;
}

p {
  color: var(--text-muted);
  margin-bottom: 16px;
  max-width: 60ch;
  line-height: 1.85;
}
p:last-child { margin-bottom: 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--trans);
}

.btn-gold {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201,162,39,0.35);
}

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.35);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.65);
  color: #fff;
}

.btn-outline-light {
  background: transparent;
  color: var(--dark-text);
  border-color: rgba(232,240,235,0.22);
  font-size: 0.85rem;
  padding: 9px 20px;
}
.btn-outline-light:hover {
  background: rgba(232,240,235,0.08);
  border-color: rgba(232,240,235,0.5);
  transform: translateY(-2px);
}

/* =============================================
   NAV
   ============================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background var(--trans), box-shadow var(--trans);
}
.nav.scrolled {
  background: rgba(244,239,227,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(200,184,154,0.4);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.nav-logo-img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.nav-logo span {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--green-deep);
  letter-spacing: 0.02em;
}

.nav:not(.scrolled) .nav-logo span { color: #fff; }
.nav:not(.scrolled) .nav-links a { color: rgba(255,255,255,0.72); }
.nav:not(.scrolled) .nav-links a:hover { color: #fff; }
.nav:not(.scrolled) .nav-toggle span { background: #fff; }

.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: color var(--trans);
}
.nav-links a:hover { color: var(--green-deep); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--green-deep);
  border-radius: 2px;
  transition: background var(--trans);
}

.nav-mobile {
  /* 用 max-height 而非 display:none，讓動畫能發生 */
  display: flex;
  flex-direction: column;
  background: rgba(244,239,227,0.98);
  border-top: 1px solid transparent;
  padding: 0 28px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height 320ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 220ms ease,
    border-color 220ms ease,
    padding 220ms ease;
}
.nav-mobile.open {
  max-height: 400px;
  opacity: 1;
  pointer-events: auto;
  border-top-color: var(--sand);
  padding: 8px 28px 20px;
}
.nav-mobile a {
  padding: 13px 0;
  font-size: 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(200,184,154,0.25);
  transition: color var(--trans), padding-left var(--trans);
}
.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover {
  color: var(--green-deep);
  padding-left: 6px;
}

/* Hamburger → X 動畫 */
.nav-toggle span {
  transform-origin: center;
  transition: transform 250ms ease, opacity 200ms ease;
}
.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* =============================================
   HERO
   ============================================= */
.hero {
  position: relative;
  height: 100vh;
  min-height: 620px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    /* Nav 區域專用：頂部加深，保住 logo 可讀性 */
    linear-gradient(to bottom, rgba(5,15,10,0.72) 0%, rgba(5,15,10,0) 22%),
    /* 文字區：左側加深 */
    linear-gradient(105deg, rgba(5,15,10,0.78) 0%, rgba(5,15,10,0.15) 65%),
    /* 底部收尾 */
    linear-gradient(to top, rgba(5,15,10,0.5) 0%, rgba(5,15,10,0) 40%);
}

.hero-body {
  position: relative;
  z-index: 2;
  padding: 0 28px;
  max-width: 660px;
  margin-left: calc((100vw - 1080px) / 2 + 28px);
}
@media (max-width: 1108px) { .hero-body { margin-left: 28px; } }

.hero-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 20px;
  max-width: none;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 900;
  line-height: 1.18;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.hero-title em {
  font-style: normal;
  color: var(--gold-light);
}

.hero-desc {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.9;
  margin-bottom: 40px;
  max-width: none;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.3);
  z-index: 2;
}
.scroll-dot {
  animation: scroll-bounce 1.8s ease-in-out infinite;
}
@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(5px); opacity: 0.35; }
}

/* =============================================
   STATS STRIP — gold brand color
   ============================================= */
.stats-strip {
  background: var(--gold);
  padding: 32px 28px;
}
.stats-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 52px;
}
.stat-num {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 5px;
}
.stat-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.05em;
}
.stat-divider {
  width: 1px;
  height: 44px;
  background: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* =============================================
   INTRO
   ============================================= */
.intro-section {
  padding: 100px 0;
}
.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.intro-heading {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--green-deep);
  line-height: 1.25;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.side-quote {
  border-left: 3px solid var(--gold);
  padding-left: 28px;
  margin-top: 8px;
}
.side-quote p {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--green-deep);
  line-height: 1.8;
  margin-bottom: 16px;
  max-width: none;
  font-style: italic;
  text-wrap: balance;
}
.side-quote cite {
  font-size: 0.82rem;
  color: var(--gold-dim);
  font-style: normal;
  letter-spacing: 0.06em;
}

/* =============================================
   山水城 CONCEPT — alternating horizontal rows
   ============================================= */
.concept-section {
  background: var(--dark);
}

.concept-row {
  display: grid;
  grid-template-columns: 60% 40%;
  min-height: 420px;
}
.concept-row-reverse {
  grid-template-columns: 40% 60%;
}
.concept-row-reverse .concept-photo { order: 2; }
.concept-row-reverse .concept-content { order: 1; }

.concept-photo {
  overflow: hidden;
}
.concept-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 700ms ease;
  filter: brightness(0.9);
}
.concept-row:hover .concept-photo img {
  transform: scale(1.03);
}

.concept-content {
  background: var(--dark-mid);
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: none;
}
.concept-row-reverse .concept-content {
  background: #0a1f13;
}
.concept-row:last-child .concept-content {
  background: #112619;
}

.concept-char {
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 24px;
  letter-spacing: -0.03em;
}

.concept-desc {
  font-size: 0.95rem;
  color: rgba(232,240,235,0.65);
  line-height: 1.9;
  max-width: 38ch;
}

/* =============================================
   ACTIONS
   ============================================= */
.actions-list {
  display: flex;
  flex-direction: column;
}
.action-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 32px;
  padding: 48px 0;
  border-top: 1px solid var(--cream-dark);
}
.action-item:last-child { border-bottom: none; }

.action-num {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  padding-top: 4px;
  opacity: 0.6;
}
.action-body h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 14px;
}
.action-note {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--gold-dim);
  border-left: 2px solid var(--gold);
  padding-left: 14px;
  margin-top: 16px;
  line-height: 1.75;
}

/* =============================================
   GALLERY
   ============================================= */
.gallery-section {
  background: var(--cream-dark);
  padding: 100px 0 0;
}
.gallery-section .section-heading {
  margin-bottom: 40px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 280px 280px;
  gap: 4px;
  margin: 40px 0 28px;
}
.g-item { overflow: hidden; }
.g-tall { grid-row: span 2; }
.g-wide { grid-column: span 2; }

.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms ease, filter 400ms ease;
  filter: brightness(0.95);
}
.g-item:hover img {
  transform: scale(1.04);
  filter: brightness(1.02);
}

.gallery-link-text {
  padding: 0 0 56px;
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: none;
}
.gallery-link-text a {
  color: var(--gold-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-left: 6px;
  transition: color var(--trans);
}
.gallery-link-text a:hover { color: var(--gold); }

/* =============================================
   JOIN + FOOTER (merged into one dark section)
   ============================================= */
.join-section {
  background: var(--dark);
  padding: 100px 0 0;
}

.join-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 60px;
  align-items: center;
  padding-bottom: 80px;
}

.join-content { max-width: 520px; }

.join-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--dark-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.join-desc {
  font-size: 1.05rem;
  color: rgba(232,240,235,0.6);
  margin-bottom: 32px;
  line-height: 1.85;
  max-width: none;
  text-wrap: balance;
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--gold-light);
  margin-bottom: 28px;
  transition: color var(--trans);
}
.contact-link:hover { color: var(--gold); }

.join-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.join-logo-col { flex-shrink: 0; }
.join-logo {
  width: 140px;
  height: 140px;
  border-radius: 16px;
  object-fit: cover;
  opacity: 0.85;
}

/* Footer bar inside join section */
.join-footer {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 28px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.9rem;
  color: rgba(232,240,235,0.55);
  margin-bottom: 2px;
  max-width: none;
}
.footer-sub {
  font-size: 0.75rem;
  color: rgba(232,240,235,0.25);
  max-width: none;
}
.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.footer-links a {
  font-size: 0.78rem;
  color: rgba(232,240,235,0.35);
  transition: color var(--trans);
  white-space: nowrap;
}
.footer-links a:hover { color: var(--gold); }

.footer-copy {
  font-size: 0.85rem;
  font-family: var(--serif);
  font-weight: 700;
  color: rgba(232,240,235,0.55);
  max-width: none;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 960px) {
  .concept-row,
  .concept-row-reverse {
    grid-template-columns: 1fr;
    min-height: unset;
  }
  .concept-row-reverse .concept-photo { order: unset; }
  .concept-row-reverse .concept-content { order: unset; }
  .concept-photo { aspect-ratio: 16/7; height: auto; }
  .concept-content { padding: 36px 28px; }
  .concept-char { font-size: 3.5rem; }
  .intro-grid { grid-template-columns: 1fr; gap: 48px; }
  .join-top { grid-template-columns: 1fr; }
  .join-logo-col { display: none; }
  .join-footer { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 20px 0; }
  .footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 32px; text-align: right; }
}

@media (max-width: 768px) {
  /* ---- Nav ---- */
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  /* Hero：把圖往下移，讓建築物跑出畫面頂部，
     溪面草地（較暗）出現在 nav 位置 */
  .hero-img { object-position: center 65%; }

  /* ---- Stats ---- */
  .stats-strip { padding: 24px 28px; }
  .stats-inner { flex-wrap: wrap; gap: 0; justify-content: space-around; }
  .stat { padding: 12px 20px; }
  .stat-divider { display: none; }

  /* ---- Section 連貫感：淺色區塊統一背景、靠 whitespace 呼吸 ----
     消除 section 的 box 感，讓閱讀像翻書而不是切格子 */
  .section { padding: 64px 0; }
  .intro-section { padding: 64px 0 48px; }

  /* 淺色 section 之間背景打通，不用色塊區分 */
  .gallery-section { background: var(--cream); }

  /* actions 和 gallery 之間用一條細線代替背景色差 */
  .gallery-section { border-top: 1px solid var(--cream-dark); }

  /* 第一個 concept 照片頂部加 cream→透明漸層，cream section 自然淡入照片 */
  .concept-row:first-child .concept-photo {
    position: relative;
  }
  .concept-row:first-child .concept-photo::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 72px;
    background: linear-gradient(to bottom, var(--cream) 0%, transparent 100%);
    pointer-events: none;
  }

  /* join section：用細金線做章節分隔，不用漸層 */
  .join-section {
    border-top: 1px solid rgba(201,162,39,0.3);
  }

  /* ---- Actions ---- */
  .action-item { grid-template-columns: 40px 1fr; gap: 16px; padding: 32px 0; }
  .action-num { font-size: 1.4rem; }

  /* ---- Gallery ---- */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 200px 200px;
    gap: 3px;
    margin: 32px 0 24px;
  }
  .g-tall { grid-row: span 1; }
  .g-wide { grid-column: span 1; }
}

@media (max-width: 520px) {
  .section { padding: 52px 0; }
  .hero-title { font-size: 2.5rem; }

  .gallery-grid { grid-template-columns: 1fr; grid-template-rows: auto; gap: 3px; }
  .g-item { aspect-ratio: 4/3; }
  .g-wide { grid-column: span 1; }

  .join-links { flex-direction: column; align-items: flex-start; }
  .join-footer { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 20px 0; }
  .footer-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 32px; text-align: right; }

  .action-item { grid-template-columns: 1fr; gap: 6px; }
  .action-num { font-size: 1.1rem; opacity: 0.4; }
}

/* =============================================
   SCROLL ANIMATIONS
   ============================================= */

/* 基礎：元素初始隱藏，JS 加 .visible 後顯現 */
.anim-fade-up {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 650ms ease, transform 650ms ease;
}
.anim-fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* section-label：從左側 clip 展開 */
.anim-label {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 550ms cubic-bezier(0.4, 0, 0.2, 1);
}
.anim-label.visible {
  clip-path: inset(0 0% 0 0);
}

/* 山水城字符：從小放大 + 淡入，像蓋章 */
.anim-stamp {
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.anim-stamp.visible {
  opacity: 1;
  transform: scale(1);
}

/* 行動 items：依序滑入 */
.anim-slide {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.anim-slide.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Gallery items：stagger 淡入 */
.anim-photo {
  opacity: 0;
  transition: opacity 700ms ease;
}
.anim-photo.visible {
  opacity: 1;
}

/* Hero 標題：字元逐字淡入（純 CSS，不依賴 JS） */
.hero-title {
  animation: hero-reveal 900ms ease 200ms both;
}
@keyframes hero-reveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-desc {
  animation: hero-reveal 900ms ease 400ms both;
}
.hero-actions {
  animation: hero-reveal 900ms ease 580ms both;
}
.hero-eyebrow {
  animation: hero-reveal 700ms ease 80ms both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .anim-fade-up, .anim-label, .anim-stamp, .anim-slide, .anim-photo {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}
