/* ==========================================================================
   SarvIMS AI — site styles
   Edit the design tokens in :root first; most visual changes start there.
   No external requests: fonts are self-hosted (SIL Open Font License).
   ========================================================================== */

@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/montserrat.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/assets/fonts/dm-sans.woff") format("woff");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Gelasio";
  src: url("/assets/fonts/gelasio-italic.woff") format("woff");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Colour — taken from the SarvIMS logo */
  --ink: #040a1c;          /* page background */
  --deep: #081232;         /* raised areas */
  --line: rgba(143, 170, 255, 0.18);
  --line-strong: rgba(143, 170, 255, 0.34);
  --text: #e6ecff;
  --muted: #a6b3d8;
  --cyan: #1fd1ff;
  --blue: #5b8cff;
  --violet: #9a74ff;
  --magenta: #c77dff;
  --grad: linear-gradient(90deg, #00cdfc 0%, #6a7dff 55%, #b76cff 100%);
  --link-hover: #7ee6ff;
  --focus: #7ee6ff;
  --btn-bg: #8fdcf5;
  --btn-fg: #04122e;

  /* Type */
  --font-display: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-story: "Gelasio", Georgia, "Times New Roman", serif;

  /* Space and layout */
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(4.5rem, 9vw, 8rem);
  --radius: 10px;
  --measure: 62ch;
}

/* Calm, light reading sections. They re-define the colour tokens, so every
   component inside picks up the light palette automatically. */
.tone-light, .tone-tint {
  color-scheme: light;
  --text: #10203f;
  --muted: #455676;
  --line: rgba(16, 32, 63, 0.13);
  --line-strong: rgba(16, 32, 63, 0.26);
  --cyan: #0a6ea8;
  --violet: #5a45c2;
  --link-hover: #064a75;
  --focus: #0a6ea8;
  --btn-bg: #0d2a5c;
  --btn-fg: #ffffff;
  color: var(--text);
}
.tone-light { background: #f6f8fc; }
.tone-tint { background: #e9eff8; }

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--cyan); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--text); color: var(--ink);
  padding: 0.6rem 1rem; border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Headings ---------- */
.h-display, h1, h2, h3 { font-family: var(--font-display); }

h1 {
  font-weight: 300;
  font-size: clamp(1.9rem, 0.6rem + 2.75vw, 3.15rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}
h1 span { display: block; white-space: nowrap; }

h2 {
  font-weight: 300;
  font-size: clamp(1.8rem, 1.1rem + 2.6vw, 2.9rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h3 {
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.lead { font-size: 1.1875rem; color: var(--muted); max-width: var(--measure); }
.lead--tight { margin-top: 1.1rem; }
.prose p { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }
.muted { color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(4, 10, 28, 0.97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 4.25rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; border-radius: 12px; text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--text); }

.nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2rem); }
.nav a:not(.btn) {
  color: var(--text); text-decoration: none; font-size: 0.97rem;
  padding: 0.35rem 0; border-bottom: 1px solid transparent;
}
.nav a:not(.btn):hover { border-bottom-color: var(--cyan); color: var(--text); }

.nav-toggle {
  display: none;
  background: none; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.5rem 0.9rem; font: inherit; font-size: 0.95rem; cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font: 600 0.97rem/1.2 var(--font-body);
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { color: var(--btn-fg); transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost { color: var(--text); border-color: var(--line-strong); background: transparent; }
.btn-ghost:hover { color: var(--text); border-color: var(--cyan); }
.btn-small { padding: 0.55rem 1.05rem; font-size: 0.92rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem);
  background:
    radial-gradient(60% 55% at 85% 20%, rgba(31, 209, 255, 0.07), transparent 70%),
    radial-gradient(50% 50% at 8% 95%, rgba(154, 116, 255, 0.08), transparent 70%);
}
.hero .wrap {
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(2rem, 5vw, 4.5rem);
}
.hero__brand { width: min(380px, 78%); margin-bottom: clamp(1.75rem, 4vw, 3rem); }
/* The supplied banner has a dark rectangle behind it; "lighten" makes that
   rectangle disappear against the page background. */
.hero__brand img { mix-blend-mode: lighten; width: 100%; }
.hero .lead { margin-top: 1.5rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }
.hero__stack { margin-top: 1.75rem; font-size: 0.97rem; color: var(--muted); max-width: 52ch; }

/* Sensor fusion illustration */
.fusion { width: 100%; max-width: 580px; margin-inline: auto; }
.fusion__stage {
  position: relative; aspect-ratio: 1 / 1;
  border: 1px solid var(--line); border-radius: 18px;
  background:
    radial-gradient(70% 60% at 50% 42%, rgba(70, 96, 255, 0.16), transparent 70%),
    var(--deep);
  overflow: hidden;
  touch-action: pan-y;
}
.fusion canvas { width: 100%; height: 100%; }
.fusion__fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.js .fusion__fallback { display: none; }
.fusion__fallback img { width: 70%; border-radius: 18px; }
.fusion__layers { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.layer-btn {
  font: 500 0.92rem/1 var(--font-body); color: var(--muted);
  background: transparent; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 0.6rem 1rem;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.layer-btn:hover { color: var(--text); border-color: var(--cyan); }
.layer-btn[aria-pressed="true"] {
  color: var(--text); border-color: var(--cyan);
  background: rgba(31, 209, 255, 0.12);
}
.fusion__caption { margin-top: 0.9rem; min-height: 3.3em; color: var(--text); font-size: 0.98rem; }
.fusion__note { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }

/* ---------- Sections ---------- */
.section { padding-block: var(--section); }
.section--deep { background: linear-gradient(180deg, var(--deep), var(--ink)); }
.section-head { display: grid; gap: 1.1rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); max-width: 46rem; }

/* Story */
.story { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.story__lead {
  font-family: var(--font-story); font-style: italic;
  font-size: clamp(1.35rem, 1rem + 1.4vw, 1.85rem); line-height: 1.4;
  color: var(--text); margin-bottom: 1.5rem; max-width: 34ch;
}

.dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); margin-top: clamp(3rem, 6vw, 5rem); }
.dims > div { border-top: 2px solid var(--cyan); padding-top: 1.1rem; }
.dims p { margin-top: 0.5rem; color: var(--muted); font-size: 0.99rem; }
.dims a { display: inline-block; margin-top: 0.75rem; font-weight: 600; font-size: 0.95rem; }

/* Product bands */
.band {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  padding-block: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
}
.band:last-of-type { border-bottom: 1px solid var(--line); }
.band__title { font-family: var(--font-display); font-weight: 300; font-size: clamp(1.4rem, 1rem + 1.4vw, 2rem); line-height: 1.2; letter-spacing: -0.015em; }
.band__body > p { max-width: var(--measure); }
.band__sub { margin-top: 1.4rem; font-weight: 600; font-size: 0.95rem; }
.band__list { margin-top: 0.5rem; display: grid; gap: 0.55rem; max-width: var(--measure); }
.band__list li { padding-left: 1.1rem; position: relative; color: var(--muted); }
.band__list li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1px; background: var(--cyan); }
.band__list strong { color: var(--text); font-weight: 600; }
.band__cta { margin-top: 1.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; }

/* Small text link to the matching resource area */
.more { font-weight: 600; font-size: 0.95rem; }
.more-row { margin-top: 0.9rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Resource library */
.area {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(1.25rem, 5vw, 5rem);
  padding-block: clamp(1.75rem, 3.5vw, 2.5rem);
  border-top: 1px solid var(--line);
}
.area:last-child { border-bottom: 1px solid var(--line); }
.area h3 { font-size: 1.2rem; }
.area__why { margin-top: 0.5rem; color: var(--muted); font-size: 0.98rem; max-width: 40ch; }
.reslist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem 1.75rem; align-content: start; }
.reslist:has(li:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reslist li { border-top: 1px solid var(--line); padding-top: 0.8rem; }
.reslist a { font-weight: 600; text-underline-offset: 0.2em; }
.reslist p { margin-top: 0.25rem; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.reslist .host { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.82rem; }
.res-note { margin-top: 1.5rem; color: var(--muted); font-size: 0.9rem; max-width: 62ch; }

/* Services */
.service {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(1.25rem, 5vw, 5rem);
  padding-block: 2rem; border-top: 1px solid var(--line);
}
.service:last-child { border-bottom: 1px solid var(--line); }
.service h3 { font-size: 1.2rem; }
.service p { max-width: var(--measure); }
.service .deliver { margin-top: 0.8rem; color: var(--muted); font-size: 0.98rem; max-width: var(--measure); }
.service .deliver strong { color: var(--text); font-weight: 600; }

.values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 2.5rem; margin-bottom: clamp(2rem, 4vw, 3rem); max-width: 52rem; }
.values li { position: relative; padding-left: 1.1rem; }
.values li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1px; background: var(--violet); }

/* Process */
.steps { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1rem; counter-reset: step; position: relative; margin-bottom: clamp(3rem, 6vw, 5rem); }
.steps::before {
  content: ""; position: absolute; left: 1.1rem; right: 1.1rem; top: 1.1rem; height: 2px;
  background: var(--line-strong);
}
.steps li { position: relative; padding-top: 3.1rem; }
.steps .n {
  position: absolute; top: 0; left: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); border: 1.5px solid var(--cyan);
  font: 600 0.85rem/1 var(--font-display); color: var(--text);
}
.steps h3 { font-size: 1rem; }
.steps p { margin-top: 0.4rem; font-size: 0.9rem; line-height: 1.5; color: var(--muted); }

.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.75rem, 3vw, 2.5rem) clamp(2rem, 5vw, 4.5rem); }
.principles > div { border-left: 2px solid var(--line-strong); padding-left: 1.25rem; }
.principles p { margin-top: 0.45rem; color: var(--muted); font-size: 0.99rem; max-width: 56ch; }

/* Work with us */
.tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 3vw, 3rem); }
.tracks > div { border-top: 1px solid var(--line-strong); padding-top: 1.25rem; }
.tracks p { margin-top: 0.6rem; color: var(--muted); font-size: 0.99rem; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.contact__facts { margin-top: 2rem; display: grid; gap: 1.1rem; }
.contact__facts dt { font-weight: 600; font-size: 0.95rem; }
.contact__facts dd { color: var(--muted); }
.contact__facts a { font-size: 1.1rem; font-weight: 500; }

.form { display: grid; gap: 1.15rem; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-weight: 600; font-size: 0.93rem; }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(8, 18, 50, 0.7);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 1.2rem) 50%, calc(100% - 0.85rem) 50%; background-size: 0.35rem 0.35rem; background-repeat: no-repeat; padding-right: 2.4rem; }
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid #7ee6ff; outline-offset: 1px; border-color: transparent; }
.field input:user-invalid, .field textarea:user-invalid { border-color: #ff8a9b; }
.consent { display: flex; gap: 0.7rem; align-items: flex-start; font-size: 0.94rem; color: var(--muted); }
.consent input { margin-top: 0.3rem; width: 1.05rem; height: 1.05rem; accent-color: var(--cyan); flex: none; }
.form__note { font-size: 0.88rem; color: var(--muted); max-width: 52ch; }
.form__status { min-height: 1.5em; font-weight: 500; color: var(--text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 3rem 2.5rem; background: var(--ink); }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem 4rem; align-items: start; }
.footer__brand { display: flex; gap: 1rem; align-items: center; }
.footer__brand img { width: 48px; height: 48px; flex: none; }
.footer__brand strong { display: block; font-family: var(--font-display); font-weight: 600; }
.footer__brand span { color: var(--muted); font-size: 0.95rem; }
.footer__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; justify-content: flex-end; }
.footer__links a { color: var(--text); text-decoration: none; }
.footer__links a:hover { color: var(--cyan); text-decoration: underline; }
.footer__legal { grid-column: 1 / -1; color: var(--muted); font-size: 0.88rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }

/* ---------- Legal and error pages ---------- */
.doc { padding-block: clamp(3rem, 7vw, 6rem); }
.doc h1 { font-size: clamp(2rem, 1.2rem + 3vw, 3.2rem); margin-bottom: 0.75rem; }
.doc .updated { color: var(--muted); margin-bottom: 2.5rem; }
.doc h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; margin: 2.5rem 0 0.75rem; }
.doc p, .doc li { max-width: var(--measure); }
.doc p + p { margin-top: 0.9em; }
.doc ul { margin-top: 0.75rem; display: grid; gap: 0.5rem; }
.doc ul li { position: relative; padding-left: 1.1rem; }
.doc ul li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 0.5rem; height: 1px; background: var(--cyan); }
.notfound { min-height: 60vh; display: grid; align-content: center; gap: 1.25rem; padding-block: 5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .steps { grid-template-columns: 1fr; gap: 1.5rem; }
  .steps::before { left: 1.1rem; right: auto; top: 1.1rem; bottom: 1.1rem; width: 2px; height: auto; }
  .steps li { padding-top: 0; padding-left: 3.4rem; min-height: 2.2rem; }
  .steps .n { top: 0; left: 0; }
}

@media (max-width: 900px) {
  .hero .wrap, .story, .contact, .site-footer .wrap { grid-template-columns: 1fr; }
  .fusion { max-width: 520px; margin-inline: 0; }
  .dims, .tracks, .principles { grid-template-columns: 1fr; }
  .band, .service, .area { grid-template-columns: 1fr; gap: 1rem; }
  .reslist, .reslist:has(li:nth-child(4)) { grid-template-columns: 1fr; }
  .values { grid-template-columns: 1fr; }
  .footer__links { justify-content: flex-start; }

  .js .nav-toggle { display: inline-flex; }
  .js .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--ink); border-bottom: 1px solid var(--line);
    padding: 0.75rem var(--gutter) 1.25rem;
  }
  .js .nav.is-open { display: flex; }
  .js .nav a:not(.btn) { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
  .js .nav .btn { margin-top: 1rem; }
  .nav { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .form__row { grid-template-columns: 1fr; }
  .hero__brand { width: min(300px, 86%); }
  .btn { width: 100%; }
  .hero__actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .fusion__layers, .nav-toggle { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- Form helpers ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status a { font-weight: 600; }
.form__status.is-error { color: #ffb4c0; }
