:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --text: #111111;
  --muted: #666666;
  --soft: #e9e9e9;
  --border: rgba(0, 0, 0, 0.1);
  --card-bg: rgba(255, 255, 255, 0.55);
  --link: #222222;
  --link-hover: #000000;
  --accent: #4c5f73;
  --footer-bg: #e9e9e9;
  --footer-text: #555555;
}

body.theme-dark {
  --bg: #0f1115;
  --surface: #151a22;
  --text: #f3f4f6;
  --muted: #aeb6c2;
  --soft: #141922;
  --border: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(255, 255, 255, 0.03);
  --link: #f3f4f6;
  --link-hover: #ffffff;
  --accent: #b7c5d6;
  --footer-bg: #141922;
  --footer-text: #9aa4b2;
}

@media (prefers-color-scheme: dark) {
  body:not(.theme-light):not(.theme-dark) {
    --bg: #0f1115;
    --surface: #151a22;
    --text: #f3f4f6;
    --muted: #aeb6c2;
    --soft: #141922;
    --border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.03);
    --link: #f3f4f6;
    --link-hover: #ffffff;
    --accent: #b7c5d6;
    --footer-bg: #141922;
    --footer-text: #9aa4b2;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-family: "Lato", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}

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

a:hover {
  text-decoration: underline;
}

.page {
  flex: 1;
  width: 100%;
  background: var(--bg);
}

.footer {
  width: 100%;
  margin-top: auto;
  padding: 16px 12px;
  box-sizing: border-box;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 14px;
  text-align: center;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: grid;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--link);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark img {
  width: 42px;
  height: auto;
  display: block;
}

.brand-mark .logo-dark {
  display: none;
}

body.theme-dark .brand-mark .logo-light {
  display: none;
}

body.theme-dark .brand-mark .logo-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  body:not(.theme-light):not(.theme-dark) .brand-mark .logo-light {
    display: none;
  }

  body:not(.theme-light):not(.theme-dark) .brand-mark .logo-dark {
    display: block;
  }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px 20px;
  min-width: 0;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--link);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.home {
  color: var(--link);
  font-size: 0.95rem;
  text-decoration: none;
}

.home:hover {
  text-decoration: underline;
}

.mode-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 8px;
}

.links a,
.contact a,
.inline-link {
  color: var(--link);
  border-bottom: 1px solid transparent;
  text-decoration: none;
}

.links a:hover,
.contact a:hover,
.inline-link:hover {
  color: var(--link-hover);
  border-color: currentColor;
}

.contact {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.contact p:first-child {
  margin-bottom: 8px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .header-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
  }
}

body.home-page .page {
  min-height: 100vh;
}

.shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

body.home-page .topbar {
  padding: 48px 0 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 48px;
  align-items: center;
  padding: 52px 0 58px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

body.home-page h1 {
  max-width: 760px;
  margin: 0;
  font-size: 68px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 720px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
  line-height: 1.48;
}

.hero-panel {
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 28px;
}

.hero-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
}

.hero-cta:hover {
  text-decoration: underline;
}

.stats {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 28px;
  border: 1px solid var(--border);
  background: var(--border);
}

.stat {
  min-width: 0;
  min-height: 96px;
  padding: 16px;
  background: var(--bg);
}

.stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.15rem, 1.6vw, 1.55rem);
  line-height: 1;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.section {
  padding: 68px 0;
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 44px;
  margin-bottom: 32px;
}

body.home-page h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
  font-weight: 700;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.research-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 24px;
}

.research-card h3 {
  margin: 0 0 14px;
  font-size: 1.35rem;
  line-height: 1.2;
}

.research-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.research-card .meta {
  margin-top: 28px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.principles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  background: var(--border);
}

.principle {
  min-height: 190px;
  padding: 22px;
  background: var(--bg);
}

.principle strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.principle p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.support-options {
  width: 100vw;
  margin-right: calc(50% - 50vw);
  margin-left: calc(50% - 50vw);
  padding: 68px max(24px, calc((100vw - 1120px) / 2)) 96px;
  contain: paint;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}

body.home-page .support-options h2 {
  margin-bottom: 14px;
}

.support-options .support-copy {
  max-width: 640px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.stripe-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 24px;
  contain: paint;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg);
}

.stripe-option {
  display: flex;
  width: min(100%, 380px);
  contain: paint;
  isolation: isolate;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  background: var(--bg);
}

stripe-buy-button {
  display: block;
  width: 100%;
  max-width: 100%;
  contain: paint;
  overflow: hidden;
  background: transparent;
  color-scheme: light;
}

.stripe-option-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 300;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 32px, 1120px);
  }

  .hero,
  .section-header {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero {
    padding: 64px 0 52px;
  }

  body.home-page h1 {
    font-size: 48px;
  }

  .hero-copy {
    font-size: 20px;
  }

  .hero-panel {
    border-top: 1px solid var(--border);
    border-left: 0;
    padding: 24px 0 0;
  }

  .stats,
  .research-grid,
  .principles {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body.home-page h1 {
    font-size: 40px;
  }

  .hero-copy {
    font-size: 18px;
  }
}

body.article-page .page {
  display: flex;
  justify-content: center;
  padding: 48px 24px;
}

.content {
  width: 100%;
  max-width: 1120px;
}

body.article-page .topbar {
  width: min(1120px, calc(100vw - 48px));
  position: relative;
  left: 50%;
  margin-bottom: 40px;
  padding-bottom: 18px;
  transform: translateX(-50%);
}

body.article-page h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
  font-weight: 700;
}

.subtitle {
  max-width: 100%;
  margin: 0 0 36px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 300;
}

.card {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  padding: 28px;
}

body.article-page:not(.compact-page) h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  font-weight: 700;
}

body.article-page.compact-page h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

body.article-page h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 700;
}

body.article-page p {
  margin: 0 0 16px;
  font-size: 1.05rem;
  line-height: 1.7;
}

body.article-page ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.item-list {
  display: grid;
  gap: 14px;
}

.item {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

body.compact-page .topbar {
  margin-bottom: 48px;
}

.compact-page .contact {
  margin-top: 48px;
  padding-top: 28px;
}

.compact-page .contact p:first-child {
  color: var(--muted);
  font-size: 1rem;
}

.compact-page .contact a {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 400;
}

body.community-page .subtitle {
  margin-bottom: 18px;
}

body.community-page .intro {
  max-width: 860px;
  margin: 0 0 36px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.7;
}

.year-block {
  margin-top: 30px;
}

body.community-page h2.year {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
}

body.community-page .card {
  margin-bottom: 18px;
  padding: 26px;
}

.event-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.community-page h3 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
  font-weight: 700;
}

body.community-page .meta {
  margin-bottom: 16px;
}

body.community-page p {
  margin-bottom: 14px;
  font-size: 1.02rem;
}

body.community-page .links {
  margin-top: 14px;
}

body.legacy-activities {
  min-height: auto;
  display: block;
  margin: 0 0 30px;
  overflow-x: auto;
  background: #ffffff;
  color: #000000;
  font-family: initial;
}

.legacy-activities .center {
  margin-right: auto;
  margin-left: auto;
}

.legacy-activities .center-div {
  text-align: center;
}

.legacy-activities .vertical-center {
  margin: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.legacy-activities .footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  margin-top: 0;
  padding: 0;
  border-top: 0;
  background-color: #f5f5f5;
  color: #000000;
  font-size: initial;
}

.legacy-activities table,
.legacy-activities th,
.legacy-activities td {
  border: 1px solid black;
  white-space: nowrap;
}

.legacy-activities #cssTable td {
  text-align: center;
  vertical-align: middle;
}
