/* ============================================================
   RICAD Support — Design System v2
   Clean, warm, accessible. Beautiful in light + dark.
   ============================================================ */

:root {
  --blue:        #2563eb;
  --blue-dark:   #1d4ed8;
  --blue-light:  #eff6ff;
  --green:       #0d9488;
  --orange:      #f59e0b;

  --bg:          #ffffff;
  --bg-subtle:   #f8fafc;
  --bg-card:     #ffffff;
  --surface:     #f1f5f9;
  --border:      #e2e8f0;

  --text:        #0f172a;
  --text-2:      #475569;
  --text-3:      #94a3b8;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:      0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);

  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --nav-h:       58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0f172a;
    --bg-subtle:  #1e293b;
    --bg-card:    #1e293b;
    --surface:    #263348;
    --border:     #334155;
    --text:       #f1f5f9;
    --text-2:     #94a3b8;
    --text-3:     #64748b;
    --blue-light: #172554;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow:     0 4px 16px rgba(0,0,0,0.4);
    --shadow-md:  0 8px 32px rgba(0,0,0,0.5);
  }
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }

/* ── Layout ─────────────────────────────────────────────────── */
.container { max-width: 980px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Navigation ─────────────────────────────────────────────── */
.navbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .container {
  height: var(--nav-h);
  display: flex;
  align-items: center;
}
.navbar ul {
  display: flex;
  list-style: none;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  gap: 0.125rem;
}
.navbar a {
  display: block;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.navbar a:hover,
.navbar a.active {
  color: var(--blue);
  background: var(--blue-light);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(140deg, rgba(17,41,120,0.82) 0%, rgba(6,78,70,0.78) 100%),
    url('../assets/hero-home.jpg') center/cover no-repeat;
  z-index: 0;
}
.hero .container {
  position: relative;
  z-index: 2;
  padding: 4rem 1.5rem;
}
.logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin: 0 auto 1.75rem;
  border-radius: 18px;
  background: rgba(255,255,255,0.18);
  padding: 0.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  opacity: 0.88;
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.65;
}
.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.925rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}
.btn-primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}
.btn-secondary {
  background: transparent;
  color: white;
  border-color: rgba(255,255,255,0.55);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: white;
  color: white;
}

/* ── Stats ───────────────────────────────────────────────────── */
#stats {
  padding: 3.5rem 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
#stats h2 {
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2rem;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-align: center;
}
.stat h2, .stat h3 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 0.5rem;
}
.stat p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.45;
}

/* ── Features ────────────────────────────────────────────────── */
#features {
  padding: 4rem 0;
  background: var(--bg);
}
#features h2 {
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 2.5rem;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.feature-link {
  text-decoration: none;
  color: inherit;
  display: flex;
}
.feature {
  flex: 1;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature-link:hover .feature {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
}
.feature svg, .feature img.icon {
  margin: 0 auto 1.25rem;
}
.feature h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}
.feature p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* ── Content page main ───────────────────────────────────────── */
main.container { padding-top: 0.5rem; padding-bottom: 4rem; }

main > h1:first-child {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
  margin: 2.5rem 0 0.75rem;
}
main h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 2.75rem 0 0.75rem;
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}
main h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.75rem 0 0.5rem;
}
main p {
  color: var(--text);
  margin-bottom: 1rem;
}
main ul, main ol {
  margin: 0.5rem 0 1.25rem 1.5rem;
  color: var(--text);
}
main li { margin-bottom: 0.35rem; }
main a { color: var(--blue); }
main a:hover { color: var(--blue-dark); }
main img {
  border-radius: var(--radius);
  margin: 2rem 0;
  box-shadow: var(--shadow);
  max-width: 100%;
}

/* lead paragraph */
.lead {
  font-size: 1.1rem;
  color: var(--text-2);
  border-left: 3px solid var(--blue);
  padding-left: 1rem;
  margin-bottom: 2.5rem;
  line-height: 1.65;
}

/* ── Table of Contents ───────────────────────────────────────── */
.toc {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  margin-bottom: 2.75rem;
}
.toc-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 0.75rem;
}
.toc ul {
  columns: 2;
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc li { margin-bottom: 0.4rem; }
.toc a {
  font-size: 0.875rem;
  color: var(--blue);
  text-decoration: none;
}
.toc a:hover { text-decoration: underline; }

/* ── Resource grid ───────────────────────────────────────────── */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 3rem;
}
.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.resource-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.resource-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.resource-card p {
  font-size: 0.875rem;
  color: var(--text-2);
  flex: 1;
  margin: 0;
}

/* ── Org links ───────────────────────────────────────────────── */
.org-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.org-list li a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s;
}
.org-list li a:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
}

/* ── Tables ──────────────────────────────────────────────────── */
#symptoms-table, table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-subtle); }

/* ── Forms ───────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
textarea { height: 120px; resize: vertical; }
#log-form {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 2rem;
}
#symptom-input, #severity { flex: 1; min-width: 180px; }
.story-form { max-width: 600px; margin: 2rem auto; }
.story-form textarea { margin-bottom: 1rem; }

/* ── Section headings (in content pages) ────────────────────── */
.section-h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 2.5rem 0 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  text-align: center;
  margin-top: 3rem;
}
footer p {
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.6;
  margin-bottom: 0.4rem;
}
footer a {
  color: var(--blue);
  text-decoration: none;
}
footer a:hover { text-decoration: underline; }

/* ── Stories & forms ─────────────────────────────────────────── */
.stories-grid { display: flex; flex-direction: column; gap: 2rem; margin: 2rem 0; }
.story {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
}
.story h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.75rem;
}
.form-hint {
  font-size: 0.9rem;
  color: var(--text-2);
  margin-bottom: 1rem;
}
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.5;
}
.checkbox-label input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
  margin-top: 3px;
}
.disclaimer {
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.55;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 0.4rem;
}

/* ── Hamburger nav ───────────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text-2);
  font-size: 1.4rem;
  line-height: 1;
  margin-left: auto;
}
.nav-toggle:hover { color: var(--blue); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Nav */
  .nav-toggle { display: flex; align-items: center; }
  .navbar .container { flex-direction: row; justify-content: space-between; height: auto; padding: 0.6rem 1.5rem; }
  .navbar ul {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding: 0.5rem 0 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }
  .navbar ul.open { display: flex; }
  .navbar a { padding: 0.6rem 0.5rem; border-radius: 0; }

  /* Grids */
  .stats-grid    { grid-template-columns: 1fr; gap: 0.75rem; }
  .features-grid { grid-template-columns: 1fr !important; }
  .spotlight-grid { grid-template-columns: 1fr; }
  .how-it-works  { grid-template-columns: 1fr; }
  .questions-grid { grid-template-columns: 1fr; }
  .symptom-grid  { grid-template-columns: 1fr 1fr; }
  .resource-grid { grid-template-columns: 1fr; }
  .toc ul        { columns: 1; }

  /* Hero */
  .hero { min-height: 55vh; }
  .cta-buttons { flex-direction: column; align-items: center; }

  /* About profile */
  .profile-header { flex-direction: column; gap: 1rem; }

  /* Frontiers table */
  .intervention-table { font-size: 0.8rem; }
  .intervention-table th, .intervention-table td { padding: 0.6rem 0.6rem; }

  /* Misc */
  .mission-block { padding: 2rem 1.5rem; }
  .philosophy-block { padding: 1.75rem 1.5rem; }
}

@media (max-width: 480px) {
  .logo { width: 68px; height: 68px; }
  .hero h1 { font-size: 1.65rem; }
  .symptom-grid { grid-template-columns: 1fr; }
  .container { padding: 0 1rem; }
  .btn { font-size: 0.875rem; padding: 0.65rem 1.1rem; }
  .cta-banner { padding: 2rem 1.25rem; }
  .profile-card { padding: 1.5rem; }
  #stats { padding: 2.5rem 0; }
}
