/* =============================================================================
   NONPROFIT PLATFORM — BASE STYLES
   Reset, typography, layout grid, utility classes
   Depends on: theme.css (must be loaded first)
   ============================================================================= */

/* ── GOOGLE FONTS ─────────────────────────────────────────────────────────────
   Change these imports in your theme file instructions.
   Playfair Display: elegant display headings
   Inter: clean, readable body text
   ──────────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

/* ── MODERN CSS RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  font-family: var(--font-body);
  /* padding-top: calc(var(--header-height) + 1px); */
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video, svg, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  font-style: italic;
  color: var(--color-text-tertiary);
}

ul, ol {
  list-style: none;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: var(--transition-color);
}

a:hover {
  color: var(--color-text-link-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

input, textarea, select {
  appearance: none;
  -webkit-appearance: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* Focus visible only on keyboard nav */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection {
  background-color: var(--color-primary-xlight);
  color: var(--color-primary-dark);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-gray-100); }
::-webkit-scrollbar-thumb { background: var(--color-gray-400); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-gray-500); }

/* ── TYPOGRAPHY SYSTEM ───────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  /* color: var(--color-text-primary); */
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl);  font-family: var(--font-body); font-weight: var(--weight-semibold); }
h6 { font-size: var(--text-lg);  font-family: var(--font-body); font-weight: var(--weight-semibold); }

p {
  line-height: var(--leading-relaxed);
  /* color: var(--color-text-secondary); */
  max-width: 70ch;
}

p + p { margin-top: var(--space-4); }

.lead {
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
  font-weight: var(--weight-normal);
  max-width: 60ch;
}

.text-balance {
  text-wrap: balance;
}

/* Rich text content (CMS-managed content) */
.prose h1 { margin-bottom: var(--space-6); }
.prose h2 { margin-top: var(--space-10); margin-bottom: var(--space-4); }
.prose h3 { margin-top: var(--space-8); margin-bottom: var(--space-3); }
.prose h4 { margin-top: var(--space-6); margin-bottom: var(--space-3); }
.prose p  { margin-bottom: var(--space-5); }
.prose ul, .prose ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-5);
  list-style: revert;
}
.prose li + li { margin-top: var(--space-2); }
.prose strong { font-weight: var(--weight-semibold); color: var(--color-text-primary); }
.prose em { font-style: italic; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote {
  border-left: 4px solid var(--color-primary);
  padding: var(--space-4) var(--space-6);
  background: var(--color-primary-xlight);
  border-radius: 0 var(--radius-base) var(--radius-base) 0;
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--color-primary-dark);
}
.prose img {
  border-radius: var(--radius-md);
  margin: var(--space-8) 0;
}
.prose table {
  margin: var(--space-6) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.prose th {
  background: var(--color-gray-100);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.prose td {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ── CONTAINER SYSTEM ─────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

.container-sm  { max-width: var(--container-sm); }
.container-md  { max-width: var(--container-md); }
.container-lg  { max-width: var(--container-lg); }
.container-xl  { max-width: var(--container-xl); }
.container-2xl { max-width: var(--container-2xl); }
.container-full { max-width: 100%; }

/* ── SECTION SYSTEM ──────────────────────────────────────────────────────── */

.section {
  padding-top: var(--section-md);
  padding-bottom: var(--section-md);
}

.section-sm   { padding-top: var(--section-sm);  padding-bottom: var(--section-sm); }
.section-lg   { padding-top: var(--section-lg);  padding-bottom: var(--section-lg); }
.section-xl   { padding-top: var(--section-xl);  padding-bottom: var(--section-xl); }

.section-surface { background-color: var(--color-bg-surface); }
.section-primary { background: var(--gradient-primary); color: var(--color-white); }
.section-dark    { background-color: var(--color-gray-900); color: var(--color-white); }

/* Section header — consistent title block */
.section-header {
  margin-bottom: var(--space-12);
  text-align: center;
}

.section-header.align-left {
  text-align: left;
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  position: relative;
}

/* Decorative line before eyebrow */
.section-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  vertical-align: middle;
  margin-right: var(--space-2);
  border-radius: 2px;
}

.section-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
  color: var(--color-text-primary);
}

.section-primary .section-title,
.section-dark .section-title {
  color: var(--color-white);
}

.section-primary .section-eyebrow,
.section-dark .section-eyebrow {
  color: var(--color-accent-light);
}

.section-primary .section-eyebrow::before,
.section-dark .section-eyebrow::before {
  background: var(--color-accent-light);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

.section-primary .section-subtitle,
.section-dark .section-subtitle {
  color: rgba(255,255,255,0.8);
}

/* ── GRID SYSTEM ─────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* Auto-responsive grids */
.grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid-auto-md { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

/* Gap sizes */
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }

/* Flex utilities */
.flex    { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-1  { flex: 1; }

/* ── UTILITY CLASSES ─────────────────────────────────────────────────────── */

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

/* Display */
.hidden  { display: none !important; }
.block   { display: block; }
.inline  { display: inline; }
.inline-block { display: inline-block; }

/* Text alignment */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Text transforms */
.uppercase  { text-transform: uppercase; }
.lowercase  { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* Font weights */
.font-light    { font-weight: var(--weight-light); }
.font-normal   { font-weight: var(--weight-normal); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

/* Text colors */
.text-primary   { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-tertiary  { color: var(--color-text-tertiary) !important; }
.text-white     { color: var(--color-white) !important; }
.text-success   { color: var(--color-success) !important; }
.text-warning   { color: var(--color-warning) !important; }
.text-error     { color: var(--color-error) !important; }
.text-muted     { color: var(--color-gray-500) !important; }

/* Background colors */
.bg-white    { background-color: var(--color-white); }
.bg-surface  { background-color: var(--color-bg-surface); }
.bg-primary  { background-color: var(--color-primary); }
.bg-primary-xlight { background-color: var(--color-primary-xlight); }

/* Spacing utilities */
.mt-auto { margin-top: auto; }
.mb-0    { margin-bottom: 0 !important; }
.mt-4    { margin-top: var(--space-4); }
.mt-6    { margin-top: var(--space-6); }
.mt-8    { margin-top: var(--space-8); }
.mb-4    { margin-bottom: var(--space-4); }
.mb-6    { margin-bottom: var(--space-6); }
.mb-8    { margin-bottom: var(--space-8); }

/* Border radius */
.rounded    { border-radius: var(--radius-base); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Object fit */
.object-cover   { object-fit: cover; }
.object-contain { object-fit: contain; }

/* Aspect ratios */
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-video  { aspect-ratio: 16 / 9; }
.aspect-photo  { aspect-ratio: 4 / 3; }
.aspect-portrait { aspect-ratio: 3 / 4; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

/* Width/height */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* Avatar */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--color-primary-xlight);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}

.avatar-sm  { width: 32px; height: 32px; font-size: var(--text-sm); }
.avatar-md  { width: 44px; height: 44px; font-size: var(--text-base); }
.avatar-lg  { width: 64px; height: 64px; font-size: var(--text-xl); }
.avatar-xl  { width: 96px; height: 96px; font-size: var(--text-3xl); }
.avatar-2xl { width: 128px; height: 128px; font-size: var(--text-4xl); }

/* ── RESPONSIVE BREAKPOINTS ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .hide-lg { display: none !important; }
}

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .hide-md { display: none !important; }

  .section-header {
    margin-bottom: var(--space-8);
  }

  p { max-width: 100%; }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-5,
  .grid-6 { grid-template-columns: 1fr; }

  .hide-sm { display: none !important; }

  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  h2 { font-size: clamp(1.75rem, 6vw, 2.5rem); }
}

/* ── PAGE LAYOUT ─────────────────────────────────────────────────────────── */

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-content {
  flex: 1;
  padding-top: calc(var(--header-height) + 1px);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  padding: var(--space-4) 0;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--color-text-tertiary);
  transition: var(--transition-color);
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb-sep {
  color: var(--color-gray-300);
  font-size: var(--text-xs);
}

.breadcrumb-current {
  color: var(--color-text-secondary);
  font-weight: var(--weight-medium);
}

/* Page hero (interior pages) */
.page-hero {
  padding: var(--space-20) 0;
  background: var(--color-primary-xlight);
  border-bottom: 1px solid var(--color-border);
}
.page-hero--sm { padding: var(--space-8) 0; }
.page-hero__title {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}
.page-hero--sm .page-hero__title { font-size: var(--text-4xl); margin-bottom: var(--space-3); }
.page-hero__subtitle {
  font-size: var(--text-xl);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 640px;
}

/* ── Section ──────────────────────────────────────────────────────────────── */
.section { padding: var(--space-20) 0; }
.section--alt { background: var(--color-surface); }

/* ── Form controls (public site) ─────────────────────────────────────────── */
.form-control {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-white);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-base);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(83,74,183,0.15);
}
textarea.form-control { height: auto; padding: var(--space-3) var(--space-4); resize: vertical; line-height: var(--leading-normal); }
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 40px; cursor: pointer;
}

/* ── Prose ────────────────────────────────────────────────────────────────── */
.prose h2, .prose h3 { font-family: var(--font-display); font-weight: 600; margin: var(--space-8) 0 var(--space-4); }
.prose h2 { font-size: var(--text-2xl); }
.prose h3 { font-size: var(--text-xl); }
.prose p  { margin-bottom: var(--space-5); }
.prose ul, .prose ol { margin: 0 0 var(--space-5) var(--space-6); }
.prose li { margin-bottom: var(--space-2); }
.prose a  { color: var(--color-primary); }
.prose img { max-width: 100%; border-radius: var(--radius-lg); margin: var(--space-6) 0; }