/* ===== 기본 초기화 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a6fc4;
  --primary-dark: #145ea8;
  --lunar: #7b3fa0;
  --bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e2e8f0;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --radius: 14px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 헤더 ===== */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

header nav ul {
  list-style: none;
  display: flex;
  gap: 6px;
}

header nav ul li a {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

header nav ul li a:hover,
header nav ul li a.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 20px 16px;
}

.mobile-nav a {
  padding: 10px 0;
  font-size: 0.95rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.mobile-nav a:last-child { border-bottom: none; }

.mobile-nav.open { display: flex; }

/* ===== 히어로 ===== */
.hero {
  background: linear-gradient(135deg, #1a6fc4, #7b3fa0);
  color: #fff;
  padding: 22px 0 20px;
  text-align: center;
}

.hero h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.hero-today {
  display: inline-block;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 16px;
  padding: 14px 24px 16px;
  margin-top: 8px;
  min-width: 360px;
  text-align: center;
}

.hero-today-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 10px;
}

.hero-today-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.hero-today-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.hero-today-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.22);
  flex-shrink: 0;
}

.hero-today-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0.6;
}

.hero-today-date {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

.hero-today-sub {
  font-size: 0.76rem;
  opacity: 0.65;
  margin-top: 1px;
}

/* ===== 변환기 ===== */
.converter-section {
  padding: 24px 0 20px;
}

/* 단일 카드 */
.single-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

/* 방향 토글 */
.toggle-wrap {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 0;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.toggle-btn.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

#btn-lunar.active {
  color: var(--lunar);
}

/* 변환 버튼 모드별 색상 */
.btn.lunar-mode { background: var(--lunar); }
.btn.lunar-mode:hover { background: #6a3590; }

.input-group {
  margin-bottom: 10px;
}

.input-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.input-group input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fafafa;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus { border-color: var(--primary); background: #fff; }

.leap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  color: var(--muted);
}

.leap-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--lunar);
  cursor: pointer;
}

.btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  letter-spacing: 0.5px;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 0;
}

.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-lunar { background: var(--lunar); }
.btn-lunar:hover { background: #6a3590; }

.result-box {
  margin-top: 16px;
  background: #f8faff;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 16px 18px;
  min-height: 64px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.result-box .main-date {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.result-box .detail {
  font-size: 0.82rem;
  color: var(--muted);
}

.result-box.empty { color: #b0b8c9; font-size: 0.88rem; }

.result-box.error {
  background: #fff5f5;
  border-color: #fecaca;
  color: #dc2626;
}

/* ===== 오늘 날짜 ===== */
.today-section { padding: 0 0 48px; }

.today-card {
  background: linear-gradient(90deg, #eff6ff, #f5f3ff);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 22px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}

.today-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.today-date {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.today-detail {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== 정보 섹션 ===== */
.info-section {
  background: #fff;
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.info-section h2,
.tips-section h2,
.faq-section h2,
.page-header h1 {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 28px;
  color: var(--text);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.info-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.info-icon { font-size: 1.8rem; margin-bottom: 10px; }

.info-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.info-card p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ===== 팁 섹션 ===== */
.tips-section {
  padding: 56px 0;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tips-list li {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.65;
}

.tips-list li strong { color: var(--text); }

/* ===== FAQ ===== */
.faq-section {
  background: #fff;
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

.faq-list { display: flex; flex-direction: column; gap: 12px; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.faq-item summary {
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::after { content: '+'; font-size: 1.1rem; color: var(--primary); }
.faq-item[open] summary::after { content: '−'; }

.faq-item p {
  padding: 16px 20px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.75;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ===== 푸터 ===== */
footer {
  background: #1a1a2e;
  color: #aaa;
  padding: 36px 0 24px;
  margin-top: 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.15s;
}
.footer-logo:hover { opacity: 0.75; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: center;
}

.footer-nav a {
  font-size: 0.85rem;
  color: #aaa;
  transition: color 0.15s;
}

.footer-nav a:hover { color: #fff; }

.footer-copy { font-size: 0.8rem; color: #666; }

/* ===== 페이지 헤더 (내부 페이지) ===== */
.page-header {
  background: linear-gradient(135deg, #1a6fc4, #7b3fa0);
  color: #fff;
  padding: 48px 0 40px;
}

.page-header p {
  opacity: 0.85;
  font-size: 0.95rem;
  margin-top: 6px;
}

.page-content {
  padding: 52px 0 72px;
}

.page-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
}

.page-content p,
.page-content li {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 8px;
}

.page-content ul,
.page-content ol {
  padding-left: 20px;
}

.page-content section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  margin-bottom: 0;
}

/* 문의 폼 */
.contact-form {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 600px;
}

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); background: #fff; }

.form-group textarea { resize: vertical; min-height: 120px; }

.btn-submit {
  padding: 13px 40px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover { background: var(--primary-dark); }

.form-notice {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 12px;
}

.toast {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #065f46;
}

/* 가이드 */
.guide-step {
  display: flex;
  gap: 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.step-num {
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.guide-step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.guide-step p { font-size: 0.88rem; color: var(--muted); line-height: 1.65; }

/* 소개 */
.about-feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.about-feature:last-child { border-bottom: none; }

.about-icon {
  font-size: 1.6rem;
  min-width: 44px;
  text-align: center;
}

.about-feature h3 { font-size: 0.97rem; font-weight: 700; margin-bottom: 4px; }
.about-feature p { font-size: 0.87rem; color: var(--muted); }

/* ===== 면책조항 ===== */
.disclaimer-section {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.disclaimer-text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.disclaimer-link {
  margin-left: 8px;
  color: var(--primary);
  text-decoration: underline;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ===== 테마 토글 버튼 ===== */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 10px;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
  margin-right: 6px;
  white-space: nowrap;
}

.theme-toggle:hover {
  background: var(--bg);
  border-color: var(--primary);
}

/* ===== 다크모드 변수 ===== */
[data-theme="dark"] {
  --bg: #0f1117;
  --card-bg: #1a1d27;
  --text: #e8eaf0;
  --muted: #9ca3b0;
  --border: #2a2d3a;
  --shadow: 0 2px 16px rgba(0,0,0,0.35);
}

[data-theme="dark"] header {
  background: #1a1d27;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

[data-theme="dark"] .mobile-nav {
  background: #1a1d27;
}

[data-theme="dark"] header nav ul li a:hover,
[data-theme="dark"] header nav ul li a.active {
  background: #252836;
}

[data-theme="dark"] .toggle-wrap {
  background: #252836;
}

[data-theme="dark"] .input-group input {
  background: #252836;
}

[data-theme="dark"] .input-group input:focus {
  background: #2d3144;
}

[data-theme="dark"] .result-box {
  background: #1a2035;
  border-color: #2a3a5c;
}

[data-theme="dark"] .result-box.error {
  background: #2a1a1a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .info-section {
  background: #141720;
}

[data-theme="dark"] .faq-section {
  background: #141720;
}

[data-theme="dark"] .faq-item summary {
  background: #1a1d27;
}

[data-theme="dark"] .faq-item p {
  background: #141720;
}

[data-theme="dark"] .tips-list li {
  background: #1a1d27;
}

[data-theme="dark"] .today-card {
  background: linear-gradient(90deg, #1a2a4a, #2a1a3a);
  border-color: #2a3a5c;
}

[data-theme="dark"] .contact-form {
  background: #1a1d27;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
  background: #252836;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus,
[data-theme="dark"] .form-group select:focus {
  background: #2d3144;
}

[data-theme="dark"] .guide-step {
  background: #1a1d27;
}

[data-theme="dark"] .dday-form-card {
  background: #1a1d27;
}

[data-theme="dark"] .dday-item {
  background: #1a1d27;
}

[data-theme="dark"] .tool-card {
  background: #1a1d27;
}

[data-theme="dark"] .sonless-card {
  background: #1a1d27;
}

[data-theme="dark"] .coming-soon-card {
  background: #1a1d27;
}

[data-theme="dark"] .update-notice {
  background: linear-gradient(135deg, #1a2a4a, #2a1a3a);
  border-color: #2a3a5c;
}

[data-theme="dark"] .dday-badge.future {
  background: #1a2a4a;
}

[data-theme="dark"] .dday-badge.past {
  background: #2a1a3a;
}

[data-theme="dark"] .info-notice {
  background: #1a1d27;
}

[data-theme="dark"] .example-card {
  background: #1a1d27;
}

[data-theme="dark"] .faq-notice {
  background: #1a1d27;
  border-color: #2a3a5c;
}

[data-theme="dark"] .today-btn {
  background: #252836;
  border-color: #2a3a5c;
  color: #60a5fa;
}

[data-theme="dark"] .today-btn:hover {
  background: #2d3144;
}

/* ===== 반응형 ===== */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.3rem; }
  header nav { display: none; }
  .hamburger { display: block; }
  .cards { flex-direction: column; }
  .card { max-width: 100%; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .guide-step { flex-direction: column; }
  .hero-today { min-width: unset; width: 100%; }
}

@media (max-width: 420px) {
  .info-grid { grid-template-columns: 1fr; }
}
