/* 기술 레이더 보드 — app specific styles.
   Tokens come from vendor/studio.css (loaded first in index.html).
   Do NOT redefine --ds-* tokens here; reference them. */

/* ===== status ===== */
#app-status:empty { display: none; }
#app-status {
  padding: var(--ds-s3) var(--ds-s4);
  border-radius: var(--ds-radius);
  background: var(--ds-bad-soft);
  color: var(--ds-bad);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--ds-s4);
}

/* ===== answer card overrides ===== */
.ds-answer { position: relative; }

/* 첫 화면: 큰 소식 + 최근 7일 새 모델을 나란히 (휴대폰에서는 세로로) */
.answer-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--ds-s3); }
@media (max-width: 640px) {
  .answer-row { grid-template-columns: 1fr; }
}

/* ===== 모델 출시·가격 (최근 7일) ===== */
#model-list, #pane-model-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
#model-list .model, #pane-model-list .model {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: var(--ds-s4) 8px;
  border-bottom: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
}
#model-list .model:last-child, #pane-model-list .model:last-child { border-bottom: 0; }
.model-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
#model-list .meta, #pane-model-list .meta { margin-top: 2px; }
.model-link { font-size: 13px; font-weight: 600; color: var(--ds-accent-text); text-decoration: none; white-space: nowrap; }
.model-link:hover { text-decoration: underline; }

/* ===== 접을 수 있는 구역 (출처 수집 현황) ===== */
.ds-details summary { cursor: pointer; }
.ds-details summary:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.ds-details-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; padding: 8px 12px; }
.ds-details-summary h2 { margin: 0; }

/* ===== answer number pulse (error state) ===== */
#sample-button.pulse { animation: pulse-border 1.2s ease-in-out 3; }
@keyframes pulse-border {
  0%   { box-shadow: 0 0 0 0 var(--ds-accent-soft); }
  50%  { box-shadow: 0 0 0 6px var(--ds-accent-soft); }
  100% { box-shadow: 0 0 0 0 var(--ds-accent-soft); }
}

/* ===== top three list ===== */
#top-three-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.top-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 4px 16px;
  align-items: start;
  padding: var(--ds-s4) 0;
  border-top: 1px solid var(--ds-line);
}
.top-item:first-child { border-top: 0; }

.rank {
  font-size: 24px;
  font-weight: 800;
  color: var(--ds-accent-text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.top-item .main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.top-item .title { font-size: 18px; font-weight: 700; line-height: 1.4; }
.top-item .title a { color: inherit; text-decoration: none; }
.top-item .title a:hover { color: var(--ds-accent-text); text-decoration: underline; }

/* top-item links: show at most 1 on mobile */
.top-item .links { grid-column: 2; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.top-item .link { display: flex; flex-direction: column; gap: 2px; }

/* ===== controls (filter row) ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 0 0 var(--ds-s3);
  padding: 8px 12px 12px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface-2);
}
.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
  color: var(--ds-ink-2);
}
.controls .check { cursor: pointer; }
.controls input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ds-accent); }
.controls select {
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface);
  color: var(--ds-ink);
  font: inherit;
}
.controls button {
  background: transparent;
  border: 1px solid var(--ds-line);
  color: var(--ds-ink);
  min-height: 44px;
  border-radius: var(--ds-radius);
  padding: 8px 16px;
  cursor: pointer;
  font: inherit;
}
.controls button:hover { background: var(--ds-surface); }

/* ===== story list ===== */
#story-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.story {
  padding: 12px 8px;
  cursor: pointer;
  border-radius: var(--ds-radius);
  border-bottom: 1px solid var(--ds-line);
  transition: background-color var(--ds-fast) var(--ds-ease);
}
.story:active { transform: scale(0.99); }
.story:hover { background: var(--ds-surface-2); }
.story:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; }
.story[aria-expanded="true"] { background: var(--ds-accent-soft); }

.title-row { display: flex; align-items: baseline; gap: 8px; }
.story .title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; flex: 1; }
.chev { font-size: 13px; color: var(--ds-ink-3); white-space: nowrap; flex-shrink: 0; }
.story[aria-expanded="true"] .chev { color: var(--ds-accent-text); }

/* story meta row */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  color: var(--ds-ink-3);
  font-size: 14px;
  margin-top: 4px;
}
.story .meta { gap: 4px 8px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  color: var(--ds-ink-3);
  border: 1px solid var(--ds-line);
}
.badge.cross { background: var(--ds-accent); color: var(--ds-accent-ink); border-color: var(--ds-accent); }
.badge.interest { background: var(--ds-accent-soft); color: var(--ds-accent-text); border-color: var(--ds-accent-line); }

/* ===== story detail panel ===== */
#story-detail:empty { display: none; }
#story-detail {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#story-detail .link { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; }
.link-source { font-size: 14px; font-weight: 700; color: var(--ds-ink-3); }
.link-title { font-weight: 600; color: var(--ds-accent-text); text-decoration: underline; overflow-wrap: anywhere; }

/* ===== empty states ===== */
.empty {
  padding: var(--ds-s4) 12px;
  border: 1px dashed var(--ds-line);
  border-radius: var(--ds-radius-l);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ds-s2);
}
.empty-text { margin: 0; color: var(--ds-ink-3); font-size: 14px; }
.ds-btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: var(--ds-radius-s); }

/* ===== source status list ===== */
#source-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#source-status-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  min-width: 180px;
  flex: 1 1 180px;
}
#source-status-list li .bar {
  height: 6px;
  border-radius: 3px;
  background: var(--ds-accent);
}
#source-status-list li.fail .bar { background: var(--ds-bad); }
.source-name { font-weight: 600; font-size: 14px; }
.source-meta { font-size: 13px; color: var(--ds-ink-3); }
#source-status-list li.fail { border-color: var(--ds-bad); background: var(--ds-bad-soft); }

/* ===== more button ===== */
button.more {
  align-self: flex-start;
  margin-top: var(--ds-s3);
  background: transparent;
  border: 1px solid var(--ds-line);
  color: var(--ds-ink);
  min-height: 44px;
  border-radius: var(--ds-radius);
  padding: 8px 16px;
  cursor: pointer;
  font: inherit;
}
button.more:hover { background: var(--ds-surface-2); }

/* ===== focus ===== */
button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--ds-focus);
  outline-offset: 2px;
}
.controls button:focus-visible { outline-offset: -2px; }

/* ===== responsive ===== */
@media (max-width: 480px) {
  /* top-item: show only 1 link */
  .top-item .links .link:nth-child(n + 2) { display: none; }
  /* story meta: tighter gap */
  .story .meta { gap: 4px 6px; }
}

@media (max-width: 640px) {
  .ds-band { padding: var(--ds-s6) var(--ds-s4) 40px; }
  .ds-band .ds-btn { width: 100%; }
  #app-status { margin-bottom: var(--ds-s3); }
  .controls { gap: 8px 12px; padding: 8px; }
  .controls label { min-height: 0; }
  .controls select { min-height: 40px; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .story:active { transform: none; }
}
