/* 돼지런 공개 웹 공통 스타일 — docs/W17_SITE_RESPONSIVE_PLAN.md §3
   모든 페이지가 <link> 로 함께 쓴다. 페이지 고유 스타일은 각 페이지 <style> 에 두고, 이 파일보다 뒤에 와서 덮는다.
   이 파일의 전역 규칙은 색 변수·머리말·바닥글·건너뛰기 링크만. 긴 글 모양은 body.doc 아래로만 건다 (베타·초대 페이지에 새지 않게).
   중단점: S ~599px(기본, 폰 세로) · M 600px~ · L 960px~. 폰 먼저 쓰고 min-width 로만 늘린다. */

:root {
  --bg: #fff6e9; --card: #ffffff; --ink: #5a2a3a; --muted: #7d5564; --edge: #5a2a3a; --line: #ecd9d0;
  --accent: #c2375e; --on-accent: #ffffff; --note: #fff0c2; --pen: #dff1d2; --grass: #7dbe5c;
  --pig: #f7a8b8; --snout: #ffd3dc; --pig-edge: #5a2a3a;
  --display: "Jua", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --text: "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  /* 좌우 여백: 폰 16px, 넓어지면 24px. 가로로 돌린 노치 폰은 각 쪽의 safe-area 를 따로 본다. */
  --gutter: 16px;
  --pad-l: max(var(--gutter), env(safe-area-inset-left, 0px));
  --pad-r: max(var(--gutter), env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f181a; --card: #2c2326; --ink: #f4e8eb; --muted: #b9a6ac; --edge: #8c737b; --line: #4a323a;
    --accent: #f291ab; --on-accent: #3b0f1d; --note: #453a1c; --pen: #2b3a27; --grass: #5c8f43; --pig-edge: #3b0f1d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1f181a; --card: #2c2326; --ink: #f4e8eb; --muted: #b9a6ac; --edge: #8c737b; --line: #4a323a;
  --accent: #f291ab; --on-accent: #3b0f1d; --note: #453a1c; --pen: #2b3a27; --grass: #5c8f43; --pig-edge: #3b0f1d;
  color-scheme: dark;
}
@media (min-width: 600px) { :root { --gutter: 24px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto !important; } }

/* 건너뛰기 링크: 키보드 초점이 오면 왼쪽 위에 보인다 */
.skip {
  position: absolute; left: var(--pad-l); top: -100px; z-index: 10;
  background: var(--accent); color: var(--on-accent); border: 2px solid var(--edge);
  padding: .5rem .9rem; font-family: var(--text); font-weight: 700; text-decoration: none;
}
.skip:focus { top: .5rem; }

/* 머리말: 붙박이 아님 (긴 글에서 화면을 깎지 않게). S 는 로고 아래 링크 한 줄, M 부터 한 줄에 양쪽 정렬. */
.site-head { border-bottom: 2px solid var(--edge); background: var(--card); font-family: var(--text); }
.site-head-in {
  max-width: 72rem; margin: 0 auto; padding: .5rem var(--pad-r) .25rem var(--pad-l);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 1rem;
}
.site-logo {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px;
  font-family: var(--display); font-size: 1.35rem; line-height: 1; color: var(--ink); text-decoration: none;
}
.site-logo img { width: 28px; height: 28px; image-rendering: pixelated; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0 .25rem; margin-left: -.6rem; width: 100%; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .6rem;
  color: var(--ink); text-decoration: none; font-size: .95rem; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }
@media (min-width: 600px) {
  .site-head-in { padding-block: .25rem; }
  .site-nav { width: auto; margin-left: 0; }
}

/* 바닥글 */
.site-foot { margin-top: 4rem; border-top: 2px solid var(--line); font-family: var(--text); font-size: .9rem; color: var(--muted); }
.site-foot-in {
  max-width: 72rem; margin: 0 auto; padding: 1.5rem var(--pad-r) calc(2rem + env(safe-area-inset-bottom, 0px)) var(--pad-l);
  display: flex; flex-direction: column; gap: .5rem;
}
.site-foot p { margin: 0; }
.site-foot-name { font-family: var(--display); font-size: 1.05rem; color: var(--ink); }
.site-foot nav { display: flex; flex-direction: column; margin-left: -.25rem; }
.site-foot nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .25rem; color: var(--muted); }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }
@media (min-width: 600px) {
  .site-foot nav { flex-direction: row; flex-wrap: wrap; gap: 0 1.25rem; }
}

/* ── 긴 글 페이지 (개인정보 처리방침·지원): <body class="doc"> ── */
body.doc {
  font-family: var(--text); font-size: 16px; line-height: 1.75;
  word-break: keep-all; overflow-wrap: anywhere;
}
.doc main { max-width: 46rem; margin: 0 auto; padding: 2rem var(--pad-r) 0 var(--pad-l); }
.doc h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 6vw, 2.2rem); line-height: 1.3; margin: 0 0 .5rem; text-wrap: balance; }
.doc h2 { font-size: 1.3rem; line-height: 1.4; margin: 2.5rem 0 .75rem; padding-top: 1rem; border-top: 2px solid var(--line); }
.doc h3 { font-size: 1.05rem; line-height: 1.5; margin: 1.75rem 0 .5rem; }
.doc p, .doc ul { margin: .75rem 0; }
.doc ul { padding-left: 1.25rem; }
.doc li { margin: .35rem 0; }
.doc main a { color: var(--accent); } /* 머리말·바닥글 링크 색을 덮지 않게 main 안만 */
.doc code { font-size: .9em; background: var(--line); padding: .1em .35em; border-radius: 3px; }
.doc .muted { color: var(--muted); font-size: .9rem; }

/* ── 개인정보 처리방침 (main.policy) — 계획 §5 ── */
.doc h2[id] { scroll-margin-top: 1rem; }
.policy-date { color: var(--muted); font-size: .95rem; margin-top: 0 !important; }
.summary { background: var(--note); border: 2px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); padding: .1rem 1.1rem; margin: 1.5rem 0; }
.doc .summary h2 { border-top: 0; padding-top: 0; margin: .9rem 0 .25rem; font-size: 1.1rem; }

/* 목차: 폰·태블릿은 접는 상자, 넓은 화면은 옆 단 */
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.doc .toc a { display: flex; align-items: center; min-height: 44px; padding: .35rem 1rem; color: var(--ink); text-decoration: none; line-height: 1.4; font-size: .95rem; }
.doc .toc a:hover { color: var(--accent); }
.doc .toc .toc-erase { font-weight: 700; color: var(--accent); border-top: 2px solid var(--line); }
.toc-s { border: 2px solid var(--edge); background: var(--card); margin: 1.5rem 0 .5rem; }
.toc-s summary {
  display: flex; align-items: center; gap: .5rem; min-height: 48px; padding: .5rem 1rem;
  cursor: pointer; font-weight: 700; list-style: none;
}
.toc-s summary::-webkit-details-marker { display: none; }
.toc-s summary::after { content: "▸"; margin-left: auto; }
.toc-s[open] summary::after { content: "▾"; }
.toc-s ol { border-top: 1px solid var(--line); }
.toc-s li + li a { border-top: 1px dotted var(--line); }
.toc-l { display: none; }

/* 카드 규칙은 :where() 로 우선순위를 낮춰, 아래 min-width 의 표 복원 규칙이 이기게 한다.
   표: 폰에서는 행마다 카드 (첫 칸이 카드 제목, 나머지는 "열 이름 | 값"). 표 마크업과 role 은 그대로라 읽기 프로그램·인쇄에는 표다. */
.tbl { margin: 1rem 0; }
.tbl table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.tbl table, .tbl tbody, .tbl tr, .tbl td { display: block; }
.tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tbl tr { background: var(--card); border: 2px solid var(--edge); padding: .6rem .9rem; }
.tbl tr + tr { margin-top: .75rem; }
.tbl td { padding: .2rem 0; border: 0; }
.tbl td:first-child { font-weight: 700; padding-bottom: .45rem; margin-bottom: .35rem; border-bottom: 1px solid var(--line); }
.tbl:where(:not(.cols-2)) td + td { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); column-gap: .75rem; }
.tbl:where(:not(.cols-2)) td + td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; line-height: 1.95; }
.tbl td, .tbl th { overflow-wrap: break-word; } /* anywhere 는 열 폭 계산을 줄여 'Supab|ase' 처럼 끊긴다 */
.tbl th { background: var(--line); text-align: left; vertical-align: top; padding: .6rem .75rem; }

/* 맨 위로: 한 화면 넘게 내려가면 보인다 (JS). 넓은 화면은 목차가 늘 보여 필요 없다. */
.doc .to-top {
  position: fixed; right: var(--pad-r); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  width: 48px; height: 48px; display: grid; place-items: center;
  background: var(--card); color: var(--ink); border: 2px solid var(--edge); box-shadow: 3px 3px 0 var(--edge);
  text-decoration: none; font-size: 1.3rem; font-weight: 700; visibility: hidden; opacity: 0; transition: opacity .2s, visibility .2s;
}
.doc .to-top.show { visibility: visible; opacity: 1; }

@media (min-width: 600px) {
  /* 6열(국외 이전)만 빼고 표로 되돌린다 */
  .tbl:not(.cols-6) { overflow-x: auto; border: 2px solid var(--edge); background: var(--card); }
  .tbl:not(.cols-6) table { display: table; }
  .tbl:not(.cols-6) thead { display: table-header-group; position: static; width: auto; height: auto; clip-path: none; white-space: normal; }
  .tbl:not(.cols-6) tbody { display: table-row-group; }
  .tbl:not(.cols-6) tr { display: table-row; background: none; border: 0; padding: 0; }
  .tbl:not(.cols-6) td { display: table-cell; vertical-align: top; padding: .6rem .75rem; border-bottom: 1px solid var(--line); font-weight: 400; margin: 0; }
  .tbl:not(.cols-6) tr:last-child td { border-bottom: 0; }
  .tbl:not(.cols-6) td + td::before { content: none; }
}
@media (min-width: 960px) {
  .tbl.cols-6 { overflow-x: auto; border: 2px solid var(--edge); background: var(--card); }
  .tbl.cols-6 table { display: table; font-size: .9rem; }
  .tbl.cols-6 thead { display: table-header-group; position: static; width: auto; height: auto; clip-path: none; white-space: normal; }
  .tbl.cols-6 tbody { display: table-row-group; }
  .tbl.cols-6 tr { display: table-row; background: none; border: 0; padding: 0; }
  .tbl.cols-6 td { display: table-cell; vertical-align: top; padding: .6rem .75rem; border-bottom: 1px solid var(--line); font-weight: 400; margin: 0; }
  .tbl.cols-6 tr:last-child td { border-bottom: 0; }
  .tbl.cols-6 td + td::before { content: none; }

  .doc main.policy {
    max-width: 68rem; display: grid; grid-template-columns: 15rem minmax(0, 44rem);
    column-gap: 3rem; justify-content: center;
  }
  .policy-head, .policy-body { grid-column: 2; }
  .toc-s, .doc .to-top { display: none; }
  .toc-l {
    display: block; grid-column: 1; grid-row: 1 / span 2; align-self: start;
    position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 2rem 0 1rem;
  }
  .toc-title { font-family: var(--display); font-size: 1.15rem; margin: 0 0 .5rem; padding-left: 1rem; }
  .doc .toc-l a { min-height: 0; padding: .4rem 1rem; font-size: .9rem; border-left: 3px solid var(--line); }
  .doc .toc-l a[aria-current] { border-left-color: var(--accent); font-weight: 700; }
  .doc .toc-l .toc-erase { border-top: 0; margin-top: .75rem; border-left-color: transparent; }
}

/* ── 지원 (main.support) — 계획 §6. 폰: 소개 → 묶음 바로가기 → FAQ → 문의 카드. 넓은 화면: 문의 카드가 오른쪽 붙박이. ── */
.doc .btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1.2rem;
  font-family: var(--display); font-size: 1.1rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 2px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); border-radius: 0;
}
.doc .btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--edge); }
.doc .btn.ghost { background: var(--card); color: var(--ink); font-family: var(--text); font-size: .95rem; font-weight: 600; box-shadow: 3px 3px 0 var(--edge); padding: .4rem .9rem; }
.doc .btn[hidden] { display: none; }

.topics { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0 0; }
.doc .topics a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem;
  background: var(--card); color: var(--ink); border: 2px solid var(--edge); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.doc .topics a:hover { background: var(--note); }
.doc .topics .topics-contact { background: none; border-style: dashed; color: var(--muted); }

.faq h2 { scroll-margin-top: 1rem; }
.faq details { border: 2px solid var(--edge); background: var(--card); scroll-margin-top: 1rem; }
.faq details + details { border-top: 0; }
.faq summary {
  display: flex; align-items: center; gap: .75rem; min-height: 52px; padding: .65rem 1rem;
  cursor: pointer; font-weight: 700; line-height: 1.45; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "▸"; margin-left: auto; color: var(--muted); flex: none; }
.faq details[open] summary::after { content: "▾"; }
.faq summary:hover { background: var(--bg); }
.faq details[open] summary { border-bottom: 1px dashed var(--line); }
.faq details > :not(summary) { margin: .75rem 1rem 1rem; }
.faq details > ul { padding-left: 1.25rem; }

.contact { margin-top: 2.5rem; padding: .25rem 1.25rem 1.25rem; background: var(--note); border: 2px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); scroll-margin-top: 1rem; }
.doc .contact h2 { border-top: 0; padding-top: 0; margin: 1rem 0 .5rem; font-family: var(--display); font-weight: 400; font-size: 1.35rem; }
.doc .contact h3 { margin: 1.25rem 0 .25rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.contact .tag { font-size: .75rem; font-weight: 700; background: var(--accent); color: var(--on-accent); padding: .05rem .45rem; }
.contact p { margin: .5rem 0; }
.contact .btn { margin: .5rem 0 .25rem; }
.mail-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.contact-way + .contact-way { border-top: 1px dashed var(--edge); }

@media (min-width: 960px) {
  .doc main.support {
    max-width: 68rem; display: grid; grid-template-columns: minmax(0, 44rem) 20rem;
    column-gap: 3rem; justify-content: center; align-items: start;
  }
  .support-intro, .faq { grid-column: 1; }
  .contact { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 1.5rem; margin-top: 2rem; }
}

@media print {
  .skip, .site-head, .site-foot nav, .toc, .to-top, .topics, .btn { display: none !important; }
  .faq details > :not(summary) { display: block !important; } /* 접힌 답도 인쇄 (지원하는 브라우저) */
  .site-foot { margin-top: 2rem; }
}
