/* Restyling a new project should mostly mean editing these tokens.
   Morfics uses one fixed palette: dark opening and results band, light reading sections. */
:root {
  --night: #06101d;
  --night-2: #0b1b2e;
  --glow: #6fd0ff;
  --signal: #ff6fb1;
  --signal-ink: #06101d;
  --accent: #1269ad;
  --accent-ink: #ffffff;
  --ink: #0d1726;
  --ink-soft: #4b5868;
  --on-night: #eef4fa;
  --on-night-soft: #a9b8c8;
  --surface: #ffffff;
  --surface-alt: #f3f6f9;
  --line: #dde3ea;
  --danger: #a3261b;
  --success: #1e6b3a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --gutter: 16px;
  --max: 1120px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.02em; font-weight: 650; }
h1 { font-size: clamp(2.1rem, 5.6vw, 3.9rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-underline-offset: 0.15em; }

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

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

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
@media (min-width: 768px) {
  :root { --gutter: 32px; }
}
.narrow { max-width: 720px; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--ink);
  z-index: 30;
}
.skip:focus { top: 0.5rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 16, 29, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--on-night);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 0.95rem;
  color: inherit;
  text-decoration: none;
}
.brand-mark { width: 22px; height: 22px; color: var(--glow); flex: none; }
.nav { display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--on-night-soft);
  text-decoration: none;
  font-size: 0.95rem;
}
.nav a:hover { color: var(--on-night); }
.nav .nav-cta {
  margin-left: 0.5rem;
  padding: 0 1rem;
  min-height: 40px;
  border-radius: 999px;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 600;
}
.nav .nav-cta:hover { color: var(--signal-ink); filter: brightness(1.06); }
@media (max-width: 599px) {
  .nav a:not(.nav-cta) { display: none; }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--signal);
  color: var(--signal-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, background-color 0.15s;
}
.button:hover { filter: brightness(1.06); }
.button:disabled { opacity: 0.6; cursor: progress; }

/* Hero (dark) */
.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 90% at 75% 50%, var(--night-2), var(--night) 70%);
  color: var(--on-night);
  padding: clamp(4.5rem, 14vw, 9rem) 0 clamp(4rem, 12vw, 8rem);
}
.hero h1 { max-width: 15ch; }
.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.9;
}
.hero-inner { position: relative; }
.eyebrow,
.kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.eyebrow { color: var(--glow); }
.kicker { color: var(--accent); }
.lead {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--on-night-soft);
  max-width: 40ch;
  margin-bottom: 2rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero .button-ghost {
  background: transparent;
  color: var(--on-night);
  border-color: rgba(255, 255, 255, 0.28);
}
.hero .button-ghost:hover { background: rgba(255, 255, 255, 0.06); filter: none; }

/* On phones the chip sits behind the text, so dim it. */
@media (max-width: 767px) {
  .hero-art { opacity: 0.35; }
  .hero-art .chip { display: none; }
}

.wire { stroke-dasharray: 6 10; animation: flow 3s linear infinite; }
.wire-out { animation-duration: 2s; }
.chip-core { animation: pulse 3s ease-in-out infinite; }
@keyframes flow { to { stroke-dashoffset: -64; } }
@keyframes pulse { 50% { fill-opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) {
  .wire, .chip-core { animation: none; }
}

/* Reading sections (light) */
.section { padding: clamp(4rem, 10vw, 7rem) 0; }
.section-alt { background: var(--surface-alt); }
.title-wide { max-width: 22ch; }
.prose { color: var(--ink-soft); font-size: 1.1rem; max-width: 60ch; }

.split { display: grid; gap: 1.5rem 4rem; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; align-items: start; }
  .split .prose { padding-top: 2.4rem; }
}

.flow {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  counter-reset: none;
}
.flow li {
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.flow p { margin: 0; color: var(--ink-soft); }
.step {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Results band (dark) */
.band {
  background: var(--night);
  color: var(--on-night);
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}
.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stats li { border-top: 1px solid rgba(255, 255, 255, 0.14); padding-top: 1.25rem; }
.stats strong {
  display: block;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--signal);
  margin-bottom: 0.4rem;
}
.stats span { color: var(--on-night-soft); }
.band-note { margin: 2.5rem 0 0; color: var(--on-night-soft); font-size: 0.95rem; }

/* Where it is used */
.uses {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.uses li {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
}
.uses svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Contact */
.contact-form { margin-top: 2rem; }
.field-row { display: grid; gap: 0 1rem; }
@media (min-width: 600px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}
.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.field input,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.875rem;
  border: 1px solid #8a96a5;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; }

/* Off-screen rather than display:none, because some bots skip hidden fields. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status { margin: 1rem 0 0; min-height: 1.6em; }
.form-status[data-state="invalid"],
.form-status[data-state="error"],
.form-status[data-state="too-many"] { color: var(--danger); }
.form-status[data-state="sent"] { color: var(--success); }

.more { margin: 2rem 0 0; font-weight: 600; }
.more a { text-decoration: none; }
.more a:hover { text-decoration: underline; }

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

/* Sub-pages */
.page-hero {
  background: radial-gradient(120% 120% at 80% 0%, var(--night-2), var(--night) 70%);
  color: var(--on-night);
  padding: clamp(3.5rem, 10vw, 6rem) 0 clamp(3rem, 8vw, 5rem);
}
.page-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 18ch; }
.page-hero .lead { margin-bottom: 0; }

.doc h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin-top: 2.75rem; }
.doc h2:first-child { margin-top: 0; }
.doc p, .doc li { color: var(--ink-soft); }
.doc strong { color: var(--ink); }
.doc ul, .doc ol { padding-left: 1.25rem; margin: 0 0 1em; }
.doc li { margin-bottom: 0.6em; }
.doc li::marker { color: var(--accent); }

.cta-card {
  margin-top: 3.5rem;
  padding: 2rem;
  border-radius: var(--radius);
  background: var(--night);
  color: var(--on-night);
}
.cta-card h2 { margin-top: 0; }
.doc .cta-card p { color: var(--on-night-soft); }

.faq details {
  border-bottom: 1px solid var(--line);
}
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: 1rem 0;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
}
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 1.25rem; max-width: 62ch; }

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 1.5rem;
  margin: 0 0 1.25rem;
}
.details dt { font-weight: 600; }
.details dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 479px) {
  .details { grid-template-columns: 1fr; gap: 0.1rem; }
  .details dd { margin-bottom: 0.6rem; }
}
.updated { margin-top: 2.5rem; font-size: 0.9rem; }

/* Footer (dark) */
.site-footer {
  padding: 3.5rem 0 2rem;
  background: var(--night);
  color: var(--on-night-soft);
  font-size: 0.95rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.footer-about p { margin: 0.75rem 0 0; max-width: 36ch; }
.footer-col h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-night);
  margin: 0 0 0.75rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 0.35rem; }
.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--on-night-soft);
  text-decoration: none;
}
.footer-col a:hover { color: var(--on-night); text-decoration: underline; }
.footer-legal {
  grid-column: 1 / -1;
  margin: 1rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
}
.brand-small { color: var(--on-night); font-size: 0.85rem; }

/* Drone diagram: a wide drawing on laptops, a tall one on phones */
.diagram { margin: 3rem 0 0; }
.diagram svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.diagram-wide { display: none !important; }
@media (min-width: 760px) {
  .diagram-wide { display: block !important; }
  .diagram-tall { display: none !important; }
}
.diagram-tall { max-width: 420px; margin: 0 auto; }
.diagram figcaption {
  margin: 1.5rem auto 0;
  max-width: 60ch;
  text-align: center;
  color: var(--ink-soft);
}
.diagram-section { padding-bottom: 0; }
.diagram-section .diagram { margin-top: 2rem; }

.d-card { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.d-frame { fill: var(--surface); stroke: #8a96a5; stroke-width: 1.5; stroke-dasharray: 6 6; }
.section-alt .d-frame { fill: #ffffff; }
.d-kick { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; fill: var(--accent); }
.d-name { font-size: 15px; font-weight: 650; fill: var(--ink); }
.d-sub { font-size: 13px; fill: var(--ink-soft); }
.d-note { font-size: 13px; fill: var(--ink-soft); }
.d-line { stroke: var(--ink); stroke-width: 2; fill: none; }
.d-arrowhead { fill: var(--ink); }
.d-yline { stroke: var(--signal); stroke-width: 6; fill: none; stroke-linecap: round; }
.d-arrowhead-y { fill: var(--signal); }
.d-morfics { fill: var(--night); stroke: var(--signal); stroke-width: 2.5; }
.d-mark { fill: var(--signal); }
.d-brand { font-size: 16px; font-weight: 700; letter-spacing: 0.16em; fill: var(--signal); }
.d-msub { font-size: 14px; fill: var(--on-night); }
.d-mnote { font-size: 12px; fill: var(--on-night-soft); }
.d-chip rect { fill: var(--surface); stroke: var(--signal); stroke-width: 2.5; }
.d-core rect { fill: var(--night); }
.d-core .d-name { fill: var(--on-night); }
.d-core .d-sub { fill: var(--on-night-soft); }
.d-part rect { fill: var(--surface-alt); stroke: var(--line); stroke-width: 1.5; }
.d-part .d-name { fill: var(--ink-soft); font-weight: 500; }
.d-link { stroke: #8a96a5; stroke-width: 1.5; fill: none; }
.d-drone { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.d-legend { fill: var(--surface); stroke: var(--signal); stroke-width: 2.5; }

/* Logo: blue frame, yellow core */
.brand-mark rect:last-child { fill: var(--signal); }

/* The label above each page headline reads as a real line, not fine print. */
.eyebrow { font-size: clamp(0.95rem, 1.5vw, 1.1rem); letter-spacing: 0.12em; margin-bottom: 1.1rem; }

/* How it works: tiles, comparison, step cards with pictures */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.tiles {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.tiles-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tiles-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tiles li {
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.tiles p { margin: 0; color: var(--ink-soft); }
.tile-num {
  display: block;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.tile-word {
  display: block;
  margin-bottom: 0.6rem;
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--night);
}
.tile-word::before {
  content: "";
  display: block;
  width: 28px;
  height: 4px;
  margin-bottom: 0.9rem;
  border-radius: 2px;
  background: var(--signal);
}

.compare {
  display: grid;
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 700px) {
  .compare { grid-template-columns: 1fr 1fr; }
  .compare figure + figure { border-left: 1px solid var(--line); }
}
@media (max-width: 699px) {
  .compare figure + figure { border-top: 1px solid var(--line); }
}
.compare figure { margin: 0; padding: 1.75rem; }
.compare .kicker { margin-bottom: 0.35rem; }
.kicker-muted { color: var(--ink-soft); }
.compare h3 { margin-bottom: 1.25rem; }
.compare svg { display: block; width: 100%; max-width: 380px; height: auto; margin: 0 auto; }

.i-grey { color: #8a96a5; --core: rgba(138, 150, 165, 0.25); }
.i-navy { color: var(--night); --core: var(--accent); }
.i-glow { color: var(--glow); --core: rgba(111, 208, 255, 0.35); }
.i-core { fill: var(--core, currentColor); }
.i-core-a { --core: var(--signal); }
.i-core-b { --core: var(--glow); }
.i-core-c { --core: #ffffff; }
.i-tangle path { stroke: #8a96a5; stroke-width: 1.5; stroke-dasharray: 4 5; }
.i-tool rect { fill: var(--surface); stroke: #8a96a5; stroke-width: 1.5; }
.i-tool path { stroke: #8a96a5; stroke-width: 1.5; stroke-linecap: round; }
.i-bus { stroke: var(--night); stroke-width: 3; }
.i-hub { fill: var(--signal); stroke: var(--night); stroke-width: 3; }

.step-cards {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.step-cards li {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.step-art {
  background: radial-gradient(120% 120% at 50% 0%, var(--night-2), var(--night) 75%);
  padding: 1.25rem 1rem;
}
.step-art svg { display: block; width: 100%; height: auto; max-height: 130px; }
.step-body { padding: 1.5rem 1.5rem 1.75rem; }
.step-body p { margin: 0; color: var(--ink-soft); }
.prose-after { margin-top: 2rem; }

.i-label { font-size: 12px; fill: var(--on-night-soft); font-family: var(--font); }
.i-track { fill: rgba(255, 255, 255, 0.14); }
.i-fill { fill: var(--signal); }
.i-piece-a { fill: var(--signal); }
.i-piece-b { fill: var(--glow); }
.i-piece-c { fill: #ffffff; }
.i-flow { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.5; stroke-dasharray: 4 5; }
.i-board { fill: var(--night-2); stroke: var(--glow); stroke-width: 2.5; }
.i-cells rect { fill: rgba(111, 208, 255, 0.18); }
.i-lit rect { fill: var(--signal); }
.i-pin { stroke: var(--glow); stroke-width: 2.5; stroke-linecap: round; }
.i-check { stroke: var(--night); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

.today {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
  margin-top: 1rem;
  padding: 1.25rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.today .kicker { margin: 0; }
.today ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  color: var(--ink-soft);
}
.today li { display: flex; align-items: baseline; gap: 0.5rem; }
.today li::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  transform: translateY(-1px);
}
.today strong { color: var(--ink); }
.i-body { fill: var(--chip-bg, none); }
.i-grey { --chip-bg: #ffffff; --core: #e3e7ec; }
.i-navy { --chip-bg: #ffffff; }
.i-glow { --chip-bg: var(--night); }
.today li { display: block; position: relative; padding-left: 1.1rem; }
.today li::before { position: absolute; left: 0; top: 0.6em; transform: none; }
.i-navy { --core: var(--signal); }
