/* ============================================================
   site.css — shared styles for all non-game pages
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --bg:          #fafaf8;
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --text:        #111827;
  --muted:       #6b7280;
  --accent:      #1d4ed8;
  --accent-lt:   #eff6ff;
  --correct:     #d1fae5;
  --font-display:'Playfair Display', Georgia, serif;
  --font-body:   'DM Sans', system-ui, sans-serif;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.10);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img { max-width: 100%; height: auto; display: block; }

/* ── Utility ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--wide {
  max-width: 1200px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}

.site-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.site-logo span { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 28px;
  list-style: none;
}

.site-nav a {
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s;
}

.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--text);
  color: #9ca3af;
  margin-top: auto;
  padding: 40px 0 24px;
  font-size: .875rem;
}

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

.site-footer h3 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 1rem;
  margin-bottom: 12px;
}

.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { color: #9ca3af; }
.site-footer a:hover { color: #fff; text-decoration: none; }

.site-footer__bottom {
  border-top: 1px solid #374151;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Ad slots (CLS-safe — fixed height, no layout shift) ──── */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: .75rem;
  overflow: hidden;
  /* ⚠️ IMPORTANT: reserve space BEFORE AdSense loads to eliminate CLS */
}

.ad-slot--leaderboard {
  width: 100%;
  min-height: 90px;     /* 728×90 → collapses to 320×50 on mobile */
  max-height: 90px;
}

.ad-slot--rectangle {
  width: 100%;
  min-height: 250px;    /* 300×250 */
  max-height: 280px;
}

.ad-slot--footer {
  width: 100%;
  min-height: 60px;
  max-height: 90px;
}

/* Ad wrapper adds vertical breathing room without height instability */
.ad-wrapper {
  padding: 16px 0;
  text-align: center;
  width: 100%;
}

/* ── Hero (used on index/clue pages) ─────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, #1e40af 100%);
  color: #fff;
  padding: 56px 0 48px;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.2;
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.1rem;
  opacity: .85;
  max-width: 560px;
  margin: 0 auto 24px;
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  border-radius: 50px;
  transition: transform .15s, box-shadow .15s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  text-decoration: none;
}

/* ── Page content areas ───────────────────────────────────── */
.page-content {
  padding: 48px 0 64px;
  flex: 1;
}

.page-content h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin-bottom: 8px;
}

.page-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 32px 0 12px;
}

.page-content p, .page-content li {
  color: #374151;
  max-width: 68ch;
  margin-bottom: 16px;
}

.page-content ul, .page-content ol {
  padding-left: 20px;
}

/* ── Clue page specific ───────────────────────────────────── */
.clue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 32px;
}

.clue-card__label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.clue-card__clue {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  margin-bottom: 20px;
  color: var(--text);
}

.clue-card__answer-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.clue-card__answer {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: .18em;
  color: var(--accent);
  background: var(--accent-lt);
  padding: 8px 24px;
  border-radius: 6px;
  line-height: 1.3;
}

.clue-card__letters {
  font-size: .875rem;
  color: var(--muted);
}

.clue-card__explanation {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #374151;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* Letter boxes — decorative display */
.letter-boxes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.letter-box {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* Related clues grid */
.related-clues {
  margin-top: 40px;
}

.related-clues h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow .15s, transform .15s;
}

.related-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  text-decoration: none;
}

.related-card__clue {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 4px;
  display: block;
}

.related-card__answer {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: .06em;
}

/* ── Contact form ─────────────────────────────────────────── */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}

.form-group textarea { resize: vertical; min-height: 120px; }

.btn--primary {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.btn--primary:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb__sep { color: #d1d5db; }

/* ── Homepage clue directory ─────────────────────────────── */
.clue-directory {
  padding: 48px 0;
}

.clue-directory h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.clue-directory__subtitle {
  color: var(--muted);
  margin-bottom: 28px;
}

.clue-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.clue-table th {
  text-align: left;
  padding: 12px 16px;
  background: #f9fafb;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.clue-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: .9rem;
}

.clue-table tr:last-child td { border-bottom: none; }

.clue-table tr:hover td { background: #fafafa; }

.clue-table a { font-weight: 500; }

/* ── Dark mode ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #111827;
  --surface:   #1f2937;
  --border:    #374151;
  --text:      #f9fafb;
  --muted:     #9ca3af;
  --accent:    #60a5fa;
  --accent-lt: #1e3a5f;
  --correct:   #065f46;
}

/* Footer is already dark — keep it unchanged in dark mode */
[data-theme="dark"] .site-footer {
  background: #111827;
  color: #9ca3af;
}

/* ── Theme toggle button ──────────────────────────────────── */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  color: var(--muted);
  transition: color .15s, background .15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--accent-lt);
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .site-nav { gap: 16px; }

  .clue-card { padding: 20px; }

  .related-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ad-slot--leaderboard { min-height: 50px; max-height: 50px; }
}
