/* 오늘근육 홈페이지·글 공용 스타일 ("연구 노트" 방향, DESIGN.md). scripts/build_site.py가 만드는 쪽에서 쓴다.
   faq.html·privacy.html도 같은 파일을 쓴다. 색·간격·글자 크기는 아래 토큰으로만. */
:root {
  color-scheme: light dark;
  --paper: #faf8f5; --card: #ffffff; --soft: #f1efea; --line: #e3e1dc; --line-strong: #c9c6bf;
  --ink: #1a1d2b; --muted: #5a5f70; --accent: #bc3f2c; --on-accent: #ffffff; --accent-soft: #fbece8;
  --panel: #161d33; --panel-ink: #eef0f6; --panel-muted: #b4b9cc; --panel-line: #2c3552; --panel-accent: #ff8570;
  --bar: #3f5a73; --bar-light: #c5d0da;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --r-sm: 6px; --r-md: 12px; --r-lg: 16px;
  --fs-sm: .875rem; --fs-body: 1.0625rem; --fs-lg: 1.3125rem; --fs-xl: 1.625rem; --fs-2xl: 2.0625rem; --fs-3xl: 2.75rem;
  --ease: cubic-bezier(.22, 1, .36, 1); --dur: 160ms;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12141c; --card: #1b1f2c; --soft: #1b1f2c; --line: #2a2e3d; --line-strong: #444a5e;
    --ink: #eef0f6; --muted: #a3a8ba; --accent: #ff8570; --on-accent: #12141c; --accent-soft: #2a2025;
    --panel: #1b2240; --panel-line: #333c5e;
    --bar: #9db7d1; --bar-light: #3a4658;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: var(--fs-body)/1.8 var(--font); word-break: keep-all; overflow-wrap: break-word; text-rendering: optimizeLegibility; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: .18em; }
@media (hover: hover) and (pointer: fine) { a:hover { color: var(--accent); } }
h1, h2, h3 { text-wrap: balance; letter-spacing: -.02em; font-weight: 800; color: var(--ink); }
p, li { text-wrap: pretty; }
.meta { color: var(--muted); font-size: var(--fs-sm); }
.wrap-page { max-width: 1080px; margin: 0 auto; padding: 0 var(--s4); }

/* 읽은 정도 막대(스크롤 타임라인을 지원하는 브라우저만) */
@supports (animation-timeline: scroll()) {
  body.article-page::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 30; animation: read-progress linear both; animation-timeline: scroll(root); }
  @keyframes read-progress { to { transform: scaleX(1); } }
}

/* 머리글·바닥글 */
header.site { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
header.site .bar { max-width: 1080px; margin: 0 auto; padding: 0 var(--s4); min-height: 60px; display: flex; align-items: center; gap: var(--s5); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 800; font-size: 1.125rem; letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
nav.nav { display: flex; gap: var(--s1); margin-left: var(--s2); }
nav.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); font-size: .95rem; font-weight: 600; text-decoration: none; color: var(--muted); border-radius: var(--r-sm); }
nav.nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
@media (hover: hover) and (pointer: fine) { nav.nav a:hover { color: var(--ink); } }
header.site .lang { margin-left: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--line-strong); border-radius: 999px; min-height: 36px; font-size: .875rem; font-weight: 600; text-decoration: none; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { header.site .lang:hover { border-color: var(--accent); color: var(--accent); } }
/* 내용이 짧아도 바닥글을 화면 맨 아래에 붙인다(2026-10-30 사용자 지시): 바닥글 바로 앞 요소가 남는 높이를 채운다 */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > :has(+ footer.site) { flex: 1 0 auto; width: 100%; }
footer.site { margin-top: var(--s9); border-top: 1px solid var(--line); background: var(--soft); }
footer.site .inner { max-width: 1080px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s7); display: grid; gap: var(--s3); font-size: .9rem; color: var(--muted); }
footer.site nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
footer.site a { color: var(--ink); display: inline-flex; align-items: center; min-height: 32px; }
footer.site .foot-note { max-width: 62ch; margin: 0; font-size: var(--fs-sm); line-height: 1.7; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s5); border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .btn:hover { color: var(--on-accent); background: color-mix(in srgb, var(--accent) 88%, #000); } }
.btn svg { width: 18px; height: 18px; }
.soon-note { color: var(--muted); font-size: .92rem; margin: 0; }
.post-banner { margin: var(--s6) 0 0; padding: var(--s5); border-radius: 20px; background: var(--panel); color: var(--panel-ink); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); }
.post-banner p { margin: 0; font-weight: 700; flex: 1 1 16rem; }

/* 주제 표시·칩 */
.topic { display: inline-block; font-size: .8125rem; font-weight: 700; color: var(--accent); letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s5) 0 var(--s6); padding: 0; list-style: none; }
.chips button, .chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .chips button:hover, .chips a:hover { border-color: var(--ink); } }
.chips button:active { transform: scale(.97); }

/* 글 카드 */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s6) var(--s5); }
.card { margin: 0; }
.card a.card-link { display: grid; gap: var(--s3); align-content: start; text-decoration: none; color: var(--ink); height: 100%; }
.card-text { display: grid; gap: var(--s2); align-content: start; }
.card .thumb { aspect-ratio: 1200/630; border-radius: var(--r-md); overflow: hidden; background: var(--soft); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 400ms var(--ease); }
@media (hover: hover) and (pointer: fine) { .card a.card-link:hover .thumb img { transform: scale(1.03); } .card a.card-link:hover h3 { color: var(--accent); } }
.card h3 { margin: 0; font-size: 1.1875rem; line-height: 1.4; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .facts { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.card[hidden] { display: none; }
.card.featured { grid-column: 1 / -1; }
.card.featured a.card-link { grid-template-columns: 1.25fr 1fr; gap: var(--s6); align-items: center; }
.card.featured h3 { font-size: var(--fs-xl); line-height: 1.3; }
.card.featured p { font-size: 1.0625rem; -webkit-line-clamp: 3; }
@media (max-width: 760px) { .card.featured a.card-link { grid-template-columns: 1fr; gap: var(--s3); } .card.featured h3 { font-size: 1.375rem; } }
.cards-index { margin-top: var(--s6); }
.home-hero .cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); margin-top: var(--s5); }

/* 첫 화면 */
.home-hero { padding: var(--s8) 0 var(--s6); max-width: 760px; }
.home-hero h1 { font-size: clamp(2.125rem, 6.2vw, var(--fs-3xl)); line-height: 1.2; letter-spacing: -.03em; margin: 0 0 var(--s4); }
.home-hero.has-shot { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--s7); align-items: center; }
.home-hero .hero-copy { max-width: 760px; }
.hero-shot { margin: 0; justify-self: end; }
.hero-shot img { display: block; width: 240px; height: auto; border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(18, 20, 28, .18); }
@media (max-width: 860px) { .home-hero.has-shot { grid-template-columns: 1fr; } .hero-shot { display: none; } }
.home-hero .lead { font-size: 1.1875rem; line-height: 1.7; color: var(--muted); margin: 0; max-width: 34em; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin: var(--s8) 0 var(--s5); }
.section-head h2 { margin: 0; font-size: var(--fs-xl); }
.section-head a { font-weight: 600; white-space: nowrap; }
.home-feature { margin-top: var(--s2); }
.how { margin: var(--s7) 0 0; padding: var(--s5) var(--s5); border: 1px solid var(--line); border-radius: var(--r-lg); display: grid; gap: var(--s2); background: var(--card); }
.how h2 { margin: 0; font-size: 1.125rem; }
.how p { margin: 0; color: var(--muted); font-size: .98rem; line-height: 1.7; max-width: 60ch; }

/* 앱 소개 띠(앱 화면과 같은 남색·산호 색) */
.app-band { margin: var(--s9) 0 0; padding: var(--s8) 0; background: var(--panel); color: var(--panel-ink); }
.app-band .inner { max-width: 1080px; margin: 0 auto; padding: 0 var(--s4); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--s7); align-items: center; }
.app-band h2 { color: var(--panel-ink); font-size: var(--fs-2xl); line-height: 1.25; margin: 0 0 var(--s3); }
.app-band .lead { color: var(--panel-muted); font-size: 1.0625rem; line-height: 1.7; margin: 0 0 var(--s5); }
.app-band .count { color: var(--panel-ink); font-weight: 700; font-variant-numeric: tabular-nums; margin: 0 0 var(--s5); }
.app-band ul.features { list-style: none; padding: 0; margin: 0 0 var(--s5); display: grid; gap: var(--s4); }
.app-band ul.features li { padding-top: var(--s4); border-top: 1px solid var(--panel-line); }
.app-band ul.features h3 { margin: 0 0 var(--s1); font-size: 1.0625rem; color: var(--panel-ink); letter-spacing: -.01em; }
.app-band ul.features p { margin: 0; color: var(--panel-muted); font-size: .95rem; line-height: 1.65; }
.app-band .soon-note { color: var(--panel-accent); font-weight: 700; }
.app-band .strip { display: flex; gap: var(--s3); overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 0 var(--s3); scrollbar-color: var(--panel-line) transparent; margin: 0; list-style: none; }
.app-band figure { flex: 0 0 min(62%, 240px); margin: 0; scroll-snap-align: start; }
.app-band figure img { width: 100%; height: auto; border-radius: var(--r-md); display: block; background: var(--panel-line); }
.app-band figcaption { color: var(--panel-muted); font-size: var(--fs-sm); margin-top: var(--s2); }
.app-band.no-shots .inner { grid-template-columns: minmax(0, 720px); }
@media (max-width: 860px) { .app-band .inner { grid-template-columns: 1fr; gap: var(--s6); } .app-band { padding: var(--s7) 0; } }

/* 글 목록 쪽 머리말 */
.page-head { padding: var(--s7) 0 0; max-width: 720px; }
.page-head h1 { font-size: clamp(1.875rem, 5.4vw, var(--fs-2xl)); line-height: 1.25; margin: 0 0 var(--s3); }
.page-head p { margin: 0; color: var(--muted); }

/* 글 본문 */
.post-layout { max-width: 1080px; margin: 0 auto; padding: var(--s7) var(--s4) 0; display: grid; grid-template-columns: minmax(0, 700px) 240px; gap: var(--s6); justify-content: space-between; }
.post-main { min-width: 0; grid-column: 1; grid-row: 1; }
.post-main .crumb { display: flex; gap: var(--s2); align-items: center; font-size: var(--fs-sm); color: var(--muted); margin: 0 0 var(--s4); }
.post-main .crumb a { color: var(--muted); }
.post-main h1 { font-size: clamp(1.9rem, 5.6vw, var(--fs-2xl)); line-height: 1.28; margin: 0 0 var(--s4); letter-spacing: -.03em; }
.evidence-bar { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0 0 var(--s5); padding: var(--s3) 0; border-block: 1px solid var(--line); font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.evidence-bar a { color: var(--ink); font-weight: 700; text-decoration-thickness: 1px; }
.evidence-bar b { color: var(--ink); }
img.hero { width: 100%; height: auto; aspect-ratio: 1200/630; object-fit: cover; border-radius: var(--r-md); margin: 0 0 var(--s6); background: var(--soft); display: block; }
@media (prefers-color-scheme: dark) { img.hero, .card .thumb img { filter: brightness(.9); } }
.prose h2 { font-size: var(--fs-xl); line-height: 1.35; margin: var(--s8) 0 var(--s3); scroll-margin-top: 76px; }
.prose h3 { font-size: 1.125rem; line-height: 1.4; margin: var(--s6) 0 var(--s2); }
.prose p { margin: 0 0 var(--s4); }
.prose ul, .prose ol { margin: 0 0 var(--s4); padding-left: 1.3em; }
.prose li { margin: var(--s2) 0; }
.prose li::marker { color: var(--muted); }
.answer { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); border-radius: var(--r-md); padding: var(--s4) var(--s5) var(--s1); margin: 0 0 var(--s6); font-size: 1.125rem; line-height: 1.75; }
.answer p { margin: 0 0 var(--s3); }
.answer b { color: var(--accent); }
.disclaimer { color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }
sup.cite { font-size: .72em; line-height: 0; }
sup.cite a { display: inline-block; padding: 2px 1px; text-decoration: none; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { sup.cite a:hover { text-decoration: underline; } }
.prose .wrap { overflow-x: auto; margin: 0 0 var(--s4); }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: var(--s2) var(--s3); text-align: left; vertical-align: top; }
.prose th { background: var(--soft); font-weight: 700; }
figure.chart { margin: var(--s5) 0; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
figure.chart svg { width: 100%; height: auto; display: block; }
figure.chart text { fill: var(--ink); font: 13px var(--font); }
figure.chart .axis line { stroke: var(--muted); stroke-width: 1; }
figure.chart .axis line.grid { stroke: var(--line); stroke-dasharray: 3 3; }
figure.chart .axis text { fill: var(--muted); font-size: 12px; }
figure.chart .bars rect { fill: var(--bar); }
figure.chart .bars rect.range { fill: var(--bar-light); }
figcaption { color: var(--muted); font-size: .875rem; line-height: 1.6; margin-top: var(--s2); }
.app-box { display: grid; grid-template-columns: 44px 1fr; column-gap: var(--s4); margin: var(--s7) 0 var(--s5); padding: var(--s5); background: var(--soft); border-radius: var(--r-lg); }
.app-box::before { content: ""; grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 10px; background: url(/assets/logo-64.png) center / cover; }
.app-box p { margin: 0 0 var(--s2); font-size: .98rem; line-height: 1.7; }
.app-box .soon { color: var(--accent); font-weight: 700; font-size: .92rem; margin: 0; }
h2.refs-title { font-size: var(--fs-lg); margin-top: var(--s8); padding-top: var(--s5); border-top: 1px solid var(--line); }
ol.refs { font-size: .9rem; line-height: 1.65; color: var(--muted); padding-left: 2em; margin: 0; }
ol.refs li { margin: var(--s3) 0; padding-left: var(--s1); }
ol.refs li::marker { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
ol.refs li:target { background: var(--accent-soft); border-radius: var(--r-sm); outline: 6px solid var(--accent-soft); }
ol.refs a { font-weight: 600; white-space: nowrap; }

/* 목차 */
.toc { grid-column: 2; grid-row: 1; position: sticky; top: 84px; align-self: start; font-size: .9rem; max-height: calc(100dvh - 108px); overflow-y: auto; }
.toc summary { list-style: none; cursor: pointer; font-weight: 800; color: var(--ink); min-height: 44px; display: flex; align-items: center; justify-content: space-between; }
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: ""; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--dur) var(--ease); margin-right: var(--s1); }
.toc[open] summary::after { transform: rotate(-135deg); }
.toc ol { list-style: none; margin: 0; padding: 0 0 0 var(--s3); border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0 6px var(--s3); margin-left: -13px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.45; }
.toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .toc a:hover { color: var(--ink); } }
@media (max-width: 1019px) {
  .post-layout { grid-template-columns: minmax(0, 700px); }
  .post-main, .toc { grid-column: auto; grid-row: auto; }
  .toc { position: static; max-height: none; order: -1; margin: 0 0 var(--s5); padding: 0 var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); }
  .toc ol { margin-bottom: var(--s3); }
}

/* 다음에 읽을 글·출처 팝업 */
.read-next { max-width: 1080px; margin: var(--s9) auto 0; padding: 0 var(--s4); }
.read-next h2 { font-size: var(--fs-xl); margin: 0 0 var(--s5); }
.cite-pop { position: fixed; z-index: 40; left: var(--s4); right: var(--s4); bottom: var(--s4); max-width: 520px; margin-inline: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s4) var(--s5) var(--s4); box-shadow: 0 8px 32px rgb(0 0 0 / .18); font-size: .92rem; line-height: 1.65; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.cite-pop[data-open] { opacity: 1; transform: none; pointer-events: auto; }
.cite-pop .n { color: var(--accent); font-weight: 800; }
.cite-pop p { margin: 0 0 var(--s3); }
.cite-pop a { font-weight: 700; }
.cite-pop button { position: absolute; top: var(--s1); right: var(--s1); width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; border-radius: 999px; }
@media (min-width: 760px) { .cite-pop { left: auto; right: var(--s5); margin: 0; } }

/* 설명 페이지(자주 묻는 질문·개인정보) */
main.plain { max-width: 760px; margin: 0 auto; padding: var(--s7) var(--s4) 0; }
main.plain h1 { font-size: var(--fs-2xl); margin: 0 0 var(--s2); }
main.plain h2 { font-size: 1.1875rem; margin: var(--s7) 0 var(--s2); padding-top: var(--s4); border-top: 1px solid var(--line); }
main.plain details { margin: var(--s2) 0; }
main.plain summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
main.plain table { width: 100%; border-collapse: collapse; margin: var(--s2) 0; font-size: .92rem; }
main.plain th, main.plain td { border: 1px solid var(--line); padding: var(--s2); text-align: left; vertical-align: top; }
main.plain th { background: var(--soft); }
main.plain .wrap { overflow-x: auto; }
main.plain .note { color: var(--muted); font-size: .9rem; }
main.plain .box { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s3) var(--s4); margin: var(--s3) 0; background: var(--soft); }
main.plain .toc-line a { display: inline-flex; align-items: center; min-height: 36px; margin: 0 var(--s3) 0 0; font-size: .92rem; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .card .thumb img, .cite-pop, .btn, .toc summary::after { transition-duration: 1ms; }
  body.article-page::before { animation: none; transform: none; opacity: 0; }
}
@media (max-width: 560px) {
  :root { --fs-body: 1.0625rem; }
  .home-hero { padding-top: var(--s7); }
  nav.nav a { padding: 0 var(--s2); }
  header.site .bar { gap: var(--s2); }
}
body.home footer.site { margin-top: 0; }
@media (max-width: 760px) { body.home .cards .card:nth-child(n+5) { display: none; } }
