/* ============================================
   CBCResources — Design tokens
   Direction: the look of an official Kenyan curriculum document —
   bond paper, gazette-style rules, a stamped reference number —
   not a generic "friendly schoolbook" cream page.
   ============================================ */

:root {
  --ink:        #16211C;   /* near-black, cool undertone — official document ink */
  --ink-soft:   #57655E;   /* secondary text */
  --paper:      #F1EFE6;   /* bond-paper ivory — cooler and greyer than a warm cream */
  --paper-2:    #E6E2D3;   /* deeper paper, for cards resting on the page */
  --green:      #163C2E;   /* deep bottle green — the brand anchor, kept and deepened */
  --green-dark: #0E2A20;
  --ochre:      #8C6A2F;   /* muted brass, not orange — a stamp/seal tone, not a "warm accent" */
  --ochre-soft: #E9E0C9;
  --line:       #CFC9B4;   /* hairline rule, like a ruled exercise book or gazette column */
  --white:      #FFFFFF;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4rem;
  --space-8: 6rem;
  --space-9: 8rem;

  /* Sharper radii for structural elements, softer for things you tap —
     creates real hierarchy instead of one rounding applied everywhere */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 1px rgba(22, 33, 28, 0.05), 0 3px 10px rgba(22, 33, 28, 0.05);
  --shadow-lift: 0 8px 24px rgba(22, 33, 28, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

:focus-visible {
  outline: 2px solid var(--ochre);
  outline-offset: 3px;
}

/* ============================================
   Type
   ============================================ */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 900; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
h3 { font-size: 1.15rem; font-weight: 700; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  margin-bottom: var(--space-2);
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
}
.eyebrow::before {
  content: "§";
  color: var(--ochre);
  font-weight: 700;
}

.section-head { max-width: 640px; margin-bottom: var(--space-6); }
.section-head h2 { margin-top: var(--space-1); }

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--green);
  color: var(--white);
  box-shadow: var(--shadow-card);
}
.btn-primary:hover { background: #163d2f; box-shadow: var(--shadow-lift); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper-2); }

.btn-block { width: 100%; }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }

/* ============================================
   Header
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 243, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo-mark {
  background: var(--green);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
}

.main-nav { display: flex; gap: var(--space-5); }
.main-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}
.main-nav a:hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 8px;
}
.menu-toggle span { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ============================================
   Hero
   ============================================ */

.hero { padding: var(--space-8) 0 var(--space-7); overflow: hidden; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-7);
  align-items: center;
}

.hero h1 { color: var(--ink); }
.hero h1 .dot { color: var(--ochre); }

.hero-sub {
  margin-top: var(--space-4);
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 46ch;
}

.hero-search {
  margin-top: var(--space-5);
  display: flex;
  gap: 0.5rem;
  background: var(--white);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}

.hero-select, .hero-search input {
  border: none;
  background: transparent;
  padding: 0.7rem 0.8rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
}
.hero-select { border-right: 1px solid var(--line); flex: 0 0 auto; }
.hero-search input { flex: 1; min-width: 0; }
.hero-search input:focus, .hero-select:focus { outline: none; }

.hero-note {
  margin-top: var(--space-3);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Hero visual — stacked "paper" cards */
.hero-visual { position: relative; height: 420px; }

.paper-stack { position: relative; width: 100%; height: 100%; }

.paper-card {
  position: absolute;
  width: 78%;
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  padding: var(--space-4);
}

.card-3 { top: 0; left: 22%; opacity: 0.55; transform: rotate(4deg); }
.card-2 { top: 70px; left: 10%; opacity: 0.8; transform: rotate(-2deg); }
.card-1 { top: 150px; left: 0; transform: rotate(1deg); }

.paper-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-3);
  border-bottom: 1px dashed var(--line);
}
.paper-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--green);
}
.paper-marks {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ochre);
}

.paper-lines span {
  display: block;
  height: 8px;
  background: var(--paper-2);
  border-radius: 3px;
  margin-bottom: 8px;
}
.paper-lines span.short { width: 60%; }

.paper-check {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
}

/* ============================================
   Trust strip
   ============================================ */

.trust-strip {
  background: var(--green);
  padding: var(--space-4) 0;
}
.trust-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}
.trust-item {
  display: flex;
  flex-direction: column;
  color: var(--white);
  text-align: center;
}
.trust-item strong { font-family: var(--font-display); font-size: 1.3rem; }
.trust-item span { font-size: 0.78rem; color: #C9D9CD; margin-top: 2px; }

/* ============================================
   Browse — level cards
   ============================================ */

.browse { padding: var(--space-8) 0; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.level-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.level-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--green);
}
.level-range {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ochre);
  letter-spacing: 0.03em;
}
.level-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.level-arrow { margin-top: var(--space-2); color: var(--ink-soft); }

/* ============================================
   How it works
   ============================================ */

.how { padding: var(--space-8) 0; background: var(--paper-2); }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.how-step { position: relative; padding-top: var(--space-5); border-top: 2px solid var(--green); }
.how-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  display: block;
  margin-bottom: var(--space-2);
}
.how-step h3 { margin-bottom: var(--space-2); }
.how-step p { color: var(--ink-soft); font-size: 0.95rem; }

/* ============================================
   Pricing
   ============================================ */

.pricing { padding: var(--space-8) 0; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  max-width: 760px;
}

.price-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
}

.price-card-featured {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}
.price-card-featured h3 { color: var(--white); }
.price-card-featured .price-amount span { color: #C9D9CD; }
.price-card-featured ul li { color: #E4EEE6; }
.price-card-featured ul li::before { color: var(--ochre); }

.price-badge {
  position: absolute;
  top: -12px;
  right: var(--space-4);
  background: var(--ochre);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
}

.price-amount { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; }
.price-amount span { font-size: 1rem; font-weight: 500; color: var(--ink-soft); }

.price-card ul { display: flex; flex-direction: column; gap: 0.6rem; margin: var(--space-2) 0; }
.price-card ul li {
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding-left: 1.4rem;
  position: relative;
}
.price-card ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ============================================
   CTA
   ============================================ */

.cta { padding: var(--space-8) 0; }
.cta-inner {
  background: var(--ink);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.cta-inner h2 { color: var(--white); }

/* ============================================
   Footer
   ============================================ */

.site-footer { background: var(--paper-2); border-top: 1px solid var(--line); padding-top: var(--space-7); }

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-6);
  padding-bottom: var(--space-6);
}

.footer-brand p { margin-top: var(--space-2); color: var(--ink-soft); font-size: 0.9rem; max-width: 26ch; }

.footer-links { display: flex; gap: var(--space-7); }
.footer-col { display: flex; flex-direction: column; gap: 0.6rem; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.footer-col a { font-size: 0.9rem; color: var(--ink-soft); transition: color 0.15s ease; }
.footer-col a:hover { color: var(--ink); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding: var(--space-4) 0;
}
.footer-bottom p { font-size: 0.82rem; color: var(--ink-soft); }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { height: 320px; order: -1; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .how-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .trust-inner { grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
  .pricing-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: var(--space-5); }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .menu-toggle { display: flex; }
  .btn-ghost { display: none; }
  .hero-search { flex-wrap: wrap; }
  .hero-select { border-right: none; border-bottom: 1px solid var(--line); flex: 1 1 100%; }
  .hero-search input { flex: 1 1 100%; }
  .hero-search .btn { width: 100%; }
}

@media (max-width: 480px) {
  .level-grid { grid-template-columns: 1fr; }
  .trust-inner { grid-template-columns: 1fr 1fr; }
}

/* ============================================
   Modern resource list — overrides the older flat row design
   used on Home's content page and Teacher's Resource Library
   ============================================ */

.resource-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: var(--space-3) !important;
  background: var(--white) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-md) !important;
  padding: var(--space-4) !important;
  flex-wrap: nowrap !important;
  box-shadow: 0 1px 2px rgba(27, 43, 34, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.resource-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
  border-color: #C9D9CD;
}
.resource-info { display: flex !important; align-items: center !important; gap: var(--space-3) !important; min-width: 0; flex: 1; }
.resource-icon {
  width: 46px !important; height: 46px !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  background: linear-gradient(135deg, var(--paper-2), var(--paper)) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  font-size: 1.3rem !important;
  flex-shrink: 0 !important;
}
.resource-title { font-weight: 700 !important; font-size: 0.98rem !important; color: var(--ink); }
.resource-meta { font-family: var(--font-mono) !important; font-size: 0.72rem !important; color: var(--ink-soft) !important; margin-top: 0.25rem !important; letter-spacing: 0.01em; }

/* Small classification tags — reads like a stamped reference code on an
   exam paper, e.g. [GR.3] [TERM 2], rather than a plain dot-joined caption */
.meta-tags { display: inline-flex; gap: 0.35rem; margin-top: 0.3rem; flex-wrap: wrap; }
.meta-tag {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 3px; padding: 0.1rem 0.4rem;
  background: var(--paper);
}

@media (max-width: 560px) {
  .resource-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
  }
  .resource-info { width: 100%; }
  .resource-row .btn,
  .resource-row .lock-badge {
    width: 100%;
    text-align: center;
    margin-top: 0.4rem;
  }
}

/* ============================================
   Responsive — applies site-wide, covers Home, Teacher, and Admin pages
   (these grid/layout class names are reused across many separate files,
   so fixing them once here fixes every page that uses them)
   ============================================ */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr !important; }
  .tool-grid,
  .action-grid,
  .subject-grid,
  .stat-grid,
  .grade-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .field-row { grid-template-columns: 1fr !important; }
  .header-inner { flex-wrap: wrap; gap: var(--space-2); height: auto; padding: var(--space-2) 0; }
}

@media (max-width: 600px) {
  .tool-grid,
  .action-grid,
  .subject-grid,
  .stat-grid,
  .grade-grid,
  .role-grid { grid-template-columns: 1fr !important; }
  .content-table,
  .grades-table,
  .attendance-table,
  .users-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .wrap { padding: 0 var(--space-3); }
  h1 { font-size: clamp(1.6rem, 6vw, 2.2rem) !important; }
  .certificate { padding: var(--space-5) var(--space-3) !important; }
  .cert-name { font-size: 1.5rem !important; }
}
