/* ==========================================================================
   RayneBowTech — design system
   Dark-committed spectrum theme.

   Two colour systems live here and they must not be mixed:

   1. BRAND SPECTRUM (--spec-*, --rainbow)
      Decorative only. Logo, rules, gradient text, section accents.
      Never used to encode data.

   2. DATA SERIES (--series-1..3, --good/--warning/--critical)
      Used inside the dashboard/product SVGs. These three steps were
      validated with the dataviz palette validator against --surface
      (#12141b): lightness band PASS, chroma floor PASS, CVD separation
      PASS (worst pair deutan ΔE 9.4), normal-vision floor PASS (ΔE 20.9),
      contrast vs surface PASS (all >= 3:1).

      If you change a series hex or --surface, re-run:
      node scripts/validate_palette.js "#3987e5,#d95926,#199e70" \
        --mode dark --surface "#12141b" --pairs all
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  /* Surfaces */
  --bg: #0a0b0f;
  --surface: #12141b;
  --surface-raised: #191c25;
  --surface-sunken: #0d0f14;

  /* Lines */
  --border: #252936;
  --border-strong: #343a4b;
  --grid: #1e2230;
  --axis: #2b3040;

  /* Ink */
  --ink: #f4f6fa;
  --ink-secondary: #a9b2c4;
  --ink-muted: #707a8d;

  /* Data series — validated, do not reorder */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;

  /* Status — reserved, never reused as a series */
  --good: #2ea043;
  --warning: #c98500;
  --critical: #e5484d;

  /* Brand spectrum — decorative only */
  --spec-red: #ff5c5c;
  --spec-orange: #ff9f43;
  --spec-yellow: #ffd93d;
  --spec-green: #4ade80;
  --spec-cyan: #38bdf8;
  --spec-violet: #a78bfa;
  --rainbow: linear-gradient(
    90deg,
    var(--spec-red) 0%,
    var(--spec-orange) 18%,
    var(--spec-yellow) 36%,
    var(--spec-green) 56%,
    var(--spec-cyan) 78%,
    var(--spec-violet) 100%
  );

  /* Interactive */
  --accent: #38bdf8;
  --accent-strong: #7dd3fc;
  --accent-wash: rgba(56, 189, 248, 0.1);

  /* Type */
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Space */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);

  /* Layout */
  --wrap: 1200px;
  --wrap-narrow: 760px;
  --header-h: 68px;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-5));
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* `clip`, NOT `hidden`.
     `overflow-x: hidden` would promote <body> to a scroll container
     (overflow-y computes to auto), and the sticky header then scrolls away
     with the content because body itself never scrolls.
     `overflow-x: clip` clips without creating a scroll container, so sticky
     keeps working. This is only a safety net — the real causes of sideways
     scroll are fixed at source (see .footer-grid and the .cols-* tracks). */
  overflow-x: clip;
}

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

a {
  color: var(--accent);
  text-decoration-color: rgba(56, 189, 248, 0.35);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

/* Email addresses are long unbreakable strings. ryanrutledge@raynebowtech.com
   renders ~265px wide, which is more than the content box of a 320px phone, so
   any container holding one inherits that as a minimum width and the page
   scrolls sideways. `anywhere` (not `break-word`) is required — it is the only
   value that also lowers the min-content size layout is measured against. */
a[href^="mailto:"] {
  overflow-wrap: anywhere;
}

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

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

::selection {
  background: rgba(56, 189, 248, 0.28);
  color: #fff;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.35rem + 3.6vw, 4rem);
}

h2 {
  font-size: clamp(1.75rem, 1.25rem + 2vw, 2.75rem);
}

h3 {
  font-size: clamp(1.15rem, 1.02rem + 0.5vw, 1.4rem);
}

p {
  text-wrap: pretty;
}

.lead {
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.25rem);
  color: var(--ink-secondary);
  line-height: 1.7;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--rainbow);
}

.gradient-text {
  background: var(--rainbow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted {
  color: var(--ink-muted);
}

.secondary {
  color: var(--ink-secondary);
}

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.wrap-narrow {
  max-width: var(--wrap-narrow);
}

.section {
  padding-block: clamp(var(--sp-8), 5vw, var(--sp-9));
}

.section-sm {
  padding-block: var(--sp-8);
}

.section-head {
  max-width: 60ch;
  margin-bottom: var(--sp-7);
}

.section-head h2 {
  margin-top: var(--sp-3);
}

.section-head p {
  margin-top: var(--sp-4);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.grid {
  display: grid;
  gap: var(--sp-5);
}

/* The `min(Npx, 100%)` matters. A bare `minmax(300px, 1fr)` track cannot shrink
   below 300px, so on a 320px phone the grid is wider than the viewport and the
   whole document gets a horizontal scrollbar. min() lets the track collapse to
   the container width instead. */
.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}

.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
}

.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr));
}

.rule {
  height: 1px;
  border: 0;
  background: var(--border);
}

.rule-spectrum {
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: var(--rainbow);
  opacity: 0.85;
}

/* Ambient background glow, purely decorative */
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  /* Never let a long label push the page wider than the screen. */
  max-width: 100%;
  /* Touch-target floor. Padding alone lands the smaller variant at ~42px. */
  min-height: 44px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Below this, a nowrap label can still exceed the screen — let those wrap
   rather than overflow. */
@media (max-width: 400px) {
  .btn {
    white-space: normal;
  }
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--spec-cyan), var(--spec-violet));
  color: #06121c;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.22);
}

.btn-primary:hover {
  color: #06121c;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.32);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--surface-raised);
  border-color: var(--ink-muted);
  color: var(--ink);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

/* --------------------------------------------------------------------------
   6. Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(10, 11, 15, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand .brand-bow {
  background: var(--rainbow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.nav a {
  padding: 0.45rem 0.8rem;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--ink);
  background: var(--surface-raised);
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav-cta {
  margin-left: var(--sp-3);
}

.nav-toggle {
  display: none;
  /* 44px is the minimum comfortable touch target — this is the only control
     on a phone that opens navigation, so it should not be marginal. */
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-1);
    padding: var(--sp-4) var(--sp-5) var(--sp-6);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }

  .nav[data-open="true"] {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav a {
    padding: 0.7rem 0.8rem;
    font-size: 1rem;
  }

  .nav-cta {
    margin: var(--sp-3) 0 0;
  }
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--sp-8), 6vw, var(--sp-9));
  border-bottom: 1px solid var(--border);
}

.hero::after {
  /* faint engineering grid */
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(
    ellipse 80% 60% at 50% 0%,
    #000 30%,
    transparent 75%
  );
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(var(--sp-6), 4vw, var(--sp-8));
  align-items: center;
}

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

.hero h1 {
  margin-top: var(--sp-4);
}

.hero .lead {
  margin-top: var(--sp-5);
  max-width: 54ch;
}

.hero-glow-a {
  top: -180px;
  left: -120px;
  width: 520px;
  height: 520px;
  background: var(--spec-cyan);
}

.hero-glow-b {
  top: -60px;
  right: -160px;
  width: 460px;
  height: 460px;
  background: var(--spec-violet);
}

.serves {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.serves strong {
  color: var(--ink-secondary);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: transform 0.22s ease, border-color 0.22s ease,
    background 0.22s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--surface-raised);
}

.card h3 {
  margin-bottom: var(--sp-3);
}

.card p {
  color: var(--ink-secondary);
  font-size: 0.95rem;
}

/* Spectrum top edge, keyed per card via --edge */
.card-edge::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--edge, var(--rainbow));
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  color: var(--edge-solid, var(--accent));
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

.card-list {
  margin: var(--sp-4) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-2);
}

.card-list li {
  position: relative;
  padding-left: 1.35rem;
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

.card-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--edge-solid, var(--accent));
}

/* Ordered list that keeps its own numbers (no ::before bullet) */
.numbered-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: var(--sp-3);
}

.numbered-list li {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  padding-left: 0.2rem;
}

.numbered-list li::marker {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Numbered process steps */
.step {
  position: relative;
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: var(--sp-4);
  border-radius: 50%;
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.step h3 {
  margin-bottom: var(--sp-2);
}

.step p {
  color: var(--ink-secondary);
  font-size: 0.94rem;
}

/* Feature row: text beside a visual */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(var(--sp-6), 4vw, var(--sp-8));
  align-items: center;
}

.feature + .feature {
  margin-top: clamp(var(--sp-8), 5vw, var(--sp-9));
}

.feature-flip .feature-visual {
  order: -1;
}

@media (max-width: 900px) {
  .feature,
  .feature-flip {
    grid-template-columns: 1fr;
  }

  .feature-flip .feature-visual {
    order: 0;
  }
}

.feature h2 {
  margin-top: var(--sp-3);
}

.feature p {
  margin-top: var(--sp-4);
  color: var(--ink-secondary);
}

.feature-visual {
  position: relative;
}

/* Pills */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.35rem 0.8rem;
  border-radius: var(--r-pill);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* Panel — a bordered content block */
.panel {
  padding: clamp(var(--sp-5), 3vw, var(--sp-7));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}

.panel-accent {
  background: linear-gradient(
    160deg,
    rgba(56, 189, 248, 0.07),
    rgba(167, 139, 250, 0.05) 55%,
    transparent
  );
}

/* Definition rows (availability, terms) */
.deflist {
  display: grid;
  gap: 0;
  margin: 0;
}

.deflist > div {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--border);
}

.deflist > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.deflist dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 0.2em;
}

.deflist dd {
  margin: 0;
  color: var(--ink-secondary);
  min-width: 0; /* grid item: allow shrinking below content width */
}

.deflist dd strong {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 640px) {
  .deflist > div {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
}

/* Callout */
.callout {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--r-md);
}

.callout svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  color: var(--warning);
}

.callout p {
  font-size: 0.93rem;
  color: var(--ink-secondary);
}

.callout strong {
  color: var(--ink);
}

/* CTA band */
.cta-band {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(var(--sp-7), 5vw, var(--sp-9)) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}

.cta-band::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--rainbow);
}

.cta-band h2 {
  max-width: 22ch;
  margin-inline: auto;
}

.cta-band p {
  max-width: 56ch;
  margin: var(--sp-4) auto 0;
  color: var(--ink-secondary);
}

.cta-band .btn-row {
  justify-content: center;
}

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
}

.field-full {
  grid-column: 1 / -1;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.field .req {
  color: var(--spec-cyan);
}

.field .hint {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a9b2c4' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 16px;
  padding-right: 2.4rem;
  cursor: pointer;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #5c6577;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--critical);
}

.field-error {
  font-size: 0.8rem;
  color: var(--critical);
  min-height: 1em;
}

/* Honeypot — hidden from people, visible to naive bots */
.hp-field {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* Form status message */
.form-status {
  display: none;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
  border-radius: var(--r-md);
  font-size: 0.94rem;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
}

.form-status[data-state="success"],
.form-status[data-state="error"],
.form-status[data-state="pending"] {
  display: flex;
}

.form-status[data-state="success"] {
  border-color: rgba(46, 160, 67, 0.5);
  background: rgba(46, 160, 67, 0.1);
  color: #b7f0c4;
}

.form-status[data-state="error"] {
  border-color: rgba(229, 72, 77, 0.5);
  background: rgba(229, 72, 77, 0.1);
  color: #ffc9cb;
}

.form-status .status-glyph {
  flex: none;
  font-weight: 700;
}

/* Spinner on submit */
.btn[data-loading="true"] {
  pointer-events: none;
  opacity: 0.75;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(6, 18, 28, 0.3);
  border-top-color: #06121c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   10. Contact aside
   -------------------------------------------------------------------------- */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(var(--sp-6), 4vw, var(--sp-8));
  align-items: start;
}

@media (max-width: 900px) {
  .contact-layout {
    grid-template-columns: 1fr;
  }
}

.contact-card {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.contact-card + .contact-card {
  margin-top: var(--sp-4);
}

.contact-card svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 3px;
  color: var(--accent);
}

.contact-card h3 {
  font-size: 1rem;
  margin-bottom: var(--sp-1);
}

.contact-card p,
.contact-card a {
  font-size: 0.91rem;
  color: var(--ink-secondary);
}

.contact-card a {
  color: var(--accent);
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   11. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: var(--sp-8);
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}

/* Mobile-first, with explicit breakpoints.
   The previous `minmax(240px, 1.6fr) repeat(auto-fit, minmax(150px, 1fr))`
   resolved to two rigid tracks (240px + 150px + 32px gap = 422px) inside a
   ~312px container. Neither track could shrink, so the footer set a 527px
   min-content floor on the ENTIRE document and every page scrolled sideways
   on a phone. Fixed track minimums and small viewports do not mix. */
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  padding-block: var(--sp-7);
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Brand blurb spans the full width above the three link columns. */
  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (min-width: 940px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: auto;
  }
}

.footer-brand p {
  margin-top: var(--sp-4);
  max-width: 38ch;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--sp-4);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--sp-3);
}

/* A grid/flex item defaults to min-width:auto, which refuses to shrink below
   its content. Without this the long email address widens the whole track. */
.footer-col,
.footer-brand,
.footer-col li {
  min-width: 0;
}

.footer-col a {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  text-decoration: none;
  /* `anywhere`, not `break-word`: only `anywhere` reduces the min-content size
     that grid measures the track against. `break-word` would let the text wrap
     visually but still report the full unbroken width, so the track — and the
     document — would stay too wide. ryanrutledge@raynebowtech.com is a 231px
     unbreakable string and was pushing the page 4px past a 1024px laptop. */
  overflow-wrap: anywhere;
}

.footer-col a:hover {
  color: var(--ink);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: center;
  justify-content: space-between;
  padding-block: var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   12. Product SVG visuals
   -------------------------------------------------------------------------- */

.viz {
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Roles used inside the SVGs */
.viz .viz-surface {
  fill: var(--surface);
}
.viz .viz-sunken {
  fill: var(--surface-sunken);
}
.viz .viz-raised {
  fill: var(--surface-raised);
}
.viz .viz-border {
  stroke: var(--border);
  fill: none;
  stroke-width: 1;
}
.viz .viz-grid {
  stroke: var(--grid);
  stroke-width: 1;
}
.viz .viz-axis {
  stroke: var(--axis);
  stroke-width: 1;
}
.viz .viz-ink {
  fill: var(--ink);
}
.viz .viz-ink-2 {
  fill: var(--ink-secondary);
}
.viz .viz-ink-3 {
  fill: var(--ink-muted);
}
.viz .s1 {
  fill: var(--series-1);
}
.viz .s2 {
  fill: var(--series-2);
}
.viz .s3 {
  fill: var(--series-3);
}
.viz .s1-line {
  stroke: var(--series-1);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.viz .s2-line {
  stroke: var(--series-2);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.viz .s3-line {
  stroke: var(--series-3);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.viz .st-good {
  fill: var(--good);
}
.viz .st-warn {
  fill: var(--warning);
}
.viz .viz-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink-muted);
}
.viz .viz-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink);
}
.viz .viz-value {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  fill: var(--ink);
}

/* Animations — all disabled under reduced motion (see §13) */
.viz .pulse {
  animation: pulse 2.4s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.viz .pulse-b {
  animation: pulse 2.4s ease-in-out infinite;
  animation-delay: 0.8s;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(1.5);
  }
}

.viz .flow {
  stroke-dasharray: 5 7;
  animation: flow 1.6s linear infinite;
}

@keyframes flow {
  to {
    stroke-dashoffset: -24;
  }
}

.viz .sweep {
  animation: sweep 3.2s ease-in-out infinite;
}

@keyframes sweep {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.5;
  }
}

.viz .draw {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw 2.6s ease-out forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* --------------------------------------------------------------------------
   13. Motion & print
   -------------------------------------------------------------------------- */

/* Scroll reveal.
   Content is VISIBLE by default and only hidden once the inline head script has
   confirmed JS is running (html.js). Without that guard, a JS error, a blocked
   script or a reader with JS off would be served an entirely blank page.
   site.js also runs a failsafe timer that reveals anything still hidden. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal[data-visible="true"] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .viz .draw {
    stroke-dashoffset: 0;
  }

  .btn:hover,
  .card:hover {
    transform: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .btn,
  .glow,
  .hero::after {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* --------------------------------------------------------------------------
   14. Utilities
   -------------------------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--accent);
  color: #06121c;
  font-weight: 600;
  border-radius: 0 0 var(--r-md) var(--r-md);
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  color: #06121c;
}

.center {
  text-align: center;
}

.mt-0 {
  margin-top: 0;
}
.mt-4 {
  margin-top: var(--sp-4);
}
.mt-5 {
  margin-top: var(--sp-5);
}
.mt-6 {
  margin-top: var(--sp-6);
}
.mt-7 {
  margin-top: var(--sp-7);
}
