body {
  padding-top: 80px;
  overflow-x: hidden;
  background-color: #f8fafc;
}

body.layout-blank {
  padding-top: 0;
}

/* Public marketing floating header: shell padding + inner bar (see header.ejs) */
body.public-header-floating {
  padding-top: 88px;
}

@media (min-width: 768px) {
  body.public-header-floating {
    padding-top: 104px;
  }
}

body.modal-open {
  overflow: hidden;
}

body.theme-logged-in {
  background:
    radial-gradient(circle at 12% 8%, rgba(30, 58, 138, 0.14), rgba(30, 58, 138, 0) 38%),
    radial-gradient(circle at 86% 4%, rgba(15, 23, 42, 0.1), rgba(15, 23, 42, 0) 36%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 52%, #e8f0f8 100%);
}

body.theme-default {
  background: #f8fafc;
}

.app-foreground {
  position: relative;
  z-index: 10;
}

.background-system {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 55%, #eef2f7 100%);
}

.background-system::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(71, 85, 105, 0.1), rgba(71, 85, 105, 0) 35%),
    radial-gradient(circle at 78% 12%, rgba(30, 58, 138, 0.12), rgba(30, 58, 138, 0) 42%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.2), rgba(248, 250, 252, 0.72) 70%, rgba(248, 250, 252, 0.9));
}

.background-system::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Top/bottom fade to keep foreground content readable */
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.86) 0%, rgba(248, 250, 252, 0.2) 18%, rgba(248, 250, 252, 0.16) 80%, rgba(248, 250, 252, 0.92) 100%);
}

.bg-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  --bg-tile-height: 130vh;
}

.bg-layer svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bg-layer-track {
  position: absolute;
  inset: 0;
  will-change: transform;
  transform: translateY(0);
}

.bg-layer-tile {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--bg-tile-height);
}

.bg-layer-tile--clone {
  top: var(--bg-tile-height);
}

.bg-layer--deep {
  opacity: 0.7;
  filter: blur(12px);
}

.bg-layer--deep path,
.bg-layer--deep rect {
  fill: #5f7488;
  stroke: #5f7488;
  stroke-width: 1.2;
}

.bg-layer--mid {
  opacity: 0.5;
  filter: blur(5px);
}

.bg-layer--mid .bg-grid-fragments path {
  fill: none;
  stroke: #4e6479;
  stroke-width: 1;
}

.bg-layer--mid .bg-routes path {
  fill: none;
  stroke: #314c66;
  stroke-width: 2;
  stroke-dasharray: 5 7;
}

.bg-layer--mid .bg-node-clusters circle {
  fill: #2e4962;
}

.bg-layer--accent {
  opacity: 0.45;
  filter: blur(3px);
}

.bg-layer--accent .bg-timeline path {
  fill: none;
  stroke: #26517d;
  stroke-width: 2;
}

.bg-layer--accent .bg-accent-nodes circle {
  fill: #26517d;
}

/* Only make section backgrounds transparent on marketing pages with parallax */
body.has-parallax-background .app-foreground section,
body.has-parallax-background .app-foreground section[class*="bg-"] {
  background-color: transparent !important;
  background-image: none !important;
}

@media (max-width: 768px) {
  .bg-layer {
    --bg-tile-height: 120vh;
  }

  .background-system::before {
    background:
      radial-gradient(circle at 25% 14%, rgba(71, 85, 105, 0.08), rgba(71, 85, 105, 0) 32%),
      linear-gradient(180deg, rgba(248, 250, 252, 0.24), rgba(248, 250, 252, 0.76));
  }

  .bg-layer--accent {
    display: none;
  }

  .bg-layer--mid {
    opacity: 0.2;
  }

  body.has-parallax-background .app-foreground section,
  body.has-parallax-background .app-foreground section[class*="bg-"] {
    background-color: transparent !important;
    background-image: none !important;
  }
}

/* Marketing header scroll — public/js/main.js toggles .header-scrolled on #main-header */
#main-header.marketing-header #marketing-header-bar {
  transition:
    box-shadow 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease,
    backdrop-filter 150ms ease,
    -webkit-backdrop-filter 150ms ease;
}

#main-header.marketing-header.header-scrolled #marketing-header-bar {
  border-color: rgba(148, 163, 184, 0.55);
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.06),
    0 10px 28px -12px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (prefers-reduced-motion: reduce) {
  #main-header.marketing-header #marketing-header-bar {
    transition: none;
  }
}

/* Mobile drawer toggled with "active" in main.js */
#mobile-menu {
  transform: translateX(100%);
  transition: transform 200ms ease;
}

#mobile-menu.active {
  transform: translateX(0);
}

#mobile-menu-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

#mobile-menu-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal toggled with "active" in main.js */
.modal-backdrop {
  display: none;
}

.modal-backdrop.active {
  display: flex;
}

/* Country selector behavior used by country_selector.js */
.country-selector {
  position: relative;
}

.country-selector-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  padding: 0.25rem;
}

.country-selector-option {
  cursor: pointer;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
}

.country-selector-option:hover {
  background-color: #f8fafc;
}

/* legacy-temp: bridge classes while templates are migrated */
.btn {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-primary {
  background: #015286;
  color: #fff;
}

.btn-primary:hover {
  background: #1f81d3;
}

.btn-secondary {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
}

.btn-secondary:hover {
  background: #f9fafb;
}

.btn-success {
  background: #388f5b;
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}


/* Divider */
.section-divider1 {
  width: 100%;
  height: 120px;
  background: linear-gradient(90deg, #38905b, #025387);
  clip-path: path("M0,60 C480,100 960,20 1440,60 L1440,0 L0,0 Z");
}
.section-divider2 {
  height: 120px;
  background: linear-gradient(90deg, #38905b, #025387);
  clip-path: polygon(
    0% 50%,
    25% 70%,
    50% 40%,
    75% 65%,
    100% 50%,
    100% 0%,
    0% 0%
  );
}

/* Shared final CTA card readability on dark backgrounds */
.cta-dark-card p {
  color: #e2e8f0;
}