/* ========== Theme Tokens (sister-sites minimal) ========== */
:root {
  --clr-bg: #ffffff;
  --clr-surface: #f7f7f7;
  --clr-text: #2f2f2f;
  --clr-muted: #6a6a6a;
  --clr-primary: #d81736;
  --clr-accent: #222222;
  --maxw: 1200px;
  --radius: 10px;
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 25px 80px rgba(0, 0, 0, 0.18);

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 80px;
  --space-4xl: 96px;

  /* Dynamic navbar height - set by JavaScript */
  --navbar-height: 64px;
}

/* Dark theme tokens */
html.theme-dark {
  --clr-bg: #0f1012;
  --clr-surface: #15171a;
  --clr-text: #e6e8ea;
  --clr-muted: #b1b6bb;
  --clr-accent: #e6e8ea;
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 25px 80px rgba(0, 0, 0, 0.7);
}

/* ========== Base ========== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: opacity 0.18s ease;
  overflow-x: hidden;
}
html.app-hidden body { opacity: 0; }

img {
  width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.section { padding: var(--space-3xl) 0; }

h1, h2, h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(28px, 4.6vw + 0.4vh, 64px); margin-bottom: var(--space-md); }
h2 { font-size: clamp(22px, 3.2vw + 0.2vh, 40px); margin-bottom: var(--space-md); }
h3 { font-size: clamp(16px, 2.2vw + 0.2vh, 24px); margin-bottom: var(--space-sm); }
.section h2:first-child { margin-bottom: var(--space-lg); }

p { color: #555555; margin: 0 0 var(--space-sm); line-height: 1.6; }

/* Cards (used for "Our Focus") */
.card {
  background: var(--clr-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: var(--space-md);
}

/* ========== Hero ========== */
.hero {
  position: relative;
  color: #111;
  min-height: 340px;
  padding: var(--space-md);
  background-size: cover;
  background-position: center;
  isolation: isolate;
  display: flex;
  align-items: center;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(0,0,0,0.35) 70%);
  z-index: 0;
}
.hero__inner { position: relative; z-index: 1; color: #fff; text-align: left; }
.hero__kicker { font-weight: 700; letter-spacing: 0.2px; margin-bottom: var(--space-xs); opacity: 0.9; }
.hero__title { font-size: clamp(28px, 4.8vw + 0.6vh, 72px); line-height: 1.05; color: #ffffff; font-weight: 900; max-width: 60%; }
.hero p,
.hero__subtitle {
  font-size: clamp(14px, 1.2vw + 0.3vh, 20px);
}

/* Sister-sites hero: consistent position */
.hero--sister { align-items: flex-start; }
.hero--sister .hero__inner {
  padding-top: calc(var(--navbar-height) + var(--space-2xl));
  padding-bottom: var(--space-xl);
  max-width: 1200px;
}
.hero--sister .hero__title { max-width: 680px; }
.hero--sister .hero__subtitle { max-width: 680px; }

.hero__subtitle {
  max-width: 600px;
  margin-top: var(--space-xs);
  color: #1a1a1a;
  font-weight: 200;
  background: rgba(255, 255, 255, 0.7);
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
}

/* Dark hero text overrides */
html.theme-dark .hero__title { color: #f0f2f5; }
html.theme-dark .hero__subtitle { background: rgba(0, 0, 0, 0.4); color: #f3f4f6; }

body.no-hero {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.no-hero #site-footer {
  margin-top: auto;
}

/* Layout helpers */
.grid { display: grid; gap: var(--space-md); }
.rule { height: 1px; background: #aaa9a9; margin: var(--space-2xl) 0; }

/* Back to top */
.backtotop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center;
  background: #fff; border: 1px solid #e7e7e7; box-shadow: var(--shadow-sm);
  color: var(--clr-text); text-decoration: none;
}
.backtotop:hover { transform: translateY(-2px); }
.backtotop::after {
  content: ""; width: 18px; height: 18px;
  background: url("/assets/svg/icons/icon-up-arrow.svg") center/contain no-repeat;
  display: block; filter: none;
}
html.theme-dark .backtotop { background: #1b1d20; border-color: #2a2d31; color: var(--clr-text); }
html.theme-dark .backtotop::after { filter: invert(1); }

/* ========== Navbar (injected) ========== */
.navbar {
  background: transparent; box-shadow: none;
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  transition: background-color 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}
.navbar--scrolled { background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); box-shadow: var(--shadow-sm); }
#site-nav:not(.is-loaded) { opacity: 0; min-height: 0; }
#site-nav.is-loaded { opacity: 1; transition: opacity 0.18s ease; }
.navbar__inner { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--space-md); }
.navbar__actions { display: flex; align-items: center; gap: var(--space-md); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--clr-accent); cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease; padding: 0;
}
.theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle:hover { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.06); }
html.theme-dark .theme-toggle:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08); }
.navbar__logo { display: flex; align-items: center; gap: var(--space-xs); font-weight: 700; color: var(--clr-accent); text-decoration: none; }
.navbar__logo img { height: 48px; width: auto; display: block; min-width: 113px; }
.navbar__nav { display: flex; gap: var(--space-md); }
.nav-link { color: var(--clr-accent); font-weight: 500; text-decoration: none; padding-bottom: 6px; position: relative; }
.nav-link:hover { color: var(--clr-primary); }
.nav-link--active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--clr-primary); border-radius: 2px; }

/* Dark mode navbar contrast */
html.theme-dark .navbar:not(.navbar--scrolled) .nav-link { color: #141414; }
html.theme-dark .navbar:not(.navbar--scrolled) .nav-link:hover { color: var(--clr-primary); }
html.theme-dark .navbar:not(.navbar--scrolled) .theme-toggle { color: #141414; }
html.theme-dark .navbar.navbar--scrolled .nav-link { color: var(--clr-accent); }
html.theme-dark .navbar.navbar--scrolled .nav-link:hover { color: var(--clr-primary); }
html.theme-dark .navbar.navbar--scrolled .theme-toggle { color: var(--clr-accent); }

/* Hamburger */
.hamburger {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  width: 32px; height: 32px; background: none; border: none; cursor: pointer; padding: 4px; transition: transform 0.3s ease;
}
.hamburger__line { width: 24px; height: 2px; background: var(--clr-accent); border-radius: 2px; transition: all 0.3s ease; transform-origin: center; }
.hamburger__line:not(:last-child) { margin-bottom: 5px; }
.hamburger--active .hamburger__line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger--active .hamburger__line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger--active .hamburger__line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
html.theme-dark .hamburger__line { background: var(--clr-accent); }

/* Mobile Navigation */
.mobile-nav {
  position: fixed; top: var(--navbar-height); left: 0; right: 0;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg); z-index: 999; max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease, box-shadow 0.3s ease;
}
.mobile-nav--active { max-height: 100vh; }
.mobile-nav__content { padding: var(--space-xl) var(--space-md); opacity: 0; transform: translateY(-10px); transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s; }
.mobile-nav--active .mobile-nav__content { opacity: 1; transform: translateY(0); }
.mobile-nav__links { display: flex; flex-direction: column; gap: var(--space-md); margin-bottom: var(--space-xl); }
.mobile-nav__link { color: var(--clr-accent); font-weight: 600; font-size: 18px; text-decoration: none; padding: var(--space-sm) 0; border-bottom: 1px solid #f0f0f0; transition: color 0.2s ease; }
.mobile-nav__link:hover { color: var(--clr-primary); }
.mobile-nav__link:last-child { border-bottom: none; }
html.theme-dark .mobile-nav { background: rgba(15,16,18,0.95); backdrop-filter: blur(10px); }

/* ========== Footer (injected) ========== */
.footer { background: #3c3c3c; color: #fff; padding: var(--space-xl) var(--space-md); }
#site-footer { display: block; min-height: 120px; }
#site-footer:not(.is-loaded) { opacity: 0; }
#site-footer.is-loaded { opacity: 1; transition: opacity 0.18s ease; }
.footer__inner { display: grid; gap: var(--space-lg); grid-template-columns: 1fr; }
.footer__col h3 { font-size: 18px; margin-bottom: var(--space-sm); font-weight: 700; }
.footer__logo { display: flex; align-items: center; gap: var(--space-xs); margin-bottom: var(--space-sm); }
.footer__logo img { height: 40px; }
.footer__social { margin-top: var(--space-sm); }
.footer__social span { display: block; font-size: 16px; font-weight: 600; margin-bottom: var(--space-xs); color: #ffffff; }
.social-icons { display: flex; gap: var(--space-sm); margin-top: var(--space-xs); }
.social-icon { display: inline-flex; width: 32px; height: 32px; background: rgba(255,255,255,0.1); border-radius: 50%; align-items: center; justify-content: center; text-decoration: none; font-size: 16px; transition: background 0.2s ease; }
.social-icon img { filter: invert(1); }
.social-icon:hover { background: rgba(255,255,255,0.2); }
.footer__links { list-style: none; padding: 0; margin: 0; }
.footer__links li { margin-bottom: 6px; color: #e0e0e0; font-size: 15px; }
.footer-link { color: #e0e0e0; text-decoration: underline; }
.footer-link:hover { color: #e0e0e0; text-decoration: underline; }
.footer p { margin-bottom: var(--space-xs); line-height: 1.4; color: #e0e0e0; }

/* Dark theme footer */
html.theme-dark .footer { background: #141517; }
html.theme-dark .footer__links li { color: #cfd3d7; }
html.theme-dark .footer-link { color: #cfd3d7; }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--clr-primary);
  color: #fff;
  padding: var(--space-sm) var(--space-md);
  border-radius: 6px;
  font-weight: 700;
  transition: transform 0.08s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: inline-block;
  text-decoration: none;
  margin: var(--space-sm) 0;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

/* Inline icon in buttons */
.btn .icon-inline {
  width: 18px;
  height: 18px;
  margin-left: 8px;
  vertical-align: middle;
  filter: invert(1); /* ensure white */
  display: inline-block;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  /* Force 1-column stack for inline 2-column grids in About sections */
  .grid[style] {
    display: flex !important;
    flex-direction: column-reverse !important; /* place image under text */
    grid-template-columns: 1fr !important;
    gap: var(--space-lg) !important;
  }
}
@media (max-width: 768px) {
  .hero--sister .hero__inner { padding-top: calc(var(--navbar-height) + var(--space-lg)); padding-bottom: var(--space-lg); }
  .hero--sister .hero__title,
  .hero--sister .hero__subtitle { max-width: 100%; }

  .navbar__nav { display: none; }
  .hamburger { display: flex; }
  .hero__title { font-size: 28px; }
}

@media (min-width: 900px) {
  .footer__inner { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 480px) {
  :root {
    --space-xs: 6px; --space-sm: 12px; --space-md: 16px;
    --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px; --space-3xl: 56px; --space-4xl: 64px;
  }
  .container { padding-inline: var(--space-sm); }
  .section { padding: var(--space-lg) 0; }
  .hero { min-height: 280px; padding: var(--space-sm); display: flex; align-items: center; }
  .hero__title { font-size: 24px; }
  .navbar__inner { padding: var(--space-sm) var(--space-sm); }
  .navbar__logo span { display: none; }
  .footer__inner { grid-template-columns: 1fr; gap: var(--space-md); }
}

/* ========== Dark theme component tweaks ========== */
html.theme-dark .navbar--scrolled { background: rgba(10, 11, 13, 0.8); backdrop-filter: blur(12px); box-shadow: var(--shadow-sm); }
html.theme-dark .card { background: var(--clr-surface); }
