/* ---------- Dark theme (default) ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #070b16;
  --bg-soft: #0d1430;
  --surface: rgba(16, 25, 52, 0.72);
  --surface-2: rgba(11, 19, 43, 0.85);
  --text: #eef3ff;
  --muted: #a9b8dc;
  --primary: #6fa4ff;
  --border: rgba(172, 185, 219, 0.22);
  --radius: 1rem;
  --shadow: 0 18px 60px rgba(4, 8, 20, 0.5);
  --body-bg: linear-gradient(180deg, #070b16 0%, #090f22 100%);
  --topbar-bg: rgba(7, 11, 22, 0.75);
  --topbar-border: rgba(172, 185, 219, 0.16);
  --topbar-shadow: 0 1px 0 rgba(172, 185, 219, 0.06), 0 10px 30px rgba(3, 6, 16, 0.45);
  --modal-bg: #0e1830;
  --section-alt-bg: linear-gradient(180deg, rgba(13, 20, 48, 0.55), rgba(13, 20, 48, 0));
  --btn-primary-end: #ffffff;
  /* accent is overridden per component page */
  --accent: #61ffd2;
  --accent-soft: rgba(97, 255, 210, 0.16);
}

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  --bg: #eef2fb;
  --bg-soft: #ffffff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-2: #eef2fb;
  --text: #121d33;
  --muted: #51607f;
  --primary: #2f6ae0;
  --border: rgba(23, 44, 82, 0.16);
  --shadow: 0 16px 44px rgba(23, 44, 82, 0.12);
  --body-bg: linear-gradient(180deg, #eef2fb 0%, #e3e9f7 100%);
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --topbar-border: rgba(23, 44, 82, 0.12);
  --topbar-shadow: 0 1px 0 rgba(23, 44, 82, 0.04), 0 10px 26px rgba(23, 44, 82, 0.10);
  --modal-bg: #ffffff;
  --section-alt-bg: linear-gradient(180deg, rgba(220, 229, 247, 0.6), rgba(220, 229, 247, 0));
  --btn-primary-end: #ffffff;
  --accent: #1f9e85;
  --accent-soft: rgba(31, 158, 133, 0.14);
}

/* System preference (no explicit choice) → follow OS light mode */
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #eef2fb;
    --bg-soft: #ffffff;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-2: #eef2fb;
    --text: #121d33;
    --muted: #51607f;
    --primary: #2f6ae0;
    --border: rgba(23, 44, 82, 0.16);
    --shadow: 0 16px 44px rgba(23, 44, 82, 0.12);
    --body-bg: linear-gradient(180deg, #eef2fb 0%, #e3e9f7 100%);
    --topbar-bg: rgba(255, 255, 255, 0.82);
    --topbar-border: rgba(23, 44, 82, 0.12);
    --topbar-shadow: 0 1px 0 rgba(23, 44, 82, 0.04), 0 10px 26px rgba(23, 44, 82, 0.10);
    --modal-bg: #ffffff;
    --section-alt-bg: linear-gradient(180deg, rgba(220, 229, 247, 0.6), rgba(220, 229, 247, 0));
    --accent: #1f9e85;
    --accent-soft: rgba(31, 158, 133, 0.14);
  }
}

/* Accent per component page — base values target the dark theme */
body.accent-teal { --accent: #61ffd2; --accent-soft: rgba(97, 255, 210, 0.16); }
body.accent-blue { --accent: #6fa4ff; --accent-soft: rgba(111, 164, 255, 0.16); }
body.accent-violet { --accent: #b79dff; --accent-soft: rgba(183, 157, 255, 0.18); }

/* Darker accents for better contrast on light backgrounds */
:root[data-theme="light"] body.accent-teal { --accent: #1f9e85; --accent-soft: rgba(31, 158, 133, 0.14); }
:root[data-theme="light"] body.accent-blue { --accent: #2f6ae0; --accent-soft: rgba(47, 106, 224, 0.14); }
:root[data-theme="light"] body.accent-violet { --accent: #6a46f0; --accent-soft: rgba(106, 70, 240, 0.16); }

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] body.accent-teal { --accent: #1f9e85; --accent-soft: rgba(31, 158, 133, 0.14); }
  :root[data-theme="system"] body.accent-blue { --accent: #2f6ae0; --accent-soft: rgba(47, 106, 224, 0.14); }
  :root[data-theme="system"] body.accent-violet { --accent: #6a46f0; --accent-soft: rgba(106, 70, 240, 0.16); }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--body-bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
}

.container {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  z-index: -1;
}

.orb-1 {
  width: 360px;
  height: 360px;
  background: rgba(111, 164, 255, 0.26);
  left: -130px;
  top: 60px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--accent-soft);
  right: -90px;
  top: 420px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: var(--topbar-shadow);
}

.topbar-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  line-height: 1.1;
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
  transition: transform 0.25s ease;
}

.brand:hover .brand-logo {
  transform: rotate(-6deg) scale(1.05);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--muted);
}

.menu {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.menu a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}

.menu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.menu a:hover,
.menu a.is-current {
  color: var(--text);
}

.menu a:hover::after,
.menu a.is-current::after {
  width: 100%;
}

.lang-switch {
  display: inline-flex;
  gap: 0.35rem;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 0.5rem;
  cursor: pointer;
  padding: 0;
}

.theme-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.theme-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lang-btn {
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  padding: 0.35rem 0.55rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
}

.lang-btn.is-active {
  color: #071022;
  background: var(--accent);
  border-color: transparent;
}

/* ---------- Hero ---------- */
.hero {
  padding: 5rem 0 3.5rem;
}

.hero-compact {
  padding: 3rem 0 1.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 1.6rem;
  align-items: center;
}

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

h1 {
  margin: 0.5rem 0 1rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.14;
}

h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.lead {
  margin: 0;
  color: var(--muted);
  max-width: 68ch;
  font-size: 1.05rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.6rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  color: var(--text);
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  padding: 0.7rem 1.05rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  color: #081225;
  background: linear-gradient(135deg, var(--accent), var(--btn-primary-end));
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary {
  color: #dcecff;
  border-color: rgba(111, 164, 255, 0.5);
}

.btn-quote {
  color: #fff;
  background: linear-gradient(135deg, #ff6b5c, #ef4a52);
  box-shadow: 0 6px 18px rgba(239, 74, 82, 0.28);
}

.btn-quote:hover {
  background: linear-gradient(135deg, #ff7d6f, #f85d64);
}

/* ---------- Hero panel + stats ---------- */
.hero-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat:hover {
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.stat strong {
  font-size: 1.8rem;
  color: var(--accent);
  min-width: 2.5rem;
}

.stat span {
  color: var(--muted);
}

/* ---------- Sections ---------- */
.section {
  padding: 2.9rem 0;
}

.section-alt {
  background: var(--section-alt-bg);
  border-top: 1px solid var(--topbar-border);
  border-bottom: 1px solid var(--topbar-border);
}

.section-lead {
  color: var(--muted);
  margin: 0 0 1.4rem;
  max-width: 74ch;
}

/* ---------- Component cards (home) ---------- */
.components {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

.component-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.component-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--card-accent, var(--accent)), transparent 85%);
  opacity: 0.85;
}

.component-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  border-color: var(--card-accent, var(--accent));
}

.component-card:nth-child(1) { --card-accent: #2bb7a0; }
.component-card:nth-child(2) { --card-accent: #4f8cff; }
.component-card:nth-child(3) { --card-accent: #9a7cff; }

.chip {
  align-self: flex-start;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem;
  border-radius: 0.5rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.chip-frontend { color: #61ffd2; border-color: rgba(97, 255, 210, 0.4); background: rgba(97, 255, 210, 0.08); }
.chip-backend { color: #6fa4ff; border-color: rgba(111, 164, 255, 0.4); background: rgba(111, 164, 255, 0.08); }
.chip-ticketing { color: #b79dff; border-color: rgba(183, 157, 255, 0.4); background: rgba(183, 157, 255, 0.08); }

:root[data-theme="light"] .chip-frontend { color: #0f8f78; border-color: rgba(31, 158, 133, 0.4); background: rgba(31, 158, 133, 0.1); }
:root[data-theme="light"] .chip-backend { color: #275fcf; border-color: rgba(47, 106, 224, 0.4); background: rgba(47, 106, 224, 0.1); }
:root[data-theme="light"] .chip-ticketing { color: #5a39d6; border-color: rgba(106, 70, 240, 0.4); background: rgba(106, 70, 240, 0.1); }

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] .chip-frontend { color: #0f8f78; border-color: rgba(31, 158, 133, 0.4); background: rgba(31, 158, 133, 0.1); }
  :root[data-theme="system"] .chip-backend { color: #275fcf; border-color: rgba(47, 106, 224, 0.4); background: rgba(47, 106, 224, 0.1); }
  :root[data-theme="system"] .chip-ticketing { color: #5a39d6; border-color: rgba(106, 70, 240, 0.4); background: rgba(106, 70, 240, 0.1); }
}

.component-tagline {
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.component-note {
  margin: 0 0 0.9rem;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--card-accent, var(--accent));
  border-radius: 0 0.5rem 0.5rem 0;
  background: color-mix(in srgb, var(--card-accent, var(--accent)) 10%, transparent);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 500;
}

.component-actions {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.component-actions .btn {
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
}

/* ---------- Feature list ---------- */
.feature-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.feature-list li + li {
  margin-top: 0.4rem;
}

/* ---------- Flow ---------- */
.flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.flow-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.1rem 1.3rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.flow-step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.1rem;
  bottom: 1.1rem;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.7;
}

.flow-step:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
  border-color: var(--accent);
}

.flow-step h4 {
  margin: 0 0 0.35rem;
  color: var(--accent);
}

.flow-step p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Demo cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
  border-color: var(--accent);
}

.card h3 {
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.card p {
  color: var(--muted);
  margin: 0 0 0.9rem;
}

/* ---------- Feature groups (detail pages) ---------- */
.features {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.feature {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.4rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.feature:hover {
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.22);
  border-color: var(--accent);
}

.feature.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-reverse .feature-copy {
  order: 2;
}

.feature-text {
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.shot {
  margin: 0;
}

.shot img {
  width: 100%;
  display: block;
  border-radius: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.shot figcaption {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.shot-teal img { box-shadow: 0 10px 40px rgba(97, 255, 210, 0.1); }
.shot-blue img { box-shadow: 0 10px 40px rgba(111, 164, 255, 0.12); }
.shot-violet img { box-shadow: 0 10px 40px rgba(183, 157, 255, 0.12); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid rgba(172, 185, 219, 0.14);
  padding: 1.3rem 0 2rem;
  margin-top: 1.5rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.footer-note {
  max-width: 52ch;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid,
  .components,
  .flow,
  .cards,
  .feature {
    grid-template-columns: 1fr;
  }

  .feature-reverse .feature-copy {
    order: 0;
  }
}

@media (max-width: 720px) {
  .menu {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
  }
}

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

  .reveal,
  .feature {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Demo access modal ---------- */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 7, 16, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal {
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.22s ease;
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  background: var(--modal-bg);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.3rem;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.1rem 1.3rem;
}

.modal-intro {
  color: var(--muted);
  margin: 0 0 1rem;
}

.modal-subtitle {
  margin: 1.3rem 0 0.6rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.modal-table th,
.modal-table td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(172, 185, 219, 0.14);
  vertical-align: top;
}

.modal-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-table code {
  background: rgba(111, 164, 255, 0.14);
  border: 1px solid rgba(111, 164, 255, 0.25);
  border-radius: 0.4rem;
  padding: 0.12rem 0.4rem;
  font-size: 0.86rem;
  color: #dcecff;
  white-space: nowrap;
}

.modal-notes {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.modal-notes li + li {
  margin-top: 0.4rem;
}

.modal-fineprint {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.modal-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.3rem;
  background: var(--modal-bg);
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .modal-foot {
    flex-direction: column-reverse;
  }

  .modal-foot .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal {
    transition: none;
  }
}

.modal-cancel {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.modal-cancel:hover {
  border-color: var(--accent);
}
