/* ==========================================================================
   알파포유 안내 — 웹 쪽 짜임
   색·글자·모서리는 전부 tokens.css 의 변수에서 온다 (deck.py 에서 뽑아낸 것).
   ⛔ 이 파일에 색 값을 직접 적지 않는다. 적으면 PPTX 와 따로 늙는다.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg-top);
  color: var(--text);
  font-family: "Apple SD Gothic Neo", "Apple SD 산돌고딕 Neo", "Noto Sans KR",
               "맑은 고딕", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.6;
  word-break: keep-all;          /* 한글은 단어 중간에서 끊지 않는다 */
  overflow-wrap: anywhere;
}

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 72px;
}

/* --------------------------------------------------------------------------
   표지
   -------------------------------------------------------------------------- */
.cover { padding-bottom: 26px; }

.cover .kicker {
  margin: 0 0 10px;
  font-size: var(--t-cover-kicker);
  line-height: var(--lh-cover-kicker);
  color: var(--accent);
  font-weight: 600;
}

.cover h1 {
  margin: 0 0 14px;
  font-size: var(--t-cover-title);
  line-height: var(--lh-cover-title);
  letter-spacing: -0.015em;
  font-weight: 800;
}

.cover .sub {
  margin: 0 0 16px;
  font-size: var(--t-cover-sub);
  line-height: var(--lh-cover-sub);
  color: var(--sub);
}

.cover .meta {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-cover-meta);
  line-height: var(--lh-cover-meta);
  color: var(--muted);
}
.cover .meta li + li { margin-top: 4px; }

/* 범례 — 빨강은 누르는 곳, 파랑은 확인하는 곳 */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 18px 0 0;
  padding: 12px var(--card-pad);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--corner);
  font-size: var(--t-caption);
  color: var(--sub);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i {
  width: 14px; height: 14px; border-radius: 3px; flex: none;
  border: 2px solid currentColor;
}
.legend .click { color: var(--red); }
.legend .check { color: var(--blue); }

/* --------------------------------------------------------------------------
   진행 순서 (목차)
   -------------------------------------------------------------------------- */
.toc { margin-top: 30px; }

.sec-title {
  margin: 0 0 14px;
  font-size: var(--t-page-title);
  line-height: var(--lh-page-title);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.toc-group {
  padding: 14px var(--card-pad);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--accent);
  border-radius: var(--corner);
}
.toc-group + .toc-group { margin-top: 10px; }

.toc-group h3 {
  margin: 0;
  font-size: var(--t-card-head);
  line-height: 1.3;
  font-weight: 700;
}
.toc-group h3 b { color: var(--accent); margin-right: 6px; }

.toc-group .lead {
  margin: 6px 0 0;
  font-size: var(--t-card-lead);
  line-height: var(--lh-card-lead);
  color: var(--sub);
}

.toc-group ol {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  font-size: var(--t-toc-item);
  line-height: var(--lh-toc-item);
  color: var(--text);
}
.toc-group li { padding-left: 14px; position: relative; }
.toc-group li::before {
  content: "";
  position: absolute; left: 2px; top: 0.72em;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--muted);
}
/* 쪽 안의 차례 항목 — «눌러야 할 것처럼» 보여야 한다.
   색을 본문과 같게 두고 밑줄도 빼면 링크인 줄 모른다 (2026-10-02 사용자 지적). */
.toc-group a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* --- 대문의 자료 카드 — 모양은 위 카드와 «같고», 카드 전체가 링크다 ---
   ⛔ 제목을 강조색으로 바꾸거나 화살표를 붙이지 않는다 (사용자 2026-10-02 — 이전이 낫다).
      달라지는 것은 «눌린다»는 것뿐이고, 그것은 누를 때의 반응으로 알린다. */
a.toc-group {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color .12s ease;
}
a.toc-group:hover { background: var(--chip-bg); }
a.toc-group:active { background: var(--chip-bg); }
a.toc-group:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a.toc-group h3 { color: inherit; }

/* --------------------------------------------------------------------------
   본문 한 쪽
   -------------------------------------------------------------------------- */
.step {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--footer-line);
  scroll-margin-top: 16px;
}

.group {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px;
  font-size: var(--t-chip);
  line-height: var(--lh-chip);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.group::before {
  content: ""; flex: none;
  width: 3px; height: 1.05em; border-radius: 2px;
  background: var(--accent);
}

.step h2 {
  margin: 0 0 18px;
  font-size: var(--t-page-title);
  line-height: var(--lh-page-title);
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* --- 사진 --- */
.shots {
  display: grid;
  gap: 12px;
  justify-content: center;
  margin-bottom: 14px;
}
/* 칸 수만 정하고 넘치는 장은 다음 줄로 흘려보낸다 — 몇 장이든 칸 크기가 같다.
   ⛔ 줄마다 칸 수를 달리 두지 않는다. 마지막 줄의 한 장만 크면 그 장만 중요해 보인다. */
.shots[data-cols="1"] { grid-template-columns: minmax(0, 360px); }
.shots[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 360px)); }
.shots[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 300px)); }

/* 좁은 화면에서는 칸이 작아지므로 사이를 좁혀 사진을 조금이라도 키운다 */
@media (max-width: 480px) {
  .shots[data-cols="3"] { gap: 7px; }
}

.shots figure { margin: 0; }

.shot {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--img-line);
  border-radius: calc(var(--corner) * 0.7);
  background: var(--panel);
}
.shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.shots figcaption {
  margin-top: 7px;
  text-align: center;
  font-size: var(--t-caption);
  line-height: var(--lh-caption);
  color: var(--muted);
}

/* --- 사이드 패널이 아래로 내려온 것 --- */
.panel {
  padding: var(--card-pad);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--accent);
  border-radius: var(--corner);
}

.row + .row { margin-top: 15px; }

.row .label {
  margin: 0 0 5px;
  font-size: var(--t-panel-label);
  line-height: var(--lh-panel-label);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent2);
}

.row .body {
  margin: 0;
  font-size: var(--t-panel-body);
  line-height: var(--lh-panel-body);
  color: var(--text);
}

.row .checks {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-panel-check);
  line-height: var(--lh-panel-check);
  color: var(--sub);
}
.row .checks li { padding-left: 15px; position: relative; }
.row .checks li + li { margin-top: 3px; }
.row .checks li::before {
  content: "";
  position: absolute; left: 3px; top: 0.66em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent2);
}

/* 안내·대처는 따뜻한 바탕 카드로 떼어 둔다 (2026-10-01 결정) */
.row.alert {
  padding: 12px var(--card-pad);
  background: var(--alert-bg);
  border: 1px solid var(--alert-line);
  border-radius: calc(var(--corner) * 0.8);
}
.row.alert .label { color: var(--amber); font-size: var(--t-panel-alert); }
.row.alert .body { color: var(--amber-dim); font-size: var(--t-panel-note); }

/* --------------------------------------------------------------------------
   글자 전용 쪽 (스크린샷 없는 자료)
   -------------------------------------------------------------------------- */
.step .lead {
  margin: -6px 0 16px;
  font-size: var(--t-page-lead);
  line-height: var(--lh-page-lead);
  font-weight: 700;
  color: var(--sub);
}

.card {
  padding: var(--card-pad);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--accent);
  border-radius: var(--corner);
}
.card + .card { margin-top: 10px; }
.card.alert {
  background: var(--alert-bg);
  border-color: var(--alert-line);
  border-left-color: var(--amber);
}
.card h3 {
  margin: 0 0 7px;
  font-size: var(--t-block-head);
  line-height: var(--lh-block-head);
  font-weight: 700;
}
.card.alert h3 { color: var(--amber); }
.card p {
  margin: 0;
  font-size: var(--t-block-body);
  line-height: var(--lh-block-body);
  color: var(--text);
}
.card p + p { margin-top: 5px; }
.card.alert p { color: var(--amber-dim); }

/* --------------------------------------------------------------------------
   마무리
   -------------------------------------------------------------------------- */
.closing { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--footer-line); }

.wrap-row { padding: 14px var(--card-pad); background: var(--panel);
            border: 1px solid var(--panel-line); border-left: 3px solid var(--accent2);
            border-radius: var(--corner); }
.wrap-row + .wrap-row { margin-top: 10px; }
.wrap-row h3 { margin: 0 0 5px; font-size: var(--t-wrap-head);
               line-height: var(--lh-wrap-head); font-weight: 700; }
.wrap-row p { margin: 0; font-size: var(--t-wrap-body);
              line-height: var(--lh-wrap-body); color: var(--sub); }

/* --------------------------------------------------------------------------
   전체화면 보기
   -------------------------------------------------------------------------- */
/* ⛔ 아이폰은 주소창이 들락거려 100% 가 «보이는 높이»와 다르다.
   dvh/dvw 를 쓰고, 모르는 브라우저를 위해 100% 를 먼저 적어 둔다. */
.viewer {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  width: 100dvw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #000;
  overflow: hidden;
}
.viewer::backdrop { background: #000; }
.viewer[hidden] { display: none; }

/* ⛔ grid + place-items:center 로 두지 않는다.
   자동 행 높이가 «내용»으로 정해져 img 의 max-height:100% 가 자기 자신을 기준으로
   풀려 버린다 — 그림이 원본 크기(1320x2868)로 커진다 (2026-10-02 실측).
   flex 는 컨테이너 높이가 확정이라 100% 가 제대로 걸린다. */
.viewer-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: none;            /* 핀치·끌기를 직접 다룬다 */
}
.viewer-stage img {
  flex: 0 0 auto;
  max-width: 100%; max-height: 100%;
  min-width: 0; min-height: 0;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.viewer-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #fff;
  font-size: 14px;
  pointer-events: none;
}
.viewer-bar .cap { flex: 1 1 auto; min-width: 0; pointer-events: none; }
.viewer-bar .zoom { display: flex; gap: 8px; pointer-events: auto; }

.viewer button {
  min-width: 44px; min-height: 44px;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 19px; font-weight: 700;
  cursor: pointer;
}
.viewer button:disabled { opacity: 0.38; cursor: default; }

.viewer-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px;
  z-index: 2;
}
/* 「3 / 23」 — 확대·축소 단추와 같은 크기로 읽히되, 단추처럼 «눌리는 것»으로는
   보이지 않게 한다. 테두리를 두지 않고 바탕만 옅게 깐다 (사용자 2026-10-02). */
.viewer-count {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px;
  min-height: 44px;
  display: flex; align-items: center;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums;   /* 숫자가 바뀌어도 폭이 흔들리지 않는다 */
  letter-spacing: 0.02em;
  opacity: 0.92;
  pointer-events: none;
}
.viewer-count:empty { display: none; }

/* --------------------------------------------------------------------------
   넓은 화면 — 제목 계열만 한 단 키운다 (본문은 키우지 않는다)
   -------------------------------------------------------------------------- */
@media (min-width: 700px) {
  .doc { padding-top: 40px; }
  .cover h1 { font-size: calc(var(--t-cover-title) * 1.3); }
  .step h2, .sec-title { font-size: calc(var(--t-page-title) * 1.18); }
}

/* --------------------------------------------------------------------------
   인쇄 — 쪽마다 끊고 사진을 작게
   -------------------------------------------------------------------------- */
@media print {
  .doc { max-width: none; padding: 0; }
  .step, .closing { break-before: page; border-top: 0; }
  .shots[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 220px)); }
  .shots[data-n="1"] { grid-template-columns: minmax(0, 220px); }
  .viewer { display: none !important; }
}

/* --------------------------------------------------------------------------
   어두운 화면 — 색만 다크 테마로 갈아끼운다 (짜임은 같다)
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; }
}
