/* ═══════════════════════════════════════════════════════
   막말 교토 가이드 — 분위기 있는 다크 테마
   금박 + 진홍 + 와시 텍스처
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-deep: #0a0a10;
  --bg-card: #14141e;
  --bg-section: #0e0e16;
  --bg-section-alt: #0c0c14;
  --gold: #c9a84c;
  --gold-dim: #8a7535;
  --crimson: #8b2232;
  --crimson-bright: #c4354a;
  --text: #e8e0d0;
  --text-dim: #b0a898;
  --text-muted: #706858;
  --border: #2a2520;
  --border-light: #3a352e;
  --font-serif: 'Noto Serif KR', serif;
  --font-sans: 'Noto Sans KR', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  filter: url(#grain);
}

/* ══════════════════════════════════════════
   네비게이션
   ══════════════════════════════════════════ */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  height: 3.5rem;
  gap: 1.5rem;
}
.nav-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
  white-space: nowrap;
}
.nav-factions {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin-left: auto;
}
.nav-factions::-webkit-scrollbar { display: none; }
.nav-faction-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}
.nav-faction-link:hover, .nav-faction-link.active {
  background: rgba(255,255,255,0.08);
}

/* ══════════════════════════════════════════
   히어로
   ══════════════════════════════════════════ */
#hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(139,34,50,0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(201,168,76,0.1) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-deep) 0%, rgba(10,10,16,0.2) 40%, var(--bg-deep) 100%);
}
.hero-grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  filter: url(#grain);
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 4rem 1.5rem;
}
.hero-badge {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  padding: 0.4rem 1.5rem;
  border-radius: 2px;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 9vw, 6rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 30%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--text-dim);
  max-width: 620px;
  margin: 0 auto 2.5rem;
  line-height: 1.9;
}
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}
.stat-item { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
}
.stat-label {
  font-size: 0.9rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.stat-divider {
  width: 1px;
  height: 2.5rem;
  background: var(--border-light);
}
.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 1.4rem;
  animation: float 2s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ══════════════════════════════════════════
   섹션 공통
   ══════════════════════════════════════════ */
.section {
  padding: 5rem 1.5rem;
  background: var(--bg-section);
}
.section-alt { background: var(--bg-section-alt); }
.section-inner {
  max-width: 800px;
  margin: 0 auto;
}
.section-wide { max-width: 1300px; }
.section-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}
.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 3rem;
}

/* ══════════════════════════════════════════
   타임라인
   ══════════════════════════════════════════ */
.timeline {
  position: relative;
  padding-left: 3rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.8rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--border-light) 10%, var(--border-light) 90%, transparent);
}
.tl-item {
  position: relative;
  margin-bottom: 2rem;
}
.tl-item.future { opacity: 0.35; }
.tl-dot {
  position: absolute;
  left: -2.45rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-light);
  border: 2px solid var(--bg-section);
}
.tl-item.current .tl-dot {
  background: var(--crimson-bright);
  box-shadow: 0 0 10px rgba(196,53,74,0.5);
  width: 12px;
  height: 12px;
  left: calc(-2.45rem - 1px);
}
.tl-year {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gold-dim);
  margin-right: 0.5rem;
}
.tl-item.current .tl-year { color: var(--crimson-bright); }
.tl-event { font-weight: 500; font-size: 1.05rem; }
.tl-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tl-toggle {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  margin-left: 0.25rem;
}
.tl-item.expanded .tl-toggle { transform: rotate(90deg); }
.tl-item.expandable { cursor: pointer; }
.tl-item.expandable:hover .tl-event { color: var(--gold); }
.tl-desc {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
  line-height: 1.6;
}
.tl-detail {
  display: none;
  margin-top: 0.75rem;
  padding: 1rem;
  background: rgba(201, 168, 76, 0.03);
  border-left: 2px solid var(--gold-dim);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.8;
}
.tl-item.expanded .tl-detail { display: block; }

/* ══════════════════════════════════════════
   세력 관계도
   ══════════════════════════════════════════ */
.diagram-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}
.diagram-top { text-align: center; margin-bottom: 2rem; }
.diagram-node {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: 1px solid;
  font-size: 1rem;
  font-weight: 600;
}
.diagram-node small {
  display: block;
  font-weight: 300;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.node-court { border-color: #c9a84c55; color: var(--gold); }
.node-satsuma { border-color: #AB47BC55; color: #AB47BC; }
.diagram-versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.diagram-side {
  padding: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.side-bakufu { background: rgba(255,213,79,0.03); }
.side-tobaku { background: rgba(255,112,67,0.03); }
.side-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.1rem;
}
.side-bakufu .side-title { color: #FFD54F; }
.side-tobaku .side-title { color: #FF7043; }
.side-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.diagram-side ul { list-style: none; font-size: 0.95rem; }
.diagram-side li {
  padding: 0.25rem 0 0.25rem 1.2rem;
  position: relative;
}
.diagram-side li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
}
.side-support {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.diagram-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.versus-icon { font-size: 2rem; color: var(--text-muted); }
.diagram-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}
.diagram-tag {
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--c);
  color: var(--c);
  opacity: 0.7;
}

/* ══════════════════════════════════════════
   세력 섹션
   ══════════════════════════════════════════ */
.faction-section {
  margin-bottom: 3.5rem;
}
.faction-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.faction-num { font-size: 1.3rem; color: var(--faction-color); }
.faction-header h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
}
.faction-kr {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}
.faction-stance {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--faction-color);
  color: var(--faction-color);
  opacity: 0.7;
}
.faction-count { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }
.faction-desc {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}
.subdojo {
  padding: 0.5rem 0 0.5rem 1rem;
  margin-bottom: 0.5rem;
  border-left: 2px solid var(--border);
}
.subdojo h4 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dim);
}
.subdojo p { font-size: 0.85rem; color: var(--text-muted); }

/* ══════════════════════════════════════════
   캐릭터 카드
   ══════════════════════════════════════════ */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.char-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  position: relative;
}
.char-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(circle at 50% 0%, var(--faction-color), transparent 70%);
  pointer-events: none;
  z-index: 1;
}
.char-card:hover, .char-card.active {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  border-color: var(--faction-color);
}
.char-card:hover::before, .char-card.active::before { opacity: 0.08; }
.card-img-wrap {
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #0a0a12;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.char-card:hover .card-img-wrap img { transform: scale(1.06); }
.card-img-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(transparent, var(--bg-card));
  pointer-events: none;
}
.card-body { padding: 0.85rem 1rem; }
.card-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}
.card-motif {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.card-role {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(201,168,76,0.08);
  color: var(--text-dim);
  border: 1px solid rgba(201,168,76,0.1);
}

/* ══════════════════════════════════════════
   인라인 상세 패널
   ══════════════════════════════════════════ */
.detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--faction-color, var(--border));
  border-radius: 12px;
  margin-top: 1.25rem;
  margin-bottom: 1rem;
  overflow: hidden;
  animation: slideDown 0.25s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; max-height: 0; transform: translateY(-10px); }
  to { opacity: 1; max-height: 800px; transform: translateY(0); }
}
.detail-inner {
  padding: 1.5rem;
  position: relative;
}
.detail-close {
  position: absolute;
  right: 1rem;
  top: 0.75rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 1.3rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
}
.detail-close:hover { border-color: var(--crimson-bright); color: var(--crimson-bright); }
.detail-layout {
  display: flex;
  gap: 2rem;
}
.detail-img-col { width: 240px; flex-shrink: 0; }
.detail-img {
  width: 100%;
  border-radius: 8px;
  object-fit: contain;
}
.detail-info-col { flex: 1; min-width: 0; }
.detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}
.detail-name {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
}
.detail-faction {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}
.detail-motif {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.detail-role {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.detail-rows { }
.detail-row {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}
.detail-row + .detail-row { border-top: 1px solid rgba(255,255,255,0.03); }
.detail-label {
  flex-shrink: 0;
  width: 5.5rem;
  font-weight: 600;
  color: var(--gold-dim);
  font-size: 0.88rem;
}
.detail-value { color: var(--text-dim); line-height: 1.6; }

/* ══════════════════════════════════════════
   푸터
   ══════════════════════════════════════════ */
.site-footer {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.footer-line {
  width: 60px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 1rem;
}

/* ══════════════════════════════════════════
   반응형
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .diagram-versus { grid-template-columns: 1fr; }
  .diagram-center { flex-direction: row; }
  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }
  .detail-layout { flex-direction: column; }
  .detail-img-col { width: 100%; max-width: 280px; }
  .section { padding: 3.5rem 1rem; }
  .card-body { padding: 0.65rem 0.75rem; }
  .card-name { font-size: 0.95rem; }
  .detail-name { font-size: 1.3rem; }
  .detail-row { font-size: 0.88rem; flex-direction: column; gap: 0.2rem; }
  .detail-label { width: auto; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2.5rem; }
  .hero-desc { font-size: 1rem; }
  .stat-num { font-size: 1.8rem; }
  .nav-faction-link { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
}
