/* 치과찾기 — "기록부" 디자인 시스템
 *
 * 이 사이트의 신뢰는 병원 브로슈어가 아니라 공개 기록에서 온다.
 * 그래서 치과 간판의 민트/하늘색을 쓰지 않고, 공문서의 종이·잉크·인주(朱)를 쓴다.
 * 색은 거의 쓰지 않고, 개성은 두 구조에 몰아넣는다:
 *   1) 계측 거터 - 왼쪽 고정폭에 수치(거리/개수)를 세로 정렬해 눈이 한 줄로 훑게 한다
 *   2) 전문의 그리드 - 11개 전문과목 고정 칸. 목록에서 패턴으로 비교된다 (시그니처)
 *
 * 웹폰트는 라틴/숫자 1종만. 한글은 시스템 스택(23,000 페이지 성능 우선).
 */

:root {
  --paper:   #EDEFF2;
  --paper-2: #F8F9FB;
  --paper-3: #E3E7EC;
  --ink:     #0E1620;
  --ink-2:   #3D4A5A;
  --ink-3:   #566171;   /* AA 4.5:1 on --paper */
  --rule:    #D3D8E0;
  --seal:    #A93B26;
  --seal-bg: #F6E9E5;
  --focus:   #1B54B8;

  --gutter: 4.25rem;
  --maxw: 60rem;
  --r: 3px;

  --kr: system-ui, -apple-system, "Pretendard", "Apple SD Gothic Neo",
        "Malgun Gothic", "맑은 고딕", sans-serif;
  --num: "Archivo Narrow", ui-monospace, "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #0D1117;
    --paper-2: #141B24;
    --paper-3: #1C242F;
    --ink:     #E7EBF1;
    --ink-2:   #AAB5C3;
    --ink-3:   #8E9AAA;   /* AA 4.5:1 on dark --paper */
    --rule:    #242D3A;
    --seal:    #E8775F;
    --seal-bg: #2A1A16;
    --focus:   #7AA7FF;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--kr);
  font-size: 0.9375rem;
  line-height: 1.68;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* 수치는 표처럼 자리를 맞춰야 목록에서 비교가 된다 */
.num, .dist, .cnt, time { font-family: var(--num); font-variant-numeric: tabular-nums; }

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { color: var(--seal); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* ---------- 머리·바닥 ---------- */

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.top-in {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0.5rem 1.25rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 0.25rem;
  font-weight: 800; letter-spacing: -0.03em; font-size: 1.0625rem;
  text-decoration: none;
}
.brand .mark {
  width: 1.375rem; height: 1.375rem; flex: none;
  border: 1.5px solid var(--seal); border-radius: var(--r);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; padding: 2.5px;
}
.brand .mark i { background: var(--seal); border-radius: 0.5px; }
.brand .mark i:nth-child(2), .brand .mark i:nth-child(6) { opacity: 0.25; }
.top nav { margin-left: auto; display: flex; gap: 0.25rem; }
.top nav a {
  min-height: 2.75rem; display: inline-flex; align-items: center;
  padding: 0 0.625rem; font-size: 0.875rem; color: var(--ink-2);
  text-decoration: none; border-radius: var(--r);
}
.top nav a:hover { background: var(--paper-3); color: var(--ink); }

main { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

footer {
  border-top: 1px solid var(--rule); margin-top: 3.5rem;
  background: var(--paper-2);
}
footer > div {
  max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 3rem;
  color: var(--ink-3); font-size: 0.8125rem; line-height: 1.7;
}
footer p { margin: 0 0 0.375rem; }

/* ---------- 제목 ---------- */

.bc {
  font-size: 0.8125rem; color: var(--ink-3);
  margin: 0 0 0.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem;
}
.bc a { min-height: 1.75rem; display: inline-flex; align-items: center; text-decoration: none; color: var(--ink-3); }
.bc a:hover { color: var(--seal); }

h1 {
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.4rem);
  line-height: 1.22; letter-spacing: -0.035em; font-weight: 800;
  margin: 0 0 0.375rem;
}
.loc { margin: 0 0 1.25rem; color: var(--ink-2); font-size: 0.9375rem; }
.loc .sep { color: var(--rule); margin: 0 0.3rem; }

main h2 {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--ink-3); text-transform: uppercase;
  margin: 2.25rem 0 0.75rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
main h2:first-child { margin-top: 0.5rem; }

/* 직답 문단 - 답변엔진이 이 문단을 통째로 추출한다.
   주어·수치·기준일을 문장 안에 모두 담아 맥락 없이도 사실이 성립하게 쓴다. */
.lead {
  font-size: 1.0625rem; line-height: 1.62; color: var(--ink);
  margin: 0 0 1.25rem; padding-left: 0.875rem;
  border-left: 3px solid var(--seal);
}

/* ---------- 기록 표 ---------- */

.rec { width: 100%; border-collapse: collapse; margin: 0 0 0.5rem; }
.rec thead th { color: var(--ink-2); font-weight: 700; font-size: 0.8125rem; width: auto; }
.rec td.num { font-family: var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec td.num small { color: var(--ink-3); font-weight: 400; }
.rec th, .rec td { text-align: left; padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.rec th { width: 8.5rem; font-weight: 500; color: var(--ink-3); font-size: 0.875rem; white-space: nowrap; }
.rec td { color: var(--ink); }

/* ---------- 목록: 계측 거터 + 시그니처 그리드 ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  position: relative;
  display: grid; grid-template-columns: var(--gutter) 1fr; gap: 0 0.875rem;
  padding: 0.875rem 0.25rem; border-bottom: 1px solid var(--rule);
}
.list > li:hover { background: var(--paper-2); }

/* 왼쪽 계측 거터 - 수치가 세로로 정렬되어 목록을 훑을 수 있다 */
.g {
  font-family: var(--num); font-variant-numeric: tabular-nums;
  font-size: 1.0625rem; font-weight: 700; line-height: 1.35;
  color: var(--ink-3); text-align: right; padding-top: 0.1rem;
}
.g small { display: block; font-size: 0.6875rem; font-weight: 400; letter-spacing: 0.04em; }
.g.on { color: var(--seal); }

.nm { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em; text-decoration: none; }
/* 카드 전체를 탭 영역으로 (링크 높이 22px 문제 해결) */
.nm::after { content: ""; position: absolute; inset: 0; }
.list > li:focus-within { background: var(--paper-2); }
.m { color: var(--ink-3); font-size: 0.8125rem; margin-top: 0.15rem; }
.m a { position: relative; z-index: 1; }

/* 시그니처: 전문의 그리드. 11개 전문과목 고정 칸 */
.sg { display: flex; gap: 2px; margin-top: 0.45rem; }
.sg b {
  width: 1.125rem; height: 1.125rem; border-radius: 1.5px;
  display: grid; place-items: center;
  font-size: 0.625rem; font-weight: 700; line-height: 1;
  background: var(--paper-3); color: var(--ink-3);
}
.sg b.on { background: var(--ink); color: var(--paper); opacity: 1; }
.sg b.on[data-n]::after { content: attr(data-n); font-size: 0.5rem; margin-left: 1px; }
.sg-key { display: flex; gap: 2px; align-items: center; color: var(--ink-3); font-size: 0.75rem; }

/* ---------- 링크 묶음 ---------- */

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.375rem; }
.links a {
  display: inline-flex; align-items: center; min-height: 2.25rem;
  padding: 0 0.75rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--paper-2); font-size: 0.875rem; text-decoration: none;
}
.links a:hover { border-color: var(--seal); color: var(--seal); }
.links li:not(:has(a)) {
  display: inline-flex; align-items: center; min-height: 2.25rem;
  padding: 0 0.75rem; color: var(--ink-3); font-size: 0.875rem;
}

/* ---------- 알림 ---------- */

.note {
  background: var(--paper-2); border: 1px solid var(--rule);
  border-left: 3px solid var(--seal);
  padding: 0.75rem 0.9rem; border-radius: var(--r);
  font-size: 0.875rem; color: var(--ink-2); margin: 0 0 1.25rem;
}
.note strong { color: var(--ink); }

/* ---------- 지도 ---------- */

.map {
  height: 17.5rem; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--paper-3); margin: 0 0 0.75rem;
}
@media (prefers-color-scheme: dark) {
  .map .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9); }
}

/* ---------- 가이드 본문 ---------- */

.prose p { margin: 0 0 1rem; color: var(--ink-2); }
.prose ul { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--ink-2); }
.prose li { margin-bottom: 0.3rem; }
.faq { margin: 0; }
.faq dt { font-weight: 700; margin-top: 1.1rem; }
.faq dd { margin: 0.3rem 0 0; color: var(--ink-2); }

/* ---------- 반응형 ---------- */

@media (max-width: 30rem) {
  :root { --gutter: 3.25rem; }
  main { padding: 1.25rem 1rem 3rem; }
  .top-in { padding: 0.375rem 1rem; }
  .rec th { width: 6.25rem; font-size: 0.8125rem; }
  .g { font-size: 0.9375rem; }
}

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