/* ============================================================
   Senivly Seniors Games — Main Stylesheet
   Mobile-first, WCAG AA contrast, large readable fonts
   ============================================================ */

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

:root {
  --primary:       #2d6a4f;
  --primary-light: #52b788;
  --primary-pale:  #d8f3dc;
  --secondary:     #d4a017;
  --secondary-pale:#fff3cd;
  --bg:            #f8f6f1;
  --bg-card:       #ffffff;
  --text:          #1a1a1a;
  --text-muted:    #5a5a5a;
  --border:        #ddd;
  --danger:        #c0392b;
  --success:       #27ae60;
  --radius:        14px;
  --radius-lg:     24px;
  --shadow:        0 2px 12px rgba(0,0,0,.08);
  --shadow-hover:  0 6px 24px rgba(0,0,0,.14);
  --font-body:     'Nunito', Arial, sans-serif;
  --font-serif:    Georgia, 'Times New Roman', serif;
  --nav-h:         72px;
}

html { scroll-behavior: smooth; font-size: 18px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
a:hover, a:focus { color: var(--primary-light); }
ul { list-style: none; }

/* --- Skip Link --- */
.skip-link {
  position: absolute; top: -100px; left: 0; padding: 8px 16px;
  background: var(--primary); color: #fff; z-index: 9999;
  border-radius: 0 0 var(--radius) 0; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* --- Container --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- Header --- */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: var(--bg-card);
  border-bottom: 2px solid var(--primary-pale);
  box-shadow: var(--shadow);
  height: var(--nav-h);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.site-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
}
.logo-icon { font-size: 2rem; }
.logo-text { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.logo-sub { font-weight: 400; color: var(--text-muted); display: block; font-size: .9rem; }

/* Nav */
.main-nav ul {
  display: flex; gap: 4px; align-items: center;
}
.main-nav a {
  display: block; padding: 8px 14px; border-radius: var(--radius);
  text-decoration: none; font-size: .95rem; font-weight: 600; color: var(--text-muted);
  transition: background .2s, color .2s;
}
.main-nav a:hover, .main-nav a.active { background: var(--primary-pale); color: var(--primary); }
.main-nav a[aria-current="page"] { color: var(--primary); font-weight: 700; }

/* Hamburger */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.hamburger span { display: block; width: 26px; height: 3px; background: var(--text); border-radius: 2px; transition: all .3s; }

/* Mobile nav */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .main-nav {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg-card); border-bottom: 2px solid var(--primary-pale);
    box-shadow: var(--shadow); z-index: 199;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: 12px 20px 20px; gap: 0; }
  .main-nav a { font-size: 1.1rem; padding: 12px 16px; }
}

/* --- Breadcrumb --- */
.breadcrumb-bar { background: var(--primary-pale); padding: 10px 0; font-size: .9rem; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.breadcrumb li { color: var(--text-muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-muted); }

/* --- Buttons --- */
.btn {
  display: inline-block; padding: 14px 28px; border-radius: var(--radius);
  font-size: 1.05rem; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: all .2s; line-height: 1.2;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1b4332; border-color: #1b4332; color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-pale); }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-sm { padding: 9px 18px; font-size: .9rem; }
.btn-lg { padding: 18px 38px; font-size: 1.2rem; border-radius: 50px; }
.btn-block { display: block; width: 100%; text-align: center; }

/* --- Hero --- */
.hero {
  background: linear-gradient(135deg, var(--primary-pale) 0%, #fff 70%);
  padding: 64px 0 56px;
  text-align: center;
  border-bottom: 3px solid var(--primary-pale);
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--text); line-height: 1.2; margin-bottom: 16px;
}
.hero h1 span { color: var(--primary); }
.hero .subtitle {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--text-muted); max-width: 620px; margin: 0 auto 32px;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* --- Section --- */
.section { padding: 56px 0; }
.section-alt { background: var(--primary-pale); }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; gap: 12px; flex-wrap: wrap;
}
.section-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.section-center { text-align: center; margin-bottom: 40px; }
.section-center h2 { font-family: var(--font-serif); font-size: clamp(1.5rem, 3vw, 2rem); }
.section-center p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 10px auto 0; }

/* --- Grid --- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* --- Game Card --- */
.game-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 2px solid var(--border); overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex; flex-direction: column;
  text-decoration: none; color: var(--text);
}
.game-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); color: var(--text); }
.game-card-thumb {
  aspect-ratio: 16/9; overflow: hidden; background: var(--primary-pale);
  display: flex; align-items: center; justify-content: center; font-size: 4rem;
}
.game-card-thumb img { width: 100%; height: 100%; object-fit: cover; loading: lazy; }
.game-card-body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.game-card-title { font-weight: 800; font-size: 1.1rem; font-family: var(--font-serif); }
.game-card-desc { color: var(--text-muted); font-size: .95rem; line-height: 1.5; flex: 1; }
.game-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--text-muted); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 50px;
  font-size: .8rem; font-weight: 700;
}
.badge-easy { background: var(--primary-pale); color: var(--primary); }
.badge-cat  { background: var(--secondary-pale); color: #7a5800; }
.game-card .btn { margin-top: 12px; }

/* --- Category Card --- */
.cat-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 2px solid var(--border); padding: 28px 20px;
  text-align: center; text-decoration: none; color: var(--text);
  transition: box-shadow .2s, transform .2s; display: flex;
  flex-direction: column; align-items: center; gap: 12px;
}
.cat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); color: var(--text); }
.cat-icon { font-size: 2.8rem; }
.cat-name { font-weight: 800; font-size: 1.1rem; }
.cat-count { font-size: .9rem; color: var(--text-muted); }

/* --- Leaderboard --- */
.leaderboard-table {
  width: 100%; border-collapse: collapse; background: var(--bg-card);
  border-radius: var(--radius-lg); overflow: hidden; border: 2px solid var(--border);
}
.leaderboard-table th {
  background: var(--primary); color: #fff; padding: 14px 16px;
  text-align: left; font-size: 1rem; font-weight: 700;
}
.leaderboard-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 1rem; }
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:nth-child(even) td { background: var(--bg); }
.leaderboard-table tbody tr:hover td { background: var(--primary-pale); }
.rank-1 { color: #d4a017; font-weight: 800; font-size: 1.2rem; }
.rank-2 { color: #95a5a6; font-weight: 700; }
.rank-3 { color: #ca6f1e; font-weight: 700; }
.score-badge {
  background: var(--primary-pale); color: var(--primary);
  padding: 4px 12px; border-radius: 50px; font-weight: 700; font-size: .95rem;
}
.leaderboard-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.tab-btn {
  padding: 10px 20px; border-radius: 50px; border: 2px solid var(--primary);
  background: transparent; color: var(--primary); font-weight: 700; cursor: pointer;
  font-size: .95rem; transition: all .2s;
}
.tab-btn.active, .tab-btn:hover { background: var(--primary); color: #fff; }
.leaderboard-empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 1.1rem; }

/* --- Game Detail --- */
.game-embed {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 2px solid var(--border); padding: 16px;
  margin-bottom: 28px; min-height: 320px;
}
.game-embed iframe { width: 100%; min-height: 480px; border: none; border-radius: var(--radius); }
.how-to-play {
  background: var(--primary-pale); border-radius: var(--radius-lg);
  padding: 28px; margin-bottom: 28px;
}
.how-to-play h3 { font-family: var(--font-serif); font-size: 1.4rem; margin-bottom: 14px; }
.how-to-play ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.how-to-play li { font-size: 1.05rem; }

/* --- Why section --- */
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.why-card { text-align: center; padding: 28px 20px; }
.why-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-pale); display: flex; align-items: center;
  justify-content: center; font-size: 2.2rem; margin: 0 auto 16px;
}
.why-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.why-card p { color: var(--text-muted); font-size: 1rem; }

/* --- Forms --- */
.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 1rem; }
.form-control {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: var(--radius); font-size: 1.05rem; font-family: var(--font-body);
  background: var(--bg-card); color: var(--text); transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,106,79,.15); }
textarea.form-control { resize: vertical; min-height: 140px; }
select.form-control { cursor: pointer; }
.form-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 2px solid var(--border); padding: 36px; max-width: 640px;
}
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 1rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* --- Pagination --- */
.pagination { margin: 40px 0; }
.pagination ul { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 12px;
  border-radius: var(--radius); border: 2px solid var(--border);
  text-decoration: none; font-weight: 700; font-size: 1rem;
  color: var(--primary); background: var(--bg-card); transition: all .2s;
}
.pagination .active a, .pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- FAQ --- */
.faq-item { border-bottom: 2px solid var(--border); }
.faq-question {
  width: 100%; text-align: left; background: none; border: none;
  padding: 22px 0; font-size: 1.1rem; font-weight: 700; cursor: pointer;
  color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-question::after { content: '+'; font-size: 1.5rem; color: var(--primary); flex-shrink: 0; }
.faq-question.open::after { content: '−'; }
.faq-answer { display: none; padding: 0 0 20px; color: var(--text-muted); font-size: 1.05rem; line-height: 1.7; }
.faq-answer.open { display: block; }

/* --- Legal pages --- */
.legal-content h2 { font-family: var(--font-serif); font-size: 1.5rem; margin: 32px 0 12px; color: var(--text); }
.legal-content p, .legal-content li { font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 12px; }
.legal-content ul { padding-left: 20px; list-style: disc; }
.legal-content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: .95rem; }
.legal-content th, .legal-content td { padding: 10px 14px; border: 1px solid var(--border); }
.legal-content th { background: var(--primary-pale); font-weight: 700; }

/* --- Footer --- */
.site-footer { background: #1b2e26; color: #ccc; padding-top: 48px; margin-top: 64px; }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
  padding-bottom: 40px; border-bottom: 1px solid #2d4a3c;
}
.footer-logo { font-size: 1.2rem; color: #fff; margin-bottom: 10px; }
.footer-tagline { font-size: .95rem; line-height: 1.6; margin-bottom: 8px; }
.footer-parent { font-size: .9rem; }
.footer-parent a { color: var(--primary-light); }
.footer-col h3 { color: #fff; font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: #aaa; text-decoration: none; font-size: .95rem; transition: color .2s; }
.footer-col a:hover { color: var(--primary-light); }
.footer-bottom { padding: 20px 0; }
.footer-bottom p { font-size: .85rem; color: #888; text-align: center; margin-bottom: 6px; }
.footer-disclaimer { max-width: 800px; margin: 0 auto; line-height: 1.6; }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-40 { margin-bottom: 40px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 14px; }
.empty-state h3 { font-size: 1.4rem; margin-bottom: 8px; }

/* --- Responsive --- */
@media (max-width: 640px) {
  html { font-size: 16px; }
  .hero { padding: 40px 0 36px; }
  .section { padding: 40px 0; }
  .form-card { padding: 22px; }
  .leaderboard-table th, .leaderboard-table td { padding: 10px 10px; font-size: .9rem; }
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .breadcrumb-bar, .btn { display: none; }
}
