/* koreaolympics 공통 스타일 — 관리 대상 문서는 이 파일 하나만 쓴다 (PRINCIPLES.md 5장) */
:root {
  --text: #202122; --muted: #54595d; --link: #3366cc; --border: #a2a9b1; --line: #c8ccd1;
  --bg: #ffffff; --box: #f8f9fa; --head: #eaecf0; --kor: #dbe8fb; --live: #d33;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.65 "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  word-break: keep-all; overflow-wrap: break-word; -webkit-text-size-adjust: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
header.site { border-bottom: 1px solid var(--line); padding: 8px 16px; font-weight: 700; }
header.site a { color: var(--text); }
main.article { max-width: 1080px; margin: 0 auto; padding: 8px 16px 48px; }

h1 { font: 400 1.9em/1.3 "Noto Serif KR", Georgia, serif; border-bottom: 1px solid var(--border); margin: .3em 0 .5em; padding-bottom: .15em; }
h1 .en { color: var(--muted); font-size: .7em; }
h2 { font: 400 1.45em/1.3 "Noto Serif KR", Georgia, serif; border-bottom: 1px solid var(--border); margin: 1.4em 0 .5em; padding-bottom: .1em; }
h3 { font-size: 1.1em; margin: 1.1em 0 .4em; }
.crumb { font-size: .85em; color: var(--muted); }

/* 인포박스: 왼쪽 정렬 */
.top { display: flex; gap: 20px; align-items: flex-start; }
.infobox { flex: 0 0 280px; order: -1; }
.infobox table { width: 100%; border: 1px solid var(--border); background: var(--box); border-collapse: collapse; font-size: .88em; }
.infobox caption { font-weight: 700; padding: 6px; font-size: 1.1em; }
.infobox th, .infobox td { padding: 4px 8px; vertical-align: top; text-align: left; border-top: 1px solid var(--line); }
.infobox th { width: 40%; }
.lead { flex: 1; min-width: 0; }
.event-list { padding-left: 1.2em; }
.event-list li { margin: .2em 0; }

.toc { display: inline-block; border: 1px solid var(--border); background: var(--box); padding: 6px 16px 6px 8px; margin-top: 12px; font-size: .9em; }
.toc h2 { font: 700 1em sans-serif; border: 0; margin: 0 0 4px; text-align: center; }
.toc ol { margin: 0; padding-left: 1.6em; }

/* 표: 단촐하게, 모바일에서는 가로 스크롤 */
/* 표는 본문 폭에 맞춰 같은 너비로 두고, 넘치면 상자 안에서만 가로로 넘긴다 */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .6em 0 1em; }
table.wikitable { border-collapse: collapse; background: var(--box); border: 1px solid var(--border); margin: .6em 0; font-size: .92em; width: 100%; }
.tw > table.wikitable { margin: 0; }
.wikitable th, .wikitable td { border: 1px solid var(--border); padding: 5px 8px; vertical-align: top; }
.wikitable thead th { white-space: nowrap; }
.wikitable th { background: var(--head); text-align: center; }
.wikitable tbody th { text-align: left; font-weight: 400; }
.wikitable caption { text-align: left; font-weight: 700; padding: 4px 0; }
tr.kor > *, td.kor { background: var(--kor); }
.live { display: inline-block; background: var(--live); color: #fff; font-size: .72em; font-weight: 700;
  padding: 0 5px; border-radius: 3px; vertical-align: middle; letter-spacing: .03em; }
.note { color: var(--muted); font-size: .9em; }
.references { font-size: .9em; }

/* 내비박스 */
.navbox { margin-top: 32px; }
.navbox table { width: 100%; border: 1px solid var(--border); border-collapse: collapse; font-size: .88em; }
.navbox caption { background: #ccf; padding: 4px; font-weight: 700; border: 1px solid var(--border); border-bottom: 0; }
.navbox th { background: #ddf; padding: 4px 8px; text-align: right; white-space: nowrap; width: 1%; border-top: 2px solid #fff; }
.navbox td { padding: 4px 8px; border-top: 2px solid #f6f6f6; }

table.portal td:last-child { text-align: right; }

@media (max-width: 720px) {
  body { font-size: 16px; line-height: 1.7; }
  header.site { padding: 10px 14px; }
  main.article { padding: 4px 14px 40px; }
  h1 { font-size: 1.55em; }
  h2 { font-size: 1.3em; margin-top: 1.6em; }
  h3 { font-size: 1.05em; }
  .top { display: block; }
  .infobox { margin-bottom: 14px; }
  .infobox table { font-size: .9em; }
  .toc { display: block; }
  .event-list { padding-left: 1em; }
  .event-list li { margin: .45em 0; }
  table.wikitable { font-size: .86em; }
  .wikitable th, .wikitable td { padding: 6px 7px; }
  .tw { margin-left: -14px; margin-right: -14px; padding: 0 14px; }
  .navbox th, .navbox td { display: block; width: auto; text-align: left; }
  .navbox td { line-height: 1.9; }
}

/* index: 임박한 대회 · 종목 검색 */
.filters { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.filters button, #upcoming-more { font: inherit; font-size: .85em; padding: 2px 10px; border: 1px solid var(--border);
  background: var(--box); color: var(--link); border-radius: 2px; cursor: pointer; }
.filters button.on { background: var(--head); color: var(--text); font-weight: 700; }
table.upcoming td:nth-child(3) { white-space: normal; min-width: 260px; }
table.upcoming .status { text-align: center; }
#sport-search { font: inherit; width: 100%; max-width: 420px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 2px; }

/* index: 맨 위 종목 박스, 목차 오른쪽 한국 출전권 박스 */
h1 + .navbox { margin-top: 8px; }
.navbox + .navbox { margin-top: 6px; }
.navbox + .lead, .navbox + section { margin-top: 16px; }
.toc-row { display: flex; gap: 20px; align-items: flex-start; margin-top: 12px; }
.toc-row .toc { margin-top: 0; flex: 0 0 auto; }
.quota-box { flex: 1; min-width: 0; border: 1px solid var(--border); background: var(--box); padding: 6px 12px 8px; font-size: .9em; }
.quota-box h2 { font: 700 1.05em/1.4 sans-serif; border-bottom: 1px solid var(--line); margin: 0 0 6px; padding-bottom: 4px; }
.quota-box table.wikitable { margin: 4px 0; background: #fff; }
.quota-box p { margin: 4px 0; }
@media (max-width: 720px) { .toc-row { display: block; } .quota-box { margin-top: 12px; } }

/* 태권도 본문 표: 다른 종목에는 적용하지 않는다. */
.tk-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; margin: .7em 0 1em; }
.tk-table-wrap table.wikitable { display: table; width: 100%; max-width: none; margin: 0; table-layout: auto; }
.tk-table-wrap .wikitable th, .tk-table-wrap .wikitable td { white-space: normal; word-break: keep-all; overflow-wrap: break-word; padding: 7px 10px; vertical-align: top; }
.tk-table-wrap .wikitable tbody th { font-weight: 400; }
.tk-table-wrap.tk-wide .wikitable { min-width: 620px; }
.tk-table-wrap.tk-medium .wikitable { min-width: 450px; }
.tk-table-wrap.tk-compact .wikitable { min-width: 280px; }
.tk-table-wrap.tk-calendar .wikitable { min-width: 0; table-layout: fixed; }
.tk-calendar .wikitable th:first-child, .tk-calendar .wikitable td:first-child { width: 36%; }
.tk-calendar .wikitable td:first-child { white-space: nowrap; }
.tk-table-wrap .wikitable td > a + a { margin-left: .5em; }
@media(max-width: 720px) {
  .tk-table-wrap .wikitable { font-size: .88em; }
  .tk-calendar .wikitable th:first-child, .tk-calendar .wikitable td:first-child { width: 45%; }
  .tk-table-wrap .wikitable th, .tk-table-wrap .wikitable td { padding: 7px 8px; }
}

/* 좁은 표 (양궁 허브 등): 본문 폭을 채우지 않고 내용 폭에 맞춰 제한 */
table.wikitable.narrow { width: auto; max-width: 640px; }
.tw:has(> table.narrow) { width: fit-content; max-width: 100%; }
table.upcoming td.content { font-size: .8em; line-height: 1.35; max-width: 340px; }
table.upcoming td:nth-child(3) { white-space: nowrap; }
h4 { font-size: 1em; margin: 1em 0 .3em; }

/* 국가명 (표의 확보 NOC · 메달 칸): 국기 없이 볼드·색으로 구분 */
td.nat, .wikitable td .nat { font-weight: 700; color: #0f6b5c; }
/* 하계 허브 첫머리 '한눈에 보기' 그림 (tools/summary_svg.py) */
.summary-figure { margin: 16px 0; overflow-x: auto; }
.summary-figure img { display: block; width: 100%; max-width: 640px; height: auto; }
@media (max-width: 600px) { .summary-figure img { width: 560px; max-width: none; } }  /* 글자가 읽히는 크기로 두고 옆으로 넘긴다 */
/* LA28 출전 확정 표 (tools/qualified.py) · 국기: flag-icons (MIT), assets/flags */
.qualified { margin: 16px 0 20px; }
.qualified h2 { font-size: 1.25em; }
.qualified .asof { font-size: .7em; color: #54595d; font-weight: normal; }
.qualified .note, .qualified .src { font-size: .9em; color: #54595d; }
.qualified .noc { font-size: .8em; color: #72777d; }
img.flag, .flag.none { display: inline-block; width: 20px; height: 15px; margin-right: 6px; vertical-align: -2px; border: 1px solid #c8ccd1; }
.flag.none { background: #eaecf0; }
.qualified .nat { white-space: nowrap; }
@media (max-width: 600px) { .qualified .noc { display: none; } }
/* 구기 LA28 예선 단계 (tools/pathways.py) */
.pathways { margin: 16px 0 20px; }
.pathways h2 { font-size: 1.25em; }
.pathways .asof { font-size: .7em; color: #54595d; font-weight: normal; }
.pathways .note, .pathways .src { font-size: .9em; color: #54595d; }
.pathways .small { font-size: .85em; color: #54595d; }
.pathways tr.st-live td { background: #fdf0f0; }
.pathways tr.st-soon td { color: #54595d; }
.pathways .nowrap { white-space: nowrap; }
/* 종목 문서 안내 (tools/sport_guide.py) */
.guide { margin: 16px 0 20px; }
.guide h2 { font-size: 1.25em; }
.guide .small { font-size: .85em; color: #54595d; }
.guide-matrix td.c, .guide-matrix th:not([scope]) { text-align: center; white-space: nowrap; }
.guide-matrix tr.grp th { text-align: left; background: #eaecf0; }
.guide-matrix th[scope="row"] { text-align: left; white-space: nowrap; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.guide-card { border: 1px solid #c8ccd1; background: #f8f9fa; padding: 8px 12px; }
.guide-card h3 { margin: 0 0 6px; font-size: 1em; }
.guide-card ul { margin: 0; padding-left: 18px; }
.guide-box { border-collapse: collapse; margin: 12px 0; width: 100%; max-width: 760px; font-size: .95em; }
.guide-box caption { text-align: left; font-weight: bold; padding-bottom: 4px; }
.guide-box th, .guide-box td { border: 1px solid #c8ccd1; padding: 5px 8px; vertical-align: top; }
.guide-box th { background: #eaecf0; white-space: nowrap; text-align: left; width: 7em; }

/* 2026 주요 대회 결과 (tools/summer_live.py) */
.results { margin: 1.2em 0; }
.results h2 .asof { font-size: .6em; color: var(--muted, #72777d); font-weight: 400; }
details.result-card { border: 1px solid var(--border); border-radius: 6px; background: var(--box); margin: .5em 0; padding: 0 10px; }
details.result-card > summary { cursor: pointer; padding: 8px 0; line-height: 1.5; }
details.result-card[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 6px; }
details.result-card b.ongoing { color: #d33; }
table.medal-rows td { min-width: 9em; }
table.medal-rows tr.grp th { background: var(--head); font-weight: 700; text-align: left; }
table.medal-rows tr.has-kor > * { background: #fdf0f0; }
.kor { font-weight: 700; color: #b3122e; }
.kor .guess { text-decoration: underline dotted; text-underline-offset: 3px; }
.korea-news { border: 2px solid #b3122e; border-radius: 8px; padding: 4px 14px 8px; margin: 12px 0 18px; background: #fffafa; }
.korea-news h2 { margin-top: 8px; } .korea-news h3 { font-size: 1.02em; margin: 10px 0 4px; }
.korea-news ul { margin: 0 0 6px; padding-left: 1.3em; }
/* 사설 랭킹 한국 현황 (tools/private_rankings.py) */
.private-rank { margin: 1.2em 0; }
.private-rank h2 .asof { font-size: .6em; color: #72777d; font-weight: 400; }
.private-rank tr.in > * { background: #eef6ee; }
.private-rank b.in8 { color: #14866d; }

/* 머리말 검색·탐색 (tools/explore.py, 원칙 8-5장) */
header.site { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
header.site nav { display: flex; gap: 12px; font-weight: 400; font-size: .9em; }
header.site nav a { color: var(--link); }
.site-search { display: flex; margin-left: auto; }
.site-search input { font: inherit; font-size: .9em; width: 180px; padding: 3px 8px; border: 1px solid var(--border); border-right: 0; border-radius: 2px 0 0 2px; }
.site-search button { font: inherit; font-size: .85em; padding: 3px 10px; border: 1px solid var(--border); background: var(--box); border-radius: 0 2px 2px 0; cursor: pointer; }
@media (max-width: 720px) { .site-search { order: 3; width: 100%; margin: 0; } .site-search input { flex: 1; width: auto; } header.site nav { margin-left: auto; } }
.edit { font: 400 13px sans-serif; white-space: nowrap; }
#xq { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 2px; }
details.xp { border-bottom: 1px solid var(--line); padding: 5px 0; }
details.xp summary { cursor: pointer; }
details.xp p { margin: 6px 0 6px 18px; }
ul.xr { list-style: none; padding: 0; }
ul.xr li { margin: 0 0 10px; }
ul.xr li > a { font-size: 1.1em; }
.small { font-size: .85em; color: var(--muted); }
.korq { color: #0f6b5c; }
td.stale { color: var(--live); font-weight: 700; }
.nowrap { white-space: nowrap; }
