/* ============================================================
   Mock - public pages (landing, join, privacy, terms, staff login)
   Plain CSS, no Tailwind. The staff/student app keeps styles.css.
   ============================================================ */

:root {
  --emerald: #0E3B2E;     /* hero + staff-login background */
  --cream: #F5F1E8;       /* text/buttons on emerald */
  --sage: #B8CBBF;        /* muted text on emerald */
  --charcoal: #111827;
  --charcoal-hover: #1F2937;
  --gold: #D4AF37;
  --gold-hover: #E0BE4A;
  --text: #374151;
  --muted: #6B7280;        /* muted text on WHITE only */
  --muted-dark: #9CA3AF;   /* muted text on DARK backgrounds */
  --white: #FFFFFF;
  --line: #E5E7EB;
  --error: #B91C1C;

  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --container: 1200px;
  --nav-pad: 48px;         /* navbar side padding: full width, like claude.com */
  --gutter: 24px;
  --radius-btn: 8px;
  --hero-gap: 48px;        /* equal space above and below the hero button row */
}

@media (max-width: 480px) {
  :root { --gutter: 16px; --hero-gap: 32px; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; }
img { max-width: 100%; height: auto; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--charcoal);
  outline-offset: 3px;
  border-radius: 4px;
}
.on-dark :focus-visible,
.contact-pill:focus-visible { outline-color: var(--gold); }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  background: var(--charcoal);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-btn);
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-sm { height: 42px; padding: 0 18px; font-size: 15px; }
.btn-lg { height: 56px; padding: 0 28px; font-size: 17px; }

.btn-dark { background: var(--charcoal); color: var(--white); }
.btn-dark:hover { background: var(--charcoal-hover); }

.btn-outline { background: var(--white); color: var(--charcoal); border-color: var(--charcoal); }
.btn-outline:hover { background: #F3F4F6; }

.btn-gold { background: var(--gold); color: var(--charcoal); }
.btn-gold:hover { background: var(--gold-hover); }

/* Cream-outlined button for dark (emerald) backgrounds */
.btn-ghost-light { background: transparent; color: var(--cream); border-color: var(--cream); }
.btn-ghost-light:hover { background: rgba(245, 241, 232, 0.1); }

/* ---------- Emerald + gold contour background (hero, staff login) ---------- */
.bg-hero {
  position: relative;
  isolation: isolate;
}
.bg-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--emerald);
}
/* Inline SVG of thin gold contour lines (see index.html / staff-login.html).
   preserveAspectRatio="none" stretches it to any width; the strokes use
   vector-effect: non-scaling-stroke so they stay 1px. */
.contours {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Navbar ----------
   Spans the full screen width: logo near the left edge, links + sign-up
   button near the right edge. Side padding 48px desktop, 24px tablet,
   16px phone (--nav-pad). Page content keeps its own --container width.
   Default = dark variant (white pages). .nav--light = on the emerald hero. */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  height: 76px;
  padding: 0 var(--nav-pad);
}
@media (max-width: 1023px) {
  :root { --nav-pad: 24px; }
}
@media (max-width: 767px) {
  :root { --nav-pad: 16px; }
}
.nav-logo { display: inline-flex; flex: none; }
.nav-logo img { height: 36px; width: auto; }

.nav-link {
  padding: 8px 2px;
  color: var(--charcoal);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
}
.nav-link:hover,
.nav-link[aria-current="page"] { text-decoration-line: underline; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-cta { background: var(--charcoal); color: var(--white); }
.nav-cta:hover { background: var(--charcoal-hover); }

.nav--light .nav-link { color: var(--cream); }
.nav--light .nav-cta { background: var(--cream); color: var(--charcoal); }
.nav--light .nav-cta:hover { background: #FFFFFF; }
.nav--light .nav-toggle { color: var(--cream); }
.nav--light :focus-visible { outline-color: var(--gold); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--charcoal);
  cursor: pointer;
}
.nav-toggle svg { width: 24px; height: 24px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

.mobile-menu {
  position: absolute;
  top: 64px;
  left: var(--nav-pad);
  right: var(--nav-pad);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.18);
}
.mobile-menu .nav-link {
  padding: 14px 12px;
  border-radius: var(--radius-btn);
  font-size: 16px;
}
.mobile-menu .nav-link:hover { background: #F3F4F6; text-decoration: none; }
.mobile-menu .btn { margin: 8px 4px 4px; }

@media (max-width: 767px) {
  .nav { height: 64px; }
  .nav-logo img { height: 32px; }
  .nav-right { display: none; }
  .nav-toggle { display: inline-flex; }
}
@media (min-width: 768px) {
  .mobile-menu { display: none !important; }
}

/* ---------- Hero ---------- */
.hero-content {
  padding-top: 56px;
  text-align: center;
}
.hero-title {
  margin: 0;
  color: var(--cream);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(36px, 3.33vw + 24px, 72px);   /* 36px at 360, 72px at 1440 */
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-title .line { display: block; }
.hero-sub {
  max-width: 640px;
  margin: 24px auto 0;
  color: var(--sage);
  font-size: clamp(17px, 0.4vw + 15px, 20px);
  font-weight: 500;
}
.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: var(--hero-gap);
}

/* Mockup bridge: one image, emerald behind its top half, white behind the
   bottom half (the white layer sits above the hero's emerald + contours). */
.hero-mockup {
  position: relative;
  z-index: 0;
  padding: 0 var(--gutter);
  /* The PNG has a transparent shadow margin above the card (2.13% of the
     image width), so the visible gap below the buttons equals --hero-gap. */
  margin-top: calc(var(--hero-gap) - min(1126px, 100% - 2 * var(--gutter)) * 0.0213);
}
.hero-mockup::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  bottom: 0;
  z-index: -1;
  background: var(--white);
}
.hero-mockup img {
  width: 100%;
  max-width: 1126px;
  margin: 0 auto;
}

@media (max-width: 767px) {
  .hero-content { padding-top: 32px; }
  .hero-actions {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .hero-actions .btn { width: 100%; max-width: 360px; }
  /* Less of the phone-sized mockup sits on the emerald. */
  .hero-mockup::before { top: 40%; }
}

/* ---------- Sections ---------- */
.section { scroll-margin-top: 24px; }
.section-head {
  max-width: 720px;
  margin: 0 auto 56px;
  text-align: center;
}
.section-title {
  margin: 0;
  color: var(--charcoal);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(30px, 1.6vw + 22px, 44px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.section-sub {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
}

/* ---------- Features ---------- */
.features { padding: 56px 0 72px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 48px 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Every item starts with the same 48px icon, so icons and titles share
   one baseline across the row. */
.feature { display: flex; flex-direction: column; align-items: flex-start; }
.feature-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--charcoal);
  color: var(--white);
}
.feature-icon svg { width: 24px; height: 24px; }
.feature-title {
  margin: 20px 0 8px;
  color: var(--charcoal);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.feature-text {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

@media (max-width: 1023px) {
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .feature-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
}

/* ---------- How it works ---------- */
.how { padding: 72px 0 104px; }

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Connector: from the centre of step 1 to the centre of step 3. */
.steps::before {
  content: "";
  position: absolute;
  top: 23px;
  left: calc((100% - 64px) / 6);
  right: calc((100% - 64px) / 6);
  height: 2px;
  background: var(--line);
}
.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.step-num {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--charcoal);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 0 0 8px var(--white);
}
.step-title {
  margin: 24px 0 8px;
  color: var(--charcoal);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.step-text {
  max-width: 300px;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

@media (max-width: 767px) {
  .how { padding: 56px 0 80px; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .steps::before { display: none; }
}

/* ---------- Footer conversion block ---------- */
.footer {
  background: var(--charcoal);
  color: var(--white);
}
.cta {
  max-width: 1080px;
  margin: 0 auto;
  padding: 88px var(--gutter) 72px;
  text-align: center;
}
.cta-title {
  margin: 0;
  color: var(--white);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(30px, 1.6vw + 21px, 44px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.cta-sub {
  max-width: 600px;
  margin: 20px auto 0;
  color: var(--muted-dark);
  font-size: 18px;
}
.cta .btn { margin-top: 36px; }
.cta-note {
  margin: 16px 0 0;
  color: var(--muted-dark);
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 767px) {
  .cta { padding: 64px var(--gutter) 56px; }
  .cta .btn { white-space: normal; height: auto; min-height: 56px; padding: 16px 24px; line-height: 1.3; }
}

/* ---------- Legal strip ---------- */
.legal { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.legal-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 24px;
  padding-bottom: 24px;
  color: var(--muted-dark);
  font-size: 14px;
}
.legal-links { display: flex; gap: 24px; }
.legal-brand { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px; }
.flag-ke { flex: none; display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.legal a {
  color: var(--muted-dark);
  text-decoration: none;
  text-underline-offset: 4px;
}
.legal a:hover { color: var(--white); text-decoration: underline; }

@media (max-width: 480px) {
  .legal-inner { flex-direction: column; justify-content: center; text-align: center; }
}

/* ---------- Floating contact ---------- */
.contact {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.contact.is-tucked {
  opacity: 0;
  visibility: hidden;
}
.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--charcoal);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.28);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.contact-pill:hover { background: var(--charcoal-hover); }

.contact-card {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 24px;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 56px rgba(17, 24, 39, 0.22), 0 2px 8px rgba(17, 24, 39, 0.08);
  animation: card-in 0.16s ease-out;
}
.contact-card:focus { outline: none; }
.contact-card:focus-visible { outline: 3px solid var(--charcoal); outline-offset: 3px; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.contact-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.contact-close:hover { background: #F3F4F6; color: var(--charcoal); }
.contact-close svg { width: 18px; height: 18px; }

.contact-title {
  margin: 0 40px 0 0;
  color: var(--charcoal);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}
.contact-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.contact-list {
  display: grid;
  gap: 14px;
  margin: 20px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}
.contact-item { display: flex; align-items: flex-start; gap: 12px; }
.contact-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F3F4F6;
  color: var(--charcoal);
}
.contact-icon svg { width: 18px; height: 18px; }
.contact-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.contact-value {
  color: var(--charcoal);
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
a.contact-value { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(17, 24, 39, 0.3); }
a.contact-value:hover { text-decoration-color: var(--charcoal); }

@media (max-width: 480px) {
  .contact { right: 16px; bottom: 16px; }
}

/* ---------- Simple pages (join, privacy, terms) ---------- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.page-main { flex: 1; }

.page-header {
  position: relative;          /* anchors the mobile menu */
  border-bottom: 1px solid var(--line);
}

.placeholder {
  max-width: 640px;
  margin: 0 auto;
  padding: 96px var(--gutter) 120px;
  text-align: center;
}
.placeholder h1 {
  margin: 0;
  color: var(--charcoal);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(34px, 2vw + 24px, 52px);
  line-height: 1.15;
}
.placeholder p { margin: 16px 0 0; color: var(--muted); font-size: 18px; }
.placeholder .btn { margin-top: 32px; }

/* Join (student login) */
.join-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px var(--gutter) 64px;
}
.join-card {
  width: 100%;
  max-width: 440px;
  padding: 40px 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 56px rgba(17, 24, 39, 0.14), 0 2px 8px rgba(17, 24, 39, 0.06);
}
.join-title {
  margin: 0;
  color: var(--charcoal);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.15;
  text-align: center;
}
.join-sub {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}
.field + .field { margin-top: 16px; }
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 600;
}
.field-input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1.5px solid #D1D5DB;
  border-radius: var(--radius-btn);
  background: var(--white);
  color: var(--charcoal);
  font-family: var(--font-sans);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input::placeholder { color: #9CA3AF; }
.field-input:focus {
  outline: none;
  border-color: var(--charcoal);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.15);
}
.field-input.is-code { text-transform: uppercase; letter-spacing: 0.08em; }
.field-input.is-code::placeholder { text-transform: none; letter-spacing: 0; }

/* auth.js shows/hides #login-error with style.display */
.join-error {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #FECACA;
  border-radius: var(--radius-btn);
  background: #FEF2F2;
  color: var(--error);
  font-size: 14px;
  line-height: 1.45;
}
.join-submit { width: 100%; margin-top: 24px; }
.join-submit:disabled { opacity: 0.75; cursor: wait; }

.spinner {
  width: 20px;
  height: 20px;
  margin: 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.join-note {
  margin: 24px 0 0;
  color: var(--text);
  font-size: 14px;
  text-align: center;
}
.join-note a { color: var(--charcoal); font-weight: 600; text-underline-offset: 3px; }

@media (max-width: 480px) {
  .join-main { padding-top: 24px; }
  .join-card { padding: 32px 20px; }
  .join-title { font-size: 30px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* A loading indicator is essential motion: keep it, slower. */
  .spinner {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }
}
