/* =============================================================================
   WORDLE ANSWER ARCHIVE — hub / year / month / per-puzzle pages
   ============================================================================= */

.archive-page {
  --archive-gap: 16px;
  width: 100%;
  min-width: 0;
}

.archive-lookup {
  margin: 24px 0 28px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.archive-lookup h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.archive-lookup__form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.archive-lookup__controls {
  display: flex;
  gap: 8px;
}

.archive-lookup__controls input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.archive-lookup__controls button {
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast, #fff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.archive-lookup__error {
  margin: 10px 0 0;
  color: var(--danger, #b91c1c);
  font-size: 0.88rem;
}

.archive-section {
  margin: 28px 0;
}

.archive-section > h2,
.archive-cta > h2 {
  font-family: var(--font-display, var(--font-sans));
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 14px;
}

/* ── Year grid (hub) ───────────────────────────────────────────────────────── */
.archive-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.archive-year-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.archive-year-card:hover {
  border-color: var(--accent);
}

.archive-year-card:active {
  transform: scale(0.99);
}

.archive-year-card__year {
  font-family: var(--font-display, var(--font-sans));
  font-size: 1.5rem;
  font-weight: 700;
}

.archive-year-card__count {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Month grid (year page) ────────────────────────────────────────────────── */
.archive-month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.archive-month-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.archive-month-card:hover {
  border-color: var(--accent);
}

.archive-month-card__name {
  font-weight: 700;
}

.archive-month-card__count {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Answer tables ─────────────────────────────────────────────────────────── */
.archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.archive-table th,
.archive-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.archive-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.archive-table tbody tr:hover {
  background: var(--surface-1);
}

.archive-table a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.archive-table a:hover {
  text-decoration: underline;
}

.archive-word {
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.08em;
}

.archive-day {
  color: var(--muted);
}

/* ── Prev / next pager ─────────────────────────────────────────────────────── */
.archive-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 24px 0;
}

.archive-pager__link {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.archive-pager__link:hover {
  border-color: var(--accent);
}

.archive-pager__link--up {
  color: var(--muted);
}

/* ── Cross-link CTA cards ──────────────────────────────────────────────────── */
.archive-cta {
  margin: 36px 0 8px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.archive-cta__links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.archive-cta__card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  text-decoration: none;
}

.archive-cta__card:hover {
  border-color: var(--accent);
}

.archive-cta__card strong {
  color: var(--fg);
}

.archive-cta__card span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Per-puzzle page ───────────────────────────────────────────────────────── */
.puzzle-answer {
  text-align: center;
  padding: 8px 0 4px;
}

.puzzle-answer__lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.puzzle-answer__tiles {
  justify-content: center;
  margin-bottom: 14px;
}

.puzzle-answer__meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.archive-diff-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #292524;
  background: var(--muted);
}

.archive-diff-badge--easy { background: #dcfce7; color: #14532d; }
.archive-diff-badge--moderate { background: #dbeafe; color: #1e3a8a; }
.archive-diff-badge--tricky { background: #fef3c7; color: #713f12; }
.archive-diff-badge--hard { background: #ffedd5; color: #7c2d12; }
.archive-diff-badge--brutal { background: #fee2e2; color: #7f1d1d; }

.archive-repeat-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--muted);
}

.puzzle-answer__reason {
  margin: 12px auto 0;
  max-width: 460px;
  font-size: 0.88rem;
  color: var(--muted);
}

.puzzle-answer__definition {
  margin: 14px auto 0;
  max-width: 540px;
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.55;
}

.puzzle-section-sub {
  margin: -6px 0 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

.solver-pressure__grid {
  margin: 16px 0;
}

.puzzle-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.puzzle-link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  text-decoration: none;
}

.puzzle-link-card:hover {
  border-color: var(--accent);
}

.puzzle-link-card strong {
  color: var(--accent);
}

.puzzle-link-card span {
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 520px) {
  .archive-lookup__controls {
    align-items: stretch;
    flex-direction: column;
  }
  .archive-table th:first-child,
  .archive-table td:first-child {
    white-space: nowrap;
  }
  .archive-pager {
    flex-direction: column;
    align-items: stretch;
  }
  .archive-pager__link {
    text-align: center;
  }
}

/* ── "By the Numbers" stats strip ──────────────────────────────────────────── */
.archive-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.archive-stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.archive-stat-card__value {
  font-family: var(--font-display, var(--font-sans));
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
}

.archive-stat-card__value a {
  color: var(--accent);
  text-decoration: none;
}

.archive-stat-card__value a:hover {
  text-decoration: underline;
}

.archive-stat-card__label {
  font-size: 0.82rem;
  color: var(--muted);
}

.archive-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.archive-difficulty__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.88rem;
}

.archive-difficulty__label {
  color: var(--fg);
}

.archive-difficulty__count {
  font-weight: 700;
  color: var(--muted);
}

.archive-difficulty__item--easy { border-left-color: #4caf50; }
.archive-difficulty__item--moderate { border-left-color: #8bc34a; }
.archive-difficulty__item--tricky { border-left-color: #ffb300; }
.archive-difficulty__item--hard { border-left-color: #fb8c00; }
.archive-difficulty__item--brutal { border-left-color: #e53935; }

/* Freshness lines and the yesterday page */
.archive-updated {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.archive-section-note {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted);
}

.archive-guide-links {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: var(--space-2);
}

.archive-guide-links a {
  color: var(--accent);
}

.archive-updated a {
  color: var(--accent);
}

.archive-updated-inline {
  color: var(--muted);
}

.archive-pending-note {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
  font-style: italic;
}

.archive-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.archive-table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .archive-table {
    table-layout: fixed;
    font-size: 0.8rem;
  }

  .archive-table th,
  .archive-table td {
    padding: 8px 5px;
  }

  .archive-table--month .archive-day-col,
  .archive-table--month .archive-day {
    display: none;
  }

  .archive-table--month th:first-child,
  .archive-table--month td:first-child {
    width: 40%;
  }

  .archive-table--month th:nth-child(3),
  .archive-table--month td:nth-child(3) {
    width: 24%;
  }

  .archive-table--month th:last-child,
  .archive-table--month td:last-child {
    width: 36%;
  }
}
