:root {
  --bg: #0b1622;
  --bg-2: #0e1c2c;
  --ink: #d6e6f5;
  --ink-soft: #9db4cb;
  --muted: #6f879e;
  --accent: #5fb2ff;
  --accent-dim: rgba(95, 178, 255, 0.55);
  --line: rgba(140, 180, 220, 0.14);
  --grid: rgba(125, 170, 210, 0.05);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 75% -10%, rgba(95, 178, 255, 0.10), transparent 60%),
    radial-gradient(900px 700px at 0% 110%, rgba(95, 178, 255, 0.06), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Blueprint grid background */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(120% 100% at 50% 30%, #000 55%, transparent 100%);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 32px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 48px;
}
/* let grid/flex children shrink below content size so text wraps instead
   of forcing horizontal overflow */
.hero > *, .copy { min-width: 0; }

.eyebrow {
  margin: 0 0 18px;
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  overflow-wrap: break-word;
}

.title {
  margin: 0 0 22px;
  font-size: clamp(2.4rem, 5.4vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 700;
  overflow-wrap: break-word;
}
/* desktop: force the accent onto its own line; mobile re-inlines it */
.title__line { display: block; }
.title__accent {
  color: transparent;
  background: linear-gradient(120deg, var(--accent), #aed8ff);
  -webkit-background-clip: text;
  background-clip: text;
}

.lede {
  margin: 0 0 26px;
  max-width: 46ch;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

/* ---------- Contact ---------- */
.contact { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.contact__label {
  margin: 0 0 14px;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.contact__list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 4px; }
.contact__list li a,
.contact__list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 7px 0;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.2s ease;
}
.contact__list li a:hover { color: var(--accent); }
.contact__key {
  flex: 0 0 78px;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.contact__val { font-size: 0.98rem; font-weight: 500; }

.contact__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(120deg, var(--accent), #7fc2ff);
  color: #06121f;
}
.btn--primary:hover { background: linear-gradient(120deg, #74bdff, #9ad0ff); }
.btn--ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.02);
}
.btn--ghost:hover { border-color: var(--accent-dim); color: var(--accent); }

/* ---------- Figure / blueprint ---------- */
.figure { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.blueprint {
  width: 100%;
  max-width: 460px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 0 22px rgba(95, 178, 255, 0.12));
}

.bp-ink path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.bp-ink .bp-diag { stroke-width: 1; stroke: var(--ink-soft); }

/* Only the active blueprint is shown. The draw/fade animations are applied
   ONLY while a group is active, so each type starts a fresh cycle the moment
   it becomes active (an animation on a long-hidden element would otherwise
   have its clock already past the end, showing nothing).
   Note: animation sub-properties are set on the base rule and only the
   animation-name is switched on, so the staggered delays below survive. */
.bp { display: none; }
.bp.is-active { display: inline; }

.bp-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation-name: none;
  animation-duration: 6.8s;
  animation-timing-function: ease;
  animation-fill-mode: both;
}
.bp.is-active .bp-draw { animation-name: drawCycle; }
.bp-draw.d1 { animation-delay: 0s; }
.bp-draw.d2 { animation-delay: 0.12s; }
.bp-draw.d3 { animation-delay: 0.24s; }
.bp-draw.d4 { animation-delay: 0.36s; }
.bp-draw.d5 { animation-delay: 0.5s; }
@keyframes drawCycle {
  0%   { stroke-dashoffset: 1; }
  20%  { stroke-dashoffset: 0; }   /* drawn */
  70%  { stroke-dashoffset: 0; }   /* hold */
  90%  { stroke-dashoffset: -1; }  /* erase (seamless, same direction) */
  100% { stroke-dashoffset: -1; }
}

/* auxiliary lines (sections, dimensions, caption) fade in/out with the cycle */
.bp-aux {
  opacity: 0;
  animation-name: none;
  animation-duration: 6.8s;
  animation-timing-function: ease;
  animation-fill-mode: both;
}
.bp.is-active .bp-aux { animation-name: auxCycle; }
@keyframes auxCycle {
  0%, 20%   { opacity: 0; }
  30%, 66%  { opacity: 1; }
  82%, 100% { opacity: 0; }
}

.bp-section {
  fill: none;
  stroke: var(--accent-dim);
  stroke-width: 0.8;
  stroke-dasharray: 10 4 2 4;
}
.bp-dim { fill: none; stroke: rgba(140, 180, 220, 0.4); stroke-width: 0.7; }
.bp-tick { fill: none; stroke: rgba(140, 180, 220, 0.6); stroke-width: 0.9; }
.bp-mark {
  fill: var(--accent);
  font-family: "Space Mono", monospace;
  font-size: 13px;
  font-weight: 700;
}
.bp-dimtext {
  fill: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 11px;
}
/* caption lives inside .bp-aux, so it fades with the group */
.bp-caption {
  fill: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
}

/* ---------- Footer ---------- */
.foot {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 32px 30px;
  display: flex;
  gap: 10px;
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  color: var(--muted);
}
.foot__dot { opacity: 0.6; }

/* ---------- Responsive ---------- */

/* Tablet & below: stack to one column, drawing on top, centered layout */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 40px 28px 48px;
    align-content: center;
    text-align: center;
  }
  .copy {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  /* with align-items:center, items size to content — cap them so long
     text wraps to the container instead of overflowing the screen */
  .copy > * { max-width: 100%; }
  .figure { order: -1; width: 100%; }
  .blueprint { max-width: 340px; }
  .eyebrow { margin-bottom: 14px; }
  .lede { max-width: 52ch; margin-inline: auto; }
  .contact {
    width: 100%;
    max-width: 440px;
    margin-inline: auto;
  }
  .contact__list li,
  .contact__list li a { justify-content: center; }
  .contact__cta { justify-content: center; }
}

/* Phones */
@media (max-width: 560px) {
  .hero { padding: 28px 22px 40px; gap: 26px; }
  .title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .title__line { display: inline; }
  .lede { font-size: 1rem; line-height: 1.6; }
  .eyebrow { font-size: 0.68rem; letter-spacing: 0.16em; }
  .blueprint { max-width: 300px; }
  .contact { margin-top: 28px; padding-top: 22px; }
  .contact__cta { width: 100%; }
  .btn { flex: 1; }
  .foot {
    padding: 18px 22px 28px;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .hero { padding: 22px 18px 34px; }
  .blueprint { max-width: 258px; }
  .contact__key { flex-basis: 62px; }
  .contact__val { font-size: 0.92rem; }
}

/* The blueprint keeps looping at all times, even with Reduce Motion on. */
