/* ================================================================
   Toanoa — clean B2B landing
   Framework: 8pt spacing · single accent · one display face (Geist)
   ================================================================ */

:root {
  /* LIGHT — matches app light mode: clean white body, navy ink, blue accent */
  --bg:        #FAFAF8;                 /* slightly warm off-white */
  --surface:   #FFFFFF;
  --ink:       #0F172A;                 /* navy ink, not black */
  --ink-2:     #475569;                 /* body */
  --ink-3:     #94A3B8;                 /* meta */
  --line:      #E2E6EC;
  --line-soft: #EDF0F4;
  --accent:    #2563EB;                 /* Toanoa blue (from app) */
  --accent-2:  #EAF0FD;                 /* accent tint */
  --ok:        #16A34A;                 /* status: on-time/available */
  --warn:      #F59E0B;                 /* status: warning */
  --exc:       #DC2626;                 /* status: exception/pin */

  /* Nav follows the theme — quiet chrome, no hard seams */
  --nav-bg:    #FAFAF8;
  --nav-ink:   #0F172A;
  --nav-ink-2: #475569;
  --nav-line:  #E2E6EC;

  --s-1: 4px;  --s-2: 8px;  --s-3: 16px;
  --s-4: 24px; --s-5: 32px; --s-6: 48px;
  --s-7: 64px; --s-8: 96px; --s-9: 128px; --s-10: 160px;

  --radius: 10px;
  --container: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root {
  /* DARK — matches app dark mode: deep navy, lighter navy surfaces */
  --bg:        #0B1424;
  --surface:   #13213B;
  --ink:       #F8FAFC;
  --ink-2:     #B4C1D4;
  --ink-3:     #6B7A91;
  --line:      #1E2D47;
  --line-soft: #182541;
  --accent:    #3B82F6;                 /* brightened blue for dark */
  --accent-2:  #162847;
  --ok:        #22C55E;
  --warn:      #F59E0B;
  --exc:       #EF4444;

  --nav-bg:    #0B1424;
  --nav-ink:   #F8FAFC;
  --nav-ink-2: #94A3B8;
  --nav-line:  #162847;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11", "tnum";
  line-height: 1.55;
  overflow-x: hidden;
  transition: background .2s, color .2s;
}
/* ------- Layout primitives ------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-5); }
.section { padding: var(--s-8) 0; }

.divider-top { border-top: 1px solid var(--line); }

/* ------- Typography primitives ------- */

.display {
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(44px, 5.6vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0;
  color: var(--ink);
}
.display em {
  font-style: normal;
  color: var(--ink-2);
  font-weight: 500;
}

.h2 {
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(32px, 3.8vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
}
.h2 em { font-style: normal; color: var(--ink-2); font-weight: 500; }

.lede {
  font-size: 19px;
  color: var(--ink-2);
  line-height: 1.5;
  max-width: 52ch;
  margin: 0;
}

/* ------- Buttons ------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s, background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-link { color: var(--ink-2); padding: 11px 4px; border-radius: 0; }
.btn-link:hover { color: var(--ink); }

/* ================================================================
   NAV
   ================================================================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--nav-bg) 85%, transparent);
  border-bottom: 1px solid var(--nav-line);
  color: var(--nav-ink);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.logo {
  display: inline-flex; align-items: center;
  text-decoration: none;
}
.logo img { display: block; }

/* ================================================================
   HERO
   ================================================================ */
.hero { padding: var(--s-8) 0 var(--s-7); position: relative; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }
.hero .display { max-width: 18ch; }
.hero .lede { margin-top: var(--s-4); }
.hero-cta { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-5); flex-wrap: wrap; }

/* ================================================================
   DEMO — one video, chapters below act as bookmarks
   ================================================================ */
.demo { margin-top: var(--s-7); }
.demo-video {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow:
    0 30px 60px -30px rgba(16, 18, 24, 0.12),
    0 4px 12px -6px rgba(16, 18, 24, 0.06);
}
.demo-video video {
  width: 100%;
  height: auto;
  display: block;
}
.play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(16,18,24,0.25);
  opacity: 1;
  transition: transform .15s, background .15s, opacity .2s;
  z-index: 2;
}
.play-btn:hover { transform: translate(-50%, -50%) scale(1.06); background: var(--bg); }
.play-btn svg { transform: translateX(2px); }
.demo.playing .play-btn { opacity: 0; pointer-events: none; }
.demo.playing .demo-video:hover .play-btn { opacity: 1; pointer-events: auto; }
.demo.playing .play-btn svg path { d: path("M6 5h4v14H6zM14 5h4v14h-4z"); }

.demo-progress {
  position: absolute; left: 0; bottom: 0;
  height: 2px; width: 0%;
  background: var(--accent);
  transition: width .25s linear;
  pointer-events: none;
}

/* Chapters */
.chapters {
  list-style: none; margin: var(--s-5) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.chapter {
  position: relative;
  padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 2px);
  border-left: 1px solid var(--line-soft);
  cursor: pointer;
  outline: none;
  transition: background .15s;
}
.chapter:first-child { border-left: 0; }
.chapter::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px;
  background: transparent;
  transition: background .2s;
}
.chapter[aria-selected="true"]::before { background: var(--accent); }
.chapter:hover { background: color-mix(in oklab, var(--accent) 4%, transparent); }
.chapter:focus-visible { background: color-mix(in oklab, var(--accent) 7%, transparent); }
.chapter .ico {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--ink-3);
  transition: color .2s;
}
.chapter[aria-selected="true"] .ico { color: var(--accent); }
.chapter h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 4px;
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--ink);
}
.chapter p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
  .chapter, .chapter::before, .chapter .ico, .demo-progress, .play-btn { transition: none; }
}


/* ================================================================
   METRICS
   ================================================================ */
.metrics { padding: var(--s-7) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4) 0;
}
.metric { padding: 0 var(--s-5); border-left: 1px solid var(--line-soft); }
.metric:first-child { border-left: 0; padding-left: 0; }
.metric .k {
  font-family: inherit; font-weight: 600;
  font-size: clamp(32px, 3.4vw, 44px);
  line-height: 1; letter-spacing: -0.025em;
  margin-bottom: var(--s-2);
  color: var(--ink);
  font-feature-settings: "tnum", "ss01";
}
.metric .k .unit { color: var(--accent); }
.metric .l { font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }

.sec-head {
  max-width: 42ch;
  margin: 0 0 var(--s-8);
}
.sec-head .lede { margin-top: var(--s-4); }

/* ================================================================
   APPS — driver + customer tracking, two-column phone mockups
   ================================================================ */
.apps { padding: 80px 0; }
.sec-head-center { text-align: center; max-width: 700px; margin: 0 auto var(--s-5); }
.sec-head-center .h2 { margin: 0 auto var(--s-3); }
.sec-head-center .lede { margin: 0 auto; max-width: 48ch; }

.apps-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
  align-items: start;
}
.app-col {
  display: flex; flex-direction: column; gap: var(--s-4);
  align-items: center;
  text-align: center;
}
.app-frame {
  width: 100%;
  display: grid; place-items: center;
  padding: 0;
}
.app-copy {
  max-width: 40ch;
}
.app-copy h3 {
  margin: 0 0 var(--s-2);
  font-size: 19px; font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.app-copy p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px; line-height: 1.6;
}

/* Phone frame — clean Android-style (no logos) */
.phone {
  width: 220px;
  aspect-ratio: 9 / 19.5;
  background: #0B1424;
  border-radius: 28px;
  padding: 8px;
  box-shadow:
    0 30px 60px -24px rgba(11, 20, 36, 0.24),
    0 8px 24px -8px rgba(11, 20, 36, 0.14),
    inset 0 0 0 1px rgba(255,255,255,0.04);
  position: relative;
}
.phone-screen {
  background: var(--surface);
  border-radius: 22px;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.phone-screen img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.phone-notch {
  position: absolute; top: 14px; left: 50%;
  transform: translateX(-50%);
  width: 76px; height: 18px;
  background: #0B1424;
  border-radius: 10px;
  z-index: 2;
}

/* Thin rule between the two app columns on desktop */
.apps-grid > .app-col:first-child {
  border-right: 1px solid var(--line-soft);
  padding-right: var(--s-4);
}
.apps-grid > .app-col:last-child {
  padding-left: var(--s-4);
}

/* ================================================================
   ORIGIN
   ================================================================ */
.origin-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-9);
  align-items: start;
}
.origin .h2 { max-width: 16ch; }
.origin-attr {
  margin-top: var(--s-4);
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
  max-width: 28ch;
  font-style: italic;
}
.origin .body p {
  margin: 0 0 var(--s-4);
  color: var(--ink-2);
  font-size: 16.5px; line-height: 1.7;
}
.origin .body p:last-child { margin-bottom: 0; }
.origin .body p strong { color: var(--ink); font-weight: 500; }

/* ================================================================
   API / INTEGRATION
   ================================================================ */
.api-grid {
  display: grid; grid-template-columns: 0.7fr 1.3fr;
  gap: var(--s-7);
  align-items: start;
}
.api-copy .h2 { max-width: 14ch; margin-bottom: var(--s-4); }
.api-copy .lede { margin-bottom: var(--s-5); max-width: 44ch; }
.api-points {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: var(--s-2);
  border-top: 1px solid var(--line-soft);
  padding-top: var(--s-4);
}
.api-points li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}
.api-points li::before {
  content: "";
  position: absolute; left: 0; top: 8px;
  width: 10px; height: 1px;
  background: var(--accent);
}

.api-code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 20px 40px -24px rgba(16, 18, 24, 0.10),
    0 2px 6px -3px rgba(16, 18, 24, 0.04);
}
.code-body {
  margin: 0;
  padding: var(--s-4) var(--s-5);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--surface);
  overflow-x: auto;
  tab-size: 2;
  white-space: pre;
}
.code-body .s    { color: var(--accent); }
.code-body .key  { color: var(--ink-2); }
.code-body .n    { color: var(--ink); font-weight: 500; }
.code-body .tok  { color: var(--ink-3); }

/* ================================================================
   CTA
   ================================================================ */
.cta { text-align: center; position: relative; overflow: hidden; }
.cta-bg {
  position: absolute; inset: 0;
  color: var(--accent);
  pointer-events: none;
  z-index: 0;
}
.cta > .container { position: relative; z-index: 1; }
.cta .display { margin: 0 auto var(--s-4); max-width: 16ch; }
.cta .lede { margin: 0 auto var(--s-5); }
.cta .hero-cta { justify-content: center; }

/* ================================================================
   FOOTER
   ================================================================ */
footer {
  border-top: 1px solid var(--line);
  padding: var(--s-6) 0;
  font-size: 13.5px; color: var(--ink-3);
}
.foot-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s-3); }


/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-5) 0; }
  .metric { padding: 0 var(--s-3); }
  .metric:nth-child(3) { border-left: 0; padding-left: var(--s-3); }
  .origin-grid { grid-template-columns: 1fr; gap: var(--s-5); }
  .api-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .apps { padding: 72px 0; }
  .apps-grid { grid-template-columns: 1fr; gap: var(--s-7); }
  .apps-grid > .app-col:first-child { border-right: 0; padding-right: 0; border-bottom: 1px solid var(--line-soft); padding-bottom: var(--s-7); }
  .apps-grid > .app-col:last-child { padding-left: 0; }
  .hero { padding: var(--s-8) 0 var(--s-7); }
  .chapters { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .chapter:nth-child(3) { border-left: 0; }
}
@media (max-width: 560px) {
  .chapters { grid-template-columns: 1fr; }
  .chapter { border-left: 0; border-top: 1px solid var(--line-soft); padding: var(--s-3) 0 var(--s-3) var(--s-3); }
  .chapter:first-child { border-top: 0; }
  .chapter::before { top: 0; bottom: 0; left: 0; }
  .chapter:first-child::before { left: 0; }
}
