/* 앱(src/styles.css)과 같은 색. 밤하늘은 책자리 화면처럼 첫 화면에만 쓰고, 나머지는 앱처럼 밝은 바탕에 카드로 둔다 */
:root {
  --sky-a: #0b1030;
  --sky-b: #1a2350;
  --sky-ink: #e6eaff;
  --sky-soft: #a9b3da;
  --sky-line: rgb(170 190 255 / 0.25);
  --star: #8ec5ff;
  --paper: #f0f2f7;
  --surface: #ffffff;
  --sunken: #e5e8f0;
  --ink: #12172b;
  --ink-2: #383f55;
  --muted: #646b80;
  --accent: #2f6fe0;
  --g0: #e5e8f0;
  --g1: #c3d5f7;
  --g2: #84a9ee;
  --g3: #4a82e6;
  --g4: #1f4fae;
  --cover-bg: #e2e6ef;
  --shadow: 0 1px 2px rgb(18 23 43 / 0.04), 0 8px 24px rgb(18 23 43 / 0.06);
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #080b16;
    --surface: #121729;
    --sunken: #1c2238;
    --ink: #edf0f8;
    --ink-2: #c3c8d8;
    --muted: #8f96ab;
    --accent: #8ec5ff;
    --g0: #1c2238;
    --g1: #1d3566;
    --g2: #2c56a3;
    --g3: #4f86e4;
    --g4: #8ec5ff;
    --cover-bg: #232a42;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.7; word-break: keep-all; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--star); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* 첫 화면: 밤하늘과 책자리 */
.sky { position: relative; isolation: isolate; overflow: hidden; color: var(--sky-ink); background: radial-gradient(120% 90% at 75% 20%, var(--sky-b), var(--sky-a) 70%); padding-bottom: 72px; }
/* 뒤쪽 하늘: 작은 별들이 숨 쉬듯 깜빡이고, 옅은 오로라가 천천히 흐른다 */
.sky::before, .sky::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.sky::before { background-image: radial-gradient(1.5px 1.5px at 52% 86%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1px 1px at 70% 15%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1.5px 1.5px at 9% 67%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1px 1px at 13% 58%, rgb(255 255 255 / 0.5), transparent), radial-gradient(2px 2px at 32% 14%, rgb(255 255 255 / 0.5), transparent), radial-gradient(2px 2px at 74% 18%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1px 1px at 82% 77%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1px 1px at 76% 53%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1px 1px at 7% 74%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1px 1px at 55% 21%, rgb(255 255 255 / 0.7), transparent), radial-gradient(1px 1px at 41% 74%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1px 1px at 76% 76%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1px 1px at 14% 73%, rgb(255 255 255 / 0.7), transparent), radial-gradient(1px 1px at 9% 82%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1px 1px at 89% 71%, rgb(255 255 255 / 0.7), transparent), radial-gradient(2px 2px at 61% 77%, rgb(255 255 255 / 0.7), transparent), radial-gradient(2px 2px at 40% 34%, rgb(255 255 255 / 0.7), transparent), radial-gradient(1px 1px at 33% 13%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1.5px 1.5px at 65% 46%, rgb(255 255 255 / 0.9), transparent), radial-gradient(2px 2px at 79% 12%, rgb(255 255 255 / 0.7), transparent), radial-gradient(1px 1px at 55% 24%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1.5px 1.5px at 64% 56%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1px 1px at 11% 74%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1.5px 1.5px at 90% 47%, rgb(255 255 255 / 0.7), transparent), radial-gradient(2px 2px at 60% 11%, rgb(255 255 255 / 0.9), transparent), radial-gradient(1px 1px at 62% 92%, rgb(255 255 255 / 0.7), transparent); opacity: 0.7; }
.sky::after { inset: -20%; background: radial-gradient(40% 35% at 70% 30%, rgb(142 197 255 / 0.16), transparent 70%), radial-gradient(35% 30% at 25% 70%, rgb(160 140 255 / 0.12), transparent 70%), radial-gradient(30% 25% at 85% 75%, rgb(242 196 107 / 0.07), transparent 70%); }
.top { display: flex; align-items: center; justify-content: space-between; padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; text-decoration: none; }

.hero { display: grid; gap: 24px; align-items: center; padding-top: 32px; }
.hero h1 { margin: 0; font-weight: 800; font-size: clamp(2rem, 6.4vw, 2.9rem); line-height: 1.3; letter-spacing: -0.03em; }
.lede { margin: 22px 0 0; max-width: 32em; color: var(--sky-soft); font-size: 1.05rem; }
.store { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin: 28px 0 0; padding: 0 24px; border-radius: 999px; background: var(--sky-ink); color: var(--sky-a); font-weight: 700; text-decoration: none; transition: background 0.15s; }
.store:hover { background: #fff; }
.store:focus-visible { border-radius: 999px; }

.hero-sky { display: grid; justify-items: center; justify-self: center; width: 100%; max-width: 560px; }
.constellation { width: 100%; height: auto; overflow: visible; }
.sky-hint { margin: 4px 0 0; color: var(--sky-soft); }
/* 앱 책자리(Graph.tsx 의 draw·drawLabels)와 같은 모양: 선은 화면 1px, 책은 별빛, 저자·분야·태그는 색과 크기로만 구분한다 */
.constellation line { stroke: var(--sky-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.constellation .book { fill: var(--star); filter: drop-shadow(0 0 5px var(--star)); }
.constellation .author { fill: #aab4d8; }
.constellation .category { fill: #6c779f; }
/* 가운데 Bookstella 별만 앱과 달리 금빛으로 두고 은은하게 반짝이게 한다 */
.constellation .tag { fill: #f2c46b; }
.constellation circle.tag { filter: drop-shadow(0 0 6px #f2c46b); }
.constellation text { fill: var(--sky-ink); font-family: var(--sans); font-size: 12px; font-weight: 500; paint-order: stroke; stroke: var(--sky-a); stroke-width: 3.3px; stroke-linejoin: round; }
.constellation .named { font-size: 13px; font-weight: 700; }

/* 페이지를 열 때 한 번: 선이 이어지고 별이 켜진다 */
@media (prefers-reduced-motion: no-preference) {
  .constellation line { stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 0.9s ease-out forwards; animation-delay: calc(0.35s + var(--i) * 0.04s); }
  .constellation circle { opacity: 0; transform-box: fill-box; transform-origin: center; animation: light 0.6s ease-out forwards; animation-delay: calc(0.1s + var(--i) * 0.05s); }
  .constellation .labels { opacity: 0; animation: fade 0.8s ease-out 1.9s forwards; }
  .constellation circle.tag { animation: light 0.6s ease-out calc(0.1s + var(--i) * 0.05s) forwards, twinkle 3.2s ease-in-out 2s infinite; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes light { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }
@keyframes fade { to { opacity: 1; } }
@keyframes twinkle { 50% { filter: drop-shadow(0 0 12px #f2c46b) drop-shadow(0 0 3px #fff3cf); } }
@keyframes breathe { 50% { opacity: 0.35; } }
@keyframes drift { to { transform: translate3d(-5%, 3%, 0) scale(1.08); } }
@media (prefers-reduced-motion: no-preference) {
  .sky::before { animation: breathe 6s ease-in-out infinite; }
  .sky::after { animation: drift 14s ease-in-out infinite alternate; }
}

/* 별을 누르면(마우스는 가리키면) 앱 책자리처럼 그 별과 이어진 별·선·이름만 밝힌다 */
.constellation, .growable { -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.constellation circle, .growable circle { transition: fill-opacity 0.25s; }
.constellation line, .growable line { transition: stroke-opacity 0.25s, stroke 0.25s; }
.constellation text { transition: opacity 0.25s; }
.is-focus circle:not(.lit) { fill-opacity: 0.15; }
.is-focus line:not(.lit) { stroke-opacity: 0.12; }
.is-focus line.lit { stroke: var(--star); stroke-width: 2; }
.is-focus text:not(.lit) { opacity: 0.15; }

/* 기능 소개 */
main { padding: 24px 0 8px; }
/* 칸이 넘기기 영역의 최소 너비만큼 늘어나 화면 밖으로 나가지 않게 0 까지 줄어들게 둔다 */
.feature { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: center; padding-top: 56px; padding-bottom: 56px; }
.feature h2 { margin: 0; font-weight: 800; font-size: clamp(1.45rem, 4vw, 1.9rem); line-height: 1.4; letter-spacing: -0.025em; }
.feature p { margin: 14px 0 0; max-width: 30em; color: var(--ink-2); font-size: 1.02rem; }

.mock { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; justify-items: center; }
.card { width: 100%; max-width: 380px; margin: 0; padding: 18px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); }

/* 앱의 대체 표지(책등 모양)를 줄여 쓴다 */
.cover { flex: none; display: flex; align-items: flex-end; width: 56px; aspect-ratio: 2 / 3; padding: 6px; border-radius: 3px 7px 7px 3px; background: var(--cover-bg); color: var(--ink-2); font-size: 0.62rem; font-weight: 700; line-height: 1.3; box-shadow: inset 4px 0 0 rgb(0 0 0 / 0.06); }

img.cover { height: auto; padding: 0; object-fit: cover; }

.reading { display: flex; gap: 16px; align-items: center; }
.reading-body { display: grid; gap: 4px; flex: 1; }
.bar { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.bar span { display: block; width: var(--w); height: 100%; border-radius: 3px; background: var(--accent); }

.grass { display: grid; gap: 10px; }
.grass-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.grass-grid i { aspect-ratio: 1; border-radius: 3px; background: var(--g0); }
.grass-grid .g1 { background: var(--g1); }
.grass-grid .g2 { background: var(--g2); }
.grass-grid .g3 { background: var(--g3); }
.grass-grid .g4 { background: var(--g4); }

.note blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--accent); font-weight: 600; font-size: 1.08rem; line-height: 1.6; }
.note figcaption { margin-top: 14px; }
.note figcaption p { margin: 0 0 6px; color: var(--ink-2); font-size: 0.95rem; }

.sky-card, .star-card { color: var(--sky-ink); background: linear-gradient(170deg, var(--sky-a), var(--sky-b)); }

/* 앱의 책자리 상세 분석 카드(src/styles.css 의 .star-card)를 줄여 옮겼다 */
.star-card { display: grid; padding-bottom: 6px; }
.star-card-kicker { display: flex; align-items: center; gap: 6px; color: var(--star); font-weight: 700; letter-spacing: 0.02em; }
.star-card-title { margin: 6px 0 16px; font-size: 1.2rem; line-height: 1.4; letter-spacing: -0.02em; }
.star-pillars { display: flex; margin: 0 0 8px; border: 1px solid var(--sky-line); border-radius: 14px; }
.star-pillars > div { flex: 1; min-width: 0; padding: 12px 4px; text-align: center; }
.star-pillars > div + div { border-left: 1px solid var(--sky-line); }
.star-pillars dt { font-size: 0.75rem; font-weight: 700; color: #6c779f; }
.star-pillars dd { display: grid; gap: 2px; margin: 6px 0 0; line-height: 1.4; }
.star-pillars strong { color: var(--star); font-size: 0.92rem; overflow-wrap: anywhere; }
.star-pillars span { font-size: 0.7rem; color: #aab4d8; }
.star-lines { margin: 0; padding: 0; list-style: none; }
.star-lines li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0; }
.star-lines li + li { border-top: 1px solid var(--sky-line); }
.star-lines li > svg:first-child { flex: none; color: var(--star); }
.star-line-body { flex: 1; min-width: 0; display: grid; gap: 2px; line-height: 1.45; }
.star-line-body strong { font-size: 0.9rem; }
.star-line-body span { font-size: 0.82rem; color: #aab4d8; }
.star-line-go { flex: none; color: #6c779f; }
.star-persona { padding-bottom: 18px; }
.persona-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 16px; padding: 0; list-style: none; }
.persona-tags li { padding: 3px 10px; border: 1px solid rgb(142 197 255 / 0.55); border-radius: 999px; color: var(--star); font-size: 0.8rem; font-weight: 700; }
.persona-quote { margin: 0 0 16px; padding-left: 14px; border-left: 3px solid var(--star); color: var(--star); font-size: 1.08rem; font-weight: 700; line-height: 1.55; }
/* 예시 풀이는 두 줄만 보이고 나머지는 말줄임으로 접는다 */
.star-card .persona-body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: none; margin: 0; color: var(--sky-ink); font-size: 0.95rem; line-height: 1.75; }
.persona-body mark { color: inherit; font-weight: 600; background: linear-gradient(transparent 58%, rgb(142 197 255 / 0.38) 0); }

.sky-card .growable { display: block; width: 100%; height: auto; }
/* 앱이 별자리를 처음 그리기 전에 보여 주는 예시 별자리(Graph.tsx 의 SampleSky)를 같은 배치 계산으로 뽑아 옮겼다 */
.sky-card line { stroke: var(--sky-line); stroke-width: 1; }
.sky-card .book { fill: var(--star); filter: drop-shadow(0 0 4px var(--star)); }
.sky-card .author { fill: #aab4d8; }
.sky-card .category, .sky-card .tag { fill: #6c779f; }
.sky-replay { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; min-height: 44px; margin-top: 10px; padding: 0 16px; border: 1px solid var(--sky-line); border-radius: 999px; background: rgb(255 255 255 / 0.06); color: var(--sky-ink); font: inherit; cursor: pointer; transition: background-color 0.2s; }
.sky-replay:hover { background: rgb(255 255 255 / 0.12); }
.sky-replay svg { color: var(--star); }
.sky-count { color: var(--sky-soft); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .sky-replay { display: none; } }
@media (prefers-reduced-motion: no-preference) {
  .growable.play line { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 0.7s ease-out forwards; animation-delay: calc(var(--i) * 0.07s); }
  .growable.play circle { opacity: 0; transform-box: fill-box; transform-origin: center; animation: light 0.5s ease-out forwards; animation-delay: calc(var(--i) * 0.07s); }
}

.insight-carousel { width: 100%; max-width: 400px; }
.insight-track { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; gap: 20px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 10px; padding: 4px 10px 28px; margin-bottom: -14px; scrollbar-width: none; }
.insight-track::-webkit-scrollbar { display: none; }
.insight-track > .insight { max-width: none; scroll-snap-align: start; }
.insight-nav { display: flex; align-items: center; justify-content: center; gap: 8px; }
.nav-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--sunken); border-radius: 50%; background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow); cursor: pointer; transition: opacity 0.2s; }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.dots { display: flex; }
.dots button { position: relative; width: 24px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.dots button::before { content: ''; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 4px; background: var(--g1); transition: width 0.25s, margin 0.25s, background-color 0.25s; }
.dots button[aria-current='true']::before { width: 18px; margin-left: -9px; background: var(--accent); }
.insight-nav button:focus-visible, .sky-replay:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.insight { display: grid; align-content: start; gap: 4px; }
.insight-head { display: grid; margin: -18px -18px 12px; padding: 14px 18px; border-radius: 22px 22px 0 0; color: var(--sky-ink); background: linear-gradient(170deg, var(--sky-a), var(--sky-b)); }
.insight-head .small { color: var(--sky-soft); letter-spacing: 0.04em; }
.insight-line { font-size: 1.15rem; }
.week { display: flex; align-items: flex-end; gap: 8px; height: 84px; margin-top: 12px; }
.week i { flex: 1; height: var(--h); border-radius: 4px 4px 0 0; background: var(--g1); }
.week--ten { gap: 5px; }
.week--ten + .week-days { justify-content: space-between; }
.week--ten + .week-days span { flex: none; }
.hbars, .shift { display: grid; gap: 8px; margin-top: 14px; }
.hbars div, .shift > div { display: grid; grid-template-columns: 5.6em 1fr; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; }
.hbars div { grid-template-columns: 5.6em 1fr 3em; }
.hbars div > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.hbars b { display: block; width: var(--w); height: 10px; border-radius: 5px; background: var(--g2); }
.hbars div:first-child b { background: var(--accent); }
.hbars b.dim { background: var(--g1); }
.stack { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.stack b { width: var(--w); }
.s1 { background: var(--g4); }
.s2 { background: var(--g2); }
.s3 { background: #f2c46b; }
.s4 { background: var(--g1); }
.legend { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0; padding: 0; list-style: none; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; }
.week .top { background: var(--accent); }
.week-days { display: flex; gap: 8px; text-align: center; }
.week-days span { flex: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 0; }
.tiles div { padding: 10px 12px; border-radius: 14px; background: var(--sunken); }
.tiles dt { color: var(--muted); font-size: 0.78rem; }
.tiles dd { margin: 2px 0 0; font-weight: 700; font-size: 1.2rem; }

/* 노트 공유 버튼이 만드는 이미지(shareCard.ts 의 noteImage)를 앱에서 그대로 렌더링해 줄였다 */
.share-image { display: block; height: auto; padding: 0; }
.share-step { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; }

/* 화면에 들어오면(JS 가 in 을 붙임) 글과 카드가 차례로 떠오르고, 막대·잔디·진행률이 채워진다 */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease-out var(--d, 0s), transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .week i, .js .hbars b, .js .stack b, .js .bar span { transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s); }
  .js .week i { transform-origin: bottom; }
  .js .hbars b, .js .stack b, .js .bar span { transform-origin: left; }
  .js .insight-carousel:not(.in) .week i { transform: scaleY(0); }
  .js .insight-carousel:not(.in) :is(.hbars, .stack) b, .js .reading:not(.in) .bar span { transform: scaleX(0); }
  .js .grass-grid i { transition: background-color 0.35s ease-out var(--d, 0s); }
  .js .grass:not(.in) .grass-grid i { background: var(--g0); }
}

.recs { display: grid; gap: 16px; list-style: none; }
.recs li { display: flex; gap: 14px; align-items: center; }
.rec-body { display: grid; gap: 2px; }
.why { color: var(--accent); font-size: 0.85rem; }

.foot { padding-top: 28px; padding-bottom: max(40px, env(safe-area-inset-bottom)); border-top: 1px solid var(--sunken); color: var(--muted); font-size: 0.9rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0 0 12px; padding: 0; list-style: none; }
.foot-links a { display: inline-block; padding: 8px 0; color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-links a:focus-visible { outline-color: var(--accent); }
.credit { margin: 4px 0; font-size: 0.82rem; }

/* 좁은 화면에서는 별자리가 줄어드는 만큼 이름을 키워 앱처럼 12px 안팎으로 읽히게 하고, 앱처럼 저자·분야 이름만 남긴다 */
@media (max-width: 600px) {
  .constellation text { font-size: 16.5px; stroke-width: 4.5px; }
  .constellation .named { font-size: 18px; }
  .constellation text:not(.named) { display: none; }
  .constellation.is-focus text.lit { display: inline; }
}

@media (min-width: 860px) {
  .hero { grid-template-columns: 1.1fr 1fr; padding-top: 48px; }
  .feature { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; }
  .feature:nth-of-type(even) .feature-copy { order: 2; }
}
