/* ===== Caersultancy design tokens ===== */
:root {
  --bg: #0A1120;
  --panel: #111B2E;
  --panel-raised: #16223A;
  --line: #223052;
  --blue: #4FB8FF;
  --blue-dim: #2E7DAE;
  --amber: #FFB454;
  --text: #F3F6FB;
  --text-dim: #8FA0B8;
  --green: #5FE3A1;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --max-w: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(79, 184, 255, 0.07) 1px, transparent 0) 0 0 / 28px 28px,
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}

/* ===== Header / nav ===== */
header.site {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(10, 17, 32, 0.88);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.logo {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo span.mark {
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  flex-shrink: 0;
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--green);
  opacity: 0.6;
  animation: pulse-ring 2.2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ===== Mobile nav ===== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 1.5px;
  width: 16px;
  margin: 0 auto;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-nav {
  display: none;
  flex-direction: column;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  font-family: var(--font-mono);
  font-size: 14px;
  border-top: 1px solid transparent;
}
.mobile-nav.open {
  max-height: 240px;
  border-top-color: var(--line);
}
.mobile-nav a {
  padding: 14px 0;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
}
.mobile-nav a.active { color: var(--blue); }

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

nav.route {
  display: flex;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}

nav.route a {
  position: relative;
  padding: 6px 12px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}
nav.route a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 1px;
  height: 1px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
nav.route a:hover { color: var(--text); background: var(--panel-raised); }
nav.route a:hover::after { transform: scaleX(1); }
nav.route a.active { color: var(--blue); }
nav.route a.active::after { transform: scaleX(1); }

.hop-sep { color: var(--line); padding: 6px 0; }

@media (max-width: 640px) {
  nav.route { display: none; }
}

/* ===== Hero traceroute ===== */
.hero {
  padding: 84px 0 64px;
  border-bottom: 1px solid var(--line);
  position: relative;
  background-image: radial-gradient(rgba(79, 184, 255, 0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -8px -8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 12px 5px 10px;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(95, 227, 161, 0.55);
  animation: pulse-dot 2.2s ease-out infinite;
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(95, 227, 161, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(95, 227, 161, 0); }
  100% { box-shadow: 0 0 0 0 rgba(95, 227, 161, 0); }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue);
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}

h1.headline {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.08;
  margin: 0 0 20px;
  max-width: 16ch;
}

p.lede {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 52ch;
  margin: 0 0 40px;
}

.term {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 26px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  overflow-x: auto;
}

.term .cmd { color: var(--text-dim); margin-bottom: 14px; min-height: 1.2em; }
.term .cmd::before { content: "$ "; color: var(--green); }
.term .cmd.typing::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 2px;
  background: var(--blue);
  vertical-align: -2px;
  animation: caret-blink 0.9s steps(1) infinite;
}
@keyframes caret-blink {
  50% { opacity: 0; }
}

.hop {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 5px 0;
  color: var(--text-dim);
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
/* JS adds .js-hide right before animating; if JS never runs, hops stay visible above */
.hop.js-hide { opacity: 0; transform: translateY(6px); }
.hop.js-hide.shown { opacity: 1; transform: translateY(0); }
.hop .n { color: var(--line); }
.hop .host { color: var(--text); }
.hop .stage { color: var(--text-dim); }
.hop .ms { color: var(--blue); text-align: right; font-variant-numeric: tabular-nums; }
.hop.final .host { color: var(--green); }
.hop.final .ms { color: var(--green); }
.hop.final.shown .n { position: relative; }

@media (max-width: 640px) {
  .hop { grid-template-columns: 16px 1fr auto; gap: 8px; font-size: 12px; }
  .hop .stage { display: none; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 14px;
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn.primary {
  background: var(--blue);
  color: #071019;
  border-color: var(--blue);
  font-weight: 600;
}
.btn.primary:hover { background: #6cc6ff; }
.btn.ghost { color: var(--text); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }

/* ===== Sections ===== */
section { padding: 64px 0; }
section.divider { border-bottom: 1px solid var(--line); }

h2.section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 8px;
}

p.section-sub {
  color: var(--text-dim);
  margin: 0 0 36px;
  max-width: 56ch;
}

/* ===== Cards ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--blue-dim);
  box-shadow: 0 12px 32px -12px rgba(79, 184, 255, 0.25);
}

/* ===== Scroll reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.card .ip {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--blue-dim);
  margin-bottom: 14px;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 10px;
}

.card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 0;
}

/* ===== Badges (vendor stack) ===== */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.badge {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 14px;
}

/* ===== Footer ===== */
footer.site {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
}

footer.site a:hover { color: var(--blue); }

.footer-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.clock {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.clock .tz { color: var(--blue-dim); margin-left: 4px; }

/* ===== Stat counters ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ===== Contact / forms ===== */
.contact-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
@media (max-width: 720px) {
  .contact-block { grid-template-columns: 1fr; }
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
}

/* ===== Utility ===== */
.mt-0 { margin-top: 0; }
.text-mono { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ===== Cross-document page transitions ===== */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.42s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
::view-transition-old(root) { animation-name: caer-fade-out; }
::view-transition-new(root) { animation-name: caer-fade-in; }

@keyframes caer-fade-out {
  from { opacity: 1; filter: brightness(1); }
  to { opacity: 0; filter: brightness(1.2); }
}
@keyframes caer-fade-in {
  from { opacity: 0; filter: brightness(1.2); }
  to { opacity: 1; filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ===== Background network canvas ===== */
#net-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.6;
}

/* ===== Scanline texture ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(79, 184, 255, 0.025) 0px,
    rgba(79, 184, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ===== Boot sequence overlay ===== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.boot-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-lines {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-dim);
  min-width: 300px;
}
.boot-lines .line {
  opacity: 0;
  animation: boot-line-in 0.3s ease forwards;
}
.boot-lines .ok { color: var(--green); }
@keyframes boot-line-in { to { opacity: 1; } }
.boot-bar-track {
  margin-top: 18px;
  width: 300px;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.boot-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  transition: width 1.1s ease;
}
.boot-skip {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.55;
}

/* ===== HUD corner brackets on cards ===== */
.hud-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:hover .hud-corner { opacity: 1; }
.hud-corner.tl { top: -1px; left: -1px; border-top: 2px solid var(--blue); border-left: 2px solid var(--blue); }
.hud-corner.br { bottom: -1px; right: -1px; border-bottom: 2px solid var(--blue); border-right: 2px solid var(--blue); }

/* ===== Button glow ===== */
.btn.primary { box-shadow: 0 0 0 0 rgba(79, 184, 255, 0); }
.btn.primary:hover { box-shadow: 0 0 22px rgba(79, 184, 255, 0.45); }

/* ===== Hero mouse-reactive spotlight ===== */
.hero { position: relative; overflow: hidden; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), rgba(79, 184, 255, 0.09), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.hero:hover::after { opacity: 1; }
