/*
 * 오늘날씨 안부 웹 공통 스타일
 * 토큰 원본: docs/design/screens.md 5장(5-1 색, 5-2 글자, 5-3 간격, 5-4 터치, 5-5 라운드).
 * 크기 프리셋: body.size-senior(부모 초대 랜딩, 본문 22px·버튼 64px)
 *              body.size-standard(그 밖의 페이지, 본문 17px·버튼 56px)
 *              body.size-doc(법률 문서·고객지원, 본문 18px 이상)
 * 모든 크기는 rem이라 브라우저 글자 크기 설정을 그대로 따른다(원칙서 C2).
 */

@font-face {
  font-family: "Anbu Web Text";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/anbu-web-text-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Anbu Web Text";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/anbu-web-text-semibold.woff2") format("woff2");
}
@font-face {
  font-family: "Anbu Web Text";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/anbu-web-text-bold.woff2") format("woff2");
}

/* ---------- 색 토큰 (5-1) ---------- */
:root {
  color-scheme: light dark;
  --bg: #FFFFFF;
  --surface: #F3F5F7;
  --border: #7D8691;
  --text-primary: #15191F;
  --text-secondary: #47505C;
  --fill-brand: #1A4CA8;
  --on-brand: #FFFFFF;
  --fill-brand-weak: #E6EFFC;
  --text-brand-weak: #1A4699;
  --danger: #A8202F;
  --success: #08663F;
  --success-bg: #E7F5EE;
  --warning-text: #7A3B00;
  --warning-bg: #FFF4E0;
  --focus-ring: #1A4CA8;
  --wx-sun: #C77700;
  --icon-sun: #FFC266;

  /* 간격 (5-3) */
  --gutter: 20px;
  --gap-xs: 8px;
  --gap-s: 12px;
  --gap-m: 16px;
  --gap-l: 24px;
  --gap-xl: 32px;
  --card-pad: 20px;

  /* 라운드·테두리 (5-5) */
  --radius-button: 16px;
  --radius-card: 20px;
  --border-width: 1.5px;
  --border-selected: 2.5px;

  /* 글자 (5-2 standard 기본값) */
  --type-title1: 1.625rem;   /* 26 */
  --type-title1-lh: 1.35;
  --type-title2: 1.375rem;   /* 22 */
  --type-title2-lh: 1.41;
  --type-body: 1.0625rem;    /* 17 */
  --type-body-lh: 1.53;
  --type-button: 1.125rem;   /* 18 */
  --type-caption: 0.875rem;  /* 14 */
  --type-caption-lh: 1.5;
  --weight-body: 400;
  --weight-button: 600;

  /* 터치 (5-4 standard) */
  --touch-cta: 56px;
  --touch-secondary: 48px;
  --touch-row: 56px;
  --touch-gap: 8px;

  --content-max: 640px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --surface: #1D2026;
    --border: #6E7783;
    --text-primary: #F1F3F5;
    --text-secondary: #B9C0C8;
    --fill-brand: #8DB6FF;
    --on-brand: #0E1420;
    --fill-brand-weak: #1E2A40;
    --text-brand-weak: #BCD4FF;
    --danger: #FF8A94;
    --success: #6FD6A3;
    --success-bg: #15261E;
    --warning-text: #FFC266;
    --warning-bg: #2A2215;
    --focus-ring: #8DB6FF;
    --wx-sun: #FFC266;
  }
}

/* senior: 부모가 여는 페이지 (WEB-01) */
body.size-senior {
  --type-title1: 2rem;       /* 32 */
  --type-title1-lh: 1.31;
  --type-title2: 1.625rem;   /* 26 */
  --type-title2-lh: 1.38;
  --type-body: 1.375rem;     /* 22 */
  --type-body-lh: 1.45;
  --type-button: 1.5rem;     /* 24 */
  --type-caption: 1.125rem;  /* 18 — 부모 화면 최소 크기 */
  --type-caption-lh: 1.44;
  --weight-button: 700;
  --touch-cta: 64px;
  --touch-secondary: 56px;
  --touch-row: 72px;
  --touch-gap: 12px;
}
@media (prefers-color-scheme: dark) {
  body.size-senior { --weight-body: 500; }
}

/* doc: 법률 문서·고객지원. 본문 18px 이상(3-41) */
body.size-doc {
  --type-body: 1.125rem;     /* 18 */
  --type-body-lh: 1.6;
  --type-caption: 1rem;      /* 16 */
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Anbu Web Text", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  font-size: var(--type-body);
  line-height: var(--type-body-lh);
  font-weight: var(--weight-body);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--text-brand-weak);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: var(--gap-xs) var(--gap-m);
  background: var(--fill-brand);
  color: var(--on-brand);
  border-radius: var(--radius-button);
  z-index: 10;
}
.skip-link:focus { top: var(--gap-xs); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- 머리·몸·꼬리 ---------- */
.site-header,
.site-main,
.site-footer {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.site-header {
  display: flex;
  align-items: center;
  gap: var(--gap-s);
  padding-top: var(--gap-m);
  padding-bottom: var(--gap-m);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-s);
  min-height: 48px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--type-title2);
  line-height: var(--type-title2-lh);
}
.brand img { width: 40px; height: 40px; flex: none; }
body.size-senior .brand img { width: 56px; height: 56px; }

.site-main { padding-bottom: var(--gap-xl); }

.site-footer {
  border-top: var(--border-width) solid var(--border);
  padding-top: var(--gap-l);
  padding-bottom: calc(var(--gap-xl) + env(safe-area-inset-bottom, 0px));
  color: var(--text-secondary);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
}
.site-footer nav ul {
  list-style: none;
  margin: 0 0 var(--gap-m);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs) var(--gap-m);
}
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--text-primary);
}
.site-footer p { margin: 0 0 var(--gap-xs); }

/* ---------- 글자 ---------- */
h1, h2, h3 { margin: 0; color: var(--text-primary); }
h1 {
  font-size: var(--type-title1);
  line-height: var(--type-title1-lh);
  font-weight: 700;
  margin: var(--gap-m) 0 var(--gap-m);
}
h2 {
  font-size: var(--type-title2);
  line-height: var(--type-title2-lh);
  font-weight: 600;
  margin: var(--gap-xl) 0 var(--gap-s);
}
h3 {
  font-size: var(--type-body);
  line-height: var(--type-body-lh);
  font-weight: 700;
  margin: var(--gap-l) 0 var(--gap-xs);
}
p { margin: 0 0 var(--gap-m); }
ul, ol { margin: 0 0 var(--gap-m); padding-left: 1.4em; }
li { margin-bottom: var(--gap-xs); }
strong { font-weight: 700; }

.lead { font-size: var(--type-body); }
.caption {
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  color: var(--text-secondary);
}
.num { font-variant-numeric: tabular-nums; }

/* ---------- 카드 (5-1 규칙 2: surface + border) ---------- */
.card {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  margin: 0 0 var(--gap-l);
}
.card > :last-child { margin-bottom: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.card-brand {
  background: var(--fill-brand-weak);
  border-color: var(--border);
}
.card-brand, .card-brand h2, .card-brand h3 { color: var(--text-primary); }

.notice {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  margin: 0 0 var(--gap-l);
}
.notice > :last-child { margin-bottom: 0; }

.result-ok {
  background: var(--success-bg);
  color: var(--text-primary);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  margin: 0 0 var(--gap-l);
}
.result-ok > :last-child { margin-bottom: 0; }

/* ---------- 버튼 (fill / neutral) ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--touch-cta);
  padding: var(--gap-s) var(--gap-l);
  border-radius: var(--radius-button);
  border: var(--border-width) solid transparent;
  font: inherit;
  font-size: var(--type-button);
  line-height: 1.33;
  font-weight: var(--weight-button);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-fill {
  background: var(--fill-brand);
  color: var(--on-brand);
  border-color: var(--fill-brand);
}
.btn-neutral {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary { min-height: var(--touch-secondary); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.btn + .btn, .btn + .caption { margin-top: var(--touch-gap); }
.btn-stack { margin: var(--gap-l) 0; }

/* ---------- 단계 카드 (Play 테스트 대안 경로) ---------- */
.steps { list-style: none; padding: 0; margin: var(--gap-l) 0; counter-reset: step; }
.steps > li {
  counter-increment: step;
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  margin: 0 0 var(--gap-m);
}
.steps > li > .step-title {
  display: block;
  font-weight: 700;
  margin-bottom: var(--gap-s);
}
.steps > li > .step-title::before {
  content: counter(step) ". ";
}

/* ---------- 초대 코드 ---------- */
.code-box {
  display: block;
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  margin: var(--gap-xs) 0 var(--gap-s);
}

/* ---------- QR ---------- */
.qr {
  display: inline-block;
  background: #FFFFFF;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--gap-m);
  margin: var(--gap-s) 0 var(--gap-m);
}
.qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }

/* ---------- 폼 ---------- */
.field { margin: 0 0 var(--gap-l); }
.field > label,
.field > .label,
fieldset > legend {
  display: block;
  font-weight: 600;
  margin-bottom: var(--gap-xs);
}
fieldset { border: 0; margin: 0 0 var(--gap-l); padding: 0; min-width: 0; }

input[type="text"],
input[type="email"],
input[type="tel"] {
  display: block;
  width: 100%;
  min-height: var(--touch-cta);
  padding: var(--gap-s) var(--gap-m);
  font: inherit;
  font-size: var(--type-body);
  color: var(--text-primary);
  background: var(--bg);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-button);
}
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="tel"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}
input.input-code {
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}
input[aria-invalid="true"] { border-color: var(--danger); border-width: var(--border-selected); }

.field-error {
  color: var(--danger);
  font-weight: 600;
  margin: var(--gap-xs) 0 0;
}
.field-hint {
  color: var(--text-secondary);
  font-size: var(--type-caption);
  line-height: var(--type-caption-lh);
  margin: var(--gap-xs) 0 0;
}

/* 큰 버튼형 라디오: 선택 카드 = fillBrand 2.5px 테두리 (5-5 border.selected) */
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: var(--touch-gap); }
@media (max-width: 359px) { .choice-group { grid-template-columns: 1fr; } }
.choice { position: relative; display: block; }
.choice input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  min-height: var(--touch-cta);
  padding: var(--gap-s) var(--gap-m);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-button);
  background: var(--bg);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.choice span::before {
  content: "";
  flex: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
}
.choice input:checked + span {
  border: var(--border-selected) solid var(--fill-brand);
  background: var(--fill-brand-weak);
}
.choice input:checked + span::before {
  border-color: var(--fill-brand);
  background: var(--fill-brand);
  box-shadow: inset 0 0 0 4px var(--bg);
}
.choice input:focus-visible + span {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--gap-s);
  min-height: var(--touch-cta);
  padding: var(--gap-s) 0;
  cursor: pointer;
}
.check input {
  flex: none;
  width: 28px; height: 28px;
  margin: 2px 0 0;
  accent-color: var(--fill-brand);
}

.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 펼침 카드 (고객지원 FAQ) ---------- */
details.faq {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  margin: 0 0 var(--gap-s);
}
details.faq > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-s);
  min-height: 56px;
  padding: var(--gap-s) var(--card-pad);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::after {
  content: "";
  flex: none;
  width: 12px; height: 12px;
  border-right: 2.5px solid var(--text-primary);
  border-bottom: 2.5px solid var(--text-primary);
  transform: rotate(45deg);
  margin-top: -6px;
}
details.faq[open] > summary::after { transform: rotate(-135deg); margin-top: 6px; }
details.faq > .faq-body { padding: 0 var(--card-pad) var(--card-pad); }
details.faq > .faq-body > :last-child { margin-bottom: 0; }

/* ---------- 법률 문서 ---------- */
.doc-meta { color: var(--text-secondary); font-size: var(--type-caption); }
.toc { margin: 0 0 var(--gap-l); }
.toc ol { margin: 0; }
.toc li { padding: 4px 0; margin-bottom: 4px; }
.doc section { scroll-margin-top: var(--gap-m); }
.doc ol.clauses > li, .doc ul > li { margin-bottom: var(--gap-s); }


/* 표: 넓은 화면은 표, 좁은 화면은 세로 카드 (3-41) */
.table-wrap { margin: 0 0 var(--gap-l); }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  font-size: var(--type-body);
}
caption {
  text-align: left;
  font-weight: 700;
  padding: 0 0 var(--gap-xs);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: var(--gap-s) var(--gap-m);
  border-bottom: 1px solid var(--border);
}
thead th { background: var(--surface); font-weight: 700; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 700; }

@media (max-width: 719px) {
  table.stack, table.stack thead, table.stack tbody, table.stack tr,
  table.stack th, table.stack td { display: block; }
  table.stack { border: 0; border-radius: 0; overflow: visible; }
  table.stack caption { display: block; padding-bottom: var(--gap-s); }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr {
    background: var(--surface);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius-card);
    padding: var(--gap-s) var(--card-pad);
    margin: 0 0 var(--gap-s);
  }
  table.stack td, table.stack tbody th {
    border: 0;
    padding: var(--gap-xs) 0;
  }
  table.stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: var(--type-caption);
    line-height: var(--type-caption-lh);
    color: var(--text-secondary);
    font-weight: 600;
  }
}

/* ---------- 소개 페이지 ---------- */
.hero-icon { width: 96px; height: 96px; margin-top: var(--gap-l); }
.policy-line {
  font-size: var(--type-title2);
  line-height: var(--type-title2-lh);
  font-weight: 600;
}
.split { display: grid; gap: var(--gap-m); grid-template-columns: 1fr; }
@media (min-width: 600px) { .split { grid-template-columns: 1fr 1fr; } }
.split > .card { margin: 0; }

/* 모션: 쓰지 않는다(5-6). 사용자가 줄이기를 켜면 브라우저 기본 스크롤 애니메이션도 끈다 */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header .brand img, .skip-link, .site-footer nav { display: none; }
  body { background: #FFFFFF; color: #000000; }
  table.stack thead { position: static; width: auto; height: auto; clip: auto; }
}
