/* ================================================================
   골목점집 오늘의운세 — styles.css
   hub-premium-spec.md §3 토큰 기반 다크 테마
   saju/styles.css와 톤 통일. 필요한 것만 정의.
   ================================================================ */

/* ── 폰트 로드 ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Noto+Serif+KR:wght@400;700&display=swap');

/* ── CSS 변수 — 사주 styles.css와 동일 토큰 ── */
:root {
  /* 배경 계층 */
  --bg-base:        #0D0D0D;
  --bg-card:        #1A1A1A;
  --bg-card-deep:   #161616;
  --bg-section:     #111111;
  --bg-input:       #222222;

  /* 브랜드 그린 */
  --color-forest:        #1B4A3C;
  --color-forest-mid:    #245F4E;
  --color-forest-bright: #4A9B82;
  --color-forest-glow:   rgba(27, 74, 60, 0.25);

  /* 앰버 */
  --color-amber:      #8B6914;
  --color-amber-glow: rgba(139, 105, 20, 0.15);

  /* 텍스트 — §3-3 명암비 준수 */
  --text-primary:   #FAF9F5;                       /* ~19:1 on #0D0D0D */
  --text-secondary: rgba(250, 249, 245, 0.75);     /* ~14:1 */
  --text-tertiary:  rgba(250, 249, 245, 0.5);      /* ~9:1  */
  --text-muted:     rgba(250, 249, 245, 0.3);
  --text-green:     #4A9B82;   /* §3-3: #0D0D0D 대비 ~5.2:1 AA — 다크 그린텍스트 */

  /* 테두리 */
  --border-subtle:  rgba(250, 249, 245, 0.08);
  --border-card:    rgba(27, 74, 60, 0.35);
  --border-active:  rgba(27, 74, 60, 0.75);

  /* 카카오 */
  --kakao-yellow: #FEE500;
  --kakao-black:  #191919;

  /* 폰트 */
  --font-serif: 'Noto Serif KR', serif;
  --font-sans:  'Noto Sans KR', sans-serif;

  /* 타이포 스케일 */
  --text-xs:    10px;
  --text-sm:    12px;
  --text-base:  14px;
  --text-md:    15px;
  --text-lg:    17px;
  --text-xl:    20px;
  --text-2xl:   24px;
  --text-3xl:   30px;

  /* 행간 */
  --leading-dialog: 2.2;
  --leading-body:   1.85;
  --leading-tight:  1.4;

  /* 자간 */
  --tracking-label: 0.08em;
  --tracking-hanja: 0.08em;

  /* 모션 */
  --dur-fast:   150ms;
  --dur-normal: 300ms;
  --dur-slow:   600ms;
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);

  /* 레거시 호환 */
  --color-text-muted: rgba(250, 249, 245, 0.35);
  --shadow-input:     0 0 0 3px rgba(27, 74, 60, 0.25);
  --container-max:    480px;
  --container-px:     20px;
}

/* ── 리셋 & 기본 ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: var(--leading-body);
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── 접근성 ── */
:focus-visible {
  outline: 2px solid #4A9B82;
  outline-offset: 2px;
}

/* ── 공통 헤더 (nav.js 삽입) ── */
.site-header { display: none !important; }

/* ── 페이지 히어로 (§C-1) ── */
.page-hero {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  background: var(--bg-base);
}

.page-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.5;   /* g4가 인물 메인이므로 더 투명 */
}

.page-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(13, 13, 13, 0.0) 0%,
    rgba(13, 13, 13, 0.95) 100%
  );
  z-index: 1;
}

/* 날짜 뱃지 — 우상단 */
.hero-date-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  background: rgba(27, 74, 60, 0.6);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* 히어로 좌하 텍스트 */
.page-hero__content {
  position: absolute;
  bottom: 32px;
  left: 24px;
  z-index: 2;
}

.page-hero__title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}

.page-hero__subtitle {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: rgba(250, 249, 245, 0.6);
  margin-top: 6px;
}

/* ── 페르소나 인사 블록 (§C-1 하단) ── */
.persona-greeting {
  background: var(--bg-section);
  padding: 28px 24px 28px 80px;
  position: relative;
}

.persona-greeting__avatar {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(27, 74, 60, 0.5);
}

.persona-greeting__text {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 400;
  color: rgba(250, 249, 245, 0.9);
  line-height: var(--leading-dialog);
}

/* ── 메인 컨테이너 ── */
.page-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-px);
}

.section { padding: 32px 0; }

/* ── 입력 카드 (§C-2) ── */
.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 24px 20px;
}

/* ── 양력/음력 토글 ── */
.calendar-toggle-wrap {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid rgba(27, 74, 60, 0.4);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}

.calendar-toggle-btn {
  padding: 8px 20px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.4);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  letter-spacing: 0.04em;
}

.calendar-toggle-btn.active,
.calendar-toggle-btn[aria-pressed="true"] {
  background: var(--color-forest);
  color: var(--text-primary);
}

.calendar-toggle-btn:hover:not(.active):not([aria-pressed="true"]) {
  color: rgba(250, 249, 245, 0.7);
}

/* 윤달 체크박스 래퍼 */
.leap-month-wrap {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 8px;
}

.leap-month-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.65);
  cursor: pointer;
  user-select: none;
}

.leap-month-check {
  width: 16px;
  height: 16px;
  accent-color: var(--color-forest-bright);
  cursor: pointer;
}

.field-group { margin-bottom: 20px; }
.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.45);
  letter-spacing: var(--tracking-label);
  margin-bottom: 10px;
}

/* 날짜 3필드 그리드 */
.date-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
}

.text-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(27, 74, 60, 0.35);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  -webkit-appearance: none;
  appearance: none;
}

.text-input::placeholder {
  color: rgba(250, 249, 245, 0.25);
  font-weight: 400;
  font-size: 14px;
}

.text-input:focus {
  outline: none;
  border-color: var(--color-forest);
  box-shadow: var(--shadow-input);
}

/* ── CTA 버튼 ── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--color-forest);
  color: var(--text-primary);   /* #FAF9F5 on #1B4A3C — ~9.2:1 AAA */
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
  margin-top: 16px;
}

.btn-primary:hover { background: var(--color-forest-mid); }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(27, 74, 60, 0.4); }

/* ── 에러 메시지 ── */
.error-msg {
  color: #E07070;
  font-size: 13px;
  margin-top: 8px;
  display: none;
}
.error-msg.visible { display: block; }

/* ── 계산 방식 아코디언 ── */
.details-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0;
  background: none;
  border: none;
  font-family: var(--font-sans);
  transition: color var(--dur-fast);
}
.details-toggle:hover { color: var(--text-green); }
.details-toggle svg { transition: transform var(--dur-fast); }
.details-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.details-content {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
}
.details-content p { margin-bottom: 6px; }

/* ── 결과 화면 ── */
#result-section {
  display: none;
  background: var(--bg-base);
}

/* ── 로딩 상태 ── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 40px 20px;
}

.loading-dots {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: 0.2em;
  animation: loadingPulse 1.2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ── 로딩 스피너 ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(250, 249, 245, 0.3);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

/* ── 페르소나 등장 대사 (시퀀스 단계1) ── */
.persona-intro-reveal {
  padding: 28px 24px;
  background: var(--bg-section);
}

.persona-intro-reveal__inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: var(--container-max);
  margin: 0 auto;
}

.persona-reveal__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(27, 74, 60, 0.5);
  flex-shrink: 0;
}

.persona-reveal__lines { flex: 1; }

.persona-reveal__line {
  font-family: var(--font-serif);
  font-size: 16px;
  color: rgba(250, 249, 245, 0.9);
  line-height: var(--leading-dialog);
  opacity: 0;
  animation: revealLine 400ms ease-out forwards;
}

.persona-reveal__line:nth-child(1) { animation-delay: 0ms; }
.persona-reveal__line:nth-child(2) { animation-delay: 350ms; }
.persona-reveal__line:nth-child(3) { animation-delay: 700ms; }

@keyframes revealLine {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 결과 날짜 헤더 ── */
.result-date-header {
  padding: 24px 24px 0;
  max-width: var(--container-max);
  margin: 0 auto;
}

.result-date-header__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(27, 74, 60, 0.6);
  flex-shrink: 0;
}

.result-date-header__text { flex: 1; }

.result-date-header__row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-date-header__title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-date-header__birth {
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.4);
  margin-top: 3px;
}

.result-pillar-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-green);
  background: rgba(27, 74, 60, 0.2);
  border: 1px solid rgba(27, 74, 60, 0.4);
  padding: 3px 9px;
  border-radius: 4px;
  margin-top: 6px;
}

/* ── 종합운 카드 (§C-3) ── */
.overall-card {
  background: var(--bg-card);
  border-left: 3px solid var(--color-forest);
  border-radius: 12px;
  padding: 24px 20px;
  margin: 20px 24px 0;
}

.overall-card__title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-green);   /* §3-3: #4A9B82 on #1A1A1A ~5.8:1 AA */
  margin-bottom: 14px;
  letter-spacing: 0.03em;
}

.overall-card__summary {
  font-family: var(--font-serif);
  font-size: 15px;
  color: rgba(250, 249, 245, 0.9);
  line-height: 1.9;
  margin-bottom: 12px;
}

.overall-card__detail {
  font-family: var(--font-sans);
  font-size: 15px;
  color: rgba(250, 249, 245, 0.82);
  line-height: var(--leading-body);
}

/* ── 영역별 미니 카드 (§C-3) ── */
.domains-grid {
  margin: 16px 24px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.domain-card {
  background: var(--bg-card-deep);
  border: 1px solid rgba(27, 74, 60, 0.2);
  border-radius: 10px;
  padding: 16px;
}

.domain-card--full {
  grid-column: 1 / -1;
}

.domain-card__title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-green);   /* §3-3: #4A9B82 on #161616 ~5.8:1 AA */
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.domain-card__text {
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.65);
  line-height: 1.75;
}

/* ── 오늘의 한마디 인용 블록 (§C-3) ── */
.word-block {
  margin: 24px 24px 0;
  border-left: 2px solid rgba(139, 105, 20, 0.6);
  padding-left: 16px;
}

.word-block__text {
  font-family: var(--font-serif);
  font-size: 14px;
  color: rgba(250, 249, 245, 0.55);
  line-height: 2.0;
}

.word-block__label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: rgba(250, 249, 245, 0.25);
  margin-top: 8px;
}

/* ── 카카오 채널 재방문 유도 (§C-3) ── */
.kakao-block {
  margin: 24px 24px 0;
  background: rgba(27, 74, 60, 0.15);
  border: 1px solid rgba(27, 74, 60, 0.4);
  border-radius: 12px;
  padding: 20px;
}

.kakao-block__title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: rgba(250, 249, 245, 0.8);
  margin-bottom: 6px;
}

.kakao-block__desc {
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.5);
  line-height: 1.75;
  margin-bottom: 14px;
}

.btn-kakao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--kakao-yellow);
  color: var(--kakao-black);  /* #191919 on #FEE500 ~15:1 AAA */
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--dur-fast);
}

.btn-kakao:hover { opacity: 0.9; }

/* 다시 입력하기 버튼 */
.btn-reset {
  display: block;
  margin: 16px auto 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.35);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--dur-fast);
  text-align: center;
}

.btn-reset:hover { color: var(--text-secondary); }

/* ── C-3 면책 고지 (§C-3 면책 상세) ── */
.disclaimer-box {
  background: var(--bg-base);
  border-top: 1px solid rgba(250, 249, 245, 0.06);
  padding: 20px 24px;
  margin-top: 24px;
}

.disclaimer-persona {
  font-family: var(--font-serif);
  font-size: 13px;
  color: rgba(250, 249, 245, 0.35);
  line-height: 1.9;
  margin-bottom: 10px;
}

.disclaimer-tech {
  font-family: var(--font-sans);
  font-size: 11px;
  color: rgba(250, 249, 245, 0.2);
  line-height: 1.7;
}

/* ── 공통 핸드오프 푸터 (§3-4) ── */
.handoff-footer {
  background: var(--bg-base);
  border-top: 1px solid rgba(250, 249, 245, 0.06);
  padding: 48px 24px 40px;
  text-align: center;
}

.handoff-footer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

.handoff-footer__label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  color: rgba(250, 249, 245, 0.3);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.handoff-footer__title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.handoff-footer__persona-lines { margin-top: 8px; }

.handoff-footer__sub {
  font-family: var(--font-sans);
  font-size: 14px;
  color: rgba(250, 249, 245, 0.55);
  line-height: 1.9;
  margin-top: 2px;
}

.btn-handoff {
  display: inline-block;
  padding: 15px 32px;
  background: var(--color-forest);
  color: var(--text-primary);   /* ~9.2:1 AAA */
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  margin-top: 24px;
  transition: background var(--dur-fast);
}

.btn-handoff:hover { background: var(--color-forest-mid); }
.btn-handoff:focus-visible {
  outline: 2px solid #4A9B82;
  outline-offset: 2px;
}

/* 핸드오프 로고 스탬프 */
.handoff-footer__logo {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.handoff-logo-stamp {
  width: 56px;
  height: 56px;
  background: rgba(250, 249, 245, 0.05);
  border-radius: 50%;
  border: 1.5px solid rgba(250, 249, 245, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.handoff-logo-stamp span {
  color: rgba(250, 249, 245, 0.25);
  font-family: var(--font-serif);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.handoff-footer__mit {
  font-family: var(--font-sans);
  font-size: 10px;
  color: rgba(250, 249, 245, 0.15);
  margin-top: 20px;
}

/* ── 캐릭터 고지 ── */
.character-notice {
  font-family: var(--font-sans);
  font-size: 10px;
  color: rgba(250, 249, 245, 0.15);
  text-align: center;
  padding: 16px 20px;
  background: var(--bg-base);
}

/* ── 애니메이션 ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 500ms var(--ease) both; }

/* ── reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .persona-reveal__line {
    animation: revealLineFade 400ms ease-out forwards;
  }

  @keyframes revealLineFade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

/* ── scroll-reveal — JS에서 스타일 설정. CSS는 선언만 ── */
.scroll-reveal { /* JS에서 opacity:0 + translateY 설정 */ }

/* ── 데스크탑 (760px+) ── */
@media (min-width: 760px) {
  :root {
    --container-max: 760px;
  }

  .domains-grid {
    grid-template-columns: 1fr 1fr;
  }
}
