/* ==========================================================================
   Qarma Technology — redesign
   Restrained, editorial palette: near-black ink, warm paper, one muted
   accent used sparingly. Serif display type for headings, clean sans for
   body copy, monospace for small structural labels — a deliberate,
   unshowy signal of precision.
   ========================================================================== */

:root {
  --ink: #14171d;
  --ink-soft: #4a4f59;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --tint: #f2f0ea;
  --line: #e3e0d8;
  --accent: #0c5a76;
  --accent-ink: #ffffff;
  --max-width: 1180px;
  --measure: 640px;
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
*[id] { scroll-margin-top: 108px; }

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

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Faint grain over the whole page — adds tactile warmth to the flat
   paper/ink palette without adding any visible "decoration." Fixed so it
   doesn't repaint on scroll; plain low opacity (no blend mode — overlay
   mathematically washes out to nothing against a near-white base, which
   multiply/screen have the same problem with at the opposite end);
   non-interactive. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch' result='noise'/%3E%3CfeColorMatrix in='noise' type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
@media print {
  body::before { display: none; }
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Type ---------- */

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  color: var(--ink);
}

h1 { font-size: clamp(2.1rem, 4.4vw, 3.15rem); }
h2 { font-size: clamp(1.65rem, 3.2vw, 2.35rem); }
h3 { font-size: 1.28rem; font-weight: 500; }

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.center { text-align: center; }

.lede {
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.lede + .lede { margin-top: 4px; }
.center .lede { margin-left: auto; margin-right: auto; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 13px 26px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
}
.btn::after {
  content: '\2192';
  display: inline-block;
  transition: transform 0.2s ease;
}
.btn:hover::after { transform: translateX(4px); }
.btn--accent { border-color: var(--accent); color: var(--accent); }
.btn--accent:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--on-dark { border-color: rgba(255,255,255,0.55); color: #fff; }
.btn--on-dark:hover { background: #fff; color: var(--ink); }

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(20, 23, 29, 0);
  transition: box-shadow 0.25s ease;
}

/* Added once the page has scrolled past the hero — a faint lift so the
   header reads as floating above the content rather than just sitting
   on the border-bottom alone. */
.site-header.is-scrolled {
  box-shadow: 0 8px 24px rgba(20, 23, 29, 0.06);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
}
.site-logo:hover { text-decoration: none; }

.logo-mark { height: 32px; width: auto; display: block; }

.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 0;
  padding: 0;
}

.main-nav a {
  position: relative;
  display: inline-block;
  color: var(--ink);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  padding-bottom: 3px;
}
.main-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.main-nav a:hover { color: var(--accent); text-decoration: none; }
.main-nav a:hover::after { transform: scaleX(1); }

.nav-divider {
  width: 1px;
  height: 14px;
  background: var(--line);
  display: inline-block;
}

.main-nav .nav-legal a {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  padding: 4px 8px;
}

@media (max-width: 800px) {
  .menu-toggle { display: block; }
  .main-nav {
    position: absolute;
    top: 88px;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  }
  .main-nav.is-open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
  }
  .main-nav ul { flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 32px 24px; }
  .main-nav li { width: 100%; border-top: 1px solid var(--line); }
  .main-nav a { display: block; padding: 15px 0; }
  .nav-divider { display: none; }
}
@media (max-width: 800px) and (prefers-reduced-motion: reduce) {
  .main-nav { transition: visibility 0s linear 0s; }
  .main-nav.is-open { transition: visibility 0s linear 0s; }
}

/* ---------- Sections ---------- */

section { padding: 84px 0; }
.section-tint { background: var(--tint); }
.section-compact { padding: 56px 0; }
.section-rule { border-top: 1px solid var(--line); }

.section-dark {
  background: var(--ink);
  color: var(--paper);
}
.section-dark h2 { color: var(--paper); }
.section-dark .lede { color: rgba(251,250,247,0.78); }
.section-dark .eyebrow { color: #7fb3c6; }

.hero p { color: var(--ink-soft); max-width: 720px; }
.hero .eyebrow { margin-bottom: 20px; }
.hero h1 { max-width: 820px; }
.hero-actions { margin-top: 40px; }

/* ---------- Numbered feature rows ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  border-top: 1px solid var(--line);
  padding-top: 56px;
}

.feature-grid--3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 680px) {
  .feature-grid { grid-template-columns: 1fr; gap: 44px; }
}
@media (min-width: 681px) and (max-width: 920px) {
  .feature-grid--3 { grid-template-columns: 1fr; }
}

/* Wider, left-aligned copy blocks for biography/strategy-style paragraphs —
   .lede's narrower centered measure suits a short pull-quote-like intro,
   not several consecutive paragraphs of running text. */
.prose { max-width: 720px; color: var(--ink-soft); }
.prose p { margin: 0 0 20px; }
.prose p:last-child { margin-bottom: 0; }
.section-dark .prose { color: rgba(251,250,247,0.78); }

/* Modifier for sections that want the .prose measure/color but centered
   (e.g. matching the centered eyebrow/h2 above them) rather than the
   left-aligned default. */
.prose--center { text-align: center; margin-left: auto; margin-right: auto; }

.feature-item {
  display: flex;
  gap: 26px;
  padding: 16px 18px;
  margin: -16px -18px;
  border-radius: 6px;
  transition: box-shadow 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}
.feature-item:hover {
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(20, 23, 29, 0.09);
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) {
  .feature-item:hover { transform: none; }
}

.feature-num {
  flex: none;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--accent);
  padding-top: 2px;
}

.feature-item h3 { margin-bottom: 14px; }

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
}
.plain-list li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.plain-list li:first-child { border-top: none; padding-top: 0; }

.feature-item p { color: var(--ink-soft); margin: 0; }

/* ---------- Tabs ---------- */

.tabs { max-width: 780px; margin-top: 48px; }

.tab-list {
  position: relative;
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0 0 -1px;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.tab-indicator {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: left 0.3s cubic-bezier(0.65,0,0.35,1), width 0.3s cubic-bezier(0.65,0,0.35,1);
  pointer-events: none;
}

.tab-list button {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  padding: 12px 4px;
  margin-right: 28px;
  cursor: pointer;
}
.tab-list button[aria-selected="true"] {
  color: var(--ink);
}

.tab-chevron {
  color: var(--accent);
  font-family: var(--font-mono);
}

.tab-panels { padding: 32px 0 0; color: var(--ink-soft); }
.tab-panel { opacity: 1; transition: opacity 0.2s ease; }
.tab-panel[hidden] { display: none; }
.tab-panel p { max-width: var(--measure); }
@media (prefers-reduced-motion: reduce) {
  .tab-panel { transition: none; }
}

/* ---------- Partner / Contact ---------- */

.partner-text { max-width: var(--measure); margin: 0 auto 56px; text-align: center; }
.partner-text .lede { margin-left: auto; margin-right: auto; }

.contact-wrap { max-width: 560px; margin: 0 auto; }
.contact-wrap h3 { text-align: center; margin-bottom: 36px; }

.contact-form label {
  display: block;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 22px 0 8px;
}
.contact-form label:first-of-type { margin-top: 0; }

.contact-form input,
.contact-form textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  padding: 10px 2px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: border-color 0.18s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.contact-form textarea { min-height: 120px; resize: vertical; }

.contact-form button {
  margin-top: 32px;
  width: 100%;
  justify-content: center;
}

.form-status {
  font-size: 0.88rem;
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 2px;
}
.form-status--success { background: #e7f1ee; color: #1c5c4c; }
.form-status--error { background: #f6e9e4; color: #96412a; }

/* ---------- Footer ---------- */

.site-footer { background: var(--ink); color: var(--paper); }

.footer-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  align-items: stretch;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; }
  .office-map { height: 360px; }
}

.footer-map { position: relative; overflow: hidden; }
.office-map { width: 100%; height: 100%; min-height: 360px; }

.map-directions {
  position: absolute;
  left: 20px;
  top: 20px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: rgba(20,23,29,0.82);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 2px;
  backdrop-filter: blur(2px);
  transition: transform 0.1s ease;
}
.map-directions:hover { background: var(--accent); color: #fff; text-decoration: none; }
.map-directions:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .map-directions:active { transform: none; }
}

/* Mapbox's own UI chrome, restyled to sit quietly within the palette */
.mapboxgl-ctrl-top-right { top: 12px; right: 12px; }
.mapboxgl-ctrl-group { background: rgba(20,23,29,0.82); border: none; box-shadow: none; }
.mapboxgl-ctrl-group button + button { border-top: 1px solid rgba(251,250,247,0.15); }
.mapboxgl-ctrl-icon { filter: invert(1); }
.mapboxgl-ctrl-attrib { background: rgba(20,23,29,0.7); font-size: 10px; padding: 0 6px; border-radius: 2px; }
.mapboxgl-ctrl-attrib a { color: rgba(251,250,247,0.7); }

/* Office marker — a solid dot with a signal ring pulsing outward, in
   place of Mapbox's default teardrop pin. */
.map-marker { position: relative; width: 16px; height: 16px; }
.map-marker-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(20, 23, 29, 0.35);
  z-index: 1;
}
.map-marker-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--accent);
  border-radius: 50%;
  animation: map-marker-pulse 2.8s ease-out infinite;
  will-change: transform, opacity;
}
/* Fades in quickly rather than snapping straight to full opacity, then
   decelerates outward and fades out — reads as a soft ripple instead of
   a mechanical scale-and-fade. */
@keyframes map-marker-pulse {
  0%   { transform: scale(0.9); opacity: 0; }
  20%  { opacity: 0.5; }
  100% { transform: scale(3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .map-marker-ring { animation: none; opacity: 0; }
}

.footer-info { padding: 64px 40px; }
.footer-info h3 { font-family: var(--font-serif); color: var(--paper); font-size: 1.3rem; margin-bottom: 18px; }
.footer-info hr { border: none; border-top: 1px solid rgba(251,250,247,0.3); width: 44px; margin: 0 0 22px; }
.footer-info address {
  font-style: normal;
  line-height: 1.85;
  color: rgba(251,250,247,0.78);
  font-size: 0.94rem;
}
.footer-info address a { color: var(--paper); }
.footer-info address a:hover { color: #7fb3c6; }

.footer-bar {
  border-top: 1px solid rgba(251,250,247,0.14);
  text-align: center;
  padding: 20px 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgba(251,250,247,0.55);
}

/* ---------- Scroll reveal ---------- */
/* Hidden-then-eased-in state only applies when motion is allowed; with
   reduced motion or no JS (see <noscript> in <head>), content is visible
   by default — never gated behind an animation. */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* Staggered children within a revealed group — numbered feature items,
     tab buttons — so they settle in one after another rather than at once. */
  .reveal-group .feature-item,
  .reveal-group .tab-list > li,
  .reveal-group .footer-info,
  .reveal-group .footer-map {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .reveal-group.is-visible .feature-item,
  .reveal-group.is-visible .tab-list > li,
  .reveal-group.is-visible .footer-info,
  .reveal-group.is-visible .footer-map {
    opacity: 1;
    transform: translateY(0);
  }

  /* The rule above pins transform/transition at higher specificity than
     the plain hover rule near .feature-item's own definition, and its
     transition list doesn't cover box-shadow/background — both would
     silently lose the hover lift once an item has scrolled into view.
     Re-assert both, with the stagger delay reset to 0 so a later card's
     hover doesn't inherit its reveal entrance delay. */
  .reveal-group.is-visible .feature-item {
    transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease,
      box-shadow 0.25s ease, background-color 0.25s ease;
    transition-delay: 0s;
  }
  .reveal-group.is-visible .feature-item:hover {
    background: var(--surface);
    box-shadow: 0 14px 30px rgba(20, 23, 29, 0.09);
    transform: translateY(-2px);
  }

  .reveal-group .feature-item:nth-child(2),
  .reveal-group .tab-list > li:nth-child(2) { transition-delay: 160ms; }
  .reveal-group .feature-item:nth-child(3),
  .reveal-group .tab-list > li:nth-child(3) { transition-delay: 320ms; }
  .reveal-group .feature-item:nth-child(4) { transition-delay: 480ms; }
  .reveal-group .footer-map { transition-delay: 140ms; }
}

/* ---------- Legal pages ---------- */

.legal-page { padding: 96px 0 120px; }
.legal-page .container { max-width: 760px; }
.legal-page h1 { margin-bottom: 8px; }
.legal-page .updated { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 44px; }
.legal-page h2 { font-size: 1.1rem; font-family: var(--font-sans); font-weight: 600; margin-top: 40px; }
.legal-page p { color: var(--ink-soft); }
.legal-page ul { color: var(--ink-soft); margin: 0 0 20px; padding-left: 22px; }
.legal-page li { margin-bottom: 4px; }
