/* 운명서재 공통 스타일 — 다크 네이비 + 골드 */

:root {
  --bg: #0a0e1f;
  --bg-elevated: #121734;
  --bg-card: #161b3d;
  --border: #2a2f58;
  --gold: #cda05a;
  --gold-bright: #e6c988;
  --text: #eae6d9;
  --text-dim: #a8a6c0;
  --text-faint: #7b7a98;
  --danger: #c76b6b;
  --max-width: 960px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(205, 160, 90, 0.5) 0, transparent 50%),
    radial-gradient(1px 1px at 80% 10%, rgba(205, 160, 90, 0.4) 0, transparent 50%),
    radial-gradient(1px 1px at 60% 70%, rgba(205, 160, 90, 0.35) 0, transparent 50%),
    radial-gradient(1px 1px at 30% 85%, rgba(205, 160, 90, 0.3) 0, transparent 50%),
    radial-gradient(1px 1px at 90% 60%, rgba(205, 160, 90, 0.3) 0, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Noto Serif KR", "Nanum Myeongjo", serif;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: "Noto Serif KR", serif;
  color: var(--gold-bright);
  line-height: 1.4;
  margin: 0 0 0.6em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--gold-bright);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  padding-left: 1.2em;
}

/* ---------- 레이아웃 ---------- */

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.page-title {
  font-size: 1.6rem;
  margin-bottom: 0.3em;
}

.page-lead {
  color: var(--text-dim);
  font-family: "Noto Sans KR", sans-serif;
  margin-bottom: 2em;
}

/* ---------- 헤더 ---------- */

#site-header {
  min-height: 64px;
}

.site-header {
  background: rgba(10, 14, 31, 0.92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.site-logo {
  font-family: "Noto Serif KR", serif;
  font-size: 1.2rem;
  color: var(--gold-bright);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-logo .moon {
  color: var(--gold);
}

.nav-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 40px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
}

.site-nav {
  display: flex;
  gap: 22px;
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--text);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
  text-decoration: none;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    display: none;
  }
  .site-nav.open {
    display: flex;
  }
  .site-nav a {
    padding: 12px 20px;
    border-bottom: none;
  }
  .site-header-inner {
    position: relative;
  }
}

/* ---------- 푸터 ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(10, 14, 31, 0.6);
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 16px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.footer-links a {
  color: var(--text-dim);
}

.footer-disclaimer {
  color: var(--text-faint);
  line-height: 1.6;
  margin-bottom: 10px;
}

.footer-copyright {
  color: var(--text-faint);
}

/* ---------- 홈 ---------- */

.hero {
  text-align: center;
  padding: 50px 16px 30px;
}

.hero .stars {
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.hero h1 {
  font-size: 2rem;
}

.hero p {
  color: var(--text-dim);
  font-family: "Noto Sans KR", sans-serif;
  max-width: 480px;
  margin: 0 auto 1.4em;
}

.hero p.hero-line {
  margin: 0 auto;
  text-align: center;
  font-size: clamp(0.75rem, 3.4vw, 1.05rem);
  line-height: 1.5;
  word-break: keep-all;
  white-space: normal;
}

.hero p.hero-line:first-of-type {
  margin-bottom: 0.25em;
}

.hero p.hero-line:last-of-type {
  margin-bottom: 1.4em;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.service-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
}

.service-card .icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.service-card h3 {
  margin-bottom: 0.3em;
  font-size: 1.1rem;
}

.service-card p {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ---------- 버튼 / 공통 UI ---------- */

.btn {
  display: inline-block;
  font-family: "Noto Sans KR", sans-serif;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #1a1407;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-weight: 500;
}

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

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
}

.mode-card h3 {
  font-size: 1.05rem;
}

.mode-card p {
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* ---------- 타로 카드 ---------- */

.card-slot {
  width: 140px;
  aspect-ratio: 2 / 3.4;
  margin: 0 auto;
  perspective: 1000px;
}

.card-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.card-flip.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  backface-visibility: hidden;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-back {
  background: linear-gradient(135deg, #1b2050, #0a0e1f 60%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back .glyph {
  color: var(--gold);
  font-size: 2.2rem;
  opacity: 0.8;
}

.card-front {
  transform: rotateY(180deg);
  background: var(--bg-card);
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-front.reversed img {
  transform: rotate(180deg);
}

.draw-area {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  margin: 30px 0;
}

.draw-slot {
  text-align: center;
  max-width: 160px;
}

.draw-slot .position-label {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.draw-slot .card-name {
  margin-top: 10px;
  font-size: 0.95rem;
}

.draw-slot .card-orientation {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.draw-controls {
  text-align: center;
  margin: 24px 0;
}

.result-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

.result-detail h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.result-detail .keywords {
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.result-detail p {
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.92rem;
  color: var(--text-dim);
}

/* 켈틱 크로스 레이아웃 */

.celtic-layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 720px;
  margin: 30px auto;
}

@media (max-width: 640px) {
  .celtic-layout {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- 카드 사전 그리드 ---------- */

.card-dict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.card-dict-item {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  transition: border-color 0.15s ease;
}

.card-dict-item:hover {
  border-color: var(--gold);
}

.card-dict-item img {
  border-radius: 6px;
  margin-bottom: 8px;
}

.card-dict-item .name {
  font-size: 0.82rem;
  color: var(--text);
}

.dict-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-family: "Noto Sans KR", sans-serif;
  font-size: 0.85rem;
}

.dict-filters button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.dict-filters button.active {
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ---------- 카드 상세 ---------- */

.card-detail {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.card-detail .image-col {
  width: 220px;
  margin: 0 auto;
}

.card-detail .info-col {
  flex: 1;
  min-width: 240px;
  font-family: "Noto Sans KR", sans-serif;
}

.card-detail .meta {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.card-detail .keywords span {
  display: inline-block;
  background: rgba(205, 160, 90, 0.12);
  color: var(--gold-bright);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  margin: 0 6px 6px 0;
}

.card-detail h2 {
  margin-top: 1.4em;
  font-size: 1.1rem;
}

/* ---------- 칼럼 ---------- */

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

.column-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.column-item .date {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.column-item h3 {
  margin: 4px 0 8px;
  font-size: 1.1rem;
}

.column-item p {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.column-body {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text);
  font-size: 1rem;
}

.column-body p {
  margin-bottom: 1.2em;
}

/* ---------- 일반 콘텐츠 페이지 ---------- */

.prose {
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text);
}

.prose h2 {
  font-size: 1.15rem;
  margin-top: 1.6em;
}

.prose p, .prose li {
  color: var(--text-dim);
}

.notice-box {
  background: rgba(205, 160, 90, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 30px;
}

.loading-text {
  text-align: center;
  color: var(--text-faint);
  font-family: "Noto Sans KR", sans-serif;
  padding: 40px 0;
}
