@import url("./tokens.css");

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 8px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--cream); color: var(--charcoal);
  font-family: var(--font-sans); font-weight: var(--w-body);
  font-size: var(--fs-body); line-height: 1.7; letter-spacing: -0.01em;
  word-break: keep-all; overflow-wrap: break-word; overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.unit { display: inline-block; white-space: nowrap; } /* 의미 단위 줄바꿈 */
:focus-visible { outline: 2px solid var(--sangria); outline-offset: 3px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--sangria); color: var(--cream); padding: 10px 16px; z-index: 100; text-decoration: none; font-weight: var(--w-strong); }
.skip:focus { top: 12px; }

/* ---------- 헤더 ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--cream); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.logo { font-family: var(--font-logo); font-weight: var(--w-logo); font-size: 32px; line-height: 1; letter-spacing: -0.05em; color: var(--sangria); text-decoration: none; }
.logo img { height: 34px; width: auto; }
.nav ul { display: flex; gap: clamp(20px, 3vw, 40px); list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 10px 2px; font-size: var(--fs-menu); font-weight: var(--w-menu); text-decoration: none; color: var(--charcoal); }
.nav a:hover { color: var(--sangria); }
.menu-toggle { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--charcoal); font: inherit; font-size: var(--fs-small); font-weight: var(--w-menu); cursor: pointer; }
.menu-toggle .bars { position: relative; width: 22px; height: 14px; }
.menu-toggle .bars::before, .menu-toggle .bars::after, .menu-toggle .bars span { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor; }
.menu-toggle .bars::before { top: 0; } .menu-toggle .bars span { top: 6px; } .menu-toggle .bars::after { bottom: 0; }
@media (max-width: 760px) {
  :root { --header-h: 60px; }
  .logo { font-size: 26px; }
  .menu-toggle { display: inline-flex; }
  .nav { position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--cream); border-bottom: 1px solid var(--rule); display: none; }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: 4px var(--gutter) 12px; }
  .nav li + li { border-top: 1px solid var(--rule-dark); }
  .nav a { padding: 16px 0; font-size: 17px; }
}

/* ---------- 버튼 · 링크 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; border: 1px solid var(--sangria); border-radius: 0; font-family: var(--font-sans); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn-primary { background: var(--sangria); color: var(--cream); }
.btn-primary:hover { background: #7A0400; }
.btn-line { background: transparent; color: var(--sangria); }
.btn-line:hover { background: rgba(147, 5, 0, .06); }
.text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; font-size: 17px; text-decoration: none; color: var(--charcoal); border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.text-link:hover { color: var(--sangria); }
.text-link .arrow { font-size: .95em; }
/* 아직 주소가 없는 버튼·링크 */
.is-pending { cursor: default; pointer-events: none; color: var(--charcoal-soft); }
.btn.is-pending { background: transparent; color: var(--charcoal-soft); border-color: var(--rule-dark); }
.text-link.is-pending { border-bottom-color: var(--rule-dark); }
.btn.is-pending, .text-link.is-pending { pointer-events: auto; } /* 키보드·마우스로 '준비 중' 안내는 보이게 */
.pending-note { font-size: 13px; font-weight: 500; letter-spacing: 0; margin-left: 6px; }

/* ---------- 메인 ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: ". media" "copy media" "actions media" ". media"; grid-template-rows: 1fr auto auto 1fr; border-bottom: 1px solid var(--rule); min-height: clamp(480px, 44vw, 620px); }
.hero-copy { grid-area: copy; position: relative; z-index: 1; margin-right: -14%; padding: 56px 0 0 max(var(--gutter), calc((100vw - var(--wrap)) / 2)); } /* 글이 사진의 흐린 가장자리 위까지 조금 넘어감 */
.hero-actions { grid-area: actions; position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 12px; padding: 40px clamp(24px, 4vw, 56px) 56px max(var(--gutter), calc((100vw - var(--wrap)) / 2)); }
.eyebrow { font-family: var(--font-serif); font-weight: var(--w-serif); font-size: 12px; letter-spacing: .32em; color: var(--charcoal); margin-bottom: 22px; }
.slogan { font-family: var(--font-serif); font-weight: var(--w-serif); color: var(--sangria); font-size: clamp(42px, 5vw, 74px); line-height: 1.22; letter-spacing: -0.035em; }
.slogan .line { display: block; }
.hero-sub { margin-top: 24px; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.6; color: var(--charcoal); }
.hero-media { grid-area: media; position: relative; margin: 0; min-height: 100%; background: #F1E7D2; overflow: hidden; }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 58% 52%;
  /* 사진 가장자리만 바탕으로 스며들게 (화면 바탕에는 그라데이션 없음) */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 15%);
          mask-image: linear-gradient(to right, transparent 0, #000 15%); }
.hero-media.has-image { background: var(--cream); }
.media-slot { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; text-align: center; padding: 24px; color: var(--charcoal-soft); font-size: 14px; border-left: 1px solid var(--rule); }
.media-slot b { color: var(--charcoal); font-size: 15px; }
.hero-media.has-image .media-slot { display: none; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "copy" "media" "actions"; grid-template-rows: auto; min-height: 0; }
  .hero-copy { margin-right: 0; padding: 48px var(--gutter) 32px; }
  .slogan { font-size: clamp(36px, 10.8vw, 44px); }
  .hero-media { min-height: 0; aspect-ratio: 1 / 1; }
  .hero-media img { object-position: 55% 55%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%); }
  .media-slot { border-left: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .hero-actions { padding: 28px var(--gutter) 48px; }
  .hero-actions .btn { flex: 1 1 140px; }
}

/* ---------- 섹션 공통 ---------- */
.section { padding: var(--space-section) 0; }
.section-label { display: flex; gap: 10px; font-size: var(--fs-small); font-weight: 600; color: var(--charcoal); margin-bottom: clamp(32px, 5vw, 56px); }
.section-label .slash { color: var(--charcoal-soft); font-weight: 400; }

/* ---------- 첫 책 ---------- */
.book { padding-top: 28px; }
.book-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 7vw, 110px); align-items: center; }
.book-cover { justify-self: center; width: min(100%, 360px); }
.book-title { font-family: var(--font-sans); font-weight: var(--w-title); color: var(--sangria); font-size: clamp(32px, 4.1vw, 54px); line-height: 1.26; letter-spacing: -0.04em; }
.book-title .line { display: block; }
.book-desc { margin-top: 22px; font-size: clamp(18px, 1.5vw, 20px); line-height: 1.65; }
.book-links { display: flex; flex-wrap: wrap; gap: 16px 48px; margin-top: 44px; }
@media (max-width: 860px) {
  .book-grid { grid-template-columns: 1fr; gap: 44px; }
  .book-cover { width: min(78%, 320px); }
  .book-links { gap: 12px 32px; margin-top: 32px; }
}

/* 표지 목업 — 실제 표지 이미지가 생기면 site-data.js의 cover에 경로만 넣으면 교체됨 */
.cover-mock { position: relative; aspect-ratio: 1 / 1.42; background: #F4EFE4; box-shadow: 0 1px 0 rgba(37,40,45,.08), 0 24px 40px -24px rgba(37,40,45,.35); container-type: inline-size; overflow: hidden; }
.cover-mock img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-spine { position: absolute; top: 0; bottom: 0; left: 0; width: 7%; background: #E9E2D3; border-right: 1px solid rgba(37,40,45,.08); }
.cover-face { position: absolute; inset: 0 0 0 7%; padding: 9cqw 9cqw 9cqw 10cqw; display: flex; flex-direction: column; }
.cover-pub { font-size: 3.6cqw; font-weight: 600; color: var(--charcoal); }
.cover-title { margin-top: 13cqw; font-size: 11.5cqw; font-weight: var(--w-title); line-height: 1.24; letter-spacing: -0.04em; color: var(--sangria); }
.cover-title span { display: block; }
.cover-art { position: relative; flex: 1; }
.cover-art::before { content: ""; position: absolute; width: 27cqw; height: 27cqw; right: 15cqw; top: 14cqw; background: var(--blue); }
.cover-art::after { content: ""; position: absolute; width: 1px; height: 62cqw; right: 30cqw; top: 2cqw; background: var(--sangria); transform: rotate(38deg); transform-origin: top center; }
.cover-foot { display: flex; justify-content: space-between; align-items: end; }
.cover-tagline .line { display: block; }
.cover-tagline { font-family: var(--font-serif); font-weight: var(--w-serif); font-size: 3.4cqw; line-height: 1.7; color: var(--charcoal); }
.cover-en { font-family: var(--font-serif); font-weight: var(--w-serif); font-size: 2.6cqw; letter-spacing: .18em; color: var(--charcoal); }
/* 책 공개 전 빈 표지 */
.cover-blank { aspect-ratio: 1 / 1.42; border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; }
.cover-blank span { font-size: var(--fs-small); color: var(--charcoal-soft); letter-spacing: .02em; }
.book-grid[hidden] { display: none; }
.book-desc .line { display: block; }
.cover-mock.has-image .cover-spine, .cover-mock.has-image .cover-face { display: none; }

/* ---------- 학습자료 · 보충영상 ---------- */
.study { background: var(--blue); padding: clamp(56px, 7vw, 88px) 0; }
.study-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.study-head { font-family: var(--font-sans); font-weight: var(--w-title); color: var(--sangria); font-size: clamp(30px, 3.4vw, 46px); line-height: 1.3; letter-spacing: -0.04em; padding-right: clamp(24px, 4vw, 56px); }
.study-item { padding: 6px clamp(24px, 3.5vw, 52px); border-left: 1px solid var(--rule); }
.study-item h3 { font-size: clamp(22px, 2vw, 28px); font-weight: var(--w-strong); letter-spacing: -0.03em; line-height: 1.3; color: var(--charcoal); }
.study-item p { margin-top: 12px; font-size: 17px; line-height: 1.6; }
.study-item .text-link { margin-top: 20px; }
.study-note { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule-dark); font-size: var(--fs-small); color: var(--charcoal); }
@media (max-width: 960px) {
  .study-grid { grid-template-columns: 1fr; align-items: stretch; }
  .study-head { padding: 0 0 28px; }
  .study-item { border-left: 0; border-top: 1px solid var(--rule); padding: 28px 0; }
}

/* ---------- 다시책 이야기 ---------- */
.story-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: clamp(32px, 6vw, 96px); border-top: 1px solid var(--rule); padding-top: clamp(32px, 4vw, 48px); }
.story-title { font-family: var(--font-serif); font-weight: var(--w-serif); color: var(--sangria); font-size: clamp(28px, 3vw, 40px); line-height: 1.35; letter-spacing: -0.03em; }
.story-body p + p { margin-top: 18px; }
@media (max-width: 760px) { .story-grid { grid-template-columns: 1fr; } }

/* ---------- 푸터 ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 36px 0 48px; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.footer-logo { font-family: var(--font-logo); font-weight: var(--w-logo); font-size: 24px; letter-spacing: -0.05em; color: var(--sangria); }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 28px; list-style: none; margin: 0; padding: 0; }
.footer-links a, .footer-links span { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--fs-small); font-weight: var(--w-menu); text-decoration: none; color: var(--charcoal); }
.footer-links a:hover { color: var(--sangria); }
.footer-info { margin-top: 20px; font-size: 13px; line-height: 1.8; color: var(--charcoal-soft); }
.footer-info:empty { display: none; }
.footer-copy { margin-top: 12px; font-size: 13px; color: var(--charcoal-soft); }
.story-title .line { display: block; }
