/* ── PuzzlHaus — Dark Editorial Arcade ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;700&family=Barlow+Condensed:wght@700;800;900&display=swap');

:root {
  --bg:        #0d0d0d;
  --bg2:       #141414;
  --bg3:       #1c1c1c;
  --border:    #2a2a2a;
  --accent:    #f5c842;
  --accent2:   #ff6b35;
  --text:      #f0f0f0;
  --muted:     #888;
  --green:     #4ade80;
  --yellow:    #facc15;
  --red:       #f87171;
  --radius:    8px;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --font-display: 'Barlow Condensed', system-ui, sans-serif;
  --font-sans: 'Manrope', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, a, [role="button"] { touch-action: manipulation; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Skip to content (ADA) ─────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  font-weight: 700;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -1px;
}
.logo span { color: var(--text); }

.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a, .header-nav button {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.header-nav a:hover, .header-nav button:hover {
  color: var(--text);
  border-color: var(--border);
}
.header-nav .btn-pro {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}
.header-nav .btn-pro:hover { background: #e6b930; }

/* ── Main layout ────────────────────────────────────────────────────────────── */
.main-content { max-width: 900px; margin: 0 auto; padding: 32px 20px; }
.page-wide     { max-width: 1200px; margin: 0 auto; padding: 32px 20px; }

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 64px 20px 48px;
  position: relative;
}
.hero-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 16px;
}
.hero p {
  font-size: 18px;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 32px;
}

/* ── Game card grid ─────────────────────────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.game-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.game-card:hover::before { transform: scaleX(1); }
.game-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.game-card-emoji { font-size: 32px; }
.game-card-title { font-weight: 700; font-size: 18px; }
.game-card-desc  { font-size: 13px; color: var(--muted); }
.game-card-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--accent);
  width: fit-content;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary  { background: var(--accent);  color: var(--bg);   }
.btn-primary:hover  { background: #e6b930; }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover  { border-color: var(--accent); color: var(--accent); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-sm       { padding: 8px 16px; font-size: 13px; }
.btn-full     { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 16px;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
.form-error { color: var(--red); font-size: 13px; }

/* ── Card / Box ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid;
  margin-bottom: 16px;
}
.alert-success { background: rgba(74,222,128,0.1); border-color: var(--green); color: var(--green); }
.alert-error   { background: rgba(248,113,113,0.1); border-color: var(--red); color: var(--red); }
.alert-info    { background: rgba(245,200,66,0.1); border-color: var(--accent); color: var(--accent); }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: auto;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; flex-wrap: wrap; }

/* ── Cookie consent ─────────────────────────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 9000;
  flex-wrap: wrap;
  /* Slide up from bottom on small screens */
  transform: translateY(0);
  transition: transform 0.3s;
}
#cookie-banner.dismissed { transform: translateY(110%); }
#cookie-banner p { font-size: 13px; color: var(--muted); max-width: 600px; }
#cookie-banner a { color: var(--accent); }
.cookie-actions { display: flex; gap: 8px; }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 440px;
  width: min(92vw, 440px);
  max-height: min(90vh, 600px);
  overflow-y: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none; border: none;
  color: var(--muted); font-size: 20px;
  cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Stats grid ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-box {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-num  { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-lbl  { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Pro badge ───────────────────────────────────────────────────────────────── */
.pro-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: var(--bg);
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  font-family: var(--font-mono);
}

/* ── Ad container (hidden for pro) ─────────────────────────────────────────── */
.ad-container { margin: 24px 0; min-height: 90px; text-align: center; }
.is-pro .ad-container { display: none; }

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

/* Display font for logo and headings */
.logo, .hero h1, h1 { font-family: var(--font-display); letter-spacing: -0.02em; }
.hero h1 { font-weight: 800; }

@media (max-width: 640px) {
  .site-header { padding: 0 16px; }
  .main-content { padding: 20px 16px; }
  .hero { padding: 40px 16px 32px; }
  #cookie-banner { flex-direction: column; align-items: flex-start; }
  .games-grid { grid-template-columns: 1fr; }
}

/* ── Focus visible (ADA) ────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
