/* =========================================================
   CXC PAST PAPERS — style.css
   Aesthetic: Bold editorial — deep Jamaica green + gold
   Fonts: Syne (display) + DM Sans (body)
   ========================================================= */

:root {
  --green-dark:  #004d1a;
  --green:       #006622;
  --green-mid:   #008c2e;
  --green-light: #00b33c;
  --gold:        #ffd700;
  --gold-muted:  #e6b800;
  --black:       #0a0a0a;
  --ink:         #111;
  --ink-soft:    #333;
  --ink-muted:   #666;
  --surface:     #f5f5f0;
  --surface-2:   #eeeee8;
  --white:       #ffffff;
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.08);
  --shadow-md:   0 6px 24px rgba(0,0,0,.12);
  --shadow-lg:   0 16px 48px rgba(0,0,0,.16);
  --trans:       .18s cubic-bezier(.4,0,.2,1);
}

/* ─── RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { display: block; max-width: 100%; }

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green-dark);
  border-bottom: 2px solid var(--gold);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.6rem; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-main {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--white);
  letter-spacing: -.5px;
}
.logo-sub {
  font-size: .65rem;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}
.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-link {
  padding: 6px 14px;
  border-radius: 20px;
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  font-weight: 500;
  transition: var(--trans);
}
.nav-link:hover {
  background: rgba(255,255,255,.1);
  color: var(--white);
}
.install-btn {
  padding: 7px 16px;
  background: var(--gold);
  color: var(--green-dark);
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  transition: var(--trans);
  flex-shrink: 0;
}
.install-btn:hover { background: var(--gold-muted); transform: translateY(-1px); }

/* ─── HERO ────────────────────────────────────────────────── */
.hero {
  position: relative;
  background: var(--green-dark);
  padding: 60px 20px 0;
  overflow: hidden;
}
.hero-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 80% 20%, rgba(0,180,60,.15) 0%, transparent 50%),
    radial-gradient(circle at 10% 80%, rgba(255,215,0,.08) 0%, transparent 40%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,215,0,.15);
  border: 1px solid rgba(255,215,0,.3);
  color: var(--gold);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
  animation: fadeUp .5s ease both;
}
.hero-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 16px;
  animation: fadeUp .5s .1s ease both;
}
.hero-accent { color: var(--gold); }
.hero-sub {
  color: rgba(255,255,255,.7);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 32px;
  animation: fadeUp .5s .2s ease both;
}

/* Search */
.search-wrap {
  animation: fadeUp .5s .3s ease both;
  margin-bottom: 16px;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 4px 4px 4px 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,.25), 0 0 0 2px rgba(255,215,0,.3);
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}
.search-icon { font-size: 1.1rem; flex-shrink: 0; }
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  color: var(--ink);
  background: transparent;
  padding: 10px 0;
}
.search-box input::placeholder { color: var(--ink-muted); }
.search-clear {
  padding: 8px 12px;
  color: var(--ink-muted);
  font-size: .9rem;
  border-radius: 20px;
  transition: var(--trans);
}
.search-clear:hover { background: var(--surface-2); color: var(--ink); }

/* Quick Filters */
.quick-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp .5s .4s ease both;
  padding-bottom: 32px;
}
.filter-chip {
  padding: 7px 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.7);
  font-size: .82rem;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  transition: var(--trans);
  letter-spacing: .5px;
}
.filter-chip:hover { border-color: var(--gold); color: var(--gold); }
.filter-chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--green-dark);
}

/* Stats Bar */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: rgba(0,0,0,.3);
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 14px 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px;
}
.stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold);
}
.stat-label {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.15);
}

/* Live visitor pulse dot */
#statVisitors::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #00ff7f;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  animation: liveBlip 2s ease-in-out infinite;
  box-shadow: 0 0 6px #00ff7f;
}
@keyframes liveBlip {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}

/* ─── AD SLOTS ────────────────────────────────────────────── */
.ad-slot { width: 100%; overflow: hidden; }
.ad-slot--banner { min-height: 90px; margin: 0; }
.ad-slot--sheet  { min-height: 60px; margin: 0 16px 12px; }
.ad-slot ins { display: block !important; }

/* ─── SECTIONS ────────────────────────────────────────────── */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px;
}
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 28px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: -.5px;
}
.section-count {
  font-size: .85rem;
  color: var(--ink-muted);
  font-weight: 500;
}

/* ─── SUBJECTS GRID ─────────────────────────────────────── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.subject-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp .4s ease both;
}
.subject-card:hover {
  border-color: var(--green-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.subject-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.subject-emoji { font-size: 1.5rem; }
.subject-level-tag {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}
.subject-level-tag.csec {
  background: rgba(0,102,34,.1);
  color: var(--green);
}
.subject-level-tag.cape {
  background: rgba(255,215,0,.2);
  color: var(--gold-muted);
}
.subject-name {
  font-family: 'Syne', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.subject-meta {
  font-size: .78rem;
  color: var(--ink-muted);
}
.subject-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--surface-2);
}
.paper-count {
  font-size: .78rem;
  font-weight: 600;
  color: var(--green);
}
.card-arrow {
  width: 28px;
  height: 28px;
  background: var(--green-dark);
  border-radius: 50%;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  transition: var(--trans);
}
.subject-card:hover .card-arrow {
  background: var(--green-light);
  transform: translateX(3px);
}

/* ─── RECENT PAPERS LIST ─────────────────────────────────── */
.papers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paper-row {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--trans);
  border: 1.5px solid var(--surface-2);
}
.paper-row:hover {
  border-color: var(--green-light);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.paper-type-badge {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--green-dark);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.paper-info { flex: 1; min-width: 0; }
.paper-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.paper-meta {
  font-size: .75rem;
  color: var(--ink-muted);
  margin-top: 3px;
}
.paper-download-btn {
  flex-shrink: 0;
  padding: 7px 16px;
  background: var(--green-dark);
  color: var(--white);
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  transition: var(--trans);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}
.paper-download-btn:hover { background: var(--green-mid); color: var(--white); }
.paper-download-btn.folder-btn { background: var(--gold-muted); color: var(--green-dark); }
.paper-download-btn.folder-btn:hover { background: var(--gold); color: var(--green-dark); }

.share-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: none;
  cursor: pointer;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.share-btn:hover { background: var(--green-dark); color: var(--white); }

.sheet-share {
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(0,102,34,.08);
  color: var(--green);
  border: 1.5px solid rgba(0,102,34,.2);
  font-size: .75rem;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  transition: var(--trans);
}
.sheet-share:hover { background: var(--green-dark); color: var(--white); border-color: var(--green-dark); }

/* ─── ABOUT ───────────────────────────────────────────────── */
.about-section { background: var(--white); border-radius: var(--radius-xl); margin: 0 auto 48px; }
.about-inner { max-width: 1100px; margin: 0 auto; padding: 48px 20px; }
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.about-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px 20px;
}
.about-icon { font-size: 1.8rem; margin-bottom: 12px; }
.about-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: .95rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--green-dark);
}
.about-card p {
  font-size: .83rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ─── BOTTOM SHEET ───────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  backdrop-filter: blur(3px);
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  z-index: 201;
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-height: 78vh;
  width: min(680px, 100vw);
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
}
.bottom-sheet.open { transform: translateX(-50%) translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--surface-2);
  flex-shrink: 0;
}
.sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sheet-subject-icon { font-size: 1.6rem; }
.sheet-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}
.sheet-level-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(0,102,34,.1);
  color: var(--green);
  margin-top: 3px;
}
.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
}
.sheet-close:hover { background: var(--surface); color: var(--ink); }

/* Sheet Year Filters */
.sheet-filters {
  display: flex;
  gap: 7px;
  padding: 9px 16px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  border-bottom: 1px solid var(--surface-2);
}
.sheet-filters::-webkit-scrollbar { display: none; }
.year-chip {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--surface-2);
  color: var(--ink-soft);
  font-size: .8rem;
  font-weight: 600;
  transition: var(--trans);
}
.year-chip:hover { border-color: var(--green-light); color: var(--green); }
.year-chip.active {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--white);
}

/* Sheet Papers */
.sheet-papers {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.empty-state p { font-size: .85rem; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #e8e8e0 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
}
.skeleton-row {
  height: 72px;
  border-radius: var(--radius-md);
}

/* Year groups in sheet */
.year-group { margin-bottom: 4px; }
.year-group-label {
  font-family: 'Syne', sans-serif;
  font-size: .7rem;
  font-weight: 800;
  color: var(--ink-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 8px 4px 5px;
}

/* ─── SHARE SHEET ────────────────────────────────────────── */
.share-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 400; opacity: 0; pointer-events: none;
  transition: opacity .25s ease; backdrop-filter: blur(2px);
}
.share-overlay.open { opacity: 1; pointer-events: all; }

.share-sheet {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  z-index: 401; width: min(480px, 100vw);
  background: var(--white); border-radius: 20px 20px 0 0;
  padding: 0 0 env(safe-area-inset-bottom);
  box-shadow: 0 -8px 32px rgba(0,0,0,.15);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.share-sheet.open { transform: translateX(-50%) translateY(0); }

.share-sheet-handle {
  width: 40px; height: 4px; background: var(--surface-2);
  border-radius: 2px; margin: 12px auto 0;
}
.share-sheet-title {
  font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 800;
  color: var(--ink); text-align: center; padding: 14px 20px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.share-options {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; padding: 12px 20px;
}
.share-option {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; border-radius: var(--radius-md);
  background: var(--surface); border: none; cursor: pointer;
  transition: var(--trans); font-family: 'DM Sans', sans-serif;
}
.share-option:hover { background: var(--surface-2); transform: translateY(-2px); }
.share-option-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.share-option-label { font-size: .72rem; color: var(--ink-soft); font-weight: 500; }

.share-cancel {
  width: calc(100% - 40px); margin: 4px 20px 16px;
  padding: 14px; border-radius: var(--radius-md);
  background: var(--surface-2); border: none;
  font-family: 'Syne', sans-serif; font-size: .9rem; font-weight: 700;
  color: var(--ink-soft); cursor: pointer; transition: var(--trans);
}
.share-cancel:hover { background: var(--surface); color: var(--ink); }

/* ─── TOAST ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── FOOTER ───────────────────────────────────────────── */
.site-footer {
  background: var(--green-dark);
  padding: 32px 20px;
  text-align: center;
  border-top: 2px solid var(--gold);
}
.footer-copy {
  font-family: 'Syne', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 8px;
}
.footer-disc {
  font-size: .72rem;
  color: rgba(255,255,255,.45);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ─── ANIMATIONS ──────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 600px) {
  .header-nav { display: none; }
  .stat { padding: 0 18px; }
  .stat-num { font-size: 1.1rem; }
  .subjects-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .hero { padding: 40px 16px 0; }
  .hero-title { font-size: 1.8rem; }
  .section { padding: 32px 16px; }
  .about-grid { grid-template-columns: 1fr 1fr; }
  .paper-row { padding: 12px 14px; gap: 10px; }
  .paper-download-btn { padding: 6px 12px; font-size: .72rem; }
}
