/* Loopstack × layered-cards × charcoal-lime — TripScan speleo landing */
:root {
  --page: #121416;
  --surface: #1c1f22;
  --surface-raised: #252a2e;
  --text: #f2f4f0;
  --muted: #8b9399;
  --accent: #c8ff3d;
  --accent-dim: #9ecc2f;
  --accent-ink: #121416;
  --line: color-mix(in srgb, var(--text) 14%, transparent);
  --lime-glow: color-mix(in srgb, var(--accent) 28%, transparent);
  --radius: 18px;
  --radius-lg: 28px;
  --rail-w: clamp(220px, 16vw, 300px);
  --content-max: 1280px;
  --section-space: clamp(72px, 9vw, 120px);
  --font-display: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --track-wide: 0.06em;
  --track-display: 0.04em;
  --hero-max-h-desktop: 55vh;
  --hero-max-h-tablet: 44vh;
  --hero-max-h-mobile: 38vh;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  line-height: 1.62;
  font-family: var(--font-body);
  letter-spacing: var(--track-wide);
  background: var(--page);
  color: var(--text);
}

body, button, input, select, textarea { font: inherit; }

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

img, svg, video, canvas, iframe {
  display: block;
  max-width: 100%;
  height: auto;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: var(--track-display);
  font-weight: 700;
}

h1 {
  font-size: clamp(2.2rem, 4.8vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.75rem, 3.2vw, 3rem);
  line-height: 1.05;
  margin-bottom: 0.85rem;
}

h3 {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.2;
}

p { color: var(--muted); }

.defs-preserver {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* Page shell — side rail + balanced main canvas */
.page-frame {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  max-width: 2160px;
  margin: 0 auto;
}

.side-rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  z-index: 40;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 92%, var(--surface));
  backdrop-filter: blur(12px);
}

.rail-inner {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  min-height: 100vh;
  padding: clamp(1.25rem, 2vw, 2rem);
  min-width: 0;
}

.rail-brand-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.rail-brand-row .brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 0.95rem;
  min-width: 0;
}

.rail-brand-row .brand-logo {
  display: block;
  width: clamp(44px, 4.5vw, 64px);
  height: clamp(44px, 4.5vw, 64px);
  max-width: 64px;
  max-height: 64px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.rail-brand-row .brand-logo svg {
  width: 100%;
  height: 100%;
}

.rail-brand-row .brand small {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-rail nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.side-rail nav a {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0.55rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.side-rail nav a:hover {
  color: var(--text);
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.rail-cta-row {
  margin-top: auto;
  min-width: 0;
}

.page-main {
  min-width: 0;
}

.main-flow {
  display: block;
}

.section-inner {
  width: min(var(--content-max), calc(100% - clamp(1.5rem, 4vw, 3.5rem)));
  margin: 0 auto;
}

/* Hero — text above scene slot; compact motion region */
.hero {
  padding: clamp(2.5rem, 5vw, 4.5rem) 0 var(--section-space);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.hero-copy { min-width: 0; }

.eyebrow,
.section-kicker {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--accent);
}

.lead {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  max-width: 42rem;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 1rem;
}

.geo-line {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.hero-visual {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  max-height: var(--hero-max-h-desktop);
  aspect-ratio: 16 / 11;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background:
    radial-gradient(ellipse 80% 60% at 30% 40%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    linear-gradient(155deg, var(--surface), var(--surface-raised));
  box-shadow: 0 24px 48px color-mix(in srgb, var(--page) 50%, transparent);
}

/* CTAs */
.header-cta,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.button-primary,
.header-cta {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.button-primary:hover,
.header-cta:hover {
  box-shadow: 0 0 24px var(--lime-glow);
  transform: translateY(-1px);
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 22%, transparent);
}

.button-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Sections rhythm */
.section {
  padding: var(--section-space) 0;
  position: relative;
}

.section-heading {
  max-width: 46rem;
  margin-bottom: 2.25rem;
}

.section-heading > p {
  font-size: 1.02rem;
}

/* Layered cards — Loopstack offset stack */
.layered-cards-zone {
  position: relative;
}

.layered-cards-zone > .section {
  padding-top: calc(var(--section-space) * 0.75);
}

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

.card {
  position: relative;
  min-width: 0;
  padding: 1.35rem 1.4rem 1.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.cards-grid .card:nth-child(3n+2) {
  transform: translateY(12px);
}

.cards-grid .card:nth-child(3n) {
  transform: translateY(24px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--page) 65%, transparent);
  opacity: 0.55;
  z-index: -1;
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

.card p { margin-bottom: 0; }

.card-icon,
.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 0.85rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 12px;
}

.card-icon svg,
.step-icon svg {
  width: 26px;
  height: 26px;
}

.card-label {
  display: block;
  color: var(--accent);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.55rem;
}

.card small {
  display: block;
  color: var(--muted);
  margin-top: 0.45rem;
  font-size: 0.82rem;
}

/* Process — horizontal layered steps */
.process-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.process-list li {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--page) 55%, transparent);
}

.process-list li:nth-child(odd) {
  margin-top: 18px;
}

.step-icon { margin-bottom: 0; flex-shrink: 0; }

/* Geography chips as layered cards */
.geo-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.geo-chip {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.geo-chip strong,
.geo-chip span { display: block; }

.geo-chip span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.35rem;
}

.geo-chip:nth-child(even) {
  transform: translateX(12px);
}

/* Guide chapters */
.component-guide .section-inner { max-width: 920px; }

.guide-body { min-width: 0; }

.chapter {
  min-width: 0;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.chapter li {
  color: var(--muted);
  margin: 0.45rem 0;
}

/* FAQ */
.faq-list { max-width: 820px; }

.faq-list details {
  border-bottom: 1px solid var(--line);
  padding: 0.95rem 0;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
}

.faq-list p { padding-right: 1.5rem; }

/* Contact form */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 0.9rem;
  background: var(--surface);
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.contact-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  background: var(--page);
  color: var(--text);
  padding: 0.8rem 0.85rem;
  border-radius: calc(var(--radius) * 0.65);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.form-message {
  color: var(--accent);
  margin: 0;
}

.tripscan-disclaimer {
  font-size: 0.78rem !important;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* Footer */
.site-footer {
  padding: 3.5rem 0 4rem;
  background: color-mix(in srgb, var(--surface) 55%, var(--page));
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}

.footer-brand { font-size: 1.35rem; color: var(--text); }

.site-footer a {
  display: block;
  color: var(--muted);
  margin: 0.35rem 0;
}

/* Abstract system diagram accents */
.component-process::before,
.component-services::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: min(680px, 80%);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.35;
}

/* Responsive */
@media (max-width: 1100px) {
  .page-frame {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .rail-inner {
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem clamp(1rem, 3vw, 1.5rem);
  }

  .rail-brand-row { flex: 1 1 auto; }

  .side-rail nav {
    flex-direction: row;
    flex-wrap: wrap;
    order: 3;
    width: 100%;
  }

  .rail-cta-row {
    margin-top: 0;
    margin-left: auto;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    max-height: var(--hero-max-h-tablet);
    max-width: min(100%, 720px);
    justify-self: center;
  }

  .process-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid .card:nth-child(3n+2),
  .cards-grid .card:nth-child(3n) {
    transform: none;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero-visual {
    max-height: var(--hero-max-h-mobile);
    aspect-ratio: 4 / 3;
  }

  .cards-grid,
  .process-list,
  .geo-chips,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .geo-chip:nth-child(even) { transform: none; }

  .process-list li:nth-child(odd) { margin-top: 0; }

  .section-inner {
    width: min(100% - 1.75rem, var(--content-max));
  }
}

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

  .card,
  .button,
  .header-cta,
  .card-icon,
  .step-icon,
  .card-icon svg,
  .step-icon svg,
  .card-icon path,
  .step-icon path {
    transition: none !important;
    animation: none !important;
  }

  .cards-grid .card:nth-child(3n+2),
  .cards-grid .card:nth-child(3n),
  .geo-chip:nth-child(even),
  .process-list li:nth-child(odd) {
    transform: none;
  }
}
