/* ── 기본 리셋 & 변수 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }

:root {
  --bg:       #0d1628;
  --bg2:      #162035;
  --gold:     #c9a85c;
  --gold-dim: rgba(201,168,92,.22);
  --gold-mid: rgba(201,168,92,.5);
  --text:     #ede8dc;
  --muted:    #8a93a8;
  --up:       #4caf8a;
  --down:     #e05555;
  --radius:   10px;
  --max:      720px;
}

html { font-size: 18px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Serif KR', 'Noto Serif SC', serif;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── 상단 네비게이션 ── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: rgba(13,22,40,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(201,168,92,.18);
}
.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 17.6px;
  color: var(--gold);
  letter-spacing: .1em;
  font-weight: 700;
  line-height: 1;
}
.nav-brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.nav-brand a img { height: 32px; width: auto; display: block; }
.nav-links { display: flex; gap: 6px; list-style: none; }
.nav-link {
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .04em;
  transition: color .2s, background .2s;
}
.nav-link:hover { color: var(--gold); }
.nav-link.nav-admin { color: #c9a85c; font-weight: 700; letter-spacing: 0.05em; }
.nav-link.nav-admin:hover { color: #e8c97a; }
.nav-link.active {
  background: rgba(201,168,92,.15);
  color: var(--gold);
  border: 1px solid rgba(201,168,92,.3);
}

/* ── 햄버거 버튼 (모바일 전용) ── */
.nav-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  z-index: 202;
  flex-shrink: 0;
}
.nav-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-menu-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-menu-btn.active span:nth-child(2) { opacity: 0; }
.nav-menu-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 680px) {
  .nav-menu-btn { display: flex; }
  .nav-links {
    display: none;
    position: fixed;
    top: 52px;
    left: 0; right: 0;
    background: rgba(13,22,40,.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-direction: column;
    padding: 8px 0 16px;
    border-bottom: 1px solid rgba(201,168,92,.2);
    gap: 2px;
    z-index: 199;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-link {
    display: block;
    padding: 13px 24px;
    font-size: 14px;
    border-radius: 0;
    letter-spacing: .06em;
  }
  .nav-link.active { border-radius: 0; border-left: 3px solid var(--gold); padding-left: 21px; }
  .lang-toggle {
    justify-content: flex-start;
    padding: 10px 24px 0;
    margin-left: 0;
  }
}

/* ── 언어 토글 버튼 ── */
.lang-toggle {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}
.lang-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 12px;
  border: 1px solid rgba(201,168,92,.3);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: .05em;
  transition: color .2s, background .2s, border-color .2s;
  font-family: inherit;
}
.lang-btn:hover { color: var(--gold); }
.lang-btn.active {
  background: rgba(201,168,92,.15);
  color: var(--gold);
  border-color: rgba(201,168,92,.5);
}

/* ── 히어로 ── */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 92px 24px 80px;
  background: radial-gradient(ellipse at 50% 30%, #1a2a48 0%, var(--bg) 70%);
  position: relative;
}
.hero figure img {
  width: min(420px, 80vw);
  height: auto;
  object-fit: contain;
  margin-bottom: 32px;
  filter: drop-shadow(0 0 36px rgba(201,168,92,.35));
}
.hero > h2 {
  font-family: 'Playfair Display', 'Noto Serif KR', serif;
  font-size: clamp(1.8rem, 7.5vw, 3.2rem);
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  letter-spacing: .06em;
  line-height: 1.3;
}
.hero > h2 em { font-style: italic; }
.hero > p {
  position: absolute;
  bottom: 28px;
  font-size: 1.3rem;
  color: var(--gold-mid);
  animation: bounce 1.8s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50%       { transform: translateY(8px); opacity: 1; }
}

/* ── 섹션 공통 ── */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 16px;
  border-bottom: 1px solid var(--gold-dim);
}
.section > h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section > h2 span,
.section > p {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.pillar-loading {
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
  padding: 20px 0;
}

/* ── 일진 섹션 배경 ── */
#saju-section {
  max-width: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--gold-dim);
  background: url('/static/main_background.png') center/cover no-repeat;
  position: relative;
}
#saju-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 22, 0.62);
}
#saju-section > div {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 52px 16px 56px;
}
#saju-section h2 {
  text-transform: none;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-family: 'Noto Serif KR', serif;
  letter-spacing: .06em;
  margin-bottom: 14px;
  gap: 12px;
  align-items: center;
}
/* ── 날짜 라인 ── */
.saju-dateline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: var(--muted);
  letter-spacing: .06em;
  margin-bottom: 38px;
}
.saju-dateline::before,
.saju-dateline::after {
  content: '';
  height: 1px;
  width: 40px;
  flex-shrink: 0;
}
.saju-dateline::before { background: linear-gradient(to right, transparent, var(--gold-mid)); }
.saju-dateline::after  { background: linear-gradient(to left,  transparent, var(--gold-mid)); }

/* ── 일진 카드 ── */
#pillars-wrap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(5px, 2vw, 16px);
  margin-bottom: 0;
}

.pillar-card {
  background: rgba(10, 14, 30, 0.72);
  border: 1px solid rgba(201,168,92,.28);
  border-radius: 14px;
  padding: clamp(10px, 2.5vw, 20px) clamp(4px, 1vw, 10px) clamp(12px, 3vw, 26px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.5vw, 14px);
  min-width: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pillar-label {
  font-size: clamp(.62rem, 2vw, .82rem);
  color: var(--gold);
  letter-spacing: .08em;
  font-weight: 700;
  position: relative;
  padding-bottom: clamp(8px, 1.5vw, 14px);
}
.pillar-label::after {
  content: '◆';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .38rem;
  color: rgba(201,168,92,.45);
}

/* 간지 원형 래퍼 */
.gz-wrap { position: relative; display: inline-flex; align-items: center; }
.gz-yinyang { position: absolute; left: -18px; font-size: .95rem; font-weight: 700; line-height: 1; }
@media (max-width: 768px) { .gz-yinyang { display: none; } }
.gz-yang { color: #f0c060; }
.gz-yin  { color: #90b8d8; }

/* 간지 원형 아이콘 */
.gz-circle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(58px, 18vw, 106px);
  height: clamp(58px, 18vw, 106px);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.28);
  gap: 2px;
  box-shadow:
    0 6px 22px rgba(0,0,0,.55),
    inset 0 2px 8px rgba(255,255,255,.14),
    inset 0 -3px 10px rgba(0,0,0,.35);
}
.gz-circle.el-wood  { background: radial-gradient(circle at 42% 38%, #5a9e6f, #1a4428); }
.gz-circle.el-fire  { background: radial-gradient(circle at 42% 38%, #d9604a, #6a1410); }
.gz-circle.el-earth { background: radial-gradient(circle at 42% 38%, #c9a85c, #5e3a0e); }
.gz-circle.el-metal { background: radial-gradient(circle at 42% 38%, #c8d8e8, #38506a); }
.gz-circle.el-water { background: radial-gradient(circle at 42% 38%, #4a8ab4, #0a2440); }

.gz-inner-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(26px, 8vw, 48px);
  height: clamp(26px, 8vw, 48px);
  border-radius: 50%;
  opacity: .4;
  pointer-events: none;
}
.gz-char {
  font-size: clamp(1.4rem, 5vw, 2.5rem);
  font-weight: 700;
  color: #fff;
  line-height: 1;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 6px rgba(0,0,0,.8), 0 0 14px rgba(0,0,0,.6);
}
.gz-ko {
  font-size: clamp(.62rem, 1.8vw, .9rem);
  color: rgba(255,255,255,.9);
  letter-spacing: .04em;
  line-height: 1;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}
.pillar-animal { font-size: clamp(.6rem, 1.6vw, .78rem); color: var(--muted); letter-spacing: .03em; }

/* 오행 바 — 일진 섹션 내 */
#saju-section #ohaeng-bars {
  margin-top: 30px;
  opacity: .75;
}

/* ── 오행 바 ── */
#ohaeng-bars {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 80px;
}
.ohaeng-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.ohaeng-bar-fill { width: 100%; border-radius: 4px 4px 0 0; transition: height .4s ease; }
.ohaeng-bar-name { font-size: 1.5rem; font-weight: 700; }
.ohaeng-bar-val  { font-size: .88rem; color: var(--text); margin-bottom: 4px; }

/* ── 오행 파이차트 ── */
#ohaeng-charts-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 600px) {
  #ohaeng-charts-wrap { grid-template-columns: 1fr; }
}
.ohaeng-chart-item { background: var(--bg2); border: 1px solid var(--gold-dim); border-radius: var(--radius); overflow: hidden; text-align: center; padding-bottom: 12px; }
.ohaeng-chart-item img { width: 100%; height: auto; display: block; }
.ohaeng-chart-label { font-size: .85rem; font-weight: 700; color: var(--gold); letter-spacing: .06em; margin-top: 10px; }
.ohaeng-chart-gz { font-size: 1rem; color: var(--text); letter-spacing: .12em; margin-top: 4px; }

/* ── 오행 트렌드 ── */
#trend-section {
  padding-bottom: 56px;
}
#trend-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 60px;
}
.trend-carousel { width: 100%; }
.trend-slide-header { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.trend-slide-title { font-size: 1rem; font-weight: 700; color: var(--gold); letter-spacing: .06em; min-width: 80px; text-align: center; }
.trend-nav { background: none; border: 1px solid var(--gold-dim); color: var(--gold); border-radius: 50%; width: 28px; height: 28px; font-size: 1.2rem; cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; }
.trend-nav:hover { border-color: var(--gold); background: var(--bg2); }
.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: center;
  margin-top: 14px;
  list-style: none;
}
.trend-legend li { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.trend-legend li span { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.el-dot-wood  { background: #5a9e6f; }
.el-dot-fire  { background: #d9604a; }
.el-dot-earth { background: #c9a85c; }
.el-dot-metal { background: #a8b8c8; }
.el-dot-water { background: #4a8ab4; }

/* ── 오늘의 명리 분석 캐러셀 ── */
.analysis-card { min-width: 100%; background: var(--bg2); border: 1px solid var(--gold-dim); border-radius: var(--radius); padding: 22px 20px; box-sizing: border-box; }
.analysis-card-meta  { font-size: .78rem; color: var(--muted); letter-spacing: .05em; margin-bottom: 8px; }
.analysis-card-title { font-size: 1rem; font-weight: 700; color: var(--gold); letter-spacing: .06em; margin-bottom: 14px; }
.analysis-card-body  { font-size: .95rem; line-height: 1.95; color: var(--text); }

/* ── 뉴스 캐러셀 ── */
.carousel-wrap  { position: relative; overflow: hidden; }
.carousel-track { display: flex; transition: transform .45s cubic-bezier(.4,0,.2,1); will-change: transform; }
.news-card {
  min-width: 100%;
  background: var(--bg2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-sizing: border-box;
  display: block;
  text-decoration: none;
  color: inherit;
}
.news-card--link { cursor: pointer; transition: border-color .2s, background .2s; }
.news-card--link:hover { border-color: var(--gold); background: var(--bg2); }
.news-badge  { display: inline-block; font-size: .8rem; letter-spacing: .07em; color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 4px; padding: 2px 9px; margin-bottom: 12px; }
.news-title  { font-size: 1.1rem; font-weight: 600; color: var(--text); line-height: 1.55; margin-bottom: 10px; }
.news-summary { font-size: .92rem; color: var(--muted); line-height: 1.65; }
.news-meri { font-size: .88rem; color: var(--gold); line-height: 1.65; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--gold-dim); }
.news-meri-label { display: block; font-size: .75rem; letter-spacing: .08em; background: var(--gold-dim); color: var(--gold); border-radius: 3px; padding: 1px 7px; margin-bottom: 8px; width: fit-content; }
.news-meri p { margin: 0 0 8px; }
.news-meri p:last-child { margin-bottom: 0; }

/* 점(dot) 내비게이션 */
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.carousel-dot  { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); cursor: pointer; transition: background .25s, transform .25s; border: none; padding: 0; }
.carousel-dot.active { background: var(--gold); transform: scale(1.3); }

/* ── 시장 헤드라인 ── */
.market-headlines { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.market-headline-item { font-size: .92rem; color: var(--muted); padding-left: 12px; border-left: 2px solid var(--gold-dim); }

/* ── 시장 테이블 ── */
.market-table-wrap { overflow-x: auto; }
#market-table { width: 100%; border-collapse: collapse; font-size: .98rem; }
#market-table thead th { color: var(--gold); font-size: .88rem; letter-spacing: .07em; border-bottom: 1px solid var(--gold-mid); padding: 10px 12px; text-align: left; }
#market-table tbody tr { border-bottom: 1px solid var(--gold-dim); transition: background .15s; }
#market-table tbody tr:hover { background: var(--bg2); }
#market-table td { padding: 10px; color: var(--text); }
.change-up   { color: var(--up);   font-weight: 600; }
.change-down { color: var(--down); font-weight: 600; }
.change-flat { color: var(--muted); }

/* ── 시장 분석 블록 ── */
.market-analysis-block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--gold-dim); }
.market-analysis-block h3 { font-size: .95rem; font-weight: 700; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px; }
.market-analysis-block > div p { font-size: .93rem; line-height: 1.85; color: var(--text); margin-bottom: 10px; }
.market-analysis-block > div p:last-child { margin-bottom: 0; }

/* ── 푸터 ── */
.site-footer { text-align: center; padding: 28px 16px 36px; max-width: var(--max); margin: 0 auto; }
.site-footer a {
  display: inline-block;
  color: var(--gold);
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid var(--gold-mid);
  border-radius: 6px;
  padding: 8px 20px;
  margin-bottom: 14px;
  letter-spacing: .04em;
  transition: background .15s;
}
.site-footer a:hover { background: var(--gold-dim); }
.site-footer small { font-size: .85rem; color: var(--muted); display: block; }
