/* ===== CSS VARIABLES ===== */
:root {
  --bg: #fdf7f4;
  --bg-alt: #f8f1ed;
  --surface: #ffffff;
  --surface-alt: #fff7f0;
  --text: #2f261f;
  --text-muted: #7a6f66;
  --accent: #e8a08b;
  --accent-strong: #d47b63;
  --accent-soft: rgba(232,160,139,0.18);
  --mint: #b8dccb;
  --mint-soft: rgba(184,220,203,0.25);
  --border: rgba(47,38,31,0.1);
  --shadow-sm: 0 2px 8px rgba(33,26,22,0.06);
  --shadow-md: 0 8px 24px rgba(33,26,22,0.10);
  --shadow-lg: 0 20px 50px rgba(33,26,22,0.13);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --header-h: 60px;
  --bnav-h: 64px;
  --font-body: 'Gowun Dodum', sans-serif;
  --font-display: 'Jua', sans-serif;
}

body.dark {
  --bg: #171313;
  --bg-alt: #1e1919;
  --surface: #1f1b1b;
  --surface-alt: #262121;
  --text: #f5efe9;
  --text-muted: #c1b5aa;
  --accent: #f0b39d;
  --accent-strong: #e28f75;
  --accent-soft: rgba(240,179,157,0.14);
  --mint: #95c4b2;
  --mint-soft: rgba(149,196,178,0.15);
  --border: rgba(245,239,233,0.1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.4);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ===== BACKGROUND ===== */
.background-texture {
  position: fixed;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 25%, rgba(232,160,139,0.3) 0%, transparent 50%),
    radial-gradient(circle at 75% 70%, rgba(184,220,203,0.28) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  filter: blur(1px);
}

/* ===== HEADER ===== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  background: rgba(253,247,244,0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background 0.3s;
}
body.dark .site-header {
  background: rgba(23,19,19,0.88);
}
.header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.2s;
  flex-shrink: 0;
}
.header-back:hover { background: var(--accent-soft); }
.header-back.hidden { display: none !important; }
.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent-strong);
  flex: 1;
  text-align: center;
}
.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--accent-soft); }

/* ===== SEARCH OVERLAY ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(253,247,244,0.97);
  z-index: 200;
  display: none;
  flex-direction: column;
  padding-top: 16px;
}
body.dark .search-overlay {
  background: rgba(23,19,19,0.97);
}
.search-overlay.open { display: flex; }
.search-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: var(--shadow-md);
}
.search-input-wrap svg { color: var(--text-muted); flex-shrink: 0; }
#search-input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  outline: none;
}
#search-input::placeholder { color: var(--text-muted); }
.search-close-btn {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.search-close-btn:hover { color: var(--accent-strong); }
.search-results {
  overflow-y: auto;
  flex: 1;
  display: grid;
  gap: 8px;
  padding-bottom: 80px;
}
.search-result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeSlideIn 0.2s ease forwards;
}
.search-result-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.search-result-tag {
  font-size: 11px;
  color: var(--accent-strong);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.search-result-title {
  font-family: var(--font-display);
  font-size: 15px;
  margin-bottom: 3px;
}
.search-result-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.search-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ===== MAIN CONTENT ===== */
.app-main {
  position: relative;
  z-index: 1;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--bnav-h) + 16px);
  min-height: 100vh;
}

/* ===== HOME VIEW ===== */
.home-view {}
.hero-section {
  padding: 28px 20px 24px;
  max-width: 900px;
  margin: 0 auto;
}
.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 10px;
}
.hero-title {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-title span {
  color: var(--accent-strong);
}
.hero-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.hero-cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-primary {
  background: var(--accent-strong);
  color: white;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(212,123,99,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(212,123,99,0.45); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); }

/* 홈 섹션 그리드 */
.home-sections {
  padding: 0 16px 16px;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.home-section-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-section-title::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--border);
}

/* 그룹 칩 */
.group-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.group-chips::-webkit-scrollbar { display: none; }
.group-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: var(--font-body);
}
.group-chip:hover { border-color: var(--accent); color: var(--text); }
.group-chip.active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: white;
  box-shadow: 0 3px 10px rgba(212,123,99,0.3);
}

/* 스테이지 카드 그리드 */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.stage-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.22s;
  animation: fadeSlideIn 0.25s ease forwards;
}
.stage-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.stage-card-group {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 6px;
}
.stage-card-label {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 4px;
}
.stage-card-range {
  font-size: 12px;
  color: var(--text-muted);
}
.stage-card-top5 {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stage-card-top5-item {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.stage-card-top5-item::before {
  content: '·';
  color: var(--accent-strong);
  font-weight: 700;
  flex-shrink: 0;
}
.stage-card-cta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent-strong);
  font-weight: 700;
}

/* 테마 카드 그리드 */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.theme-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.22s;
  animation: fadeSlideIn 0.25s ease forwards;
}
.theme-card:hover {
  border-color: var(--mint);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.theme-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 6px;
}
.theme-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}
.theme-card-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.keyword-pill {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--mint-soft);
  color: var(--text-muted);
  border-radius: 999px;
}

/* ===== STAGE DETAIL VIEW ===== */
.detail-view {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
  animation: fadeSlideIn 0.3s ease;
}
.detail-header {
  margin-bottom: 24px;
}
.detail-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 6px;
}
.detail-title {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin-bottom: 6px;
}
.detail-range {
  font-size: 14px;
  color: var(--text-muted);
}

/* Top5 박스 */
.top5-box {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}
.top5-box-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--accent-strong);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.top5-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}
.top5-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.4;
}
.top5-num {
  width: 22px;
  height: 22px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* 섹션 탭 (테마용) */
.section-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: var(--font-body);
}
.section-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--text);
}

/* 정보 카드 */
.info-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.info-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.2s;
  animation: fadeSlideIn 0.25s ease forwards;
}
.info-card:hover { box-shadow: var(--shadow-sm); }
.info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
}
.info-card-left { flex: 1; min-width: 0; }
.info-card-cat {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 3px;
}
.info-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-card-summary {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-card-chevron {
  color: var(--text-muted);
  transition: transform 0.25s;
  flex-shrink: 0;
}
.info-card.open .info-card-chevron { transform: rotate(180deg); }
.info-card-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}
.info-card.open .info-card-body { display: block; }
.info-card-detail {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}
.detail-row-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 5px;
}
.detail-row-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-row-item {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.45;
}
.detail-row-item::before {
  content: '•';
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}
.checklist-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.checklist-chip {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 999px;
}

/* 제품 카드 강조 */
.info-card.product-card {
  border-color: var(--mint);
  background: linear-gradient(135deg, var(--surface), var(--mint-soft));
}
.info-card.product-card .info-card-cat {
  color: #3a8c6e;
}
.product-focus-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.product-focus-item {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.45;
}
.product-focus-item::before {
  content: '✓';
  color: #3a8c6e;
  flex-shrink: 0;
  font-weight: 700;
}

/* ===== ABOUT VIEW ===== */
.about-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
  animation: fadeSlideIn 0.3s ease;
}
.about-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.about-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}
.about-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent-strong);
}
.about-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
}
.about-section { margin-bottom: 24px; }
.about-section h2 {
  font-size: 1.2rem;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
}
.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sources-list a {
  font-size: 14px;
  color: var(--accent-strong);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}
.sources-list a:hover { opacity: 0.75; }
.sources-list a::before {
  content: '→';
  font-weight: 700;
}
.contact-card {
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
}
.partnership-form {
  display: grid;
  gap: 14px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.form-field input,
.form-field textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); }
.form-submit {
  background: var(--accent-strong);
  color: white;
  border-radius: 999px;
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-body);
  transition: all 0.2s;
}
.form-submit:hover { opacity: 0.9; transform: translateY(-1px); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bnav-h);
  display: flex;
  background: rgba(253,247,244,0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 100;
  transition: background 0.3s;
}
body.dark .bottom-nav {
  background: rgba(23,19,19,0.95);
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  transition: color 0.2s;
  padding: 6px 0;
}
.bnav-item:hover { color: var(--accent-strong); }
.bnav-item.active {
  color: var(--accent-strong);
}
.bnav-item.active svg {
  filter: drop-shadow(0 0 6px rgba(212,123,99,0.5));
}

/* ===== AD SLOTS ===== */
.ad-slot {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 16px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (min-width: 640px) {
  .stage-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .about-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .brand { text-align: left; }
  .bottom-nav { display: none; }
  .app-main { padding-bottom: 24px; }
  /* 데스크탑에서는 상단 nav 추가 */
  .site-header {
    padding: 0 32px;
    gap: 0;
  }
  .header-actions { margin-left: auto; }
  .desktop-nav {
    display: flex;
    gap: 4px;
    margin-left: 24px;
  }
  .desktop-nav-link {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: 999px;
    transition: all 0.2s;
    font-family: var(--font-body);
  }
  .desktop-nav-link:hover, .desktop-nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
}

/* ===== 스크롤바 ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
