/* ==========================================================================
   TechEase Stay Safe Online — design tokens & shared styles
   Palette pulled from techeasefl.org's own CSS custom properties.
   ========================================================================== */

:root {
  --primary: #0079b8;
  --primary-dark: #005f92;
  --primary-light: #e6f3fa;
  --accent: #00b8a1;
  --accent-dark: #009686;
  --background: #f9fafb;
  --foreground: #0e171e;
  --card: #ffffff;
  --muted: #e5ecf1;
  --muted-foreground: #55636e;
  --secondary: #ecf3f8;
  --destructive: #b3121a;
  --destructive-light: #fbe9e9;
  --border: #dde5ea;
  --ring: #0079b8;

  --font-sans: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(14, 23, 30, 0.06);
  --shadow: 0 4px 16px rgba(14, 23, 30, 0.08);
  --shadow-lg: 0 12px 40px rgba(14, 23, 30, 0.14);

  --container: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #0099e4;
    --primary-dark: #0079b8;
    --primary-light: #10202b;
    --accent: #00cab1;
    --accent-dark: #00a892;
    --background: #060c11;
    --foreground: #f2f6f8;
    --card: #10171c;
    --muted: #19232a;
    --muted-foreground: #9db0bb;
    --secondary: #19232a;
    --destructive: #ff5a5f;
    --destructive-light: #2a1416;
    --border: #232f37;
    --ring: #0099e4;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
.text-gradient {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

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

.skip-link {
  position: absolute; left: 12px; top: -60px; background: var(--primary);
  color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  z-index: 1000; transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 1rem; font-weight: 600;
  padding: 14px 26px; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  line-height: 1;
}
.btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #04231e; box-shadow: var(--shadow); }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 18px 34px; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* ---------- Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: var(--container); margin: 0 auto;
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--foreground); }
.nav-brand img { width: 40px; height: 40px; object-fit: contain; }
.nav-brand-text { line-height: 1.15; }
.nav-brand-text strong { display: block; font-size: 1.05rem; }
.nav-brand-text span { display: block; font-size: 0.78rem; color: var(--muted-foreground); }
.nav-links { display: flex; align-items: center; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  position: relative; color: var(--foreground); text-decoration: none;
  font-weight: 600; font-size: 0.98rem; padding-bottom: 4px;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--primary); border-radius: 2px;
  transform: scaleX(0); transform-origin: left; transition: transform 0.25s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--primary); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-actions { display: flex; align-items: center; gap: 14px; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span, .nav-toggle::before, .nav-toggle::after {
  content: ""; display: block; width: 24px; height: 2.5px; background: var(--foreground); margin: 5px 0; border-radius: 2px;
}

@media (max-width: 860px) {
  .nav-links { position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: flex-start;
    background: var(--card); padding: 20px 24px; gap: 18px; border-bottom: 1px solid var(--border);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    box-shadow: var(--shadow);
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav-toggle { display: block; }
  .nav-actions .btn-outline { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 90px 24px 100px;
  background: radial-gradient(circle at 85% 15%, var(--primary-light), var(--background) 65%);
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 52px; align-items: center;
}
.hero-copy { text-align: left; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; background: var(--secondary);
  color: var(--primary); border-radius: 999px; padding: 7px 16px; font-weight: 700;
  font-size: 0.85rem; margin-bottom: 22px; border: 1px solid var(--border);
}
.hero h1 { margin-bottom: 18px; }
.hero-lead { font-size: 1.15rem; color: var(--muted-foreground); max-width: 520px; margin: 0 0 34px; }
.hero-ctas { display: flex; justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { text-align: center; margin: 0 auto; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-ctas { justify-content: center; }
  .hero-media { margin-top: 36px; }
  .hero-media img { aspect-ratio: 16 / 10; }
}

@media (max-width: 640px) {
  .hero { padding: 60px 20px 70px; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
}

/* ---------- Sections ---------- */
section { padding: 84px 0; }
.section-head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.section-head p { color: var(--muted-foreground); font-size: 1.08rem; }
.eyebrow { color: var(--accent-dark); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.82rem; }

.about-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center;
}
.about-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px; box-shadow: var(--shadow);
}
.about-photo {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 24px;
}
.stat-row { display: flex; gap: 28px; margin-top: 24px; flex-wrap: wrap; }
.stat { min-width: 120px; }
.stat strong { display: block; font-size: 1.8rem; color: var(--primary); }
.stat span { color: var(--muted-foreground); font-size: 0.92rem; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
}

/* ---------- Threat cards ---------- */
.threat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.threat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.threat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.threat-card .icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--secondary); font-size: 1.4rem; margin-bottom: 16px;
  transition: transform 0.25s ease;
}
.threat-card:hover .icon { transform: scale(1.12) rotate(-4deg); }
.threat-card h3 { margin-bottom: 8px; font-size: 1.1rem; }
.threat-card p { color: var(--muted-foreground); font-size: 0.98rem; margin-bottom: 0; }

.stat-callout {
  margin-top: 36px; background: var(--secondary); border-radius: var(--radius);
  padding: 22px 28px; font-size: 1rem; color: var(--foreground); border: 1px solid var(--border);
}
.stat-callout strong { color: var(--primary); }

@media (max-width: 860px) {
  .threat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .threat-grid { grid-template-columns: 1fr; }
}

/* ---------- Course cards ---------- */
.module-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.module-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px; text-decoration: none; color: var(--foreground); box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.module-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem;
}
.module-card h3 { margin: 4px 0 2px; font-size: 1.12rem; }
.module-card p { color: var(--muted-foreground); font-size: 0.95rem; margin-bottom: 0; }
.module-status {
  align-self: flex-start; margin-top: 6px; font-size: 0.78rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground);
}
.module-status.complete { background: #dff5ef; color: var(--accent-dark); }
.module-status.complete::before { content: "✓ "; }

@media (max-width: 860px) {
  .module-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .module-grid { grid-template-columns: 1fr; }
}

/* ---------- CTA banner ---------- */
.cta-banner {
  background: linear-gradient(120deg, var(--primary), var(--accent-dark));
  border-radius: var(--radius-lg); padding: 56px 40px; text-align: center; color: #fff;
}
.cta-banner h2, .cta-banner p { color: #fff; }
.cta-banner p { opacity: 0.92; }
.cta-banner .btn-primary { background: #fff; color: var(--primary-dark); }
.cta-banner .btn-primary:hover { background: #f1f6fa; }

/* ---------- Footer ---------- */
.site-footer { background: var(--secondary); border-top: 1px solid var(--border); padding: 56px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
.footer-brand { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.footer-brand img { width: 40px; height: 40px; }
.footer-brand strong { display: block; }
.footer-col h4 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--foreground); text-decoration: none; font-size: 0.96rem; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 22px; font-size: 0.86rem; color: var(--muted-foreground); }

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Lesson pages ---------- */
.lesson-header { padding: 56px 0 20px; }
.breadcrumb { font-size: 0.9rem; color: var(--muted-foreground); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted-foreground); }
.lesson-head-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.lesson-icon-canvas {
  width: 128px; height: 128px; flex-shrink: 0; background: var(--secondary);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.lesson-icon-canvas:hover { transform: scale(1.05); box-shadow: var(--shadow); }
.lesson-progress-track {
  height: 8px; background: var(--muted); border-radius: 99px; overflow: hidden; margin: 26px 0 6px;
}
.lesson-progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s ease; }
.lesson-progress-label { font-size: 0.85rem; color: var(--muted-foreground); }

.lesson-body { max-width: 760px; margin: 0 auto; padding: 10px 24px 30px; }
.lesson-body h2 { margin-top: 2.2em; }
.lesson-body ul, .lesson-body ol { padding-left: 1.3em; }
.lesson-body li { margin-bottom: 0.5em; }

.callout {
  background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--accent);
  border-radius: var(--radius); padding: 22px 26px; margin: 28px 0; box-shadow: var(--shadow-sm);
}
.callout h3 { margin-top: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.callout.warning { border-left-color: var(--destructive); }
.callout.warning h3 { color: var(--destructive); }
.callout ul { margin-bottom: 0; }

.example-box {
  background: var(--muted); border-radius: var(--radius); padding: 22px 26px; margin: 28px 0; font-style: italic;
}

/* ---------- Quiz ---------- */
.quiz {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; margin: 40px 0; box-shadow: var(--shadow-sm);
}
.quiz h2 { margin-top: 0; }
.quiz-question { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.quiz-question:last-of-type { border-bottom: none; margin-bottom: 10px; padding-bottom: 0; }
.quiz-question p.q-text { font-weight: 700; margin-bottom: 12px; }
.quiz-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.quiz-option:hover { border-color: var(--primary); }
.quiz-option input { margin-top: 3px; accent-color: var(--primary); }
.quiz-option.correct { border-color: var(--accent); background: #e8f8f4; }
.quiz-option.incorrect { border-color: var(--destructive); background: var(--destructive-light); }
.quiz-feedback { font-size: 0.92rem; margin-top: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--secondary); display: none; }
.quiz-feedback.show { display: block; }
.quiz-result { font-weight: 700; margin-top: 16px; font-size: 1.05rem; }

.lesson-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border);
}
.lesson-nav-links { display: flex; gap: 12px; }

/* ---------- Resources / glossary ---------- */
.resource-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.resource-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.resource-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.resource-card h3 { margin-bottom: 8px; }
.resource-card p { color: var(--muted-foreground); margin-bottom: 12px; }

.glossary dt { font-weight: 700; margin-top: 18px; color: var(--primary); }
.glossary dd { margin: 4px 0 0; color: var(--muted-foreground); }

@media (max-width: 760px) {
  .resource-grid { grid-template-columns: 1fr; }
}

/* ---------- Course hub ---------- */
.progress-summary {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px 30px; margin-bottom: 40px; box-shadow: var(--shadow-sm);
}
.progress-summary-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.completion-banner {
  background: linear-gradient(120deg, var(--accent), var(--primary));
  color: #fff; border-radius: var(--radius-lg); padding: 30px; text-align: center; margin-bottom: 40px; display: none;
}
.completion-banner.show { display: block; }
.completion-banner h2, .completion-banner p { color: #fff; }

/* ---------- Scroll reveal (progressive enhancement — see main.js) ---------- */
.js .reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(.16,.84,.44,1), transform 0.7s cubic-bezier(.16,.84,.44,1);
}
.js .reveal.revealed { opacity: 1; transform: translateY(0); }

/* ---------- Contact form ---------- */
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.form-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 34px; box-shadow: var(--shadow-sm);
}
.form-field { margin-bottom: 20px; display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-weight: 600; font-size: 0.95rem; }
.form-field input, .form-field select, .form-field textarea {
  font-family: inherit; font-size: 1rem; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--background); color: var(--foreground);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-field textarea { resize: vertical; min-height: 120px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.form-honeypot { position: absolute; left: -9999px; top: -9999px; }
.form-status {
  padding: 18px 20px; border-radius: var(--radius); margin-top: 6px; font-weight: 600;
}
.form-status[hidden] { display: none; }
.form-status.success { background: #e8f8f4; color: var(--accent-dark); border: 1px solid var(--accent); }
.form-status.error { background: var(--destructive-light); color: var(--destructive); border: 1px solid var(--destructive); }

.contact-side .resource-card { margin-bottom: 18px; }
.contact-side .resource-card:last-child { margin-bottom: 0; }

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Visits world map ---------- */
.visits-map-wrap {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm);
}
.visits-map-wrap svg { width: 100%; height: auto; display: block; }
.visits-map-wrap path.country { cursor: pointer; transition: stroke-width 0.15s ease; }
.visits-map-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--foreground); color: var(--background);
  font-size: 0.85rem; font-weight: 600; padding: 6px 12px;
  border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap;
  transform: translate(-50%, -130%);
}
.visits-map-tooltip[hidden] { display: none; }
.visits-map-note {
  text-align: center; color: var(--muted-foreground); font-size: 0.85rem; margin-top: 14px;
}

/* ---------- Impact model ---------- */
.impact-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 26px;
}
.impact-figure {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px 24px; text-align: center; box-shadow: var(--shadow-sm);
  transition: border-color 0.3s ease;
}
.impact-figure:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.impact-figure strong {
  display: block; font-size: clamp(2.1rem, 3.5vw, 2.75rem); font-weight: 800;
  color: var(--foreground); font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.impact-figure span { color: var(--muted-foreground); font-size: 0.95rem; font-weight: 600; }

.impact-methodology {
  max-width: 720px; margin: 0 auto; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 22px;
}
.impact-methodology summary { cursor: pointer; font-weight: 600; }
.impact-methodology p { margin: 10px 0 0; color: var(--muted-foreground); font-size: 0.92rem; }

@media (max-width: 760px) {
  .impact-grid { grid-template-columns: 1fr; }
}
