/* ==========================================================================
   Serventrix — Design tokens
   ========================================================================== */
:root {
  --paper: #ffffff;
  --mist: #eff7f6;
  --mist2: #e4f1f0;
  --line: #dcebea;
  --ink: #0b2545;
  --ink-soft: #4c6478;
  --ink-faint: #8598a8;
  --teal: #158c86;
  --teal-deep: #0d6b68;
  --teal-pale: #cfe9e6;

  --s1: 8px;
  --s2: clamp(12px, 2vw, 16px);
  --s3: clamp(16px, 3vw, 24px);
  --s4: clamp(20px, 3.5vw, 32px);
  --s6: clamp(28px, 5vw, 48px);
  --s8: clamp(32px, 6vw, 64px);
  --s12: clamp(48px, 8vw, 96px);
  --s16: clamp(64px, 10vw, 128px);

  --font-display: "Instrument Sans", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.1vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--teal-pale); color: var(--ink); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 32px);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 var(--s2);
}

.section { padding: var(--s16) 0; }
.section--mist {
  background: linear-gradient(180deg, var(--mist) 0%, var(--mist2) 100%);
}
.section--texture {
  background-image:
    radial-gradient(circle, rgba(11, 37, 69, 0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 36px) 0;
}
.section-divider svg { opacity: 0.85; }

.prose { max-width: 640px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.h-xl { font-size: clamp(2.5rem, 6vw, 5rem); line-height: 1.03; letter-spacing: -0.03em; }
.h-lg { font-size: clamp(2.25rem, 5vw, 4rem); line-height: 1.06; letter-spacing: -0.025em; }
.h-md { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; }
.body-lg { font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.6; color: var(--ink-soft); }
p.muted { color: var(--ink-soft); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 48px;
  padding: 14px 24px;
  transition: background 0.25s var(--ease-premium), color 0.25s var(--ease-premium),
    border-color 0.25s var(--ease-premium), transform 0.15s var(--ease-premium),
    box-shadow 0.25s var(--ease-premium);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-display);
}
.btn::after {
  content: "";
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg) translateX(0);
  transition: transform 0.25s var(--ease-premium);
  flex-shrink: 0;
}
.btn:active { transform: translateY(0) scale(0.98); box-shadow: none; transition-duration: 0.1s; }
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -12px rgba(11, 37, 69, 0.32); }
  .btn:hover::after { transform: rotate(45deg) translateX(3px); }
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-on-dark { background: var(--paper); color: var(--ink); }
@media (hover: hover) {
  .btn-primary:hover { background: var(--teal-deep); }
  .btn-secondary:hover { border-color: var(--teal); background: var(--mist); }
  .btn-on-dark:hover { background: var(--teal-pale); }
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: 76px;
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: all 0.3s var(--ease-premium);
}
.nav.scrolled {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--line);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-brand img { width: 30px; height: 30px; border-radius: 6px; }
.nav-brand span { font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }

.nav-links { display: none; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--ink-soft);
  transition: color 0.2s;
  white-space: nowrap;
}
@media (hover: hover) { .nav-links a:hover { color: var(--ink); } }
.nav-links a.active { color: var(--ink); font-weight: 500; }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--teal);
  border-radius: 999px;
}
.nav-cta { display: none; padding: 10px 18px; font-size: 0.875rem; }
.nav-toggle {
  display: block;
  background: none;
  border: none;
  padding: 8px;
  margin-right: -8px;
  cursor: pointer;
  color: var(--ink);
  z-index: 70;
  position: relative;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* Tablet (768–1279px): compact horizontal nav — smaller gaps/padding/font
   so all four links + a shortened CTA fit without crowding. */
@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
  .nav-toggle { display: none; }
}

/* Desktop (1280px+): full-size spacious nav */
@media (min-width: 1280px) {
  .nav-links { gap: 4px; }
  .nav-links a { padding: 8px 16px; font-size: 0.925rem; }
  .nav-links a.active::after { left: 16px; right: 16px; }
  .nav-cta { padding: 14px 24px; font-size: 0.95rem; }
}

/* Mobile (<768px): dark overlay behind a centered floating glass panel */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  width: 100vw;
  height: 100vh; /* fallback for browsers without dvh support */
  height: 100dvh; /* tracks the true visible viewport on mobile (avoids the iOS Safari toolbar gap) */
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in, visibility 0.2s;
}
.nav-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease-out, visibility 0.3s;
}

.nav-mobile {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 60;
  width: 90%;
  max-width: 400px;
  max-height: 85vh; /* fallback */
  max-height: 85dvh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.08);
  padding: var(--s8) var(--s6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) translateY(10px) scale(0.95);
  transition: opacity 0.2s ease-in, transform 0.2s ease-in, visibility 0.2s;
}
@media (min-width: 480px) {
  .nav-mobile { width: 70%; }
}
.nav-mobile.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) translateY(0) scale(1);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s;
}

.nav-mobile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
@media (hover: hover) {
  .nav-mobile-close:hover { background: rgba(255, 255, 255, 0.9); transform: scale(1.08); }
}
.nav-mobile-close:active { transform: scale(0.92); }

.nav-mobile ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.nav-mobile li { width: 100%; }
.nav-mobile a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  transition: background 0.2s ease, color 0.2s ease;
}
@media (hover: hover) {
  .nav-mobile a:hover { background: rgba(21, 140, 134, 0.08); color: var(--ink); }
}
.nav-mobile a.active { color: var(--ink); font-weight: 600; background: rgba(21, 140, 134, 0.12); }
.nav-mobile .nav-cta-mobile { width: 100%; margin-top: var(--s6); }

@media (min-width: 768px) {
  .nav-mobile, .nav-overlay { display: none; }
}

/* Body scroll lock while the mobile overlay is open — JS applies the
   inline position:fixed/top offset directly (see main.js) so the scroll
   position restores exactly on close with no jump; this class is a
   supplementary safeguard. */
body.nav-open { overflow: hidden; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: clamp(96px, 22vw, 148px) 0 var(--s12); overflow: hidden; }
@media (min-width: 1024px) { .hero { padding: 176px 0 var(--s16); } }

.hero .grid { display: grid; gap: var(--s8); align-items: center; }

/* Mobile & tablet (<1024px): stacked, centered — never side-by-side */
.hero-copy { grid-column: span 12; text-align: center; }
.hero-visual { grid-column: span 12; position: relative; order: -1; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); margin-top: var(--s6); }
.hero-copy .body-lg { margin-left: auto; margin-right: auto; }

/* Logo sizing per tier — mobile: 30–40% of viewport width; tablet: fixed
   reduced size; desktop: full size, defined further down */
.hero-visual-inner {
  position: relative;
  aspect-ratio: 1 / 1;
  width: clamp(160px, 38vw, 280px);
  margin: 0 auto;
}
@media (min-width: 768px) {
  .hero-visual-inner { width: 300px; }
}

/* Desktop (1024px+): side-by-side, left-aligned copy, full-size logo */
@media (min-width: 1024px) {
  .hero .grid { grid-template-columns: repeat(12, 1fr); }
  .hero-copy { grid-column: span 7; text-align: left; }
  .hero-visual { grid-column: span 5; order: 0; }
  .hero-actions { justify-content: flex-start; }
  .hero-copy .body-lg { margin-left: 0; margin-right: 0; }
  .hero-visual-inner { width: 100%; max-width: 440px; }
}

.hero-actions .btn { width: 100%; justify-content: center; }
@media (min-width: 480px) {
  .hero-actions .btn { width: auto; }
}

.hero-desc { max-width: 100%; }
@media (min-width: 1024px) { .hero-desc { max-width: 480px; } }

.hero-fade {
  opacity: 0;
  transform: translateY(12px);
  animation: heroFadeIn 0.25s var(--ease-premium) forwards;
}
@keyframes heroFadeIn { to { opacity: 1; transform: translateY(0); } }

/* Page transitions — progressive enhancement only; a no-JS visitor never
   gets the "js-anim" class, so the page is always visible by default. */
html.js-anim body { opacity: 0; }
html.js-anim.page-ready body { opacity: 1; transition: opacity 0.3s ease; }
html.js-anim.page-leaving body { opacity: 0; transition: opacity 0.25s ease; }

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease-premium), transform 0.7s var(--ease-premium); }
.reveal.in-view { opacity: 1; transform: translateY(0); }

.reveal-card {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.6s var(--ease-premium), transform 0.6s var(--ease-premium);
}
.reveal-card.in-view { opacity: 1; transform: translateY(0) scale(1); }

/* ==========================================================================
   Grid helpers
   ========================================================================== */
.grid-12 { display: grid; grid-template-columns: 1fr; gap: var(--s8); }
.col-4, .col-5, .col-7, .col-8 { grid-column: auto; }
@media (min-width: 768px) {
  .grid-12 { grid-template-columns: repeat(12, 1fr); }
  .col-4 { grid-column: span 4; }
  .col-5 { grid-column: span 5; }
  .col-7 { grid-column: span 7; }
  .col-8 { grid-column: span 8; }
  .col-start-6 { grid-column-start: 6; }
}

/* ==========================================================================
   Service cards
   ========================================================================== */
.service-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
@media (min-width: 768px) { .service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .service-grid { grid-template-columns: repeat(4, 1fr); } }
.service-card {
  background: var(--paper);
  padding: var(--s6);
  position: relative;
  transition: background 0.3s var(--ease-premium);
}
.service-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.3s var(--ease-premium);
}
.service-card svg { color: var(--teal); width: 22px; height: 22px; margin-bottom: var(--s4); transition: transform 0.3s var(--ease-premium); }
@media (hover: hover) {
  .service-card:hover { background: var(--mist); }
  .service-card:hover::before { background: var(--teal); }
  .service-card:hover svg { transform: translateY(-5px); }
}
.service-card h3 { font-size: 1.05rem; font-weight: 500; margin-bottom: 8px; }
.service-card p { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }

.icon-tile {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--mist2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-tile svg { width: 19px; height: 19px; color: var(--teal); }

/* ==========================================================================
   What We Do — service rows
   ========================================================================== */
.service-row {
  padding: var(--s8) 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s6);
}
@media (min-width: 768px) { .service-row { grid-template-columns: repeat(12, 1fr); padding: var(--s12) 0; } }
.service-row-icon { display: flex; align-items: center; gap: var(--s4); }
@media (min-width: 768px) { .service-row-icon { grid-column: span 4; } }
.service-row-icon .icon-tile { width: 48px; height: 48px; }
.service-row-icon .icon-tile svg { width: 22px; height: 22px; }
.service-row-number { font-family: var(--font-mono); color: var(--ink-faint); font-size: 0.85rem; }
.service-row-body { }
@media (min-width: 768px) { .service-row-body { grid-column: span 8; } }
.service-row-body h2 { font-size: clamp(1.75rem, 2.6vw, 2.75rem); font-weight: 500; margin-bottom: 12px; }
.service-row-body p { color: var(--ink-soft); font-size: 1.05rem; max-width: 640px; margin: 0; }

/* ==========================================================================
   CTA banner
   ========================================================================== */
.cta-banner {
  border-radius: 24px;
  background: var(--ink);
  padding: var(--s12) var(--s6);
  text-align: center;
  max-width: 1180px;
  margin: 0 auto;
}
@media (min-width: 768px) { .cta-banner { padding: var(--s16) var(--s12); } }
.cta-banner h2 { color: var(--paper); max-width: 560px; margin: 0 auto; }
.cta-banner p { color: #b7c6d3; max-width: 440px; margin: 16px auto 0; font-size: 1.05rem; }
.cta-banner .btn { margin-top: var(--s6); }

/* ==========================================================================
   Values / feature blocks
   ========================================================================== */
.value-item { display: flex; gap: var(--s4); }
.value-item svg { color: var(--teal); flex-shrink: 0; margin-top: 4px; width: 24px; height: 24px; transition: transform 0.3s var(--ease-premium); }
.value-item h3 { font-size: 1.1rem; font-weight: 500; margin-bottom: 6px; transition: color 0.3s var(--ease-premium); }
.value-item p { color: var(--ink-soft); margin: 0; }
@media (hover: hover) {
  .value-item:hover svg { transform: translateY(-4px); }
  .value-item:hover h3 { color: var(--teal-deep); }
}

.values-grid { display: grid; gap: var(--s8) var(--s8); }
@media (min-width: 640px) { .values-grid { grid-template-columns: repeat(2, 1fr); } }

.mv-grid { display: grid; gap: var(--s8); }
@media (min-width: 640px) { .mv-grid { grid-template-columns: repeat(2, 1fr); } }

.pillars-grid { display: grid; gap: var(--s8); }
@media (min-width: 768px) { .pillars-grid { grid-template-columns: repeat(3, 1fr); } }
.pillar svg { color: var(--teal); width: 24px; height: 24px; margin-bottom: var(--s4); transition: transform 0.3s var(--ease-premium); }
.pillar h3 { font-size: 1.1rem; font-weight: 500; margin-bottom: 8px; transition: color 0.3s var(--ease-premium); }
.pillar p { color: var(--ink-soft); margin: 0; }
@media (hover: hover) {
  .pillar:hover svg { transform: translateY(-4px); }
  .pillar:hover h3 { color: var(--teal-deep); }
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-grid { display: grid; gap: var(--s8); }
@media (min-width: 768px) { .contact-grid { grid-template-columns: 7fr 5fr; gap: var(--s12); } }
.contact-info { display: flex; flex-direction: column; gap: var(--s6); }
.contact-detail { display: flex; align-items: flex-start; gap: var(--s4); }
.contact-detail .label { font-size: 0.85rem; color: var(--ink-faint); margin-bottom: 4px; }
.contact-detail .value { font-weight: 500; }
.contact-detail .value:hover { color: var(--teal-deep); }
.map-embed {
  margin-top: var(--s8);
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  aspect-ratio: 4/3;
}
.map-embed iframe { display: block; width: 100%; height: 100%; }

.form-card { border: 1px solid var(--line); border-radius: 16px; padding: var(--s6); }
@media (min-width: 768px) { .form-card { padding: var(--s8); } }
.form-group { margin-bottom: var(--s6); }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; }
.form-group input, .form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 0.2s;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--ink-faint); }
.form-group input:focus, .form-group textarea:focus { border-color: var(--teal); outline: none; }
.form-group textarea { resize: none; }

.form-success {
  border: 1px solid var(--line);
  background: var(--mist);
  border-radius: 16px;
  padding: var(--s8);
}
.form-success svg { color: var(--teal); width: 28px; height: 28px; margin-bottom: 12px; }
.form-success h2 { font-size: 1.15rem; font-weight: 500; margin-bottom: 8px; }
.form-success p { color: var(--ink-soft); margin: 0; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { position: relative; overflow: hidden; background: var(--mist); border-top: 1px solid var(--line); padding: var(--s12) 0; }
.footer-network {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.12;
  pointer-events: none;
}
.footer .container { position: relative; z-index: 1; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: var(--s8); }
.footer-brand, .footer-col { grid-column: auto; }
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(12, 1fr); gap: var(--s4); }
  .footer-brand { grid-column: span 5; }
  .footer-col { grid-column: span 3; }
  .footer-col:last-child { grid-column: span 4; }
}
.footer-brand .nav-brand { margin-bottom: 16px; }
.footer-brand p { color: var(--ink-soft); font-size: 0.95rem; max-width: 320px; margin: 0; }
.footer-social { display: flex; gap: 12px; margin-top: var(--s4); }
.footer-social a {
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.footer-social svg { width: 17px; height: 17px; }
@media (hover: hover) {
  .footer-social a:hover {
    border-color: var(--teal);
    color: var(--teal-deep);
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(21, 140, 134, 0.12);
  }
}
.footer-social a:focus-visible { transform: scale(1.08); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 12px; font-size: 0.95rem; }
.footer-col a { color: var(--ink-soft); transition: color 0.2s; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  margin-top: var(--s12);
  padding-top: var(--s6);
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
