/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555;
  --accent: #4361ee;
  --accent-hover: #3a56d4;
  --border: #e0e0e0;
  --tag-bg: #eef1ff;
  --tag-text: #4361ee;
  --radius: 10px;
  --max-width: 820px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Layout ── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

/* ── Hero ── */
.hero {
  padding: 5rem 0 3rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
}

/* ── About Section ── */
.about {
  padding: 2rem 0 3rem;
}

.about h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.about p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1.02rem;
}

.about p:last-child { margin-bottom: 0; }

.highlight-box {
  background: var(--tag-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.97rem;
  color: var(--text);
}

/* ── Puzzles Grid ── */
.puzzles-section {
  padding: 1rem 0 4rem;
}

.puzzles-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.puzzle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.puzzle-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(67, 97, 238, 0.08);
}

.puzzle-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.puzzle-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.puzzle-card h3 a {
  color: var(--text);
}

.puzzle-card h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  white-space: nowrap;
}

.tag.active { background: #e0f7e9; color: #1b7a3d; }
.tag.upcoming { background: #fff3e0; color: #b36b00; }
.tag.closed { background: #f0f0f0; color: #888; }

.puzzle-card p {
  color: var(--text-secondary);
  font-size: 0.97rem;
  margin-bottom: 1rem;
}

.puzzle-card .links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5em 1.1em;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

/* ── Month Page ── */
.month-page { padding: 3rem 0 4rem; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
  color: var(--text-secondary);
}

.back-link:hover { color: var(--accent); text-decoration: none; }

.month-page h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.month-page .subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2rem;
}

.month-page h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}

.month-page h2:first-of-type { margin-top: 0; }

.month-page p, .month-page li {
  color: var(--text-secondary);
  font-size: 0.97rem;
  margin-bottom: 0.75rem;
}

.month-page ul {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.month-page li { margin-bottom: 0.4rem; }

.puzzle-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.puzzle-detail h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.spec-table {
  width: 100%;
  font-size: 0.9rem;
  border-collapse: collapse;
  margin: 0.75rem 0;
}

.spec-table td {
  padding: 0.35rem 0.75rem 0.35rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.spec-table td:first-child {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  width: 140px;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
  background: #f3f3f3;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.action-box {
  background: var(--tag-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.action-box h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.action-box p {
  margin-bottom: 1rem;
}

.action-box .links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Footer ── */
footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

footer a { color: var(--text-secondary); }
footer a:hover { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  .hero { padding: 3rem 0 2rem; }
  .puzzle-card-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
