/* L.SPACE Biz Radar — single stylesheet (light / dark). Tokens·header·footer follow L.SPACE Tech Radar. */

:root {
  --bg: #f4f5f7;
  --bg-soft: #eceef2;
  --surface: #ffffff;
  --text: #0b0f19;
  --text-sub: #474f5e;
  --text-mute: #687080;
  --line: #e2e5ea;
  --line-strong: #c6ccd6;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --shadow: 0 0 0 1px rgba(0,0,0,.03), 0 1px 3px rgba(0,0,0,.05);
  --shadow-hover: 0 0 0 1px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.07);

  /* notice types */
  --t-rnd: #7c3aed;
  --t-support: #0891b2;
  --t-bid: #ea580c;
  /* deadline states */
  --s-urgent: #dc2626;
  --s-open: #16a34a;
  --s-soon: #2563eb;
  --s-closed: #858d9b;

  /* type scale — 크기는 이 6단계만 쓴다 */
  --fs-xs: 12px;   /* 배지·태그·라벨 */
  --fs-sm: 14px;   /* 기관·마감 시각·개요·필터·버튼 */
  --fs-base: 16px; /* 읽는 글: 요약·조건·적합도 근거·WHY·규모 */
  --fs-md: 19px;   /* 공고 제목 */
  --fs-lg: 26px;   /* 통계 숫자·D-day */
  --fs-xl: 30px;   /* 페이지 제목 */

  --radius: 14px;
  --radius-sm: 8px;
  --max: 1120px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07090f;
    --bg-soft: #10141d;
    --surface: #0d1118;
    --text: #eef1f6;
    --text-sub: #b3bbc8;
    --text-mute: #8b94a5;
    --line: #1d2330;
    --line-strong: #323b4b;
    --accent: #6ea8ff;
    --accent-soft: #111d33;
    --shadow: 0 0 0 1px rgba(255,255,255,.06);
    --shadow-hover: 0 0 0 1px rgba(255,255,255,.12), 0 6px 18px rgba(0,0,0,.35);

    --t-rnd: #a78bfa;
    --t-support: #22d3ee;
    --t-bid: #fb923c;
    --s-urgent: #f87171;
    --s-open: #4ade80;
    --s-soon: #60a5fa;
    --s-closed: #7a8394;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }
.mono { font-family: var(--mono); }

/* ---------- header / footer ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: var(--fs-md); letter-spacing: -0.02em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-sub { font-weight: 500; color: var(--text-sub); }
.brand-logo { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.updated { font-size: var(--fs-sm); color: var(--text-mute); font-family: var(--mono); white-space: nowrap; }

.site-footer { margin-top: 72px; border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--text-mute); font-size: var(--fs-sm); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-end; }
.footer-brand { display: flex; flex-direction: column; gap: 10px; }
.footer-logo { display: block; width: 114px; height: auto; }
.footer-link { color: var(--text-sub); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
@media (prefers-color-scheme: dark) { .footer-logo { filter: brightness(0) invert(1); opacity: .85; } }

/* ---------- intro / stats ---------- */

.intro { padding: 28px 0 8px; }
.intro h1 { margin: 0 0 4px; font-size: var(--fs-xl); letter-spacing: -0.03em; }
.intro p { margin: 0; color: var(--text-sub); font-size: var(--fs-base); }
.intro p.intro-scope { margin: 2px 0 6px; font-size: var(--fs-base); font-weight: 600; color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 8px; }
.stat {
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.stat:hover { box-shadow: 0 0 0 1px var(--line-strong); }
.stat b { display: block; font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { font-size: var(--fs-sm); color: var(--text-mute); }
.stat.is-new b { color: var(--accent); }
.stat.is-urgent b { color: var(--s-urgent); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- toolbar ---------- */

.toolbar { position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: 12px 0 10px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0;
  background: transparent;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: var(--bg-soft); color: var(--text); }
.tab[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.tab .n { font-weight: 500; opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.filters input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.filters select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
}
.filters input:focus, .filters select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: var(--fs-sm);
  color: var(--text-sub);
  cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.result-count { font-size: var(--fs-sm); color: var(--text-mute); margin: 14px 0 8px; }

/* ---------- notice list ----------
   Card = decision first (판정 막대·규모·마감·기회), evidence on expand (적합도 근거 → 공고 내용).
   Segmented status bar pattern adapted from 21st.dev "Performance Benchmark Card" (kavikatiyar). */

.list { display: flex; flex-direction: column; gap: 10px; }
.empty { padding: 48px 0; text-align: center; color: var(--text-mute); }

.notice {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 240px;
  overflow: hidden;
  transition: box-shadow .15s ease;
}
@media (hover: hover) { .notice:hover { box-shadow: var(--shadow-hover); } } /* 터치 기기에는 적용하지 않음 */
.notice[data-type="rnd"] { --type: var(--t-rnd); }
.notice[data-type="support"] { --type: var(--t-support); }
.notice[data-type="bid"] { --type: var(--t-bid); }
.notice.is-closed { opacity: .62; }

.notice-head {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 20px;
  row-gap: 6px;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.notice-head > * { grid-column: 1; }
.notice-head:hover .notice-title { color: var(--accent); }
.notice-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.notice-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-sm); color: var(--text-mute); }
.type-badge { color: var(--type); font-weight: 700; }
.badge-new { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 600; color: #fff; background: var(--accent); border-radius: 4px; padding: 0 5px; letter-spacing: .04em; }
.badge-upd { font-size: var(--fs-xs); font-weight: 600; color: var(--accent); }

.notice-title { margin: 0; font-size: var(--fs-md); font-weight: 700; line-height: 1.45; letter-spacing: -0.015em; }

/* 판정 줄: 적합도 · 4칸 막대 · 규모 */
.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; }
.fit-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--text-sub);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.fit-pill.high { color: #fff; background: var(--s-open); border-color: var(--s-open); }

.scorebar { display: inline-flex; gap: 3px; }
.score-cell {
  --c: var(--text-mute);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border-bottom: 3px solid var(--c);
  white-space: nowrap;
}
.score-cell:first-child { border-radius: 6px 0 0 6px; }
.score-cell:last-child { border-radius: 0 6px 6px 0; }
.score-cell i { font-style: normal; font-weight: 800; }
.score-cell.ok { --c: var(--s-open); }
.score-cell.partial { --c: #d97706; }
.score-cell.no { --c: var(--s-urgent); }
.score-cell.check { --c: var(--s-soon); }

.verdict-budget { font-size: var(--fs-base); font-weight: 700; color: var(--text); }
.verdict-budget small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-mute); margin-right: 6px; }

/* 기회: why it matters */
.notice-body .notice-why {
  display: block;
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--type) 8%, transparent);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
}
/* 라벨은 CSS 가 그린다 — 데이터 why 에는 "왜 중요한가:" 를 쓰지 않는다 */
.notice-why::before {
  content: "WHY IT MATTERS · 기회";
  display: block;
  margin-bottom: 2px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--type);
}

/* 마감: 오른쪽 열 */
.notice-head > .dday {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  text-align: right;
  min-width: 96px;
  padding-top: 2px;
}
.dday strong { display: block; font-family: var(--mono); font-size: var(--fs-lg); font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dday span { font-size: var(--fs-sm); color: var(--text-mute); font-variant-numeric: tabular-nums; }
.dday.urgent strong { color: var(--s-urgent); }
.dday.open strong { color: var(--s-open); }
.dday.soon strong { color: var(--s-soon); font-family: var(--font); font-size: var(--fs-md); font-weight: 700; }
.dday.closed strong { color: var(--s-closed); }

.notice-head > .chevron {
  grid-column: 2;
  grid-row: 3;
  justify-self: end;
  align-self: end;
  width: 9px;
  height: 9px;
  margin: 0 4px 6px 0;
  border-right: 2px solid var(--text-mute);
  border-bottom: 2px solid var(--text-mute);
  transform: rotate(45deg);
  transition: transform .15s;
}
.notice.is-open .chevron { transform: rotate(-135deg); }

/* ---------- expanded body ---------- */

.notice-body { display: none; padding: 4px 20px 20px; overflow-wrap: anywhere; }
.notice.is-open .notice-body { display: block; }
.notice-body h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text-mute);
}
.notice-body h4 { margin: 14px 0 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-mute); }
.notice-body p { margin: 0; color: var(--text-sub); }

.fit-sec { padding: 14px 16px; border-radius: 10px; background: var(--bg-soft); }
.notice-body ul.fit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fit-row { display: grid; grid-template-columns: 24px 84px 1fr; gap: 8px; align-items: baseline; font-size: var(--fs-base); color: var(--text-sub); }
.fit-row b { font-weight: 700; color: var(--text); }
.fit-row > span:last-child { min-width: 0; overflow-wrap: anywhere; } /* keep-all 이라도 띄어쓰기 없는 긴 단어는 틀 안에서 끊는다 */
.fit-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: var(--fs-xs);
  font-weight: 800;
  color: #fff;
  background: var(--text-mute);
  align-self: center;
}
.fit-row.ok .fit-mark { background: var(--s-open); }
.fit-row.partial .fit-mark { background: #d97706; }
.fit-row.no .fit-mark { background: var(--s-urgent); }
.fit-row.check .fit-mark { background: var(--s-soon); }

.detail-sec { margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 20px; }
.summary { font-size: var(--fs-base); line-height: 1.7; }
.cond-list { margin: 0; padding-left: 18px; color: var(--text-sub); font-size: var(--fs-base); }
.cond-list li { margin: 3px 0; }
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-self: start;
  align-content: start;
  gap: 6px 14px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: var(--fs-sm);
}
.facts dt { color: var(--text-mute); }
.facts dd { margin: 0; color: var(--text); }
.unknown { color: var(--text-mute); font-style: normal; }
.note { margin-top: 12px; font-size: var(--fs-sm); color: var(--accent); }

.body-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: var(--fs-xs); padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--text-sub); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { color: var(--bg); opacity: .88; }

@media (max-width: 640px) {
  :root { --fs-md: 17px; --fs-lg: 22px; --fs-xl: 26px; }
  .toolbar { position: static; }
  .updated { font-size: var(--fs-xs); }
  /* 모바일은 검색창만 — 상태·적합도·정렬 드롭다운과 분야 칩은 숨긴다(기본값: 접수중·예정, 마감 임박순) */
  .filters input[type="search"] { flex-basis: 100%; }
  .filters select, .chips { display: none; }
  .notice { scroll-margin-top: 70px; }
  .notice-head { grid-template-columns: 1fr; padding: 14px; }
  .notice-head > .dday { grid-column: 1; grid-row: auto; order: -1; text-align: left; display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 0; }
  .notice-head > .chevron { display: none; }
  .notice-body { padding: 4px 14px 16px; }
  .detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .fit-sec { padding: 12px; }
  .fit-row { grid-template-columns: 22px 1fr; row-gap: 2px; }
  .fit-row > span:last-child { grid-column: 1 / -1; } /* 근거는 제목 아래 줄, 아이콘 위치부터 */
}
@media (max-width: 360px) {
  .upd-label { display: none; }
}
