@import url("./tokens.css");

:root {
  --ink: var(--rv-color-ink);
  --ink-deep: #04181f;
  --muted: var(--rv-color-muted);
  --accent: var(--rv-color-accent);
  --accent-deep: #c4922a;
  --teal: var(--rv-color-primary);
  --teal-bright: #1aa396;
  --sea: #06232c;
  --paper: #ffffff;
  --paper-soft: var(--rv-color-surface);
  --line: #d5e0e4;
  --shadow: 0 24px 60px rgba(6, 35, 44, 0.12);
  --radius: var(--rv-radius-md);
  --shell: min(1180px, calc(100% - 48px));
  --header-height: 76px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font-display: var(--rv-font-display);
  --font-body: var(--rv-font-body);
  --font-mono: var(--rv-font-mono);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

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

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 5.2rem);
}

h2 {
  font-size: clamp(1.8rem, 3.2vw, 3rem);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.skip-link {
  position: fixed;
  z-index: 11000;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--sea);
  color: #fff;
  font-weight: 700;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: none;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.site-header {
  position: fixed;
  z-index: 10000;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  background: rgba(6, 35, 44, .88);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  backdrop-filter: blur(18px);
  color: #f4f7f8;
}

.site-header.is-scrolled {
  background: rgba(4, 24, 31, .96);
  box-shadow: 0 10px 32px rgba(4, 24, 31, .35);
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f4f7f8;
  text-decoration: none;
}

.brand img {
  height: 40px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
}

.site-nav a {
  position: relative;
  color: #e8eef2;
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-nav a:not(.nav-cta)::after {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .25s var(--ease);
}

.site-nav a:is(:hover, :focus-visible)::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-cta {
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--sea);
  background: var(--accent);
}

.nav-cta:hover {
  background: #f2cc6e;
}

.api-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #9fb3b8;
  font-family: var(--font-mono);
  font-size: .68rem;
}

.api-chip[data-ok="1"] {
  color: var(--teal-bright);
}

.api-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5b7380;
}

.api-chip[data-ok="1"] i {
  background: var(--teal-bright);
  box-shadow: 0 0 0 4px rgba(14, 138, 122, .25);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  margin: 6px 8px;
  background: #f4f7f8;
}

.hero {
  position: relative;
  min-height: min(920px, 100svh);
  padding: calc(var(--header-height) + 88px) 0 160px;
  overflow: hidden;
  background: var(--sea);
  color: #fff;
}

.hero::after {
  position: absolute;
  z-index: 3;
  right: -4%;
  bottom: -1px;
  left: -4%;
  height: 8vw;
  max-height: 110px;
  background: var(--paper);
  content: "";
  clip-path: polygon(0 100%, 100% 28%, 100% 100%);
  pointer-events: none;
}

.hero-media,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-media {
  background: url("../images/hero.webp") center/cover no-repeat;
  transform: scale(1.04);
}

.hero-overlay {
  background:
    linear-gradient(108deg, rgba(6, 35, 44, .92) 0%, rgba(6, 35, 44, .62) 46%, rgba(6, 35, 44, .18) 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(820px, 100%);
}

.eyebrow {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 24px;
  color: #fff;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.hero-lead {
  max-width: 640px;
  margin-bottom: 36px;
  color: rgba(244, 247, 248, .82);
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .25s var(--ease), background .25s, border-color .25s;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--accent);
  color: var(--sea);
  box-shadow: 0 14px 32px rgba(232, 184, 74, .28);
}

.button-ghost {
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
}

.section {
  padding: clamp(72px, 8vw, 120px) 0;
}

.section-head {
  display: grid;
  gap: 12px;
  max-width: 720px;
  margin-bottom: 36px;
}

.kicker {
  color: var(--teal);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.section-head p {
  color: var(--muted);
}

.demo-grid,
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, .55fr);
  gap: 20px;
  align-items: stretch;
}

.map-shell-wide {
  min-height: min(64vh, 580px);
}

.map-wide {
  height: min(64vh, 580px);
}

.progress {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .8rem;
}

.map-shell {
  position: relative;
  z-index: 0;
  isolation: isolate;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  background: #dce8ea;
}

.map {
  height: 420px;
}

.leaflet-container {
  z-index: 0;
  font-family: var(--font-body);
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-soft);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 16px;
}

.actions button {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--sea);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.actions button.accent {
  background: var(--accent);
  color: var(--sea);
}

.result {
  min-height: 88px;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.result.is-error {
  color: #9a3412;
}

.chain {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.chain li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
}

.chain button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chain button:hover {
  color: var(--teal);
}

.api-stack {
  display: grid;
  gap: 40px;
}

.api-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.api-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.method {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 138, 122, .12);
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.api-card h3 {
  margin: 0;
  font-size: 1.35rem;
}

.api-path {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .92rem;
}

.api-card > p {
  max-width: 62ch;
  color: var(--muted);
}

.api-card .demo-grid,
.api-card .overview-grid {
  margin-top: 20px;
}

.request-how {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.request-how h4 {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.last-request {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef5f4;
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: .78rem;
  word-break: break-all;
}

pre {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border-radius: 14px;
  background: var(--sea);
  color: #e8eef2;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.65;
}

.card-link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--teal);
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
}

.card-link:hover {
  color: var(--accent-deep);
}

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

.use-card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, #fff 0%, #f3f8f8 100%);
  text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s;
}

.use-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.use-card strong {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -.03em;
}

.use-card p {
  margin: 0 0 auto;
  color: var(--muted);
}

.use-card span {
  margin-top: 18px;
  color: var(--teal);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hub-hero {
  padding: calc(var(--header-height) + 56px) 0 48px;
  background: var(--sea);
  color: #fff;
}

.hub-hero h1 {
  color: #fff;
}

.hub-hero p {
  max-width: 58ch;
  color: rgba(244, 247, 248, .78);
}

body.is-tool {
  background: var(--sea);
}

body.is-tool .site-footer {
  display: none;
}

.tool-stage {
  position: relative;
  height: calc(100svh - var(--header-height));
  margin-top: var(--header-height);
}

.tool-map {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 100%;
}

.tool-panel {
  position: absolute;
  z-index: 800;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 22px;
  background: rgba(6, 35, 44, .88);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  color: #f4f7f8;
  backdrop-filter: blur(16px);
}

.tool-panel .kicker {
  color: var(--accent);
}

.tool-panel h1,
.tool-panel h2 {
  color: #fff;
  font-size: 1.55rem;
}

.tool-panel p,
.tool-panel .field span {
  color: #9fb3b8;
}

.tool-panel .panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.tool-panel .result {
  background: rgba(255, 255, 255, .06);
  color: #e8eef2;
}

.tool-panel .field input,
.tool-panel .field select {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.tool-panel .chain li {
  border-color: rgba(255, 255, 255, .1);
}

.tool-panel .last-request,
.tool-panel pre {
  background: #04181f;
}

.tool-version {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.call-grid {
  display: grid;
  gap: 16px;
}

.site-footer {
  padding: 36px 0 44px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.footer-credit {
  display: flex;
  justify-content: center;
}

.rv-credit {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
}

.rv-credit img {
  width: 168px;
  height: auto;
}

.rv-credit:hover span {
  color: var(--teal);
}

@media (max-width: 980px) {
  .use-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --shell: calc(100% - 32px);
    --header-height: 68px;
  }

  .menu-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    right: 16px;
    left: 16px;
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: #06232c;
    box-shadow: var(--shadow);
  }

  body.menu-open .site-nav {
    display: flex;
  }

  .demo-grid,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-bottom: 96px;
  }

  .api-chip {
    display: none;
  }

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

  .api-card {
    padding: 18px;
  }

  .tool-panel {
    top: auto;
    bottom: 12px;
    max-height: 46vh;
  }
}
