/* shooking v2 공유 스타일. 모바일 우선, 순수 CSS. 토큰은 DESIGN.md 참고 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #ffffff;
  --surface: #f3f6fb;
  --ink: #191f28;
  --ink-2: #4a5565;
  --ink-3: #66707f;
  --line: #e3e8ef;
  --blue: #1f5eff;
  --blue-deep: #1448cc;
  --blue-soft: #e8f0ff;
  --accent: #ffc400;
  --accent-ink: #3a2d00;

  --r-chip: 999px;
  --r-card: 20px;
  --r-inner: 14px;
  --r-btn: 12px;
  --shadow: 0 10px 28px rgba(20, 50, 120, 0.09);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* 헤더 */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -0.04em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 800; }
.site-nav { display: flex; gap: 4px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.site-nav a { padding: 8px 10px; border-radius: 10px; text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }

/* 버튼, 링크 */
.btn-src {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--r-btn); background: var(--blue-soft); color: var(--blue-deep);
  font-size: 14px; font-weight: 700; text-decoration: none;
}
.btn-src:hover { background: #d6e5ff; }
.src { font-size: 13px; font-weight: 600; color: var(--blue-deep); text-underline-offset: 3px; }
.api-source { display: block; font-size: 12px; line-height: 1.45; font-weight: 500; color: var(--ink-3); letter-spacing: normal; }

.gloss { font-size: 12.5px; line-height: 1.45; font-weight: 500; color: var(--ink-3); }

/* 태그, 배지, 칩 */
.tag { display: inline-block; padding: 2px 10px; border-radius: var(--r-chip); font-size: 12.5px; font-weight: 700; background: var(--blue-soft); color: var(--blue-deep); }
.tag-line { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); }
.tag-accent { background: var(--accent); color: var(--accent-ink); }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border-radius: var(--r-chip); background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; font-size: 14px; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--r-chip); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; }
.chip:hover { background: var(--blue-soft); color: var(--blue-deep); }

/* 섹션 */
.section { padding: 48px 0 8px; }
.section-head { margin-bottom: 20px; }
.section-head h2 { font-size: 24px; line-height: 1.3; font-weight: 800; letter-spacing: -0.035em; }
.section-head p { margin-top: 6px; color: var(--ink-2); font-size: 15px; }

/* 카드 */
.cards { display: grid; gap: 12px; }
.card { background: var(--surface); border-radius: var(--r-card); padding: 20px; }
.card-raised { background: var(--bg); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card .amount { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }

/* 푸터 */
.site-footer { margin-top: 64px; padding: 28px 0 48px; background: var(--surface); font-size: 13px; color: var(--ink-3); }
.site-footer p + p { margin-top: 6px; }
.sample-note { display: inline-block; padding: 4px 12px; border-radius: var(--r-chip); background: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* ---------- home ---------- */
.hero { padding: 40px 0 8px; display: grid; gap: 32px; }
.hero h1 { font-size: clamp(38px, 11vw, 68px); line-height: 1.12; font-weight: 800; letter-spacing: -0.05em; }
.hero .lead { margin-top: 16px; font-size: 17px; color: var(--ink-2); max-width: 30em; }

.search { display: flex; margin-top: 28px; padding: 6px; background: var(--bg); border: 2px solid var(--blue); border-radius: 18px; box-shadow: var(--shadow); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 14px; height: 52px; font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); font-weight: 500; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 3px solid rgba(31, 94, 255, 0.28); outline-offset: 2px; }
.search button { flex: none; height: 52px; padding: 0 22px; border: 0; border-radius: 13px; background: var(--blue); color: #fff; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.search button:hover { background: var(--blue-deep); }
.hero .chips { margin-top: 16px; }

.peek { display: block; text-decoration: none; padding: 22px; border-radius: var(--r-card); background: var(--blue); color: #fff; box-shadow: var(--shadow); }
.peek .gloss { color: rgba(255, 255, 255, 0.78); }
.peek h2 { margin-top: 4px; font-size: 18px; font-weight: 700; }
.peek .big { margin-top: 14px; font-size: 52px; line-height: 1; font-weight: 800; letter-spacing: -0.05em; }
.peek .line { margin-top: 10px; font-size: 15px; font-weight: 500; }

.feed .card { display: grid; gap: 10px; }
.feed .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-3); font-weight: 500; }
.feed h3 { font-size: 18px; line-height: 1.4; font-weight: 700; letter-spacing: -0.03em; }
.feed h3 a { text-decoration: none; }
.feed h3 a:hover { color: var(--blue-deep); }
.feed .org { font-size: 14px; color: var(--ink-2); }
.feed .foot-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 4px; }
.feed .foot-row .label { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.feed .delta-inline { font-size: 15px; font-weight: 800; color: var(--ink); }

.flow { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -20px; padding: 4px 20px 16px; scrollbar-width: none; }
.flow::-webkit-scrollbar { display: none; }
.flow li { flex: 0 0 72%; scroll-snap-align: start; padding: 20px; border-radius: var(--r-card); background: var(--surface); }
.flow .n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800; font-size: 15px; }
.flow strong { display: block; margin-top: 14px; font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.flow p { margin-top: 4px; font-size: 14px; color: var(--ink-2); }

/* ---------- project ---------- */
.page-title { padding: 32px 0 20px; }
.page-title .crumb { font-size: 14px; color: var(--ink-3); font-weight: 600; text-decoration: none; }
.page-title h1 { margin-top: 8px; font-size: clamp(28px, 7.5vw, 44px); line-height: 1.2; font-weight: 800; letter-spacing: -0.045em; }
.page-title .org { margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.page-title .tags { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }

.summary { padding: 24px 22px; border-radius: 24px; background: var(--blue); color: #fff; box-shadow: var(--shadow); }
.summary .gloss { color: rgba(255, 255, 255, 0.78); }
.summary .src { color: #fff; }
.summary .row .k { font-size: 14px; font-weight: 600; }
.summary .row .v { margin-top: 2px; font-size: 26px; line-height: 1.25; font-weight: 800; letter-spacing: -0.035em; }
.summary .row .src { display: inline-block; margin-top: 4px; }
.summary .join { margin: 16px 0 16px 6px; padding-left: 16px; border-left: 3px solid rgba(255, 255, 255, 0.45); display: grid; gap: 2px; min-height: 40px; align-content: center; }
.summary .join span { font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.9); }
.summary .result { margin-top: 20px; padding: 20px; border-radius: var(--r-inner); background: #fff; color: var(--ink); }
.summary .result .pct { font-size: clamp(56px, 18vw, 84px); line-height: 1; font-weight: 800; letter-spacing: -0.06em; color: var(--blue-deep); }
.summary .result .diff { margin-top: 8px; font-size: 18px; font-weight: 700; }
.summary .result .easy { margin-top: 6px; font-size: 16px; color: var(--ink-2); font-weight: 500; }
.summary .result .src { color: var(--blue-deep); display: inline-block; margin-top: 8px; }

.steps { position: relative; }
.step { position: relative; padding: 0 0 20px 54px; }
.step::before { /* 연결선: 완료 구간은 파랑으로 채워짐 */
  content: ""; position: absolute; left: 16px; top: 38px; bottom: -2px; width: 4px; border-radius: 2px;
  background: var(--blue); transform-origin: top; animation: fill 0.55s ease-out both; animation-delay: calc(var(--i) * 0.28s);
}
.step:last-child::before { display: none; }
.step.is-todo::before { background: var(--line); }
.node { position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 15px; font-weight: 800; }
.step.is-change .node { background: var(--accent); color: var(--accent-ink); font-size: 12px; letter-spacing: -0.03em; }
.step.is-todo .node { background: var(--line); color: var(--ink-3); }
@keyframes fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.step-card { padding: 18px; border-radius: var(--r-card); background: var(--surface); }
.step.is-change .step-card { background: #fff8de; }
.step-card h3 { font-size: 19px; line-height: 1.3; font-weight: 800; letter-spacing: -0.035em; }
.step-card .date { margin-top: 2px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.step-card dl { margin-top: 14px; display: grid; gap: 12px; }
.step-card dt { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.step-card dd { font-size: 15px; font-weight: 600; }
.step-card dd.amt { font-size: 24px; line-height: 1.25; font-weight: 800; letter-spacing: -0.035em; }
.step-card .delta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.step-card .delta strong { font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -0.04em; color: var(--blue-deep); }
.step-card .delta span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.step-card .delta .api-source { flex-basis: 100%; }
.step-card .go { margin-top: 16px; }
.change-from { font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* ---------- company ---------- */
.co-head { padding: 32px 0 20px; display: grid; gap: 14px; }
.co-head h1 { font-size: clamp(30px, 8vw, 46px); line-height: 1.2; font-weight: 800; letter-spacing: -0.045em; }
.co-head .reg { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.co-head .reg b { color: var(--ink); font-weight: 700; }
.co-head .status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

.stats { display: grid; gap: 12px; }
.stat { padding: 20px; border-radius: var(--r-card); background: var(--surface); }
.stat .k { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.stat .v { margin-top: 4px; font-size: 30px; line-height: 1.2; font-weight: 800; letter-spacing: -0.045em; }
.stat .v small { font-size: 18px; font-weight: 700; margin-left: 2px; }
.stat .sub { margin-top: 2px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.stat .src { display: inline-block; margin-top: 8px; }
.stat-main { background: var(--blue); color: #fff; }
.stat-main .k, .stat-main .sub { color: rgba(255, 255, 255, 0.85); }
.stat-main .src { color: #fff; }

.bars { display: grid; gap: 18px; }
.bar-row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bar-row .name { font-size: 15px; font-weight: 700; }
.bar-row .pct { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; flex: none; }
.bar-track { margin-top: 8px; height: 14px; border-radius: var(--r-chip); background: var(--blue-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-chip); background: var(--blue); }
.bar-row .amt { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }

.clist { display: grid; gap: 12px; }
.clist-head { display: none; }
.crow { display: grid; gap: 10px; padding: 18px; border-radius: var(--r-card); background: var(--surface); }
.crow h3 { font-size: 17px; line-height: 1.4; font-weight: 700; letter-spacing: -0.03em; }
.crow .org { font-size: 14px; color: var(--ink-2); }
.crow .pair { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.crow .pair .label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.crow .amount { font-size: 21px; font-weight: 800; letter-spacing: -0.035em; }
.crow .rate { font-size: 17px; font-weight: 800; }
.crow .date { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.crow .m-label { display: inline; }

/* ---------- institution (company 컴포넌트 재사용, 사업명 링크만 추가) ---------- */
.crow h3 a { text-decoration: none; }
.crow h3 a:hover { color: var(--blue-deep); }

/* ---------- 태블릿 이상 ---------- */
@media (min-width: 720px) {
  .wrap { padding: 0 32px; }
  .section { padding-top: 72px; }
  .section-head h2 { font-size: 30px; }
  .hero { grid-template-columns: 1.25fr 0.75fr; align-items: center; gap: 56px; padding-top: 72px; }
  .cards.feed { grid-template-columns: repeat(2, 1fr); }
  .flow { margin: 0; padding: 0; overflow: visible; display: grid; grid-template-columns: repeat(5, 1fr); }
  .flow li { flex: none; }
  .summary { padding: 32px; }
  .summary .grid2 { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 24px; align-items: stretch; }
  .summary .join { display: none; }
  .summary .result { margin-top: 0; }
  .summary .row .v { font-size: 30px; }
  .step { padding-left: 68px; }
  .step::before { left: 22px; }
  .node { width: 48px; height: 48px; font-size: 18px; }
  .step::before { top: 52px; }
  .step.is-change .node { font-size: 13px; }
  .step-card { padding: 24px; }
  .step-card dl { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .clist-head, .crow { grid-template-columns: 2.4fr 1.4fr 1fr 1.5fr 0.8fr 0.9fr; align-items: center; gap: 16px; }
  .clist { gap: 0; }
  .clist-head { display: grid; padding: 0 18px 10px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
  .crow { border-radius: 0; background: transparent; border-top: 1px solid var(--line); padding: 16px 18px; }
  .crow .pair { display: contents; }
  .crow .pair .label, .crow .m-label { display: none; }
  .crow .amount { font-size: 17px; text-align: right; }
  .crow .rate { text-align: right; font-size: 16px; }
  .clist-head .r { text-align: right; }
  /* institution: 목록 5열(계약일, 사업명, 업체, 금액, 원문) */
  .clist-head.clist-inst, .clist-inst .crow { grid-template-columns: 1fr 2.4fr 1.4fr 1.5fr 0.9fr; }
}
@media (min-width: 1000px) {
  .cards.feed { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .step::before { animation: none; }
}

/* 서버에서 연결한 기록과 원문 표시 */
.site-nav a, .brand, .crumb, .src {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
}
.site-nav a { padding-block: 0; }
.brand { display: inline-flex; }
.source-disabled { cursor: default; text-decoration: none; color: var(--ink-3); }
.btn-src.source-disabled { background: var(--line); color: var(--ink-2); }
.peek .src, .summary .row .source-disabled, .stat-main .source-disabled { color: #fff; }
.peek .big { font-size: clamp(25px, 4vw, 44px); overflow-wrap: normal; }
.peek h2 a { text-underline-offset: 4px; }
.peek .src { margin-top: 8px; }
.source-list { display: inline-block; max-width: 100%; vertical-align: top; }
.source-list summary { cursor: pointer; list-style: none; }
.source-list summary::-webkit-details-marker { display: none; }
.source-list summary::after { content: "+"; margin-left: 6px; font-weight: 700; }
.source-list[open] summary::after { content: "−"; }
.source-list ul { max-height: 16rem; overflow-y: auto; padding-inline: 8px; }
.source-list li { border-top: 1px solid currentColor; }
.summary .row .src, .summary .result .src, .stat .src { display: inline-flex; }
.summary .result .k { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.summary .result .pct { font-size: clamp(43px, 13vw, 84px); }
.summary .v.is-unavailable, .stat .v.is-unavailable { font-size: 20px; }
.step.incomplete-line::before { background: var(--line); animation: none; }
.step-record + .step-record { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.step-record h4, .search-results h4 { margin: 0; }
.step-empty, .change-title { margin-top: 8px; color: var(--ink-2); }
.rate .src { display: flex; justify-content: flex-end; }
.crow .btn-src { text-align: center; }
.crow > .btn-src { padding-inline: 10px; }
.search-group + .search-group { margin-top: 24px; }
.search-group > h3 { margin-bottom: 8px; font-size: 17px; }
.search-results .org { color: var(--ink-2); font-size: 14px; }
.search-results h3 a, .search-results h4 a, .crow h3 a, .feed h3 a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-underline-offset: 3px;
}
.search-results h3 a, .search-results h4 a { text-decoration: none; }
.search-results h3 a:hover, .search-results h4 a:hover { color: var(--blue-deep); }
.chip[aria-current="page"] { background: var(--blue-soft); color: var(--blue-deep); }

@media (max-width: 350px) {
  .site-header .wrap { padding-inline: 12px; }
  .site-nav a { padding-inline: 8px; }
}
@media (min-width: 720px) {
  .hero.hero-single { grid-template-columns: minmax(0, 620px); }
  .summary .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); }
  .summary .result .pct { font-size: clamp(38px, 7vw, 84px); }
  .search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
