
/* ===============================
   PAST PAPERS – GRID STYLING
================================ */

.past-papers {
  margin-top: 3rem;
}

/* YEAR SECTION */
.year-section {
  margin-bottom: 4rem;
}

.year-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--primary-blue);
  border-bottom: 2px solid var(--primary-blue);
  padding-bottom: 0.5rem;
}

/* PAPER (P1 / P2) */
.paper-section {
  margin-bottom: 3rem;
}

.paper-section h3 {
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
  color: #222;
}

/* PROVINCE GRID */
.province-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

/* PROVINCE CARD */
.province-card {
  background-color: #f9fbff;
  border: 1px solid #e2e6f0;
  border-radius: 10px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.province-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

/* PROVINCE NAME */
.province-card h4 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: #111;
}

/* LINKS */
.province-card a {
  display: inline-block;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  color: var(--primary-blue);
  background-color: #eef3ff;
  transition: background-color 0.15s ease;
}

.province-card a:hover {
  background-color: #dfe8ff;
}

/* MOBILE OPTIMIZATION */
@media (max-width: 600px) {
  .year-section h2 {
    font-size: 1.5rem;
  }

  .paper-section h3 {
    font-size: 1.2rem;
  }
}

/* =========================
   CONTENT READABILITY FIX
   ========================= */

.main-content {
  max-width: 900px;          /* narrower = more readable */
  margin: 3rem auto;
  padding: 0 1.5rem;
}

/* Improve paragraph readability */
.main-content p,
.main-content li {
  font-size: 1rem;
  line-height: 1.75;
  max-width: 750px;
}

/* Section spacing */
.main-content section {
  margin-bottom: 3.5rem;
}

/* Headings hierarchy */
.main-content h1 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  color: var(--primary-blue);
}

.main-content h2 {
  font-size: 1.45rem;
  margin-bottom: 0.75rem;
}

.main-content h3 {
  font-size: 1.2rem;
}

/* Lists */
.main-content ul,
.main-content ol {
  margin-top: 0.75rem;
  padding-left: 1.5rem;
}

.main-content li {
  margin-bottom: 0.5rem;
}

/* =========================
   DROPDOWN MENU (FIXED)
   ========================= */

.dropdown {
  position: relative;
  display: inline-block;
}

/* Button */
.dropdown-btn {
  background: #0bd8df;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
}

/* Dropdown panel */
.dropdown-content {
  position: absolute;
  top: 100%;           /* directly under button */
  left: 0;

  display: none;
  flex-direction: column;

  background-color: #fdfdfd;
  min-width: 200px;

  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);

  z-index: 1000;
}

/* Links */
.dropdown-content a {
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.dropdown-content a:hover {
  background-color: #f1f5f9;
  color: var(--primary-blue);
}

/* ✅ KEY FIX: keep dropdown open when hovering content */
.dropdown:hover .dropdown-content,
.dropdown-content:hover {
  display: flex;
}

/* ===== IMPROVED RESPONSIVE FIXES FOR MOBILE ===== */

/* Base font size adjustment for mobile */
@media (max-width: 768px) {
  html {
    font-size: 14px; /* Smaller base font on mobile */
  }
  
  body {
    font-size: 1rem;
    overflow-x: hidden; /* Prevent horizontal scroll */
  }
  
  /* Adjust hero sections */
  .math-hero,
  .landing-hero,
  .hero {
    padding: 1.5rem 1rem !important;
  }
  
  .math-hero h1,
  .landing-hero h1,
  .hero h2 {
    font-size: 1.8rem !important;
    line-height: 1.2 !important;
  }
  
  .hero-math-subtitle,
  .landing-subtitle,
  .hero p {
    font-size: 1rem !important;
  }
  
  /* Make cards smaller on mobile */
  .topic-card,
  .data-card,
  .prep-card,
  .formula-container,
  .application-scenario {
    padding: 1.2rem !important;
  }
  
  .topic-card h3 {
    font-size: 1.2rem !important;
    min-height: auto !important;
  }
  
  /* Fix progress tracker on mobile */
  .progress-steps {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.5rem !important;
  }
  
  .progress-steps::before {
    display: none !important;
  }
  
  .progress-step {
    min-width: auto !important;
    margin-bottom: 0.5rem;
  }
  
  .step-indicator {
    width: 25px !important;
    height: 25px !important;
    font-size: 0.8rem !important;
  }
  
  .step-label {
    font-size: 0.7rem !important;
  }
  
  /* Adjust tables for mobile */
  .comparison-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  /* Fix grid layouts */
  .topics-grid,
  .data-container,
  .prep-container,
  .resources-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  /* Adjust navigation buttons */
  .math-nav-button {
    padding: 0.8rem !important;
  }
  
  .math-nav-title {
    font-size: 0.9rem !important;
  }
  
  /* Fix breadcrumbs */
  .breadcrumbs {
    font-size: 0.8rem;
    padding: 0.5rem 1rem !important;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Adjust concept tags */
  .concepts-tags-grid {
    gap: 0.5rem !important;
  }
  
  .concept-tag {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.75rem !important;
  }
  
  /* Fix form inputs on mobile */
  input, select, textarea {
    font-size: 16px !important; /* Prevents zoom on focus in iOS */
  }
}

/* Extra small devices (phones under 480px) */
@media (max-width: 480px) {
  html {
    font-size: 13px;
  }
  
  .math-hero h1,
  .landing-hero h1,
  .hero h2 {
    font-size: 1.5rem !important;
  }
  
  .topic-number {
    width: 35px !important;
    height: 35px !important;
    font-size: 1rem !important;
  }
  
  .progress-steps {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .site-header .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .main-nav {
    margin-top: 0.5rem;
    flex-wrap: wrap;
  }
  
  .main-nav a {
    margin-left: 0 !important;
    margin-right: 1rem;
  }
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between; /* logo left, menu right */
  padding: 0.5rem 1rem;
}

.menu-toggle {
  display: none; /* hidden on desktop */
  font-size: 1.8rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* Show button on mobile */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .main-nav {
    display: none; /* hide menu by default on mobile */
    flex-direction: column;
    gap: 0.5rem;
  }

  .main-nav.active {
    display: flex; /* show menu when button is clicked */
  }
}

.menu-toggle {
  z-index: 1001;
  position: relative;
}

.site-header {
  position: relative;
  z-index: 1000;
}

/* Desktop */
.menu-toggle {
  display: none;
}

/* Mobile */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
  }

  .main-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #fff;
  }

  .main-nav.active {
    display: flex;
  }
}
