/*
Theme Name: PaperVault
Theme URI: https://yoursite.lk
Author: PaperVault
Description: Sri Lanka Past Papers Archive Theme
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: papervault
*/

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

:root {
  --sky: #0ea5e9;
  --sky-dark: #0284c7;
  --sky-light: #e0f2fe;
  --navy: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --surface: #f8fafc;
  --white: #ffffff;
  --gold: #f59e0b;
  --green: #10b981;
  --radius: 12px;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--navy);
  background: var(--white);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; }

/* ── TOP BAR ── */
.topbar {
  background: var(--navy);
  color: #94a3b8;
  font-size: 12px;
  padding: 7px 0;
  text-align: center;
}
.topbar a { color: var(--sky); }

/* ── HEADER ── */
#site-header {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 24px;
}
.site-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--sky-dark);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--sky-dark);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
}
.site-logo span { color: var(--navy); }

/* ── NAV ── */
#primary-navigation { display: flex; gap: 4px; flex: 1; }
#primary-navigation ul { list-style: none; display: flex; gap: 4px; }
#primary-navigation ul li { position: relative; }
#primary-navigation ul li a {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px;
  font-size: 14px; font-weight: 500;
  color: var(--slate);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
#primary-navigation ul li:hover > a,
#primary-navigation ul li a:hover {
  background: var(--sky-light);
  color: var(--sky-dark);
}
/* Dropdown */
#primary-navigation ul li ul {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  min-width: 210px;
  padding: 6px;
  z-index: 200;
  flex-direction: column;
}
#primary-navigation ul li:hover > ul { display: flex; }
#primary-navigation ul li ul li a {
  font-size: 13px;
  border-radius: 6px;
  padding: 8px 12px;
}

/* Search in header */
.header-search {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  gap: 8px;
  width: 210px;
  transition: border-color .15s;
}
.header-search:focus-within { border-color: var(--sky); }
.header-search input {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--navy);
  padding: 8px 0; width: 100%;
}
.search-icon { width:16px; height:16px; color: var(--muted); flex-shrink:0; }

.btn-forum {
  background: var(--sky-dark);
  color: white !important;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background .15s;
}
.btn-forum:hover { background: var(--sky) !important; }

/* Hamburger */
.menu-toggle {
  display: none;
  background: none; border: none;
  cursor: pointer; padding: 8px;
  margin-left: auto;
}

/* ── HERO ── */
.hero-section {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 60%, #0c4a6e 100%);
  color: white;
  text-align: center;
  padding: 60px 20px 50px;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(14,165,233,.2);
  border: 1px solid rgba(14,165,233,.35);
  color: #7dd3fc;
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 14px; border-radius: 999px; margin-bottom: 16px;
}
.hero-section h1 {
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 14px;
  max-width: 680px;
  margin-left: auto; margin-right: auto;
}
.hero-section h1 em { color: var(--sky); font-style: normal; }
.hero-section p.hero-desc {
  font-size: 16px; color: #94a3b8;
  max-width: 520px; margin: 0 auto 28px;
}
.hero-search-form {
  display: flex; gap: 8px; justify-content: center;
  max-width: 480px; margin: 0 auto;
}
.hero-search-form input[type="search"] {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  outline: none;
}
.hero-search-form button {
  background: var(--sky-dark);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.hero-search-form button:hover { background: var(--sky); }
.hero-stats {
  display: flex; gap: 32px; justify-content: center;
  margin-top: 32px; flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-num { font-size: 24px; font-weight: 800; color: white; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ── MAIN CONTENT ── */
.site-main { max-width: 1200px; margin: 0 auto; padding: 48px 20px; }
.section-title {
  font-size: 26px; font-weight: 800;
  margin-bottom: 6px;
}
.section-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; }

/* ── GRADE GRID ── */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
  margin-bottom: 48px;
}
.grade-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform .18s, border-color .18s, box-shadow .18s;
  display: block;
}
.grade-card:hover {
  transform: translateY(-4px);
  border-color: var(--sky);
  box-shadow: 0 8px 24px rgba(14,165,233,.15);
}
.grade-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.grade-title { font-size: 13px; font-weight: 700; color: var(--navy); }
.grade-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── PAPER CARDS ── */
.papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}
.paper-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s;
  display: block;
}
.paper-card:hover { box-shadow: 0 8px 28px rgba(0,0,0,.1); border-color: var(--sky); }
.paper-header { padding: 18px 18px 12px; display: flex; align-items: flex-start; gap: 14px; }
.paper-badge {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.paper-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.paper-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.paper-tags { padding: 0 18px 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.paper-tag {
  font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 6px;
  background: var(--sky-light); color: var(--sky-dark);
}
.paper-tag.green { background: #d1fae5; color: #065f46; }
.paper-tag.gold { background: #fef3c7; color: #92400e; }
.paper-footer {
  border-top: 1px solid var(--border);
  padding: 10px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.paper-year { font-size: 12px; color: var(--muted); }
.dl-btn { font-size: 12px; font-weight: 600; color: var(--sky-dark); }
.dl-btn:hover { color: var(--sky); }

/* ── PROVINCE CHIPS ── */
.province-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 48px; }
.province-chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--slate);
  transition: background .15s, border-color .15s, color .15s;
  display: inline-block;
}
.province-chip:hover { background: var(--sky-light); border-color: var(--sky); color: var(--sky-dark); }

/* ── DIVIDER ── */
.section-divider { border: none; border-top: 1.5px solid var(--border); margin: 0; }

/* ── FOOTER ── */
#site-footer {
  background: var(--navy);
  color: #94a3b8;
  padding: 48px 20px 24px;
}
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-logo {
  font-size: 20px; font-weight: 800;
  color: white; margin-bottom: 10px;
}
.footer-desc { font-size: 13px; line-height: 1.7; max-width: 260px; }
.footer-col h4 { color: white; font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.footer-col a {
  display: block; font-size: 13px; color: #94a3b8;
  margin-bottom: 8px; transition: color .15s;
}
.footer-col a:hover { color: var(--sky); }
.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 20px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; flex-wrap: wrap; gap: 12px;
}
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 32px; height: 32px;
  border-radius: 8px; background: #1e293b;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background .15s; color: #94a3b8;
}
.footer-social a:hover { background: var(--sky-dark); color: white; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  #primary-navigation, .header-search { display: none; }
  .menu-toggle { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grade-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 20px; }
  .papers-grid { grid-template-columns: 1fr; }
}

/* ── WORDPRESS DEFAULTS ── */
.wp-block-image { margin: 1em 0; }
.aligncenter { text-align: center; }
