/* ── Reset & Variables ──────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Dark theme (default) */
  --bg: #0d0f14;
  --bg2: #161a23;
  --bg3: #1e2330;
  --surface: #242938;
  --border: #2e3548;
  --text: #e4e8f0;
  --text2: #9ba4b8;
  --accent: #6c8ef7;
  --accent-green: #4ec994;
  --accent-purple: #b47ef7;
  --accent-gold: #f7c84e;
  --accent-rose: #f76c8e;
  --bar-fill: var(--accent);
  --timeline-fill: var(--accent-green);
  --hero-grad: linear-gradient(135deg, #1a1f3a 0%, #0d1525 60%, #0d0f14 100%);
  --milestone-bg: #1a1030;
  --milestone-border: #6c3ef7;
  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="light"] {
  --bg: #f5f7fc;
  --bg2: #edf0f7;
  --bg3: #e2e7f2;
  --surface: #ffffff;
  --border: #d0d6e8;
  --text: #1a1e2e;
  --text2: #5a6180;
  --accent: #3563e9;
  --accent-green: #1a9e68;
  --accent-purple: #7c3aed;
  --accent-gold: #c98a00;
  --accent-rose: #e0365a;
  --bar-fill: var(--accent);
  --timeline-fill: var(--accent-green);
  --hero-grad: linear-gradient(135deg, #dde5ff 0%, #edf2ff 60%, #f5f7fc 100%);
  --milestone-bg: #f0ebff;
  --milestone-border: #7c3aed;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Sans", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.header-nav { display: flex; gap: 0.5rem; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  background: var(--hero-grad);
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-inner { max-width: 720px; margin: 0 auto; }

.milestone-badge {
  display: inline-block;
  background: linear-gradient(135deg, #6c8ef7, #b47ef7);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 0.3rem 1rem;
  border-radius: 99px;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

#hero-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text2);
  margin-bottom: 1rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-tagline {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.5rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  display: inline-block;
  background: var(--surface);
}

/* ── Milestone banner ────────────────────────────────────────────────────── */

.milestone-banner {
  background: var(--milestone-bg);
  border-left: 4px solid var(--milestone-border);
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--text2);
  font-style: italic;
}

/* ── Status messages ─────────────────────────────────────────────────────── */

.status-msg {
  text-align: center;
  padding: 2rem;
  color: var(--text2);
}
.error-msg { color: var(--accent-rose); }

/* ── Stat cards ──────────────────────────────────────────────────────────── */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  background: var(--bg2);
  gap: 0.4rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.accent-blue::before { background: var(--accent); }
.accent-green::before { background: var(--accent-green); }
.accent-purple::before { background: var(--accent-purple); }
.accent-gold::before { background: var(--accent-gold); }

.stat-value {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.accent-blue .stat-value { color: var(--accent); }
.accent-green .stat-value { color: var(--accent-green); }
.accent-purple .stat-value { color: var(--accent-purple); }
.accent-gold .stat-value { color: var(--accent-gold); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ── Charts grid ─────────────────────────────────────────────────────────── */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.chart-section {
  background: var(--bg2);
  padding: 1.5rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* ── Bar chart ───────────────────────────────────────────────────────────── */

.bar-chart {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bar-chart li {
  display: grid;
  grid-template-columns: 7rem 1fr 2.5rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.bar-label {
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
}

.bar-track {
  background: var(--bg3);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--bar-fill);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.timeline-fill { background: var(--timeline-fill); }

.bar-value {
  color: var(--text2);
  font-size: 0.75rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Timeline ────────────────────────────────────────────────────────────── */

.timeline-section {
  background: var(--bg2);
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
}

.timeline-container { overflow-x: auto; }

.timeline-chart li {
  grid-template-columns: 5.5rem 1fr 2.5rem;
}

/* ── Top tested ──────────────────────────────────────────────────────────── */

.top-tested {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  counter-reset: top-list;
}

.top-tested li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  counter-increment: top-list;
}

.top-tested li::before {
  content: counter(top-list);
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 1.2rem;
}

.top-name {
  flex: 1;
  margin: 0 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-count {
  color: var(--accent-green);
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
}

/* ── Tags ────────────────────────────────────────────────────────────────── */

.tags-section {
  background: var(--bg2);
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  cursor: default;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.tag-chip:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Explorer ────────────────────────────────────────────────────────────── */

.explorer-section {
  background: var(--bg);
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
}

.explorer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.filter-select:focus { outline: none; border-color: var(--accent); }

.grid-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text2);
  white-space: nowrap;
}

/* ── Entry grid ──────────────────────────────────────────────────────────── */

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s, transform 0.15s;
}

.entry-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.entry-num {
  font-size: 0.7rem;
  color: var(--text2);
  font-weight: 600;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
  line-height: 1.3;
}

.stage-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.stage-planned { background: var(--bg3); color: var(--text2); }
.stage-dev { background: #1a2e50; color: #6cabf7; }
.stage-published { background: #0e2a20; color: #4ec994; }
.stage-articled { background: #2a1a40; color: #c084fc; }
.stage-listed { background: #2a2010; color: var(--accent-gold); }
.stage-done { background: #1a2a1a; color: #86efac; }

[data-theme="light"] .stage-dev { background: #dbeafe; color: #1d4ed8; }
[data-theme="light"] .stage-published { background: #dcfce7; color: #15803d; }
[data-theme="light"] .stage-articled { background: #f3e8ff; color: #7e22ce; }
[data-theme="light"] .stage-listed { background: #fef9c3; color: #854d0e; }
[data-theme="light"] .stage-done { background: #f0fdf4; color: #166534; }

.card-pitch {
  font-size: 0.78rem;
  color: var(--text2);
  flex: 1;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.card-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tech-pill {
  font-size: 0.62rem;
  padding: 0.1rem 0.4rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text2);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.test-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  background: rgba(78, 201, 148, 0.12);
  color: var(--accent-green);
  border-radius: 99px;
  font-weight: 600;
}

.card-link {
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
}

.no-results {
  color: var(--text2);
  text-align: center;
  padding: 2rem;
  grid-column: 1 / -1;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text2);
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .hero { padding: 3rem 1rem 2.5rem; }
  #hero-title { font-size: 2rem; }
  .bar-chart li { grid-template-columns: 5.5rem 1fr 2rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; align-items: flex-start; }
  .grid-count { margin-left: 0; }
}
