/* ===== リセット & 基本設定 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #7c3aed;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --tag-ai: #ede9fe;
  --tag-ai-text: #7c3aed;
  --tag-tool: #dbeafe;
  --tag-tool-text: #1d4ed8;
  --tag-news: #dcfce7;
  --tag-news-text: #15803d;
}

body {
  font-family: 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a { text-decoration: none; color: inherit; }

/* ===== ヘッダー ===== */
header {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 11px;
  opacity: 0.8;
  display: block;
  line-height: 1;
}

/* ハンバーガーメニュー（スマホ用） */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

nav {
  display: flex;
  gap: 6px;
}

nav a {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.2s, color 0.2s;
  font-weight: 500;
}

nav a:hover, nav a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* ===== ヒーローバナー ===== */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  color: white;
  padding: 60px 20px 80px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 4px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.3;
}

.hero h1 span {
  background: linear-gradient(90deg, #fbbf24, #f9a8d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 16px;
  opacity: 0.85;
  max-width: 520px;
  margin: 0 auto 32px;
}

.hero-search {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

.hero-search input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 30px;
  border: none;
  font-size: 15px;
  outline: none;
  color: var(--text);
}

.hero-search button {
  padding: 12px 24px;
  background: #fbbf24;
  color: #1e293b;
  border: none;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.hero-search button:hover { background: #f59e0b; }

/* ===== ティッカー（速報） ===== */
.ticker {
  background: #fbbf24;
  color: #1e293b;
  padding: 10px 0;
  overflow: hidden;
}

.ticker-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.ticker-label {
  background: #1e293b;
  color: #fbbf24;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ticker-track {
  overflow: hidden;
  flex: 1;
}

.ticker-text {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-block;
  animation: tickerScroll 30s linear infinite;
}

@keyframes tickerScroll {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ===== メインレイアウト ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
}

/* ===== セクションタイトル ===== */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.section-title h2 {
  font-size: 20px;
  font-weight: 800;
}

.section-title .icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-blue   { background: #dbeafe; }
.icon-purple { background: #ede9fe; }
.icon-yellow { background: #fef9c3; }
.icon-green  { background: #dcfce7; }

.section-title a.more {
  margin-left: auto;
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-title a.more:hover { text-decoration: underline; }

/* ===== 新着記事カード ===== */
.articles-grid {
  display: grid;
  gap: 20px;
}

.article-card {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.article-thumb {
  width: 160px;
  min-width: 160px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.article-body {
  padding: 16px 20px;
  flex: 1;
}

.article-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.tag-ai       { background: var(--tag-ai);   color: var(--tag-ai-text); }
.tag-tool     { background: var(--tag-tool);  color: var(--tag-tool-text); }
.tag-news     { background: var(--tag-news);  color: var(--tag-news-text); }
.tag-beginner { background: #fff7ed;          color: #c2410c; }

.article-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.5;
}

.article-card p {
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 注目の特集カード */
.featured-card {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
  border-radius: 14px;
  padding: 32px;
  color: white;
  margin-bottom: 32px;
  cursor: pointer;
  transition: transform 0.2s;
}

.featured-card:hover { transform: translateY(-3px); }

.featured-card .tag {
  background: rgba(255,255,255,0.2);
  color: white;
  margin-bottom: 12px;
  display: inline-block;
}

.featured-card h2 {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.4;
}

.featured-card p {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 20px;
}

.featured-card .btn {
  display: inline-block;
  background: white;
  color: #1e3a8a;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s;
}

.featured-card .btn:hover { background: #f1f5f9; }

/* ===== サイドバー ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* 人気記事ランキング */
.popular-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.popular-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.popular-item:hover { background: var(--bg); }

.popular-rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
}

.rank-1     { background: #fbbf24; color: #92400e; }
.rank-2     { background: #94a3b8; color: white; }
.rank-3     { background: #cd7c3e; color: white; }
.rank-other { background: var(--bg); color: var(--text-muted); }

.popular-item h4 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.popular-item .meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* AI用語集ウィジェット */
.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glossary-item {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.glossary-item dt {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.glossary-item dd {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* カテゴリナビ */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.category-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.category-btn:hover {
  background: #dbeafe;
  border-color: var(--primary);
  color: var(--primary);
}

.category-btn .cat-icon { font-size: 20px; }

/* ===== 初心者向けバナー ===== */
.beginner-banner {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid #fbbf24;
  border-radius: 14px;
  padding: 24px 28px;
  margin: 32px 0;
  display: flex;
  align-items: center;
  gap: 20px;
}

.beginner-banner .icon-big { font-size: 48px; }

.beginner-banner h3 {
  font-size: 17px;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 6px;
}

.beginner-banner p {
  font-size: 13px;
  color: #78350f;
}

.beginner-banner .btn {
  margin-left: auto;
  background: #fbbf24;
  color: #1e293b;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.beginner-banner .btn:hover { background: #f59e0b; }

/* ===== ページトップへ戻るボタン ===== */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.2s;
  z-index: 200;
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover { transform: translateY(-3px); }

/* ===== フッター ===== */
footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 48px 20px 24px;
  margin-top: 60px;
}

.footer-inner { max-width: 1100px; margin: 0 auto; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .logo-text { font-size: 20px; color: white; }

.footer-brand p {
  font-size: 13px;
  margin-top: 10px;
  line-height: 1.7;
}

.footer-col h4 {
  color: white;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-col ul { list-style: none; }

.footer-col ul li { margin-bottom: 8px; }

.footer-col ul li a {
  font-size: 13px;
  color: #94a3b8;
  transition: color 0.15s;
}

.footer-col ul li a:hover { color: white; }

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 20px;
  font-size: 12px;
  text-align: center;
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }

  .article-thumb {
    width: 100px;
    min-width: 100px;
    font-size: 32px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e3a8a, #7c3aed);
    padding: 16px 20px;
    gap: 4px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  }

  nav.open { display: flex; }

  nav a { padding: 10px 14px; border-radius: 8px; }

  .hamburger { display: flex; }

  .beginner-banner {
    flex-direction: column;
    text-align: center;
  }

  .beginner-banner .btn { margin: 0 auto; }
}
