/* ==========================================================================
   종이팩은 종이가 아니다 — Carton Project
   Design tokens
   - paper : 종이 질감 배경 (원료인 '종이'에서 착안)
   - ink   : 인쇄 잉크에 가까운 짙은 그린블랙 (포스터/기록집의 인쇄물 느낌)
   - leaf  : 잎사귀 그린 (자원순환의 결과물)
   - sky   : 분리배출함/재활용 상징색에서 온 블루
   - carton: 우유팩 크래프트지 색
   - spout : 우유팩 마개(스파우트) 색 — 포인트 컬러
   ========================================================================== */

:root {
  --paper: #f3eee0;
  --paper-dim: #ece5d2;
  --ink: #1e2b22;
  --ink-soft: #44523f;
  --leaf: #3b7a57;
  --leaf-dark: #2c5c41;
  --sky: #3e7ca6;
  --carton: #d8c9a3;
  --spout: #dd9b3f;
  --line: rgba(30, 43, 34, 0.14);
  --radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans KR", "Pretendard", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-display {
  font-family: "Noto Serif KR", serif;
  color: var(--ink);
  letter-spacing: -0.01em;
}

a { color: inherit; }

/* Subtle paper grain so flat Tailwind fills don't feel like plain UI panels */
.paper-grain {
  position: relative;
  isolation: isolate;
}
.paper-grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  z-index: -1;
  background-image:
    radial-gradient(rgba(30,43,34,0.05) 1px, transparent 1px);
  background-size: 3px 3px;
}

/* ---------- Header / Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.logo-mark {
  font-family: "Noto Serif KR", serif;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
}

.nav-item { position: relative; }

/* 메뉴 항목과 드롭다운 사이의 빈 구간을 덮는 투명 다리.
   이게 없으면 마우스가 내려오는 도중 hover가 끊겨 메뉴가 닫힙니다. */
.nav-item::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 1.15rem;
}

.nav-link {
  font-weight: 500;
  padding: 0.5rem 0.15rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-link.is-active { border-color: var(--leaf); }
.nav-link:hover,
.nav-item:hover > .nav-link,
.nav-item:focus-within > .nav-link,
.nav-item.is-open > .nav-link {
  color: var(--leaf-dark);
}

.dropdown {
  position: absolute;
  top: calc(100% + 1.15rem);   /* 헤더 아래쪽 경계에 맞춰 떨어뜨림 */
  left: -1.5rem;
  min-width: 14rem;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: 0 16px 34px -12px rgba(30, 43, 34, 0.26);
  padding: 0.7rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 40;
}
.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown,
.nav-item.is-open .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown a {
  display: block;
  padding: 0.72rem 1.5rem;
  border-radius: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.dropdown a:hover { background: var(--paper-dim); color: var(--leaf-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary {
  background: var(--leaf);
  color: #fdfbf3;
}
.btn-primary:hover { background: var(--leaf-dark); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--paper); }

.btn-spout {
  background: var(--spout);
  color: #2a1c08;
}
.btn-spout:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -10px rgba(221,155,63,0.7); }

/* ---------- Tape / collage accents ---------- */
.tape {
  position: absolute;
  background: rgba(214, 197, 148, 0.75);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  height: 26px;
}

/* ---------- Poster card (campaign collage feel) ---------- */
.poster-card {
  background: #fffdf6;
  border: 1px solid var(--line);
  padding: 0.9rem 0.9rem 1.1rem;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 16px -10px rgba(30,43,34,0.4);
}
.poster-card:hover {
  transform: rotate(0deg) translateY(-4px);
  box-shadow: 0 16px 30px -14px rgba(30,43,34,0.45);
}
.poster-card:nth-child(3n+1) { --tilt: -1.4deg; }
.poster-card:nth-child(3n+2) { --tilt: 0.9deg; }
.poster-card:nth-child(3n+3) { --tilt: -0.6deg; }

/* iframe(유튜브·PDF 뷰어)을 품은 카드는 절대 기울이지 않습니다.
   CSS transform이 걸린 조상 안의 iframe은 클릭 좌표가 어긋나
   재생 버튼이 안 눌리는 문제가 생깁니다. */
.poster-card.is-flat,
.poster-card.is-flat:hover {
  transform: none;
}

/* ---------- Step / process card ---------- */
.step-card {
  border-left: 3px solid var(--leaf);
  padding-left: 1.1rem;
}

.stat {
  font-family: "Noto Serif KR", serif;
  font-weight: 700;
  color: var(--leaf-dark);
  line-height: 1;
}

/* ---------- Section eyebrow (used only where content is genuinely sequential/labeled) ---------- */
.eyebrow {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #e8e3d3;
}
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ---------- Modal (Tally form) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 43, 34, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
}
.modal-overlay.is-open { display: flex; }

.modal-box {
  background: #fffdf6;
  max-width: 30rem;
  width: 100%;
  padding: 2rem;
  border-radius: 6px;
  position: relative;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
  display: block;
}

.field-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.65rem 0.8rem;
  background: #fff;
  font-size: 0.95rem;
}
.field-input:focus {
  outline: 2px solid var(--leaf);
  outline-offset: 1px;
}

.mobile-menu {
  display: none;
}
.mobile-menu.is-open { display: block; }

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

/* ---------- PDF 뷰어 (기록집) ---------- */
.pdf-viewer {
  width: 100%;
  aspect-ratio: 1 / 1.35;          /* 세로형 기록집 비율 */
  background: var(--paper-dim);
  border: 1px solid var(--line);
}
.pdf-viewer iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
@media (min-width: 768px) {
  .pdf-viewer { aspect-ratio: 1 / 1.1; }   /* 넓은 화면에선 조금 낮게 */
}

/* ---------- 통계 표 · 차트 ---------- */
.chart-box {
  background: #fffdf6;
  border: 1px solid var(--line);
  padding: 1.25rem 1rem;
}

/* 넓은 표는 페이지가 아니라 표 자신이 가로 스크롤되도록 */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fffdf6;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 46rem;
  font-size: 0.86rem;
}
.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table thead th {
  background: var(--paper-dim);
  font-weight: 500;
  text-align: left;
  position: sticky;
  top: 0;
}
.data-table tbody th {
  text-align: left;
  font-weight: 500;
  background: #fffdf6;
  position: sticky;
  left: 0;
}
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td { border-bottom: 0; }

/* 핵심 지표(재활용률) 강조 */
.data-table .row-hi th,
.data-table .row-hi td {
  background: var(--leaf);
  color: #fdfbf3;
  font-weight: 700;
}

/* ---------- 홈 히어로 설명글 (문단 간격) ---------- */
.hero-desc p + p { margin-top: 0.9rem; }

/* ---------- 홈 통계 그래프 ----------
   가로로 긴 그래프라 좁은 화면에서 축소하면 글자를 읽을 수 없습니다.
   페이지가 아니라 그래프 자신이 가로 스크롤되게 하고 최소 너비를 지킵니다. */
.chart-scroll { overflow-x: auto; }
.chart-scroll img { min-width: 30rem; }

/* ---------- 섹션 배경 밴드 ----------
   첫 화면에서 파트가 눈으로 구분되도록 배경을 번갈아 깝니다.
   종이 질감 팔레트 안에서만 움직여 색이 튀지 않게 했습니다.
   (밝음 → 조금 어두움 → 크래프트지 → 잎사귀 그린 순으로 깊어짐) */
.band {
  border-top: 1px solid var(--line);
}
.band--paper  { background: var(--paper); }
.band--dim    { background: var(--paper-dim); }
.band--carton { background: rgba(216, 201, 163, 0.55); }
.band--leaf   { background: rgba(59, 122, 87, 0.28); }

/* ---------- 기록집: 발행 정보 ---------- */
.book-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  color: var(--ink-soft);
}
.book-meta dt { font-weight: 500; white-space: nowrap; }
.book-meta dd { margin: 0; }

/* ---------- 기록집: 목차 ---------- */
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.toc-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.toc-page {
  font-family: "Noto Serif KR", serif;
  font-weight: 700;
  color: var(--leaf-dark);
  font-size: 0.95rem;
  padding-top: 0.1rem;
}
.toc-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}
.toc-title {
  font-family: "Noto Serif KR", serif;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.5;
}
.toc-kind {
  font-size: 0.8rem;
  color: var(--leaf);
  margin-top: 0.6rem;
}
.toc-sub {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.65;
}
.toc-sub li::before { content: "– "; }

@media (max-width: 480px) {
  .toc-row { grid-template-columns: 2.6rem 1fr; }
  .toc-title { font-size: 0.97rem; }
}

/* ---------- 기록집: 목차 이미지 ----------
   가로로 긴 펼침면이라 좁은 화면에서 축소하면 글자를 읽을 수 없습니다.
   페이지가 아니라 이미지 영역만 가로 스크롤되게 합니다. */
.toc-image {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
}
.toc-image img {
  display: block;
  width: 100%;
  min-width: 46rem;
}

/* ---------- 기록집 표지 (배경 없는 PNG) ----------
   네모난 박스 그림자 대신, 책의 실제 모양을 따라가는 그림자를 씁니다. */
.book-shadow {
  filter: drop-shadow(0 18px 28px rgba(30, 43, 34, 0.28));
}

/* ---------- 교육 자료 미리보기 (자료 첫 장) ---------- */
.manual-preview {
  margin-top: 1rem;
  max-width: 22rem;
  border: 1px solid var(--line);
  background: #fff;
}
.manual-preview img {
  display: block;
  width: 100%;
}

/* ---------- 통계 자료 이미지 ----------
   세로로 긴 한 장을 8조각으로 나눠 스크롤에 따라 받습니다.
   조각 사이가 벌어지지 않도록 여백·테두리를 두지 않습니다. */
.stat-pages {
  background: #fff;
  font-size: 0;          /* 이미지 사이 공백 문자 제거 */
}
.stat-pages img {
  display: block;
  width: 100%;
  height: auto;          /* 원본 비율 유지 */
}
