:root {
  --ink: #14161a;
  --ink-soft: #55565c;
  --paper: #ffffff;
  --paper-alt: #f4f2ef;
  --line: #e5e2db;
  --accent: #b81f24;
  --accent-dark: #8f1418;
  --on-accent: #f7f3ee;
  --radius: 2px;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Archivo', Arial, sans-serif;
  color-scheme: light;

  /* Per-section backgrounds. Each defaults to the shared --paper /
     --paper-alt tokens (so the site looks the same until the CMS
     overrides one), but can be set independently. */
  --bg-header: var(--paper);
  --bg-hero: var(--paper-alt);
  --bg-strip: var(--paper);
  --bg-why: var(--paper);
  --bg-services: var(--paper);
  --bg-about: var(--paper);
  --bg-contact: var(--paper-alt);
  --bg-footer: var(--paper);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ece8e2;
    --ink-soft: #9d988f;
    --paper: #0a0a0b;
    --paper-alt: #161617;
    --line: #2b2b2c;
    --accent: #b81f24;
    --accent-dark: #e8383d;
    --on-accent: #f7f3ee;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #ece8e2;
  --ink-soft: #9d988f;
  --paper: #0a0a0b;
  --paper-alt: #161617;
  --line: #2b2b2c;
  --accent: #b81f24;
  --accent-dark: #e8383d;
  --on-accent: #f7f3ee;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}

p { margin: 0 0 16px; color: var(--ink-soft); }

.eyebrow {
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--accent-dark);
  margin: 0 0 12px;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  line-height: 1;
  text-decoration: none;
  font-family: var(--sans);
}

.brand-logo {
  height: 40px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.brand-wordmark {
  display: flex;
  flex-direction: column;
}

.brand-first {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--accent-dark);
}

.brand-last {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
  font-weight: 600;
  font-size: 14px;
}

.nav a {
  text-decoration: none;
  color: var(--ink);
}

.nav a:hover { color: var(--accent-dark); }

.nav-cta {
  border: 1px solid var(--ink);
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}

.nav-cta:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.theme-toggle .icon-moon { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline-flex; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  height: 2px;
  background: var(--ink);
  width: 100%;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  padding: 96px 24px 72px;
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  margin-bottom: 20px;
}

.hero-sub {
  font-size: 18px;
  max-width: 560px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin: 28px 0 36px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 14px 28px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

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

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

.hero-badges {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.hero-badges li {
  padding-left: 14px;
  border-left: 2px solid var(--accent);
}

.hero-rings {
  position: absolute;
  right: -120px;
  top: -80px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  border: 1px solid rgba(184, 31, 36, 0.35);
  box-shadow: 0 0 0 40px var(--paper), 0 0 0 41px rgba(184, 31, 36, 0.2), 0 0 0 80px var(--paper), 0 0 0 81px rgba(184, 31, 36, 0.12);
  opacity: 0.8;
  overflow: hidden;
}

/* Radar sweep, spinning inside the existing decorative rings. */
.hero-rings::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(184, 31, 36, 0.4), transparent 22%, transparent 100%);
  animation: hero-radar-spin 8s linear infinite;
}

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

/* Radar "contacts" pinging inside the rings. */
.radar-blip {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: rgba(232, 56, 61, 0.9);
  opacity: 0;
  animation: hero-blip-ping 3.2s ease-out infinite;
}

@keyframes hero-blip-ping {
  0% { opacity: 0; transform: scale(0.4); box-shadow: 0 0 0 0 rgba(232, 56, 61, 0.55); }
  15% { opacity: 1; transform: scale(1); }
  70% { opacity: 0.5; box-shadow: 0 0 0 14px rgba(232, 56, 61, 0); }
  100% { opacity: 0; transform: scale(0.4); box-shadow: 0 0 0 0 rgba(232, 56, 61, 0); }
}

/* Hero background effects: canvas particle network, schematic grid, dual
   scan lines, drifting data fragments, a targeting reticle, and a
   typewriter terminal readout. Purely decorative and non-interactive —
   sits behind .hero-inner (z-index: 1). */
.hero-fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(184, 31, 36, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 31, 36, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 85%);
  animation: hero-grid-drift 40s linear infinite;
}

@keyframes hero-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 48px 48px, 48px 48px; }
}

.hero-scanline { position: absolute; opacity: 0; }

.hero-scanline-h {
  left: 0;
  right: 0;
  top: -5%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(184, 31, 36, 0.6) 20%,
    rgba(184, 31, 36, 0.9) 50%,
    rgba(184, 31, 36, 0.6) 80%,
    transparent
  );
  box-shadow: 0 0 12px 2px rgba(184, 31, 36, 0.45);
  animation: hero-scanline-sweep-h 7s ease-in-out infinite;
}

@keyframes hero-scanline-sweep-h {
  0% { top: -5%; opacity: 0; }
  8% { opacity: 0.7; }
  50% { opacity: 0.45; }
  92% { opacity: 0.7; }
  100% { top: 105%; opacity: 0; }
}

.hero-scanline-v {
  top: 0;
  bottom: 0;
  left: -5%;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(184, 31, 36, 0.5) 20%,
    rgba(184, 31, 36, 0.8) 50%,
    rgba(184, 31, 36, 0.5) 80%,
    transparent
  );
  box-shadow: 0 0 12px 2px rgba(184, 31, 36, 0.4);
  animation: hero-scanline-sweep-v 11s ease-in-out infinite;
  animation-delay: 2.5s;
}

@keyframes hero-scanline-sweep-v {
  0% { left: -5%; opacity: 0; }
  8% { opacity: 0.6; }
  50% { opacity: 0.35; }
  92% { opacity: 0.6; }
  100% { left: 105%; opacity: 0; }
}

.hero-fragments {
  position: absolute;
  inset: 0;
}

.fragment {
  position: absolute;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  white-space: nowrap;
  opacity: 0;
  animation: hero-fragment-drift 12s ease-in-out infinite;
}

@keyframes hero-fragment-drift {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 0.35; }
  80% { opacity: 0.35; }
  100% { opacity: 0; transform: translateY(-14px); }
}

.fragment-accent {
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(184, 31, 36, 0.5);
  animation-name: hero-fragment-drift-accent;
}

@keyframes hero-fragment-drift-accent {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 0.6; }
  80% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* Targeting-reticle corner brackets. */
.hero-reticle {
  position: absolute;
  width: 26px;
  height: 26px;
  border-style: solid;
  border-width: 0;
  border-color: rgba(184, 31, 36, 0.55);
  opacity: 0.4;
  animation: hero-reticle-pulse 4s ease-in-out infinite;
}

.hero-reticle-tl { top: 20px; left: 20px; border-top-width: 2px; border-left-width: 2px; animation-delay: 0s; }
.hero-reticle-tr { top: 20px; right: 20px; border-top-width: 2px; border-right-width: 2px; animation-delay: 1s; }
.hero-reticle-bl { bottom: 20px; left: 20px; border-bottom-width: 2px; border-left-width: 2px; animation-delay: 2s; }
.hero-reticle-br { bottom: 20px; right: 20px; border-bottom-width: 2px; border-right-width: 2px; animation-delay: 3s; }

@keyframes hero-reticle-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.85; }
}

/* Typewriter terminal readout, styled like an always-dark HUD panel so it
   reads consistently in both light and dark site themes. */
.hero-terminal {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 280px;
  max-width: calc(100% - 48px);
  background: rgba(10, 10, 11, 0.82);
  border: 1px solid rgba(184, 31, 36, 0.4);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  font-family: 'Courier New', Consolas, monospace;
}

.hero-terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(184, 31, 36, 0.18);
  border-bottom: 1px solid rgba(184, 31, 36, 0.35);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #f2b8ba;
  text-transform: uppercase;
}

.hero-terminal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e8383d;
  box-shadow: 0 0 6px 1px rgba(232, 56, 61, 0.8);
  animation: hero-terminal-dot-pulse 1.6s ease-in-out infinite;
}

@keyframes hero-terminal-dot-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.hero-terminal-body {
  padding: 10px 12px 12px;
  min-height: 44px;
  font-size: 12px;
  line-height: 1.5;
  color: #d8d6d0;
  white-space: pre-wrap;
  word-break: break-word;
}

.hero-terminal-cursor {
  display: inline-block;
  color: #e8383d;
  animation: hero-terminal-blink 1s step-end infinite;
}

@keyframes hero-terminal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-grid,
  .hero-scanline-h,
  .hero-scanline-v,
  .hero-rings::before,
  .radar-blip,
  .fragment,
  .fragment-accent,
  .hero-reticle,
  .hero-terminal-dot,
  .hero-terminal-cursor {
    animation: none;
  }
  .hero-scanline-h,
  .hero-scanline-v,
  .radar-blip {
    opacity: 0;
  }
  .fragment,
  .fragment-accent {
    opacity: 0.22;
  }
  .hero-reticle {
    opacity: 0.5;
  }
  .hero-canvas {
    display: none;
  }
}

/* Strip */
.strip {
  background: var(--bg-strip);
  border-bottom: 1px solid var(--line);
}

.strip-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 32px 24px;
}

.strip-inner div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.strip-inner strong {
  font-size: 22px;
  font-family: var(--sans);
  font-weight: 900;
}

.strip-inner span {
  font-size: 13px;
  color: var(--ink-soft);
}

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

#why { background: var(--bg-why); }
#services { background: var(--bg-services); }
#about { background: var(--bg-about); }

.section h2 {
  font-size: clamp(26px, 3.4vw, 38px);
  max-width: 640px;
}

.section-lead {
  max-width: 680px;
  font-size: 16px;
}

.why .callout {
  background: var(--paper-alt);
  border-left: 3px solid var(--accent);
  padding: 18px 24px;
  margin: 24px 0;
  font-size: 15px;
  border-radius: var(--radius);
}

/* Services */
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 40px;
}

.service-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  background: var(--paper);
}

.service-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
}

.service-card ul {
  padding-left: 18px;
  margin: 16px 0 0;
}

.service-card li {
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.service-card li strong { color: var(--ink); }

.service-note {
  margin-top: 16px;
  font-style: italic;
  font-family: var(--serif);
  font-size: 14.5px;
}

.skills-band {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.skills-band h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.skills-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 32px;
}

.skills-list li {
  font-size: 14.5px;
  padding-left: 16px;
  position: relative;
}

.skills-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

/* About */
.about-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-soft);
}

.about-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

.about-columns h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.plain-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.plain-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
}

.plain-list li:first-child { border-top: none; }

.plain-list span {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* Contact */
.contact {
  border-bottom: none;
  background: var(--bg-contact);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.contact-list a {
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
}

.contact-list a:hover { color: var(--accent-dark); }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 32px;
  border-radius: var(--radius);
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.contact-form input,
.contact-form textarea {
  font-family: var(--sans);
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.form-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
  min-height: 18px;
}

/* Footer */
.site-footer {
  background: var(--bg-footer);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Responsive */
@media (max-width: 860px) {
  .service-grid,
  .about-columns,
  .contact-grid {
    grid-template-columns: 1fr;
  }
  .skills-list { grid-template-columns: 1fr; }
  .strip-inner { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 18px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .hero-rings,
  .hero-canvas,
  .hero-terminal,
  .hero-reticle,
  .hero-scanline-v {
    display: none;
  }
  .hero-inner { padding: 64px 24px 56px; }
}
