/* keywords.css — キーワードランキングページ専用スタイル */

.logo-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }

.keywords-main { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }

/* ===== CONTROLS ===== */
.kw-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1.25rem; }
.category-filter { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.cat-btn {
  background: var(--bg-surface); border: 1px solid var(--border-med);
  border-radius: 100px; padding: 4px 14px; font-size: 12px;
  font-family: var(--font-body); color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition);
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== NOTICE ===== */
.kw-notice {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 16px; margin-bottom: 1.5rem;
}

/* ===== LOADING ===== */
.kw-loading {
  padding: 3rem 2rem; display: flex; flex-direction: column;
  align-items: center; gap: 1rem;
}

.kw-progress-wrap {
  width: 100%; max-width: 400px; height: 6px;
  background: var(--bg-muted); border-radius: 100px; overflow: hidden;
}

.kw-progress-bar {
  height: 100%; background: var(--accent); border-radius: 100px;
  width: 0%; transition: width 0.4s ease;
}

.kw-loading-msg { font-size: 13px; color: var(--text-muted); }

/* ===== GRID ===== */
.kw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ===== KEYWORD CARD ===== */
.kw-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  cursor: pointer; transition: all var(--transition);
  animation: fadeUp 0.3s ease both;
  display: flex; flex-direction: column; gap: 12px;
}

.kw-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-med);
  transform: translateY(-2px);
}

.kw-card-top { display: flex; align-items: center; justify-content: space-between; }

.kw-rank {
  font-family: var(--font-display); font-weight: 800; font-size: 11px;
  min-width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.kw-rank.rank-1 { background: var(--rank-1); color: #fff; }
.kw-rank.rank-2 { background: var(--rank-2); color: #fff; }
.kw-rank.rank-3 { background: var(--rank-3); color: #fff; }
.kw-rank.rank-other { background: var(--badge-bg); color: var(--badge-text); }

.kw-cat-badge {
  font-size: 10px; padding: 2px 10px; border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--badge-bg); color: var(--badge-text);
}
.kw-cat-badge.language  { background: #e8f4fd; color: #1a7abf; border-color: #1a7abf; }
.kw-cat-badge.frontend  { background: #fff3e0; color: #e65100; border-color: #e65100; }
.kw-cat-badge.backend   { background: #e8f5e9; color: #2e7d32; border-color: #2e7d32; }
.kw-cat-badge.infra     { background: #f3e5f5; color: #7b1fa2; border-color: #7b1fa2; }
.kw-cat-badge.ai        { background: #fce4ec; color: #c62828; border-color: #c62828; }

[data-theme="dark"] .kw-cat-badge.language  { background: #0d2333; color: #5ab4f0; border-color: #5ab4f0; }
[data-theme="dark"] .kw-cat-badge.frontend  { background: #2d1a00; color: #ffb74d; border-color: #ffb74d; }
[data-theme="dark"] .kw-cat-badge.backend   { background: #0d2210; color: #66bb6a; border-color: #66bb6a; }
[data-theme="dark"] .kw-cat-badge.infra     { background: #1e0d2d; color: #ce93d8; border-color: #ce93d8; }
[data-theme="dark"] .kw-cat-badge.ai        { background: #2d0d14; color: #ef9a9a; border-color: #ef9a9a; }

.kw-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: 22px; color: var(--text-primary); letter-spacing: -0.02em;
}

/* スコアバー */
.kw-score-row { display: flex; align-items: center; gap: 10px; }

.kw-score-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.kw-score-bar-wrap {
  flex: 1; height: 6px; background: var(--bg-muted);
  border-radius: 100px; overflow: hidden;
}

.kw-score-bar {
  height: 100%; background: var(--accent);
  border-radius: 100px; width: 0%;
  transition: width 0.7s ease;
}

.kw-score-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: 13px; color: var(--accent); white-space: nowrap;
}

/* ミニ統計 */
.kw-mini-stats { display: flex; justify-content: space-between; }

.kw-mini-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.kw-mini-num { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--text-primary); }
.kw-mini-label { font-size: 10px; color: var(--text-muted); }

.kw-view-btn {
  width: 100%; padding: 8px; border: 1px solid var(--border-med);
  border-radius: var(--radius-sm); background: none;
  font-size: 12px; font-family: var(--font-body);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.kw-view-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== DETAIL PANEL ===== */
.kw-detail-panel {
  margin-top: 2rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
  animation: fadeUp 0.25s ease;
}

.kw-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}

.kw-detail-title {
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  color: var(--text-primary);
}

.kw-detail-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border-med); background: none;
  color: var(--text-secondary); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.kw-detail-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.kw-detail-stats {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}

.kw-dstat {
  background: var(--bg-muted); border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem; display: flex; flex-direction: column;
  align-items: center; gap: 3px; min-width: 90px;
}

.kw-dstat-num {
  font-family: var(--font-display); font-weight: 800;
  font-size: 22px; color: var(--accent);
}

.kw-dstat-label { font-size: 10px; color: var(--text-muted); }

.kw-detail-articles-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 14px; color: var(--text-primary); margin-bottom: 1rem;
}

.kw-article-list { display: flex; flex-direction: column; gap: 8px; }

.kw-article-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-md); text-decoration: none;
  color: inherit; transition: all var(--transition);
}
.kw-article-item:hover { border-color: var(--accent); background: var(--accent-soft); }

.kw-article-rank {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  color: var(--text-muted); min-width: 24px; padding-top: 2px;
}

.kw-article-title { font-size: 13px; line-height: 1.5; flex: 1; color: var(--text-primary); }

.kw-article-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ===== FOOTER ===== */
.footer { background: var(--bg-surface); border-top: 1px solid var(--border); margin-top: 5rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 3rem 2rem 2rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-logo-mark { width: 40px; height: 40px; background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); flex-shrink: 0; }
.footer-logo-title { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--text-primary); }
.footer-logo-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.footer-links { display: flex; gap: 3rem; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col-title { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.footer-link { font-size: 13px; color: var(--text-secondary); text-decoration: none; transition: color var(--transition); }
.footer-link:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding: 1.25rem 2rem; text-align: center; font-size: 11px; color: var(--text-muted); }
.footer-bottom a { color: var(--accent); text-decoration: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .keywords-main { padding: 0 1rem; }
  .kw-grid { grid-template-columns: 1fr; }
  .kw-controls { gap: 8px; }
}
