/* ==========================================================================
   Flowstate Ops — stylesheet
   Palette: royal blue #3563E9, accent #84A9FA, ink #0E1526, paper #FBFAF7, rust #B5541C
   Type: Instrument Serif (display), Archivo (body/UI), IBM Plex Mono (labels/data)
   ========================================================================== */

:root {
  --blue: #3563E9;
  --blue-light: #84A9FA;
  --ink: #0E1526;
  --paper: #FBFAF7;
  --rust: #B5541C;

  --paper-dim: #F1EFE8;
  --ink-soft: #3A4256;
  --border: #E4E1D8;
  --border-dark: #263049;

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --container: 72rem;
  --radius: 6px;

  --shadow-card: 0 1px 2px rgba(14, 21, 38, 0.06), 0 1px 0 rgba(14, 21, 38, 0.04);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; margin: 0; padding: 0; }
img, picture, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Base ---------- */
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
}

h1 { font-size: clamp(2.25rem, 5vw + 1rem, 3.75rem); }
h2 { font-size: clamp(1.75rem, 3vw + 1rem, 2.75rem); }
h3 { font-size: clamp(1.25rem, 1.5vw + 1rem, 1.625rem); }

p { max-width: 62ch; }
p.wide { max-width: none; }

a { text-decoration-thickness: 1px; text-underline-offset: 0.15em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: var(--space-2);
}
.eyebrow.rust { color: var(--rust); }
.eyebrow.on-dark { color: var(--blue-light); }

/* var(--blue) on var(--paper-dim) measures 4.44:1 — just under WCAG AA's 4.5:1.
   Darken it specifically where the eyebrow/step label sits on that background. */
.problem .eyebrow:not(.rust):not(.on-dark),
.section-beyond .eyebrow:not(.rust):not(.on-dark) {
  color: #2A50C4;
}

.eyebrow::before {
  content: "";
  width: 1.25em;
  height: 1px;
  background: currentColor;
}

/* ---------- Layout helpers ---------- */
.wrap {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

section { padding-block: var(--space-6); }
@media (max-width: 640px) {
  section { padding-block: var(--space-5); }
}

.section-head {
  max-width: 40rem;
  margin-bottom: var(--space-4);
}

.stack { display: flex; flex-direction: column; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  z-index: 100;
  transition: top 0.15s ease;
  font-family: var(--font-body);
  font-weight: 600;
}
.skip-link:focus {
  top: 1rem;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Header / Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  position: relative;
  padding-block: 1.35rem;
  gap: var(--space-4);
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.logo svg {
  display: block;
  flex-shrink: 0;
  height: 40px;
  width: auto; /* scales from the viewBox — stays crisp at any size, never pixelates */
}
.site-footer .logo svg { height: 22px; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
}
.nav-toggle svg { width: 20px; height: 20px; }

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1 1 auto;
}

.nav-links {
  display: flex;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  gap: var(--space-3);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav-links a {
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  border-bottom-color: var(--blue);
}
.main-nav > .btn-primary {
  margin-left: auto;
}

@media (max-width: 780px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .main-nav {
    position: fixed;
    inset: 0 0 0 min(30%, 100% - 18rem);
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    padding: 5.5rem var(--space-3) var(--space-3);
    gap: var(--space-4);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    border-left: 1px solid var(--border);
  }
  .main-nav.is-open { transform: translateX(0); }
  .nav-links {
    position: static;
    left: auto; top: auto; transform: none;
    flex-direction: column;
    gap: var(--space-3);
    font-size: 1.1rem;
  }
  .main-nav > .btn-primary {
    margin-left: 0;
    width: 100%;
    white-space: normal;
    text-align: center;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue);
  color: #FFFFFF;
}
.btn-primary:hover { background: #2A50C4; }

.btn-outline {
  background: transparent;
  border-color: var(--border-dark);
  color: var(--ink);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-outline.on-dark {
  border-color: rgba(251, 250, 247, 0.35);
  color: var(--paper);
}
.btn-outline.on-dark:hover { border-color: var(--blue-light); color: var(--blue-light); }

.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  padding-block: var(--space-6) var(--space-5);
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-5);
  align-items: center;
}
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
}

.hero h1 { margin-bottom: var(--space-2); }
.hero .lede { font-size: 1.15rem; color: var(--ink-soft); margin-bottom: var(--space-3); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.hero-ctas .link-secondary {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: underline;
  color: var(--ink-soft);
}

/* ---------- Hero diagram ---------- */
.diagram-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: 10px;
  padding: var(--space-3);
  box-shadow: var(--shadow-card);
}
.diagram-card .eyebrow { margin-bottom: var(--space-2); }

.diagram { display: block; width: 100%; height: auto; }

.node {
  fill: rgba(251, 250, 247, 0.04);
  stroke: rgba(251, 250, 247, 0.16);
  stroke-width: 1;
}
.node.center { stroke: var(--blue-light); stroke-width: 1.4; }
.node-label {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: rgba(251, 250, 247, 0.75);
}
.edge {
  fill: none;
  stroke: rgba(251, 250, 247, 0.22);
  stroke-width: 1.2;
  transition: stroke 0.2s ease, opacity 0.2s ease, stroke-width 0.2s ease;
}
.edge.edge-dim { opacity: 0.3; }
.edge.edge-hot { stroke: var(--blue-light); stroke-width: 1.8; opacity: 1; }
.pulse-dot { fill: var(--blue-light); }

.dnode { cursor: pointer; }
.dnode .node { transition: stroke 0.2s ease, stroke-width 0.2s ease, fill 0.2s ease; }
.dnode:hover .node, .dnode:focus-visible .node {
  stroke: var(--blue-light);
  stroke-width: 1.6;
  fill: rgba(132, 169, 250, 0.08);
}
.dnode:focus-visible { outline: none; }
.dnode:focus-visible .node { outline: 2px solid var(--blue-light); outline-offset: 2px; }

.diagram-caption {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(251, 250, 247, 0.12);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--blue-light);
  min-height: 1.3em;
}

@media (prefers-reduced-motion: reduce) {
  .motion-only { display: none; }
}

/* Static (no-JS) fallback is identical markup — CSS/SVG render without it */

/* ---------- Problem band ---------- */
.problem {
  background: var(--paper-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.problem .wrap {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: var(--space-5);
}
@media (max-width: 860px) {
  .problem .wrap { grid-template-columns: 1fr; }
}
.problem h2 { color: var(--ink); }
.problem-body p { margin-bottom: var(--space-2); color: var(--ink-soft); }
.problem-body p:last-child { margin-bottom: 0; }

/* ---------- Card grids ---------- */
.grid {
  display: grid;
  gap: var(--space-3);
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 960px) {
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-3, .grid-5 { grid-template-columns: 1fr; }
}

.card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.card h3 { font-size: 1.15rem; }
.card p { font-size: 0.95rem; color: var(--ink-soft); }
.card .card-link {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--blue);
  text-decoration: none;
  padding-top: 0.4rem;
}
.card .card-link:hover { text-decoration: underline; }

.card-number {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--blue);
}

/* ---------- How it works ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  counter-reset: step;
}
@media (max-width: 780px) {
  .steps { grid-template-columns: 1fr; }
}
.step {
  border-top: 3px solid var(--blue);
  padding-top: var(--space-2);
}
.step-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #2A50C4; /* var(--blue) on var(--paper-dim), the .steps background, is only 4.44:1 */
  margin-bottom: 0.5rem;
  display: block;
}
.step p { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  align-items: stretch;
}
@media (max-width: 860px) {
  .pricing-grid { grid-template-columns: 1fr; }
}
.price-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
}
.price-card.is-featured {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.price-name { font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-bottom: 0.5rem; }
.price-amount { font-family: var(--font-display); font-size: 2.5rem; margin-bottom: 0.25rem; }
.price-amount span { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-soft); }
.price-features {
  margin: var(--space-2) 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.92rem;
  flex-grow: 1;
}
.price-features li {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}
.price-card .btn { margin-top: var(--space-2); }
.price-features li::before {
  content: "—";
  color: var(--blue);
  flex-shrink: 0;
}
.pricing-note {
  margin-top: var(--space-3);
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

/* ---------- FAQ ---------- */
.faq-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: start;
  gap: 0.75rem var(--space-3);
}
@media (max-width: 700px) {
  .faq-list { grid-template-columns: 1fr; }
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #FFFFFF;
  padding: 0.25rem var(--space-2);
}
.faq-item summary {
  cursor: pointer;
  padding: 0.9rem 0;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--blue);
  flex-shrink: 0;
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p {
  padding-bottom: var(--space-2);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--ink);
  color: var(--paper);
}
.cta-band .wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.cta-band h2 { color: var(--paper); }
.cta-band p { color: rgba(251, 250, 247, 0.75); }
.cta-band .hero-ctas { justify-content: center; margin-top: var(--space-1); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-4);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.footer-col { display: flex; flex-direction: column; gap: 0.4rem; }
.footer-col a { text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.footer-legal {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding-block: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.page-hero .lede { color: var(--ink-soft); font-size: 1.1rem; max-width: 52ch; }

/* ---------- Service detail blocks ---------- */
.service-detail {
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.service-detail:last-of-type { border-bottom: none; }
.service-detail .wrap {
  display: grid;
  grid-template-columns: 0.6fr 1.4fr;
  gap: var(--space-4);
}
@media (max-width: 860px) {
  .service-detail .wrap { grid-template-columns: 1fr; }
}
.service-meta { display: flex; flex-direction: column; gap: 0.75rem; }
.service-meta-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
}
.service-meta-value { font-size: 0.95rem; color: var(--ink-soft); }
.service-body p { color: var(--ink-soft); margin-bottom: var(--space-2); }

/* ---------- About page ---------- */
.values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
@media (max-width: 780px) {
  .values-grid { grid-template-columns: 1fr; }
}

/* ---------- Contact / booking ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-4);
}
@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}
.booking-embed {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #FFFFFF;
}
.booking-embed iframe {
  display: block;
  width: 100%;
  height: 630px;
  border: 0;
}
@media (max-width: 860px) {
  .booking-embed iframe { height: 800px; }
}

.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: #FFFFFF;
}
.contact-card h3 { margin-bottom: 0.4rem; }
.contact-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: var(--space-2); }
.contact-card .email-link {
  font-family: var(--font-mono);
  color: var(--blue);
  text-decoration: underline;
  word-break: break-word;
}

/* ---------- Beyond automation (secondary / expansion content) ---------- */
.section-beyond {
  padding-block: var(--space-5);
  background: var(--paper-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-head-secondary { max-width: 42rem; margin-bottom: var(--space-3); }
.section-head-secondary h3 {
  font-size: clamp(1.35rem, 2vw + 1rem, 1.75rem);
  margin-bottom: 0.5rem;
}
.section-head-secondary p { color: var(--ink-soft); font-size: 0.95rem; }

.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.card-compact {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  gap: 0.5rem;
}
.card-compact h4 { font-size: 1.1rem; color: var(--ink); }
.card-compact p { font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }

/* Layout overrides — kept last so they beat contextual rules like `.problem .wrap`
   at equal (two-class) specificity via source order. */
.wrap.wrap-block { display: block; }
.wrap.wrap-1col { grid-template-columns: 1fr; }
.wrap.wrap-narrow { max-width: 46rem; }
