:root {
  /* Bridge new layout tokens to TSI theme tokens.
     Theme dropdown swaps `tsi-*.css` which define `--tsi-*` variables. */
  --background: var(--tsi-white, hsl(200 20% 98%));
  --foreground: var(--tsi-text, hsl(210 30% 15%));
  --card: var(--tsi-white, hsl(0 0% 100%));
  --card-foreground: var(--tsi-text, hsl(210 30% 15%));
  --primary: var(--tsi-primary, #0f172a);
  --primary-foreground: var(--tsi-white, hsl(0 0% 100%));
  --secondary: var(--tsi-secondary, #0ea5e9);
  --secondary-foreground: var(--tsi-white, hsl(0 0% 100%));
  --muted: var(--tsi-light, hsl(200 15% 94%));
  --muted-foreground: var(--tsi-text-light, hsl(210 10% 45%));
  --accent: var(--tsi-accent, #38bdf8);
  --accent-foreground: var(--tsi-white, hsl(0 0% 100%));
  --border: var(--tsi-gray-light, hsl(200 15% 88%));
  /* Keep hero/widget look stable (not theme-swapped) */
  --hero-gradient: linear-gradient(
    135deg,
    var(--tsi-primary, #0f172a),
    var(--tsi-secondary-dark, var(--tsi-secondary, #0284c7))
  );
  --section-gradient: linear-gradient(180deg, var(--background), var(--muted));
  --shadow-card: 0 4px 20px -4px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 8px 30px -4px rgba(0, 0, 0, 0.14);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--foreground);
  background: var(--background);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.tsi-skip-link,
.tsi-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;
}

.tsi-skip-link {
  left: 16px;
  top: 16px;
  z-index: 2000;
  width: auto;
  height: auto;
  margin: 0;
  padding: 12px 16px;
  clip: auto;
  border-radius: 12px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.tsi-skip-link:focus {
  transform: translateY(0);
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}
.section { padding: 20px 0; }
.page-section { padding: 56px 0 72px; }
.page-hero {
  background: var(--hero-gradient);
  color: var(--primary-foreground);
  padding: 64px 0;
}
.page-hero p {
  max-width: 720px;
  color: hsl(0 0% 100% / 0.9);
}
.page-hero .breadcrumb {
  color: hsl(0 0% 100% / 0.72);
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.page-hero h1, .hero h1, h2, h3, h4 {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}
.hero {
  min-height: 640px;
  color: var(--secondary-foreground);
  position: relative;
  display: flex;
  align-items: center;
  background:
    linear-gradient(
      color-mix(in srgb, var(--secondary) 78%, transparent),
      color-mix(in srgb, var(--secondary-dark, var(--secondary)) 78%, transparent)
    ),
    url('./images/hero-banner.jpg') center/cover no-repeat;
}
.hero-inner { padding: 96px 0; }
.eyebrow {
  display: inline-block;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary-foreground);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  margin-bottom: 18px;
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 4.5rem); line-height: 1.08; margin: 0 0 18px; }
.hero p { font-size: 1.15rem; max-width: 680px; color: hsl(0 0% 100% / 0.84); margin: 0 0 28px; }
.accent { color: var(--accent); }
.topbar {
  background: var(--secondary);
  color: hsl(0 0% 100% / 0.88);
  font-size: 0.9rem;
}
.topbar-inner, .navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.topbar-inner { padding: 10px 0; }
.topbar-links, .nav-links, .social-links { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}
.navbar {
  background: hsl(0 0% 100% / 0.94);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px hsl(210 30% 15% / 0.05);
}
.navbar-inner { padding: 14px 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand img { width: 52px; height: 52px; }
.brand-title {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--secondary);
  font-weight: 700;
  font-size: 1.25rem;
}
.brand-subtitle { font-size: 0.78rem; color: var(--muted-foreground); }
.nav-links a {
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--foreground);
}
.nav-links a:hover, .nav-links a.active {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.mobile-nav {
  display: none;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid hsl(200 15% 88% / 0.8);
  font-weight: 600;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 14px 24px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: 0.2s ease;
}
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible,
.filter-btn:focus-visible,
.amount-btn:focus-visible,
.tsi-nav a:focus-visible,
.tsi-menu-toggle:focus-visible,
.tsi-theme-toggle:focus-visible,
.tsi-theme-select:focus-visible,
.footer a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-card-hover); }
.btn-outline {
  border-color: color-mix(in srgb, var(--primary-foreground) 35%, transparent);
  color: var(--primary-foreground);
}
.btn-outline:hover { background: color-mix(in srgb, var(--primary-foreground) 8%, transparent); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-accent { background: var(--accent); color: var(--accent-foreground); }
.btn-light { border: 1px solid var(--border); background: var(--card); color: var(--foreground); }
.stats {
  background: var(--primary);
  color: var(--primary-foreground);
}
.grid-2, .grid-3, .grid-4 {
  display: grid;
  gap: 24px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid hsl(200 15% 88% / 0.7);
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.soft-card {
  background: hsl(200 15% 94% / 0.6);
  border-radius: var(--radius);
  padding: 24px;
}
.image-card img, .rounded-image { border-radius: 22px; box-shadow: var(--shadow-card); }
.section-gradient { background: var(--section-gradient); }
.section-muted { background: hsl(200 15% 94% / 0.55); }
.text-center { text-align: center; }
.subtle { color: var(--muted-foreground); }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { margin-bottom: 10px; }
.icon-bullet { display: flex; gap: 12px; align-items: flex-start; }
.number-list .item {
  display: flex;
  gap: 14px;
  padding: 18px;
  background: hsl(200 15% 94% / 0.6);
  border-radius: 12px;
}
.number {
  color: var(--primary);
  font-weight: 800;
  min-width: 28px;
}
.timeline {
  border-left: 2px solid color-mix(in srgb, var(--primary) 25%, transparent);
  padding-left: 22px;
}
.timeline .event {
  position: relative;
  margin-bottom: 18px;
}
.timeline .event::before {
  content: '';
  position: absolute;
  left: -29px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--foreground);
  padding: 12px 14px;
}
.textarea { min-height: 120px; resize: vertical; }
.search-wrap { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.filter-btn {
  border: 0;
  background: var(--muted);
  color: var(--muted-foreground);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}
.filter-btn.active { background: var(--primary); color: var(--primary-foreground); }
.resource-row, .member-row, .news-row, .event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.badge-primary {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}
.badge-accent {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.badge-muted { background: var(--muted); color: var(--muted-foreground); }
.footer {
  background: var(--tsi-primary-dark, var(--secondary));
  color: var(--secondary-foreground);
  margin-top: 40px;
}
.footer a { color: hsl(0 0% 100% / 0.72); }
.footer a:hover { color: var(--accent); }
.footer-top { padding: 72px 0 36px; }
.footer-bottom {
  border-top: 1px solid hsl(0 0% 100% / 0.12);
  padding: 22px 0 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.logo-box { background: hsl(0 0% 100% / 0.08); padding: 6px; border-radius: 12px; }
.hero-cta {
  background: var(--hero-gradient);
  color: var(--primary-foreground);
  border-top: 1px solid color-mix(in srgb, var(--primary-foreground) 22%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--secondary) 25%, transparent);
}
.hero-cta h1,
.hero-cta h2,
.hero-cta h3,
.hero-cta h4,
.hero-cta p,
.hero-cta a:not(.btn) {
  color: var(--primary-foreground);
}
.hero-cta p { opacity: 0.88; }
.table-like {
  display: grid;
  gap: 16px;
}
.amount-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.amount-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}
.amount-btn.active, .amount-btn:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}
.center-narrow { max-width: 760px; margin: 0 auto; }
.notice {
  color: var(--muted-foreground);
  font-size: 0.95rem;
}
.hidden { display: none !important; }

.form-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: hsl(200 15% 94% / 0.6);
  color: var(--foreground);
}

.form-status.is-success {
  border-color: hsl(140 35% 45% / 0.35);
  background: hsl(140 40% 96%);
}

.form-status.is-info {
  border-color: hsl(210 45% 45% / 0.25);
  background: hsl(210 60% 97%);
}

body.tsi-menu-open {
  overflow: hidden;
}

@supports not ((backdrop-filter: blur(10px))) {
  .site-header {
    background: hsl(0 0% 100% / 0.98);
  }
}

@supports (color: color-mix(in srgb, white 50%, black)) {
  .hero-cta {
    border-top: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--secondary) 25%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .menu-toggle { display: inline-flex; }
}

@media (max-width: 680px) {
  .section { padding: 20px 0; }
  .page-section { padding: 40px 0; }
  .page-hero { padding: 52px 0; }
  .hero { min-height: auto; }
  .hero-inner { padding: 72px 0; }
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  /* Homepage hero stats: keep 2×2 on small phones (four metrics in two rows). */
  section.stats .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .amount-options { grid-template-columns: 1fr; }
  .topbar-inner, .navbar-inner, .footer-bottom { align-items: flex-start; }
  .footer-top { padding-top: 52px; }
}

/* Theme bar: icon-only light/dark + mobile palette sheet (see /tsi-theme-bar.js) */
.tsi-theme-toggle-label {
  display: none !important;
}

.tsi-theme-toggle {
  gap: 0;
  justify-content: center;
  min-width: 40px;
  padding: 6px 8px;
}

.tsi-theme-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

.tsi-theme-mobile-open {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.tsi-theme-mobile-open-swatches {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.tsi-theme-swatch {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.tsi-theme-mobile-open .tsi-theme-swatch {
  width: 11px;
  height: 11px;
}

.tsi-theme-mobile-open-chevron {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(255, 255, 255, 0.88);
  margin-left: 2px;
}

.tsi-theme-sheet-backdrop[hidden],
.tsi-theme-sheet[hidden] {
  display: none !important;
}

.tsi-theme-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1090;
}

.tsi-theme-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(72vh, 520px);
  z-index: 1100;
  background: var(--card, #fff);
  color: var(--foreground, #1a1a2e);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tsi-theme-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}

.tsi-theme-sheet-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.tsi-theme-sheet-close {
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted-foreground, #64748b);
  padding: 4px 8px;
  border-radius: 8px;
}

.tsi-theme-sheet-close:hover {
  background: var(--muted, hsl(200 15% 94%));
}

.tsi-theme-sheet-list {
  overflow-y: auto;
  padding: 8px 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.tsi-theme-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 10px;
  margin: 0 0 6px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: var(--background, #fff);
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.tsi-theme-sheet-item:hover,
.tsi-theme-sheet-item:focus-visible {
  border-color: var(--primary, #2563eb);
  outline: none;
}

.tsi-theme-sheet-swatches {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.tsi-theme-sheet-swatches .tsi-theme-swatch {
  width: 18px;
  height: 18px;
}

.tsi-theme-sheet-name {
  font-weight: 600;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  .tsi-top-theme-wrap {
    gap: 6px;
    position: relative;
  }

  .tsi-theme-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
    appearance: none;
  }

  .tsi-theme-mobile-open {
    display: inline-flex;
  }
}