/* AI Trend Research — 디자인 토큰은 docs/01_product/ui_design.md 참고 */
:root {
  /* 글자 위계: --heading(제목) > --text(본문) > --muted(보조) */
  --bg: #fbfbf9; --surface: #ffffff; --surface-2: #f4f4f1;
  --heading: #111110; --text: #2e2e2b; --muted: #6b6b66;
  --line: #e4e4e0; --accent: #1f5fbf;
  --p0: #b42318; --p1: #b54708; --p2: #475467; --p3: #98a2b3;
  --official: #027a48; --secondary: #6941c6; --community: #667085;
  --ok-bg: #ecfdf3; --ok: #027a48;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --surface: #1c1c1a; --surface-2: #252523;
    --heading: #f7f7f2; --text: #c9c9c1; --muted: #8e8e86;
    --line: #2e2e2b; --accent: #7aa7ec;
    --p0: #f97066; --p1: #fdb022; --p2: #98a2b3; --p3: #667085;
    --official: #32d583; --secondary: #b692f6; --community: #98a2b3;
    --ok-bg: #0b2a1c; --ok: #32d583;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }

/* 레이아웃 */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1120px; }
.layout { display: block; }
/* 사이드바 없는 페이지: 헤더와 같은 시작선, 본문 폭은 읽기 좋은 760px */
main.wide > :not(.layout):not(.region-cols) { max-width: 760px; }
.primary { min-width: 0; }
@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; align-items: start; }
  .sidebar { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; padding-bottom: 16px; }
}

/* 헤더·푸터 */
.site-header { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--heading); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 18px; height: 18px; border-radius: 5px; background: url(/static/favicon.svg) center / cover; }
.menu { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a { color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.menu a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.menu a[aria-current="page"] { color: var(--heading); font-weight: 700; background: var(--surface-2); }
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 24px 0 32px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--muted); text-decoration: underline; }

/* 타이포 */
h1, h2, h3 { color: var(--heading); }
h1 { font-size: 30px; line-height: 1.25; margin: 8px 0 6px; letter-spacing: -0.015em; font-weight: 800; }
h2 { font-size: 19px; margin: 40px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--heading); display: flex; align-items: baseline; gap: 8px; font-weight: 800; }
h3 { font-size: 18.5px; line-height: 1.45; margin: 8px 0 10px; font-weight: 750; letter-spacing: -0.01em; }
h2 .count, .count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; }
main > h1:first-child { margin-top: 32px; }
.kicker { margin: 32px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.crumb { margin: 24px 0 0; font-size: 14px; }
.crumb + .kicker { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.coverage { font-size: 13px; margin: 0; }
.empty { color: var(--muted); padding: 32px 0; }

/* 오늘의 숫자 */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 20px 0 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 800; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stats dd small { font-size: 14px; font-weight: 600; margin-left: 1px; }

/* 배지·기업 */
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.badge { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
a.badge:hover { text-decoration: none; border-color: var(--muted); }
.badge.p-p0 { color: #fff; background: var(--p0); border-color: var(--p0); }
.badge.p-p1 { color: var(--p1); border-color: var(--p1); }
.badge.p-p2 { color: var(--p2); }
.badge.p-p3 { color: var(--p3); }
.badge.a-ga, .badge.a-api, .badge.a-open_weights { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.field { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.industry { color: var(--secondary); border-color: color-mix(in srgb, var(--secondary) 35%, transparent); }
.badge.region-kr { color: #fff; background: #3b5bdb; border-color: #3b5bdb; }
.companies { display: inline-flex; flex-wrap: wrap; gap: 4px; }
a.entity { color: var(--heading); font-weight: 600; }
a.entity.related { font-weight: 400; color: var(--muted); }
a.entity.related::before { content: "· "; }

/* 핵심 카드 */
.event.lead { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.event p, .detail p { margin: 0 0 10px; }
.fact { font-size: 15.5px; line-height: 1.8; }
.why { font-size: 15.5px; line-height: 1.8; }
.why b, .claim b { color: var(--heading); }
.claim { color: var(--muted); font-size: 14.5px; line-height: 1.75; border-left: 2px solid var(--line); padding-left: 10px; }
.claim b, .why b { font-weight: 700; margin-right: 4px; }
.sources { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; border-top: 1px dashed var(--line); padding-top: 8px; }
.sources li { margin: 3px 0; }
.stype { display: inline-block; min-width: 46px; font-size: 11px; font-weight: 700; }
.stype.official { color: var(--official); }
.stype.secondary { color: var(--secondary); }
.stype.community { color: var(--community); }

/* 접이식 목록 */
.event-list { border-top: 1px solid var(--line); }
.event-item { border-bottom: 1px solid var(--line); }
.event-item summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 120px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 12px 4px; }
.event-item summary::-webkit-details-marker { display: none; }
.event-item summary:hover { background: var(--surface-2); }
.event-item .who { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-item .what { font-weight: 700; color: var(--heading); }
.event-item .state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.event-item summary::after { content: "＋"; color: var(--muted); font-size: 13px; grid-column: 5; }
.event-item[open] summary::after { content: "－"; }
.event-item .detail { padding: 0 4px 16px 4px; }
.event-item .detail .meta { margin-bottom: 8px; }
@media (max-width: 640px) {
  .event-item summary { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "p who sign" "what what what"; row-gap: 4px; }
  .event-item summary .badge { grid-area: p; }
  .event-item .who { grid-area: who; }
  .event-item .what { grid-area: what; }
  .event-item .state { display: none; }
  .event-item summary::after { grid-area: sign; }
}

/* 사이드바 */
.sidebar { font-size: 14px; }
.side-block { margin-top: 32px; }
.side-block h2 { font-size: 14px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.side-sector { margin-bottom: 12px; }
.side-sector h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 0 4px; }
.side-sector ul, .side-topics, .side-recent { list-style: none; padding: 0; margin: 0; }
.side-sector ul { display: flex; flex-wrap: wrap; gap: 6px; }
.side-sector li a { display: inline-block; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; }
.side-sector li .count { margin-left: 2px; }
.side-topics li { display: flex; justify-content: space-between; padding: 4px 0; }
.side-recent li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.side-recent li a { font-variant-numeric: tabular-nums; font-weight: 600; }
.side-recent li span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1023px) { .sidebar { border-top: 2px solid var(--heading); margin-top: 48px; } }

/* 목록 페이지 */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li a { font-variant-numeric: tabular-nums; margin-right: 10px; }
h2.day { font-size: 15px; border-bottom-width: 1px; margin-top: 28px; }
.event-row .title { display: block; color: var(--heading); font-weight: 700; margin-top: 6px; font-size: 16.5px; }
.event-row .date { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 2px; }
.row-summary { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.watch li { margin-bottom: 6px; }
.pager { display: flex; justify-content: space-between; margin-top: 32px; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); }
.chips .count { margin-left: 4px; }

/* 기업 */
.sector-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.sector-nav a { display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 14px; }
.company-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.company-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.company-grid li a { color: var(--heading); font-weight: 700; }
.company-grid li.idle a { color: var(--muted); font-weight: 400; }

/* 검색 */
.search { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.search input { flex-basis: 100%; }
.search input, .search select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.search input { flex: 1; min-width: 0; }

/* 표 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event.lead { padding: 14px; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 10px; }
  .menu { width: 100%; padding-bottom: 6px; }
  .search { flex-direction: column; }
}

/* 분야·산업 */
.field-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.field-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.field-grid li a { color: var(--heading); font-weight: 700; }
.field-grid li p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.field-grid li.idle a { color: var(--muted); font-weight: 600; }
.region-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 640px) { .region-cols { grid-template-columns: 1fr; } }
.empty-note { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* 접는 카드(북마크형) — 기본은 접힘, 오른쪽 위 버튼으로 펼침 상태를 바로 알 수 있게 */
:root { --card-shadow: 0 1px 2px rgba(16,16,15,.06), 0 4px 14px rgba(16,16,15,.07); --card-shadow-hover: 0 2px 4px rgba(16,16,15,.08), 0 10px 24px rgba(16,16,15,.12); --card-body: #fafaf7; }
@media (prefers-color-scheme: dark) {
  :root { --card-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 18px rgba(0,0,0,.45); --card-shadow-hover: 0 1px 0 rgba(255,255,255,.06) inset, 0 12px 28px rgba(0,0,0,.6); --card-body: #181816; --surface: #1f1f1d; }
}
.card-tools { display: flex; justify-content: flex-end; margin: 16px 0 -24px; }
.expand-all { font: inherit; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; box-shadow: var(--card-shadow); }
.expand-all:hover { color: var(--heading); border-color: var(--muted); }
.card-list { display: flex; flex-direction: column; gap: 14px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--p3);
  border-radius: 12px; box-shadow: var(--card-shadow); transition: box-shadow .18s, transform .18s, border-color .18s; overflow: hidden; }
.card.pr-p0 { border-left-color: var(--p0); }
.card.pr-p1 { border-left-color: var(--p1); }
.card.pr-p2 { border-left-color: var(--p2); }
.card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.card[open] { box-shadow: var(--card-shadow-hover); }
.card > summary { list-style: none; cursor: pointer; padding: 16px 18px 14px; padding-right: 104px; display: block; }
.card > summary::-webkit-details-marker { display: none; }
.card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.card .card-title { margin: 8px 0 6px; font-size: 17px; }
.card.lead .card-title { font-size: 19px; }
.card-teaser { margin: 0; color: var(--text); font-size: 14.5px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card.lead .card-teaser { -webkit-line-clamp: 3; }
.card[open] .card-teaser { display: none; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.src-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.src-label { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.src-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.src-chip.official { color: var(--official); }
.src-chip.secondary { color: var(--secondary); }
/* 펼치기 버튼: 오른쪽 위 고정, 화살표 회전 */
.fold-btn { position: absolute; top: 14px; right: 14px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; padding: 4px 10px 4px 12px; }
.card:hover .fold-btn { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.fold-btn .chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .18s; }
.card[open] .fold-btn .chev { transform: translateY(2px) rotate(-135deg); }
.fold-btn .close-label, .card[open] .fold-btn .open-label { display: none; }
.card[open] .fold-btn .close-label { display: inline; }
.card-body { padding: 14px 18px 18px; border-top: 1px solid var(--line); background: var(--card-body); }
.card-body .sources { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 12px; }
@media (max-width: 640px) {
  .card > summary { padding: 14px 14px 12px; padding-top: 48px; }
  .fold-btn { top: 12px; right: 12px; }
}

/* 당일 업데이트 */
.updated { color: var(--accent); font-weight: 600; }
.update-group { margin-bottom: 18px; }
.update-time { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--accent); }
.update-time .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.badge.upd { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* 묶음 카드 설명 */
.company-grid li .desc { margin-top: 4px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* 연구·용어집·스터디 */
a.paper-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  box-shadow: var(--card-shadow); color: var(--text); transition: box-shadow .18s, transform .18s; }
a.paper-card:hover { text-decoration: none; box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
a.paper-card .card-teaser { -webkit-line-clamp: 2; }
.paper-orig { margin: 0 0 6px; color: var(--muted); font-size: 13.5px; font-style: italic; }
.lede { font-size: 17px; line-height: 1.75; color: var(--heading); margin: 16px 0; }
.h1-sub { font-size: 20px; font-weight: 600; }
.paper-sec h2 { font-size: 16px; border-bottom-width: 1px; margin-top: 28px; }
.paper-sec p, .paper-sec li { line-height: 1.85; }
.terms dt { font-weight: 700; color: var(--heading); margin-top: 10px; }
.terms dd { margin: 2px 0 0; color: var(--text); }
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 16px; margin: 16px 0; }
.callout b { color: var(--heading); margin-right: 6px; }
.glossary-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.glossary-grid li[hidden], section[hidden] { display: none; }
a.term-card { display: flex; flex-direction: column; gap: 4px; height: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; box-shadow: var(--card-shadow); color: var(--text); transition: box-shadow .18s, transform .18s; }
a.term-card:hover { text-decoration: none; box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }
.term-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.term-head b { color: var(--heading); font-size: 16.5px; }
.term-ko { font-size: 12.5px; color: var(--muted); }
.term-short { font-size: 13.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.badge.lv-입문 { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.lv-기초 { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.badge.lv-심화 { color: var(--p1); border-color: var(--p1); }
.level-filter { display: flex; gap: 6px; margin: 12px 0 0; }
.level-filter button { font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.level-filter button[aria-pressed="true"] { background: var(--heading); color: var(--bg); border-color: var(--heading); font-weight: 700; }

/* 광고 슬롯 */
.ad-slot { margin: 28px 0; min-height: 90px; position: relative; }
.ad-slot.side { margin: 24px 0 0; min-height: 250px; }
.ad-slot .ad-label { position: absolute; top: -18px; left: 0; font-size: 11px; color: var(--muted); }
.ad-slot.preview { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; background: repeating-linear-gradient(45deg, transparent, transparent 8px, var(--surface-2) 8px, var(--surface-2) 9px); }

/* 구간 페이징 */
.pager-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 0; }
.pager-mini button { font: inherit; font-size: 13px; min-width: 34px; padding: 5px 10px; border-radius: 8px; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--card-shadow); }
.pager-mini button:hover:not(:disabled) { border-color: var(--muted); color: var(--heading); }
.pager-mini button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager-mini button:disabled { opacity: .4; cursor: default; }
.pager-info { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.card[hidden] { display: none; }
.stat-note { margin: 4px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* 커뮤니티 화제 */
.buzz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.buzz { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--card-shadow); }
.buzz p { margin: 6px 0 0; font-size: 14px; line-height: 1.65; }
.buzz-kw { display: inline-block; font-weight: 800; color: var(--accent); font-size: 15px; }
