/* 문산연세치과의원 — 공용 스타일 (index.html · letter.html)
   2026-11-27 구성요소별로 한 번씩 정리. 기준 문서: 00_brief/design-system.md

   규칙
   · 색 · 서체 · 크기 · 간격은 아래 :root 변수로만 쓴다
   · 여백 값: 4 · 8 · 16 · 24 · 32 · 48 · 64 · 96
   · 세로 간격: 8(머리글→제목, 붙는 것) · 16(제목→본문, 문단) · 32(본문→블록) · 48(큰 덩어리 사이)
     24는 상자 안쪽 여백과 카드 사이 틈에만
   · 화면 폭: 폰(기본) → 태블릿 600 이상 → 컴퓨터 900 이상
   · 움직임은 2개뿐: 스크롤 등장(.rv) · 누름 표시 */

@font-face { font-family: "Pretendard"; font-weight: 400; font-display: swap; src: url("fonts/Pretendard-Regular.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 600; font-display: swap; src: url("fonts/Pretendard-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 700; font-display: swap; src: url("fonts/Pretendard-Bold.woff2") format("woff2"); }

:root {
  --font: "Pretendard", system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --s-1: 4px;  --s-2: 8px;  --s-3: 16px; --s-4: 24px;
  --s-5: 32px; --s-6: 48px; --s-7: 64px; --s-8: 96px;

  --fs-display: 32px; --lh-display: 40px;   /* 첫 화면 병원 이름 · 큰 숫자 */
  --fs-title:   24px; --lh-title:   32px;   /* 섹션 제목 */
  --fs-sub:     20px; --lh-sub:     28px;   /* 소제목 */
  --fs-body:    18px; --lh-body:    32px;   /* 본문 · 버튼 (폰에서도 18) */
  --fs-small:   16px; --lh-small:   24px;   /* 머리글 · 주소 · 안내 문구 */

  --c-text: #1A1A1A; --c-sub: #5F5E5A; --c-line: #E7E5E0; --c-bg: #FFFFFF; --c-band: #F7F6F3;
  --c-heading: #14284B; --c-brand: #0A63C2; --c-accent: #0A63C2;

  --radius: 8px;
  --gutter: var(--s-3);
  --section: var(--s-7);
  --header: 64px;
}
@media (min-width: 900px) {
  :root {
    --fs-display: 48px; --lh-display: 56px;
    --fs-title:   32px; --lh-title:   40px;
    --gutter: var(--s-4);
    --section: var(--s-8);
  }
}

/* ── 바탕 ───────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + var(--s-3)); }
body { background: var(--c-bg); color: var(--c-text); font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh-body); word-break: keep-all; overflow-wrap: break-word; }
img { display: block; max-width: 100%; height: auto; border-radius: var(--radius); background: var(--c-band); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.inner { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
section { padding: var(--section) 0; border-top: 1px solid var(--c-line); }
.band { background: var(--c-band); }

/* ── 글자 ───────────────────────────────────────────── */
h1 { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: -0.5px; color: var(--c-heading); }
h2 { font-size: var(--fs-title); line-height: var(--lh-title); letter-spacing: -0.3px; color: var(--c-heading); margin-bottom: var(--s-3); }
h3 { font-size: var(--fs-sub); line-height: var(--lh-sub); }
section p { max-width: 720px; }                                   /* 한 줄 40자 안팎 */
.sub { color: var(--c-sub); }
.eyebrow { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-accent); margin-bottom: var(--s-2); }
.lead { font-size: var(--fs-sub); line-height: var(--s-5); margin-top: var(--s-3); }
.lead + .sub { margin-top: var(--s-2); }
.note { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-sub); }
.sub-h { margin-top: var(--s-6); color: var(--c-heading); }
.sub-h.first { margin-top: 0; }
.sub-h + p { margin-top: var(--s-3); }
.nb { white-space: nowrap; }
.mt-3 { margin-top: var(--s-3); }
.mt-5 { margin-top: var(--s-5); }

/* 줄바꿈: 제목은 줄 길이를 고르게, 본문은 끝줄에 한두 단어만 남지 않게 */
h1, h2, h3, dt, .gate b, .cards b, .stats > div, .note { text-wrap: balance; }
p, li, dd, .gate span, .proc span { text-wrap: pretty; }

/* ── 버튼 · 글자 링크 ───────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 var(--s-5); background: var(--c-brand); color: var(--c-bg); font-size: var(--fs-body); font-weight: 700; text-decoration: none; border-radius: var(--radius); transition: opacity .2s ease; }
.btn:active { opacity: .7; }
.more { display: inline-block; margin-top: var(--s-2); min-height: 48px; line-height: 48px; color: var(--c-accent); }

/* ── 상단 ───────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 20; background: var(--c-bg); border-bottom: 1px solid var(--c-line); }
.top .inner { display: flex; align-items: center; justify-content: space-between; height: var(--header); }
.logo { font-weight: 700; font-size: var(--fs-body); color: var(--c-heading); text-decoration: none; }
.top nav { display: none; gap: var(--s-4); }
.top nav a { display: flex; align-items: center; min-height: 48px; color: var(--c-sub); font-weight: 600; font-size: 17px; text-decoration: none; transition: color .2s ease; }   /* 17은 글자 단계 밖 예외(사용자 지정) */
.top .btn { display: none; min-height: 48px; padding: 0 var(--s-3); }

/* ── 첫 화면 ─────────────────────────────────────────── */
.hero { border-top: 0; padding-top: var(--s-6); }
.hero-grid { display: grid; gap: var(--s-5); }
.h1-pre { font-size: var(--fs-title); line-height: var(--lh-title); }
.h1-name { color: var(--c-accent); }
.hero .lead { margin-top: var(--s-5); }
.hero .lead .ln { display: block; text-wrap: balance; }           /* 문장마다 한 줄씩 */
.jump { margin-top: var(--s-3); font-weight: 600; color: var(--c-heading); }
.jump a { display: inline-block; min-height: 48px; line-height: 48px; text-decoration: none; }
.jump span { margin: 0 var(--s-2); color: var(--c-line); }
.hero .btn { display: none; margin-top: var(--s-3); }             /* 폰 · 태블릿: 화면 아래 고정 버튼이 있으므로 숨김 */
.info { display: grid; gap: var(--s-2); margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--c-line); }
.info .sep { display: none; }
.info .nb + .sep + .nb { display: block; }                        /* 폰: 평일 / 토요일을 한 줄씩 */
.director { width: 100%; max-width: 432px; }
.director.wide { max-width: 480px; }

/* ── 진료 분야 카드 3장 ──────────────────────────────── */
.gate { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.gate a { display: block; padding: var(--s-4); border: 2px solid var(--c-brand); border-radius: var(--radius); background: var(--c-bg); text-decoration: none; transition: background-color .2s ease, color .2s ease; }
.gate b { display: block; font-size: var(--fs-title); line-height: var(--lh-title); color: var(--c-heading); }
.gate span { display: block; margin-top: var(--s-1); color: var(--c-sub); }
.gate a:active { background: var(--c-brand); }
.gate a:active b, .gate a:active span { color: var(--c-bg); }
.gate-note { margin-top: var(--s-3); color: var(--c-sub); max-width: none; }
.gate-note b { color: var(--c-text); margin-right: var(--s-1); }

/* ── 대표원장 ────────────────────────────────────────── */
.two { display: grid; gap: var(--s-5); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--c-line); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--c-sub); }
.stats b { display: block; font-size: var(--fs-display); line-height: var(--lh-display); color: var(--c-heading); }
ul.cv { margin-top: var(--s-5); padding-left: var(--s-4); display: grid; gap: var(--s-1); }

/* ── 진료 과정 (사진과 함께 가는 단계) ───────────────── */
.steps { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.step { display: grid; grid-template-columns: 112px 1fr; gap: var(--s-3); align-items: center; padding-top: var(--s-3); border-top: 1px solid var(--c-line); }   /* 폰: 작은 사진 + 글 */
.step img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.step p { margin-top: var(--s-1); }

/* ── 분야 내용 (한 번에 한 분야) ─────────────────────── */
.switch { position: sticky; top: var(--header); z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); margin-bottom: var(--s-6); padding: var(--s-2) 0; background: var(--c-bg); }   /* 폰 · 태블릿: 읽는 동안 따라온다 */
.switch a { display: flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 var(--s-2); border: 2px solid var(--c-brand); border-radius: var(--radius); color: var(--c-heading); font-weight: 700; text-align: center; text-decoration: none; transition: background-color .2s ease, color .2s ease; }
.switch a[aria-current="true"] { background: var(--c-brand); color: var(--c-bg); }
.js .panel:not(.on) { display: none; }                            /* 스크립트가 꺼져 있으면 세 분야가 차례로 다 보인다 */
.js .panel-intro .eyebrow { display: none; }                      /* 선택된 버튼과 같은 글자라 숨김 */
.panel + .panel { margin-top: var(--s-7); padding-top: var(--s-7); border-top: 1px solid var(--c-line); }
.js .panel + .panel { margin-top: 0; padding-top: 0; border-top: 0; }
.panel-intro { max-width: 720px; }
.panel-intro h2:focus { outline: none; }
.panel-last { margin-top: var(--s-6); }
.banner { margin-top: var(--s-6); padding: var(--s-4); background: var(--c-band); border-left: 4px solid var(--c-brand); border-radius: var(--radius); }
.banner h3 { font-size: var(--fs-title); line-height: var(--lh-title); color: var(--c-heading); margin-bottom: var(--s-2); }
.banner .note { margin-top: var(--s-3); }
.cards { display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.cards > div { padding: var(--s-4); border: 1px solid var(--c-line); border-radius: var(--radius); }
.cards b { display: block; font-size: var(--fs-sub); line-height: var(--lh-sub); color: var(--c-heading); margin-bottom: var(--s-1); }
.proc { list-style: none; counter-reset: step; margin-top: var(--s-3); border-top: 1px solid var(--c-line); }
.proc > li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; column-gap: var(--s-2); align-items: baseline; padding: var(--s-3) 0; border-bottom: 1px solid var(--c-line); }
.proc > li::before { content: counter(step, decimal-leading-zero); grid-row: 1 / span 2; font-weight: 700; color: var(--c-accent); }
.proc b { color: var(--c-heading); }
.proc span { color: var(--c-sub); }
.signs { margin-top: var(--s-3); padding-left: var(--s-4); display: grid; gap: var(--s-2); }
.ph { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.xray { display: grid; gap: var(--s-3); }                         /* 치료 전후 X-ray는 자르지 않는다 */
.xray figcaption { font-weight: 700; color: var(--c-heading); margin-bottom: var(--s-1); }
.xray img { width: 100%; height: auto; }

/* ── 오랜 신뢰 + 치료 후 관리 ────────────────────────── */
.after { margin-top: var(--s-6); padding-top: var(--s-6); border-top: 1px solid var(--c-line); }

/* ── 오시는 길 ───────────────────────────────────────── */
.map { display: flex; align-items: center; justify-content: center; min-height: 56px; margin-top: var(--s-3); padding: var(--s-3); border: 2px solid var(--c-brand); border-radius: var(--radius); background: var(--c-bg); color: var(--c-accent); font-weight: 600; text-align: center; text-decoration: none; }
.hours { width: 100%; border-collapse: collapse; margin-top: var(--s-5); }
.hours th, .hours td { border-bottom: 1px solid var(--c-line); padding: var(--s-2) 0; }
.hours th { width: 45%; text-align: left; font-weight: 400; color: var(--c-sub); }
.faq { margin-top: var(--s-5); }
.faq div { border-top: 1px solid var(--c-line); padding: var(--s-3) 0; }
.faq dt { font-weight: 700; }

/* ── 원장님 인사말 (letter.html) ─────────────────────── */
.letter { max-width: 640px; margin-top: var(--s-5); }
.letter p + p { margin-top: var(--s-3); }
.letter .sign { margin-top: var(--s-5); font-weight: 600; color: var(--c-heading); }
.letter + .more { margin-top: var(--s-5); }
.back { display: inline-block; min-height: 48px; line-height: 48px; margin-bottom: var(--s-2); font-size: var(--fs-small); color: var(--c-accent); }

/* ── 하단 ───────────────────────────────────────────── */
footer { border-top: 1px solid var(--c-line); padding: var(--s-5) 0 128px; color: var(--c-sub); font-size: var(--fs-small); line-height: var(--lh-small); }
footer p + p { margin-top: var(--s-2); }
footer a { display: inline-block; min-height: 48px; line-height: 48px; }
.foot-slogan { font-weight: 700; color: var(--c-heading); }

/* 폰 · 태블릿: 화면 아래 고정 전화 버튼 */
.callbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: var(--s-2) var(--s-3) calc(var(--s-2) + env(safe-area-inset-bottom)); background: var(--c-bg); border-top: 1px solid var(--c-line); }
.callbar .btn { width: 100%; }

/* ── 움직임 ─────────────────────────────────────────── */
.rv { opacity: 0; transform: translateY(var(--s-3)); transition: opacity .5s ease, transform .5s ease; }   /* 스크롤 등장: 한 번만 */
.rv.in { opacity: 1; transform: none; }
@media (hover: hover) {
  .btn:hover { opacity: .85; }
  .top nav a:hover { color: var(--c-accent); }
  .gate a:hover { background: var(--c-brand); }
  .gate a:hover b, .gate a:hover span { color: var(--c-bg); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; transition: none; }
  .btn, .gate a, .switch a, .top nav a { transition: none; }
}

/* ── 태블릿 600 이상 ─────────────────────────────────── */
@media (min-width: 600px) {
  .hero-grid { grid-template-columns: 1.2fr 1fr; align-items: center; }
  .gate { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: 1fr 1fr; }
  .steps { gap: var(--s-5); }
  .step { grid-template-columns: 240px 1fr; gap: var(--s-5); padding-top: var(--s-5); }
  .step img { aspect-ratio: 4 / 3; }
}

/* ── 컴퓨터 900 이상 ─────────────────────────────────── */
@media (min-width: 900px) {
  .top nav, .top .btn { display: flex; }
  .hero { padding-top: var(--s-7); }
  .hero-grid { gap: var(--s-7); }
  .hero .btn { display: inline-flex; }
  .info .sep, .info .nb + .sep + .nb { display: inline; }
  .two { grid-template-columns: 1fr 1fr; gap: var(--s-7); align-items: start; }
  .gate { gap: var(--s-4); }
  .cards { gap: var(--s-4); }
  .cards.c3 { grid-template-columns: repeat(3, 1fr); }
  .step { grid-template-columns: 288px 1fr; }
  .switch { position: static; max-width: 640px; gap: var(--s-3); padding: 0; }
  .proc > li { grid-template-columns: 48px 1fr; }
  .callbar { display: none; }
  footer { padding-bottom: var(--s-6); }
}
