/* ---------- Reset & base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --color-primary: #7967C1;
  --color-primary-dark: #54419F;
  --color-primary-light: #BAB2DC;
  --color-tint: #ECEAF5;
  --color-text: #363347;
  --color-text-light: #7A7389;
  --color-bg: #FDFCFF;
  --color-bg-alt: #ECEAF5;
  --color-border: #DBD7EA;
  --color-danger: #DE9B9B;
  --color-success: #8FCFA6;
  --radius: 10px;

  color-scheme: light;
}

/* ---------- Dark mode ---------- */
:root[data-theme="dark"] {
  --color-bg: #1D1A26;
  --color-bg-alt: #26212F;
  --color-border: #423A57;
  --color-text: #E6E1F0;
  --color-text-light: #A79ECB;
  --color-tint: #26212F;
  --color-danger: #E3ABAB;
  --color-success: #9FDFB8;

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #1D1A26;
    --color-bg-alt: #26212F;
    --color-border: #423A57;
    --color-text: #E6E1F0;
    --color-text-light: #A79ECB;
    --color-tint: #26212F;
    --color-danger: #E3ABAB;
    --color-success: #9FDFB8;

    color-scheme: dark;
  }
}

body,
.site-header,
.card,
.site-footer,
.nav-dropdown-menu,
.accordion-item,
.contact-form input,
.contact-form select,
.contact-form textarea,
.theme-toggle {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.underline {
  text-decoration: underline;
  text-decoration-color: var(--color-primary);
  text-underline-offset: 4px;
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  line-height: 1.6;
  background: var(--color-bg);
}

a { text-decoration: none; color: var(--color-primary); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow {
  max-width: 700px;
}

h1 { font-size: 2.4rem; margin-bottom: 12px; }
h2 { font-size: 1.8rem; margin-bottom: 24px; }
h3 { font-size: 1.2rem; margin-bottom: 8px; }

p { color: var(--color-text-light); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--color-primary);
  color: white;
  margin-bottom: 10px;
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-outline {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ---------- Work-in-progress banner ---------- */
.wip-banner {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.8em;
  max-width: min(380px, calc(100vw - 40px));
  padding: 0.9em 1.2em;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  transform: translate(120%, -20%);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}
.wip-banner-visible {
  transform: translate(0, 0);
  opacity: 1;
}
.wip-banner-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2em 0.4em;
  opacity: 0.8;
}
.wip-banner-close:hover { opacity: 1; }

@media (max-width: 600px) {
  .wip-banner {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ---------- Header / Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.theme-toggle {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 1000;
  width: 64px;
  height: 64px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--color-primary);
  background-color: #ffffff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(121, 103, 193, 0.6), 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: background-color 0.6s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
}
:root[data-theme="dark"] .theme-toggle {
  background-color: #111111;
}
.theme-toggle-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  line-height: 1;
  opacity: 0;
  transition: left 0.7s cubic-bezier(0.4, 0, 0.2, 1), top 0.7s cubic-bezier(0.34, 1.15, 0.64, 1), opacity 0.5s ease;
}
/* rest state: whichever icon matches the theme sits centered; the JS click handler
   arcs the outgoing/incoming icons in from opposite sides of the circle before
   settling back here, so sun and moon each orbit in a consistent direction */
.theme-toggle .icon-sun {
  opacity: 1;
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 0;
}
:root[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 1;
}

.logo {
  display: flex;
  align-items: center;
  min-width: 0;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
}

.logo img {
  height: 84px;
  width: auto;
}

.logo-dark { display: none; }

:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

.site-nav {
  display: flex;
  gap: 28px;
}

.site-nav a {
  color: var(--color-text-light);
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.nav-dropdown {
  position: relative;
}

/* invisible bridge over the gap to the menu, so moving the mouse from the
   toggle down to the menu doesn't cross a dead zone and trigger mouseleave */
.nav-dropdown::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 12px;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font: inherit;
  font-weight: 500;
  color: var(--color-text-light);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.nav-dropdown-arrow {
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

.nav-dropdown.open .nav-dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 180px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  padding: 8px;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  color: var(--color-text);
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  border-bottom: none;
}

.nav-dropdown-menu-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 2px 8px;
  width: max-content;
  min-width: 320px;
  max-width: 560px;
}

.nav-dropdown-menu a:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  background: linear-gradient(180deg, var(--color-tint) 0%, var(--color-bg) 100%);
}
.hero h1 { max-width: 700px; margin: 0 auto 16px; }
.hero p {
  max-width: 520px;
  margin: 0 auto 28px;
}
.hero .btn {
  display: block;
  width: fit-content;
  margin: 0 auto 10px;
}

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--color-bg-alt); }
.section h2 { text-align: center; }

.page-header {
  padding: 56px 0 40px;
  text-align: center;
  background: var(--color-bg-alt);
}
.page-header p { max-width: 520px; margin: 0 auto; }

/* ---------- Grids & cards ---------- */
.grid {
  display: grid;
  gap: 24px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary-light);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: box-shadow 0.2s ease, border-top-color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: 0 8px 24px rgba(121, 103, 193, 0.15);
  border-top-color: var(--color-primary);
}

/* Pricing */
.pricing-card .price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
}
.pricing-card-featured {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(121, 103, 193, 0.15);
  transform: scale(1.03);
}
.feature-list {
  margin-bottom: 20px;
  text-align: left;
}
.feature-list li {
  padding: 6px 0;
  color: var(--color-text-light);
}
.feature-list li::before {
  content: "✓ ";
  color: var(--color-primary);
  font-weight: 700;
}

/* Team */
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* Stats */
.stats { text-align: center; }
.stat-number {
  display: block;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--color-primary);
}
.stat-label {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* ---------- sponsor slider ---------- */
.sponsor-slider {
  position: relative;
  width: calc(100% + 200px);
  margin-left: -100px;
  margin-right: -100px;
  background-color: var(--color-tint);
  box-shadow: 0 0 50px rgba(121, 103, 193, 0.1);
  border-radius: var(--radius);
  padding: 3em 0;
  overflow: hidden;
}
.sponsor-slider::before,
.sponsor-slider::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(40px, 10%, 120px);
  pointer-events: none;
  z-index: 2;
}
.sponsor-slider::before {
  left: 0;
  background: linear-gradient(to right, var(--color-tint), transparent);
}
.sponsor-slider::after {
  right: 0;
  background: linear-gradient(to left, var(--color-tint), transparent);
}
.sponsor-track {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 2em;
  animation: scroll 20s linear infinite;
}
.sponsor-track a {
  display: block;
  flex-shrink: 0;
}
/* the light/dark logo variant that's hidden for the current theme must not
   reserve a flex slot, or the gap on both sides of it doubles up */
.sponsor-track a:has(.logo-dark) {
  display: none;
}
:root[data-theme="dark"] .sponsor-track a:has(.logo-light) {
  display: none;
}
:root[data-theme="dark"] .sponsor-track a:has(.logo-dark) {
  display: block;
}
.sponsor {
  display: block;
  width: auto;
  height: 72px;
  max-width: 170px;
}

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- Accordion ---------- */
.accordion {
  max-width: 700px;
  margin: 0 auto;
}
.accordion-item {
  border-bottom: 1px solid var(--color-border);
}
.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 20px 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text);
}
.accordion-icon {
  font-size: 1.4rem;
  color: var(--color-primary);
  transition: transform 0.2s ease;
}
.accordion-item.open .accordion-icon {
  transform: rotate(45deg);
}
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.accordion-panel p {
  padding: 0 4px 20px;
}

/* ---------- CTA ---------- */
.cta {
  background: var(--color-primary);
  color: white;
  text-align: center;
  padding: 64px 0;
}
.cta h2 { color: white; margin-bottom: 20px; }
.cta .btn-primary {
  background: white;
  color: var(--color-primary);
}
.cta .btn-primary:hover { background: var(--color-tint); }

/* ---------- Contact form ---------- */
.contact-form .form-group {
  margin-bottom: 20px;
}
.contact-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.contact-form input.invalid,
.contact-form textarea.invalid {
  border-color: var(--color-danger);
}
.error-message {
  display: block;
  color: var(--color-danger);
  font-size: 0.85rem;
  margin-top: 4px;
  min-height: 1.2em;
}
.form-success {
  margin-top: 16px;
  color: var(--color-success);
  font-weight: 600;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .header-right { gap: 12px; }

  .logo img { height: 52px; }

  .header-inner { padding-right: 32px; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .site-nav.open { max-height: 500px; }
  .site-nav a { padding: 16px 24px; width: 100%; border-bottom: 1px solid var(--color-border); }

  .nav-dropdown { width: 100%; }
  .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
  }
  .nav-dropdown-menu {
    position: static;
    display: none;
    background: var(--color-bg-alt);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }
  .nav-dropdown.open .nav-dropdown-menu { display: flex; }
  .nav-dropdown-menu a { padding: 12px 36px; border-radius: 0; }

  .nav-dropdown-menu-wide {
    display: flex;
    flex-direction: column;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pricing-card-featured { transform: none; }
  .hero { padding: 64px 0 48px; }
  h1 { font-size: 1.9rem; }

  .sponsor-slider {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .theme-toggle {
    width: 52px;
    height: 52px;
    right: calc(24px + env(safe-area-inset-right));
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .theme-toggle-icon {
    font-size: 20px;
  }
}
