/* 수호신 랜딩·공개(/guardian). 첫 화면은 밤 호수와 열 가지 빛(.hero), 본문(main.night)과 공개 화면도 같은 밤.
   시안 .impeccable/mocks/mist-*.png(2026-11-17 승인 조합). 버건디는 신년(2027 붉은 양의 해) 포인트 */
:root {
  --bg: #0b1120; --bg2: #16203f; --text: #f2eef3; --dim: #b8b8cc; --faint: #8a8fa8;
  --gold: #f2c879; --line: #ffffff1f; --panel: #ffffff0d;
  --paper: #f5f0e6; --ink: #1d2236; --warn: #f2a08a;
  --ivory: #f8f4ef; --ink-strong: #101724; --burgundy: #7a1e2b; --gold-bright: #f2c879;
  --strong: #fff;
  --el-wood: #8fc29b; --el-fire: #e8836a; --el-earth: #d9b45f; --el-metal: #cdd1da; --el-water: #86aee8;
  --narr: "Gowun Batang", "Noto Serif KR", serif;
  --name: "Nanum Myeongjo", "Noto Serif KR", serif;
  --han: "Noto Serif KR", "Noto Serif CJK KR", serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
body.guardian {
  margin: 0;
  background: radial-gradient(120% 60% at 50% 0%, #121c45 0%, #070b1f 55%) fixed, #070b1f;
  color: var(--text);
  font-family: var(--narr);
  font-size: 16px;
  line-height: 1.85;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: hidden;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 96px var(--gutter);
}
body.guardian.is-locked { overflow: hidden; }
/* 폰에서 화면 밖으로 나가는 장식(카드 부채 끝 카드 등) 때문에 화면이 좌우로 밀리거나 확대 비율이 바뀌지 않게.
   body 만 막으면 폰 브라우저는 html 기준으로 여전히 밀림. clip 은 스크롤 영역을 만들지 않아 고정 헤더(sticky)를 깨지 않음 */
html:has(body.guardian) { overflow-x: clip; }
body.guardian { overflow-x: clip; }
[hidden] { display: none !important; }
.col { max-width: 560px; margin: 0 auto; }
b { color: var(--strong); }

::selection { background: #e9c46a59; color: #fff; }
h2 { font-family: var(--name); font-weight: 800; font-size: 25px; line-height: 1.45; margin: 0 0 10px; text-wrap: balance; color: #fff; }
.lead { color: #c9cbe0; font-size: 15px; margin: 0 0 18px; }
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn {
  display: block; width: 100%; text-align: center; font-weight: 700; font-size: 17px;
  border-radius: 12px; padding: 14px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, #f6d690, #e0b357); color: #1a1606;
}
.btn--small { font-size: 15px; padding: 12px; }
.btn--ghost { background: #ffffff10; color: var(--text); border-color: #ffffff3a; font-size: 15px; padding: 12px; }

/* 첫 화면(시안 .impeccable/mocks/mist-c-lake-lanterns.png): 별 뜬 밤 호수(배경 그림, 물가 안개 포함) · 수평선 물 위에 작게 선
   상아빛 전신 뒷모습 둘과 물그림자 · 하늘의 풍등 열 가지 색(캔버스) · 가운데 위 금박 이름과 제목 · 아래 한지 입력판.
   움직임 guardian-motion.js bindHeroScene. data-focus=M/F: 그쪽 사람에게 빛, 다른 쪽은 물러남.
   data-state=tied → untie(내 색 풍등만 그 사람에게 모이고 다른 쪽은 사라짐, 1.7초) → open. --mine: 내 수호신 천간의 빛 색 */
.hero {
  --foil: #e9c46a; --foil-hi: #fff1c2; --hanji: #f6efe4; --ink-c: #101724;
  position: relative; margin: 0 calc(-1 * var(--gutter)); isolation: isolate; overflow: hidden;
  min-height: 100svh; display: flex; flex-direction: column;
  background: #070b1f; color: #fff;
}
/* 배경 그림의 수평선: 세로 그림 56%, 가로 그림 60%. 그림이 cover 로 잘리므로 --hz 를 화면 비율로 계산 */
.hs { position: absolute; inset: 0; z-index: 0; container-type: size; }
.hs-bg { position: absolute; inset: 0; }
.hs-bg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hs-stage {
  --fig: 21cqh;
  --hz: calc(50cqh + 0.06 * max(100cqh, 177.8cqw));
  position: absolute; left: 50%; top: calc(var(--hz) - var(--fig)); height: var(--fig); width: calc(var(--fig) * .92);
  transform: translateX(-50%);
  z-index: 2; /* 풍등(캔버스, z-index 1)은 언제나 두 사람 뒤로 지나감 */
}
.hs-person {
  position: absolute; bottom: 0; display: block; height: 100%; transform-origin: 50% 100%;
  transition: filter .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1), opacity .9s ease;
  filter: brightness(.95);
}
.hs-person--m { left: 2%; }
.hs-person--f { right: 2%; height: 94%; }
.hs-person img { display: block; height: 100%; width: auto; }
/* 발끝은 물에 잠긴 듯 흐리게, 물그림자는 뒤집어 아래로 */
.hs-person > img:first-child { -webkit-mask-image: linear-gradient(180deg, #000 93%, #0008 100%); mask-image: linear-gradient(180deg, #000 93%, #0008 100%); }
.hs-refl {
  position: absolute; left: 0; top: 100%; transform: scaleY(-1); opacity: .32; filter: blur(1.5px);
  -webkit-mask-image: linear-gradient(0deg, #000 0%, #0000 55%); mask-image: linear-gradient(0deg, #000 0%, #0000 55%);
}
.hs[data-focus="M"] .hs-person--m,
.hs[data-focus="F"] .hs-person--f { z-index: 2; filter: brightness(1.15) drop-shadow(0 0 14px #f2c879aa); transform: scale(1.06); }
.hs[data-focus="M"] .hs-person--f,
.hs[data-focus="F"] .hs-person--m { filter: brightness(.45) saturate(.6); transform: scale(.96); }

/* 풍등(캔버스). 하늘에 떠오르고 물에 비침. 두 사람 뒤 */
.hs-lights { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.hs-flash { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; background: radial-gradient(40% 30% at 50% 50%, color-mix(in srgb, var(--mine, #f2c879) 50%, transparent), transparent 70%); }

/* 풀기: 수호신 쪽 사람이 내 색 빛에 물들고 다른 쪽은 사라짐 */
.hs[data-state="untie"] .hs-flash { animation: flash 1.7s ease-out forwards; }
.hs[data-state="untie"][data-focus="M"] .hs-person--m,
.hs[data-state="untie"][data-focus="F"] .hs-person--f { filter: brightness(1.25) drop-shadow(0 0 22px var(--mine, #f2c879)) drop-shadow(0 0 8px var(--mine, #f2c879)); transform: scale(1.12); }
.hs[data-state="untie"][data-focus="M"] .hs-person--f,
.hs[data-state="untie"][data-focus="F"] .hs-person--m { opacity: 0; }
@keyframes flash { 0% { opacity: 0; } 70% { opacity: 1; } 100% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .hs-person { transition: none; }
}

/* 금박 천간 열 글자(PC 에서만). 한 글자씩 불이 옮겨 가다 공개 뒤엔 내 글자에 멈춤 */
.hs-stems { display: none; margin: 0; padding: 0; list-style: none; border-block: 1px solid #e9c46a59; }
.hs-stems li {
  width: 46px; line-height: 46px; text-align: center;
  font-family: var(--han); font-size: 22px; color: #d8b766;
  border-inline-start: 1px solid #e9c46a33; text-shadow: 0 1px 0 #3a2a08;
  transition: color .5s ease, background-color .5s ease, box-shadow .5s ease;
}
.hs-stems li:first-child { border-inline-start: 0; }
.hs-stems li.is-on { color: var(--foil-hi); background: #e9c46a26; box-shadow: inset 0 0 0 1px #e9c46acc, 0 0 18px #e9c46a66; text-shadow: 0 0 12px #f2c879; }
/* 서비스 로고(그림): 가운데 위, 세로형. PC 는 왼쪽 위 가로형 */
.hs-brand { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 50%; transform: translateX(-50%); }
.hs-brand img { display: block; height: 84px; width: auto; filter: drop-shadow(0 0 14px #f2c87940) drop-shadow(0 2px 6px #000a); }
/* 부제: 로고 바로 아래 작은 글씨 */
.hs-sub {
  position: absolute; z-index: 3; top: calc(env(safe-area-inset-top, 0px) + 106px); left: 0; right: 0; margin: 0; text-align: center;
  font-size: 13px; letter-spacing: .12em; color: #e6dcc4; text-shadow: 0 1px 8px #000c;
}
/* 금박 질감(guardian-foil.jpg)을 글자 모양으로 오려 씀. 빛이 천천히 지나감. 오려 쓰기가 안 되는 브라우저는 위 금색 그대로 */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hs-stems li.is-on {
    background: url("/assets/guardian-foil.jpg") 0 0 / 220px 220px;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    text-shadow: none; filter: brightness(1.45) saturate(1.1) drop-shadow(0 1px 0 #3a2806) drop-shadow(0 0 3px #070b1f) drop-shadow(0 0 12px #f2c87959);
    animation: foil-pass 9s linear infinite;
  }
  .hs-stems li.is-on { background-color: #e9c46a26; filter: drop-shadow(0 0 8px #f2c879aa); }
}
@keyframes foil-pass { to { background-position: 220px 110px; } }
@media (prefers-reduced-motion: reduce) {
  .hs-stems li.is-on { animation: none; }
}

/* 글과 입력: 제목은 가운데 위(이름 아래), 입력은 맨 아래 한지 판 */
.hero-in {
  position: relative; z-index: 3; flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 136px) max(18px, env(safe-area-inset-left, 0px)) calc(env(safe-area-inset-bottom, 0px) + 18px);
}
.hero-copy { text-align: center; }
.hero h1 { font-family: var(--name); font-weight: 800; font-size: clamp(23px, 6.6vw, 30px); line-height: 1.4; margin: 0 0 8px; color: #fff; text-wrap: balance; text-shadow: 0 2px 18px #000c; }
.nowrap { white-space: nowrap; }
/* 제목 아래 안내 글만(입력판 안 메시지에 그림자·밝은 색이 번지지 않게) */
.hero-copy p { margin: 0; color: #e6dcc4; font-size: 14.5px; text-shadow: 0 1px 10px #000c; }
.hint { white-space: pre-line; text-wrap: balance; }
/* 문장·쉼표 마디 묶음: 한 줄에 안 들어가면 마디 사이에서만 줄이 바뀜(문구 HTML, guardian-motion.js lineClauses) */
.clause { display: inline-block; }
.lead, details p, .gline2, .gmeta { text-wrap: pretty; }
.gline, .rv-who, .book p { text-wrap: balance; }

/* 입력판: 한지 바탕, 안쪽 가는 금 테두리(저장 카드와 같은 방식). 칸마다 작은 이름(생년월일 · 내 성별) */
.ask {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px;
  padding: 16px 16px 12px; border-radius: 20px; background: var(--hanji); color: var(--ink-c);
  box-shadow: 0 24px 60px #000a, 0 2px 8px #0006;
}
.ask::before { content: ""; position: absolute; inset: 6px; border: 1px solid #d4af3780; border-radius: 15px; pointer-events: none; }
.ask > * { position: relative; }
.ask-field { display: grid; gap: 6px; }
.ask-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.ask-label { font-size: 13px; font-weight: 700; letter-spacing: .06em; color: #4e5466; }
.ask input[type="text"] {
  font: inherit; font-size: 16px; width: 100%; height: 48px; padding: 0 16px; border-radius: 24px;
  border: 1px solid #c9b98f; background: #fff; color: var(--ink-c); caret-color: #9a7428;
  box-shadow: inset 0 1px 3px #0000001a;
}
.ask input::placeholder { color: #8d8572; }
/* 브라우저 자동 완성 색(회색 바탕) 대신 흰 칸 그대로 */
.ask input:-webkit-autofill { -webkit-box-shadow: inset 0 0 0 40px #fff; -webkit-text-fill-color: var(--ink-c); caret-color: #9a7428; }
.ask input[aria-invalid="true"] { border-color: #c4543b; box-shadow: 0 0 0 2px #c4543b40; }
.ask small { display: block; text-align: center; font-size: 12.5px; color: #6f7384; }
.ask-msg { font-size: 13.5px; color: #b4472f; margin: 0; white-space: pre-line; }
.ask-msg:empty { display: none; }
.leap { font-size: 14px; color: #4e5466; display: flex; align-items: center; gap: 8px; }
.leap input { width: 18px; height: 18px; accent-color: #b8892c; }

/* 두세 칸 선택 버튼(달력·성별) */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid #c9b98f; border-radius: 20px; overflow: hidden; justify-self: start; background: #fff; }
.seg button { border: 0; background: none; color: #4e5466; padding: 4px 14px; font-size: 13px; }
.seg--wide { grid-auto-flow: column; }
.seg button[aria-pressed="true"] { background: #e9c46a40; color: #6b4c10; font-weight: 700; }
.seg--wide { display: grid; width: 100%; gap: 8px; border: 0; border-radius: 0; background: none; overflow: visible; }
.seg--wide button { min-height: 44px; padding: 10px 0; font-size: 15px; border-radius: 23px; background: #fff; color: var(--ink-c); border: 1px solid #c9b98f; }
.seg--wide button[aria-pressed="true"] { background: #16204a; color: #fff; border-color: #16204a; box-shadow: 0 0 0 2px #e9c46a, 0 6px 16px #16204a55; }
.seg.is-invalid { box-shadow: 0 0 0 2px #c4543b88; border-radius: 23px; }
.hero .btn { border-radius: 28px; padding: 15px; font-size: 17.5px; border-color: #e7c56f; background: linear-gradient(180deg, #f2d48a, #c9973a); color: #1a1606; box-shadow: 0 10px 22px #6b4c1059, inset 0 1px 0 #fff6d6; }

/* 태블릿: 사람이 조금 커지고, 입력은 한 줄 */
@media (min-width: 720px) {
  .hs-stage { --fig: 26cqh; }
  /* 이름 글자가 커져 부제를 아래로 */
  .hs-brand img { height: 112px; }
  .hs-sub { top: calc(env(safe-area-inset-top, 0px) + 140px); }
  .hero-in { padding-top: calc(env(safe-area-inset-top, 0px) + 176px); }
  .hero-in { max-width: 900px; padding-left: 40px; padding-right: 40px; padding-bottom: 36px; }
  .hero h1 { font-size: clamp(32px, 5vw, 44px); }
  /* 태블릿: 생년월일과 성별을 나란히, 버튼은 아래 한 줄 */
  .ask { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px 18px; padding: 20px 22px 16px; border-radius: 22px; }
  .ask-msg, .ask .btn, .ask small { grid-column: 1 / -1; }
}

/* PC: 왼쪽 이름·천간·제목·입력, 오른쪽 호수와 두 사람(가로 그림 수평선 60%) */
@media (min-width: 1024px) {
  .hero { min-height: min(100vh, 980px); justify-content: center; }
  .hs-stage { --fig: 30cqh; --hz: calc(50cqh + 0.10 * max(100cqh, 56.25cqw)); left: 68%; }
  /* 가로형 높이 46px: 글자 시작이 그림 폭의 300/910 지점 → 부제를 글자 시작에 맞춤 */
  .hs-brand { top: 22px; left: max(48px, 6vw); transform: none; }
  .hs-brand img { height: 46px; }
  .hs-sub { top: 70px; left: calc(max(48px, 6vw) + 46px * 910 / 256 * 300 / 910); right: auto; text-align: left; font-size: 14px; }
  .hs-stems { display: flex; position: absolute; z-index: 3; top: 104px; left: max(48px, 6vw); }
  .hero-in { flex: none; width: min(560px, 44vw); max-width: none; margin: 0; padding: 170px 0 60px max(48px, 6vw); box-sizing: content-box; justify-content: flex-start; gap: 26px; }
  .hero-copy { text-align: left; }
  .hero h1 { font-size: clamp(40px, 3.6vw, 56px); line-height: 1.3; margin-bottom: 14px; }
  .hero-copy p { font-size: 16px; color: #f0d58f; }
  .ask { grid-template-columns: minmax(0, 1fr); padding: 22px 22px 16px; }
}

/* 본문: 첫 화면의 밤이 그대로 이어짐. 구간 사이에 가는 금빛 선. PC 는 넓게 펼침 */
main.night { max-width: 1120px; margin: 0 auto; }
.sec { position: relative; padding: 76px 0 20px; }
.sec + .sec::before {
  content: ""; position: absolute; left: 50%; top: 18px; width: min(70%, 520px); height: 1px; transform: translateX(-50%); pointer-events: none;
  background: linear-gradient(90deg, #e9c46a00, #e9c46a55, #e9c46a00);
}
.sec-text { max-width: 560px; }
.lead--sub { color: #e9c46acc; font-size: 14px; }

/* 합 별자리(guardian-motion.js bindConstellation). 원 위 열 글자, 마주 보는 두 글자가 한 쌍, 선은 모두 가운데 合 을 지남 */
.sky { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; margin: 14px auto 0; width: min(100%, 440px); }
.sky-lines, .sky-stems { grid-area: 1 / 1; width: 100%; aspect-ratio: 1; }
.sky-stems { position: relative; }
.sky-ring { fill: none; stroke: #e9c46a33; stroke-width: 1; }
[data-sky-lines] line {
  stroke: #e9c46a26; stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 0;
  transition: stroke .6s ease, stroke-width .6s ease;
}
[data-sky-lines] line.is-on {
  stroke: #f2c879; stroke-width: 2.2; filter: drop-shadow(0 0 6px #f2c879aa);
  animation: sky-draw .9s cubic-bezier(.2, .7, .2, 1);
}
@keyframes sky-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.sky-hap { fill: #f2c879; font-family: var(--han); font-size: 46px; text-anchor: middle; dominant-baseline: central; filter: drop-shadow(0 0 14px #f2c87966); }
.sky-stem {
  position: absolute; transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #16204a, #0a1029); color: #d8b766;
  border: 1px solid #e9c46a40; box-shadow: 0 6px 16px #0007;
  transition: box-shadow .5s ease, border-color .5s ease, color .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}
.sky-stem b { font-family: var(--han); font-weight: 600; font-size: 22px; line-height: 1.1; color: inherit; }
.sky-stem small { font-size: 11px; line-height: 1.2; color: #b8b8cc; }
.sky-stem:hover { border-color: var(--c); }
.sky-stem.is-on { color: #fff; border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 0 22px var(--c), 0 6px 16px #0007; transform: translate(-50%, -50%) scale(1.08); }
.sky-cap { grid-area: 2 / 1; width: 100%; margin-top: 18px; text-align: center; min-height: 168px; }
.sky-pair { display: block; font-family: var(--name); font-weight: 800; font-size: 18px; color: #f2c879; margin-bottom: 12px; }
.sky-who { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.sky-side { display: grid; grid-template-columns: auto auto; gap: 6px 8px; justify-items: center; }
.sky-side small { grid-column: 1 / -1; font-size: 12.5px; color: #b8b8cc; }
.sky-face { display: grid; gap: 4px; justify-items: center; }
.sky-face img { width: 60px; height: 80px; object-fit: cover; object-position: 50% 15%; border-radius: 10px; box-shadow: 0 0 0 1px #f2c87966, 0 8px 18px #0008; }
.sky-face em { font-style: normal; font-family: var(--name); font-weight: 800; font-size: 13px; color: #fff; }
@media (prefers-reduced-motion: reduce) {
  [data-sky-lines] line.is-on { animation: none; }
  .sky-stem { transition: none; }
}

/* 세 권: 폰은 옆으로 넘김(다음 권이 살짝 보임), PC 는 세 권 나란히. 표지는 책 모양(왼쪽 책등 그늘, 오른쪽 모서리만 둥금) */
.shelf {
  display: grid; grid-auto-flow: column; grid-auto-columns: 68%; gap: 18px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 8px calc(-1 * var(--gutter)) 0; padding: 6px var(--gutter) 18px;
  /* 넘겨 맞출 때 첫 책이 화면 끝(0)에 붙어 잘리지 않게, 좌우 여백만큼 안쪽에 맞춤 */
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin; scrollbar-color: #e9c46a55 transparent;
}
.shelf:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.book { scroll-snap-align: start; }
.book-cv {
  position: relative; aspect-ratio: 3 / 4; border-radius: 3px 14px 14px 3px; overflow: hidden; background: #0d1328;
  box-shadow: 0 22px 40px #000a, 0 2px 6px #0008;
}
.book-cv::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, #0009, #0000 9%, #ffffff14 10%, #0000 13%); pointer-events: none; }
.book-cv img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-cv b {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 48px 20px 14px;
  background: linear-gradient(0deg, #070b1fd9, transparent);
  font-family: var(--han); font-size: 36px; line-height: 1; color: var(--gold-bright);
}
.book h3 { font-family: var(--name); font-weight: 800; font-size: 20px; margin: 16px 0 2px; color: #fff; }
.book .tag { font-size: 12.5px; color: #a9abc4; }
.book p { margin: 8px 0 6px; font-size: 15px; line-height: 1.65; color: #e6dcc4; }
.book .go { font-size: 13px; color: #a9abc4; }
.book--hot .book-cv { box-shadow: 0 0 0 1px #c2394f, 0 22px 40px #000a, 0 0 40px #7a1e2b66; }
.hotb { position: absolute; z-index: 2; top: 12px; right: 12px; font-size: 12px; font-weight: 700; background: var(--burgundy); color: #fff; border-radius: 20px; padding: 2px 10px; }

/* 수호신 스무 명 카드 부채(guardian-motion.js bindFan). 화면에 들어오면 뒷면(천간 글자)으로 펼쳐짐.
   마우스를 올리거나(PC) 누르면(폰, .is-flipped) 그 카드만 뒤집혀 얼굴이 보이며 크게 올라옴 */
/* isolation: 카드끼리의 겹침 순서(z-index)를 부채 안에서만 계산. 없으면 가운데·올라온 카드가 화면 아래 고정 버튼(z-index 10) 위로 올라옴 */
/* 높이 = 가운데 카드가 1.6배로 커졌을 때 높이(카드 높이 × 1.6)에 조금 더한 만큼. 그 이상은 글과 카드 사이 빈 공간이 됨 */
.fan { --step: 5.4deg; position: relative; isolation: isolate; height: 160px; margin: 18px auto 6px; max-width: 900px; }
.fan-card {
  position: absolute; left: 50%; bottom: 0; width: 70px; margin-left: -35px; aspect-ratio: 3 / 4;
  padding: 0; border: 0; background: none; cursor: pointer; perspective: 800px;
  transform-origin: 50% 360%; transform: rotate(0deg) translateY(30px); opacity: 0;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .6s ease;
  z-index: calc(20 - var(--i) * var(--i));
}
.fan.is-open .fan-card { transform: rotate(calc(var(--i) * var(--step))); opacity: 1; }
.fan-in { display: block; position: absolute; inset: 0; transform-origin: 50% 96%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, .7, .2, 1); }
.fan-back, .fan-face { display: block; position: absolute; inset: 0; border-radius: 8px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
/* 뒷면: 공개 화면 카드(.tcard-back)와 같은 남색 바탕·금 테두리·천간 글자 */
.fan-back {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, #f2c87922 0 32%, transparent 33%), linear-gradient(160deg, #1b2652, #0b1129);
  box-shadow: inset 0 0 0 1px #f2c879aa, inset 0 0 0 4px #0b1129, inset 0 0 0 5px #f2c87955, 0 10px 22px #000b;
}
/* 카드 뒷면 그림(card-back.svg: 금 테두리·초승달·열 천간 점 고리·로고 문양). 아래 띠(83.75%)에는 공개 카드만 천간 글자를 얹음 */
.fan-back, .tcard-back { background: url(/assets/brand/card-back.svg) center / 100% 100% no-repeat, #0b1129; }
.fan-back { box-shadow: 0 10px 22px #000b; }
/* 부채 카드는 스무 장이 같은 뒷면(겹쳐서 가운데 한 장만 보이고, 올리면 뒤집힘). 띠 가운데는 작은 금빛 마름모 */
.fan-back::after, .tcard-back:empty::after { content: ""; position: absolute; left: 50%; top: 83.75%; width: 6%; aspect-ratio: 1; background: #f2d48a; transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 0 6px #f2c879aa; }
.fan-face { transform: rotateY(180deg); box-shadow: 0 0 0 1px var(--c), 0 0 26px var(--c), 0 10px 22px #000b; }
.fan-face img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
/* 이름: 얼굴 아래쪽 안(카드와 함께 커짐) */
.fan-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 0 5px; text-align: center; font-family: var(--name); font-weight: 800; font-size: 10px; color: #fff; white-space: nowrap; background: linear-gradient(180deg, #070b1f00, #070b1fcc 60%); }
/* 그 자리에서 뒤집히며 커짐: 카드 자리(부채 각도)는 그대로, 앞뒷면만 제 가운데를 축으로 뒤집고 키움 */
/* 누른 카드(고정)는 40, 마우스를 올린 카드는 그보다 위(50) - 고정한 카드가 다른 카드를 가리지 않게 */
.fan.is-open .fan-card.is-flipped { z-index: 40; }
.fan.is-open .fan-card:is(:hover, :focus-visible) { z-index: 50; }
/* 아래 끝을 기준으로 위로 커짐(아래 버튼을 가리지 않게) */
.fan-card:is(:hover, :focus-visible, .is-flipped) .fan-in { transform: rotateY(180deg) scale(1.6); }
.fan-card:focus-visible { outline: none; }
.fan-card:focus-visible .fan-face { box-shadow: 0 0 0 2px #fff, 0 0 26px var(--c); }
/* 카드가 위로 커져도 기울어진 카드 끝이 닿지 않게 부채와 버튼 사이를 띄움 */
.fan-go { display: block; width: auto; margin: 64px auto 0; padding: 12px 28px; border-radius: 26px; }
@media (prefers-reduced-motion: reduce) {
  .fan-card, .fan-in { transition: none; }
}

/* 자주 묻는 것 */
details { border-bottom: 1px solid #ffffff1f; padding: 4px 0; }
summary { cursor: pointer; font-family: var(--name); font-weight: 800; font-size: 16px; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; color: #fff; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--gold); }
details[open] summary::after { content: "−"; }
details p { margin: 0 0 12px; color: #c9cbe0; font-size: 14.5px; }

/* PC·태블릿: 합 별자리는 글 옆에, 세 권은 나란히, 부채는 넓게, 자주 묻는 것은 두 줄 */
@media (min-width: 720px) {
  .fan { height: 215px; }
  .fan-card { width: 96px; margin-left: -48px; }
  .fan { --step: 4.6deg; }
  .sec--share .sec-text { margin: 0 auto; text-align: center; }
}
@media (min-width: 900px) {
  .shelf { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; overflow: visible; margin: 18px 0 0; padding: 0; }
  .faq { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
}
@media (min-width: 1024px) {
  .sec { padding-top: 110px; }
  .sec--how { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center; }
  .sec--how .sky { margin: 0; }
  h2 { font-size: 34px; }
  .lead { font-size: 16.5px; }
  .fan { height: 250px; }
  .fan-card { width: 112px; margin-left: -56px; }
}

/* 하단 고정 버튼 */
/* 고정 헤더: 첫 화면을 지나면 내려옴(.is-on). 높이 48px */
.topbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: #070b1fd9; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid #ffffff14;
  transform: translateY(-100%); visibility: hidden;
  transition: transform .3s ease, visibility 0s linear .3s;
}
.topbar.is-on { transform: none; visibility: visible; transition: transform .3s ease, visibility 0s; }
.topbar-in { max-width: 1120px; height: 48px; margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; justify-content: space-between; }
.topbar-logo { display: inline-flex; align-items: center; gap: 8px; font-family: var(--name); font-weight: 800; font-size: 15px; letter-spacing: .2em; color: #e9c46a; text-decoration: none; }
.topbar-logo img { display: block; width: 26px; height: 26px; }
.topbar-mine { padding: 8px 4px; font-size: 14px; color: #ece8ef; text-decoration: none; }
.topbar-mine:hover { color: #e9c46a; }
@media (prefers-reduced-motion: reduce) {
  .topbar, .topbar.is-on { transition: none; }
}

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) var(--gutter);
  background: linear-gradient(0deg, #070b1f 62%, transparent); transition: transform .3s;
}
.dock-in { max-width: 560px; margin: 0 auto; }
.dock.is-off { transform: translateY(120%); }

/* 공개 화면 */
.reveal {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; overflow-x: hidden;
  /* 첫 화면 비단이 걷힌 뒤 그대로 이어지게 같은 코발트 비단 위에 어둠을 깖 */
  background: radial-gradient(70% 45% at 50% 24%, #e9c46a2e, transparent 70%), linear-gradient(180deg, #0b1446d1, #070c2ef2), url("/assets/guardian-hero-bg-p.jpg") center / cover fixed, #0b1446;
  padding: max(18px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 40px var(--gutter);
}
.reveal .col { text-align: center; }
.close { position: sticky; top: 0; margin-left: auto; display: block; background: #ffffff14; border: 1px solid #ffffff2e; color: var(--text); border-radius: 20px; padding: 6px 16px; font-size: 13.5px; z-index: 2; }
.rv-who { font-size: 13px; color: var(--dim); margin: 6px 0 10px; }
/* 카드 무대: 카드 열 장 → 부채꼴 → 내 카드만 가운데서 뒤집힘(guardian-motion.js) */
.rv-stage { position: relative; width: min(300px, 78vw); aspect-ratio: 3 / 4; margin: 0 auto; perspective: 1400px; }
.tcard {
  position: absolute; inset: 0; transform-origin: 50% 50%;
  /* 등장 때 크기는 그대로(.55)·위치만 올라옴, 투명도는 짧게: 반투명 스무 장이 겹쳐 뿌옇게 보이던 구간을 줄임.
     크기를 바꾸며 들어오면 브라우저가 작은 크기로 그린 그림을 키워 흐려짐 */
  opacity: 0; transform: translateY(40px) scale(.55);
  transition: transform .7s cubic-bezier(.2, .8, .2, 1), opacity .18s linear;
  transition-delay: var(--delay, 0ms);
}
.tcard.is-in { opacity: 1; transform: scale(.55); }
.tcard.is-fanned { transform: translate(var(--fan-x), var(--fan-y)) rotate(var(--fan-r)) scale(.55); }
.tcard.is-gone { opacity: 0; transform: translate(var(--fan-x, 0), 80px) rotate(var(--fan-r, 0)) scale(.42); transition-delay: 0ms; }
.tcard.is-center { opacity: 1; transform: none; transition-delay: 0ms; z-index: 2; }
.tcard-inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.3, .7, .2, 1);
}
.tcard.is-flipped .tcard-inner { transform: rotateY(180deg); }
.tcard-back, .tcard-front {
  position: absolute; inset: 0; border-radius: 20px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.tcard-back {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  /* 스무 장이 겹치므로 그림자는 얕게(진하면 겹친 그림자가 안개처럼 깔림) */
  box-shadow: 0 6px 14px #0008;
}
/* 공개 카드 뒷면: 천간 글자는 아래 띠, 읽기·상징은 그 아래 */
.tcard-back b { position: absolute; left: 0; right: 0; top: 83.8%; transform: translateY(-50%); text-align: center; font-family: var(--han); font-size: 30px; line-height: 1; color: #f2d48a; text-shadow: 0 0 14px #f2c87977; }
.tcard-back small { position: absolute; left: 0; right: 0; top: 91.5%; text-align: center; font-size: 12px; color: var(--dim); letter-spacing: .08em; }
/* 펼친 스무 장 중 내 카드만 빛나며 떠오름. 매 프레임 그리던 빛 훑기는 카드 스무 장의 그림자·밝기를 프레임마다 다시 그려 끊겨서 뺌 */
.tcard-back { transition: box-shadow .6s ease; }
.tcard.is-fanned.is-picked { z-index: 30; transform: translate(var(--fan-x), calc(var(--fan-y) - 44px)) rotate(var(--fan-r)) scale(.6); transition-delay: 0ms; }
.tcard.is-picked .tcard-back { box-shadow: 0 0 0 3px #f2d48a, 0 0 44px #f2c879cc, 0 6px 14px #0008; }
.tcard-front { transform: rotateY(180deg); box-shadow: 0 0 0 1px #f2c87988, 0 20px 60px #000a, 0 0 60px #f2c87933; }
.tcard-front img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 14%; }
.tcard.is-mine.is-flipped .tcard-front { animation: card-glow 1.6s ease .6s both; }
@keyframes card-glow { 0% { box-shadow: 0 0 0 1px #f2c87988, 0 0 0 #f2c87900; } 40% { box-shadow: 0 0 0 2px var(--gold), 0 0 80px #f2c879aa; } 100% { box-shadow: 0 0 0 1px #f2c87988, 0 20px 60px #000a, 0 0 60px #f2c87933; } }

/* 카드가 뒤집힌 뒤 이름·설명이 아래서 올라옴 */
.rv-text { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.rv-text.is-shown { opacity: 1; transform: none; }
/* 타자 효과(guardian-motion.js typeText): 글자는 처음부터 제자리에 있고 숨겨져 있다가 드러남. 커서는 자리를 차지하지 않게 겹쳐 그림 */
.ty { visibility: hidden; }
.ty-on { visibility: visible; }
.ty-cur { position: relative; }
.ty-cur::after { content: "▍"; position: absolute; left: 100%; top: 0; margin-left: 1px; color: var(--gold); animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .tcard, .tcard-inner, .rv-text { transition: none; }
  .tcard.is-mine.is-flipped .tcard-front { animation: none; }
}
.gname { font-family: var(--name); font-weight: 800; font-size: 38px; margin: 18px 0 0; line-height: 1.2; }
.gname small { font-family: var(--han); font-size: 17px; color: var(--gold); margin-left: 8px; }
.gmeta { font-size: 13.5px; color: var(--dim); margin: 6px 0 0; }
.gline { font-family: var(--name); font-weight: 800; font-size: clamp(17px, 5.4vw, 20px); line-height: 1.6; margin: 18px auto 6px; max-width: 420px; text-wrap: balance; }
.gline2 { font-size: 14.5px; color: var(--dim); margin: 0 auto 20px; max-width: 420px; }
.rv-share { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 22px; }
.rv-share [data-save-card] { grid-column: 1 / -1; }
.copied { font-size: 12.5px; color: var(--gold); min-height: 1.4em; margin: 6px 0 0; }
.pick { font-family: var(--name); font-weight: 800; font-size: 19px; margin: 28px 0 12px; }
.rv-books { display: grid; gap: 8px; text-align: left; }
.rv-book { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); font-size: 14.5px; line-height: 1.5; }
.rv-book b { display: block; font-family: var(--name); font-size: 16px; }
.rv-book span { color: var(--faint); font-size: 13px; flex: none; }
.rv-book--hot { border-color: var(--gold); }

/* 수호신 프로필(공개 화면): 위 이름·대사와 같은 가운데 정렬. 항목은 이름표(작은 글씨) 위, 값 아래로 쌓고 두 칸씩 */
.profile { margin: 8px auto 22px; max-width: 420px; padding: 20px 4px 4px; border-top: 1px solid #f2c8792e; text-align: center; }
.profile-intro { margin: 0 0 10px; font-family: var(--name); font-weight: 800; font-size: 15px; color: #f2c879; }
.profile-story { margin: 0 0 18px; font-size: 14.5px; line-height: 1.8; color: #e9e4f2; text-wrap: balance; }
.profile-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #ffffff14; }
.profile-facts > div { padding: 12px 8px; border-bottom: 1px solid #ffffff14; }
.profile-facts > div:nth-child(odd) { border-right: 1px solid #ffffff14; }
/* 말버릇·관계는 문장이라 한 줄 전체를 씀 */
.profile-facts > [data-pf-row="catchphrase"], .profile-facts > [data-pf-row="bond"] { grid-column: 1 / -1; border-right: 0; }
.profile-facts dt { margin: 0 0 4px; font-size: 11.5px; letter-spacing: .08em; color: #f2c879aa; }
.profile-facts dd { margin: 0; font-size: 14px; line-height: 1.6; text-wrap: balance; }
/* 카드 부채 앞면의 한 줄 소개: 카드가 작은 폰에선 이름만 */
.fan-name small { display: none; margin-top: 2px; font-family: var(--body, inherit); font-weight: 500; font-size: 7px; letter-spacing: 0; color: #ffffffcc; white-space: normal; line-height: 1.3; padding: 0 6px; }
@media (min-width: 768px) { .fan-name small { display: block; } }

/* 상품 종류 배지: 신년운세(붉은 등롱)·평생 사주(금)·시험운(새벽 푸름) */
.kind { display: inline-block; margin: 0 0 4px; padding: 1px 9px; border-radius: 10px; font-family: var(--narr); font-size: 11.5px; font-weight: 700; line-height: 1.6; letter-spacing: .04em; }
.kind.kind--newyear { background: #c2394f; color: #fff; }
.kind.kind--lifetime { background: #f2c879; color: #2a1d05; }
.kind.kind--exam { background: #6fa3d8; color: #0b1838; }
.book .kind { margin-top: 16px; }
.book .kind + h3 { margin-top: 2px; }
/* .rv-book span(흐린 글씨) 보다 앞서게 클래스 두 개로 */
.rv-book .kind { display: table; margin-bottom: 2px; font-size: 11.5px; }
.go--open { color: var(--gold); text-decoration: none; font-weight: 700; }
.go--open::after { content: " →"; }
button.rv-book { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rv-go { color: var(--gold) !important; font-weight: 700; }
/* 좁은 폰: 부채를 덜 벌려 끝 카드가 화면 밖으로 덜 나가게 */
@media (max-width: 419px) { .fan { --step: 4.2deg; } }
/* 카드 저장(폰, 공유창을 못 쓸 때): 카드를 띄우고 길게 눌러 사진에 저장 */
.card-save { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px 16px; background: #04071ae6; }
.card-save img { display: block; max-width: min(88vw, 420px); max-height: 70vh; height: auto; border-radius: 8px; -webkit-touch-callout: default; user-select: auto; }
.card-save p { margin: 0; color: var(--text); font-size: 15px; text-align: center; }
.card-save button { padding: 10px 24px; border: 1px solid #ffffff33; border-radius: 20px; background: none; color: var(--text); font: inherit; }
/* 카드에 넣을 이름(선택) */
.rv-owner { display: grid; gap: 6px; margin: 4px auto 12px; max-width: 320px; font-size: 13.5px; color: var(--dim); text-align: left; }
.rv-owner span { color: var(--faint); }
.rv-owner input { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #ffffff0d; color: var(--text); }
.rv-owner input::placeholder { color: var(--faint); }


/* 하단 사업자 정보(site-foot.css): 이 화면은 body 여백이 없고, 아래 고정 버튼(.dock)이 덮지 않게 아래를 더 띄움 */
body.guardian .site-foot { padding-left: var(--gutter); padding-right: var(--gutter); padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }

/* 세 권: 열린 책(열두 편지)은 카드 전체가 링크. "1편 무료로 읽기" 링크의 ::before 를 카드 크기로 펼침(링크 하나라 읽기 프로그램에는 한 번만 읽힘) */
.book--hot { position: relative; cursor: pointer; }
.book--hot .go--open::before { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: 8px; }
.book--hot .go--open:focus-visible { outline: none; }
.book--hot .go--open:focus-visible::before { outline: 2px solid var(--gold); outline-offset: 6px; }
.book--hot .book-cv { transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s cubic-bezier(.2, .7, .2, 1); }
@media (hover: hover) {
  .book--hot:hover .book-cv { transform: translateY(-4px); box-shadow: 0 0 0 1px #e0566c, 0 28px 48px #000c, 0 0 48px #7a1e2b88; }
  .book--hot:hover .go--open { text-decoration: underline; text-underline-offset: 4px; }
}
@media (prefers-reduced-motion: reduce) { .book--hot .book-cv { transition: none; } .book--hot:hover .book-cv { transform: none; } }
