/* ============================================================
   BITFIELD SYSTEMS — Design tokens
   Blueprint / technical-drafting aesthetic for an infrastructure
   & platform engineering consultancy.
   ============================================================ */

:root {
  --paper: #F5F6F7;
  --paper-raised: #FFFFFF;
  --ink: #101820;
  --ink-soft: #4A5560;
  --blueprint: #1D4E89;
  --blueprint-deep: #14385F;
  --amber: #E8A33D;
  --line: #C7CDD4;
  --line-strong: #9AA4AD;
  --uptime: #3F8F5F;

  --font-sans: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --max-width: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --radius: 2px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12161A;
    --paper-raised: #191F25;
    --ink: #EDEFF1;
    --ink-soft: #B7C0C7;
    --blueprint: #6FA0D8;
    --blueprint-deep: #8FB8E8;
    --amber: #F0B75A;
    --line: #333B42;
    --line-strong: #4A545C;
    --uptime: #5FBF85;
  }
}

:root[data-theme="dark"] {
  --paper: #12161A;
  --paper-raised: #191F25;
  --ink: #EDEFF1;
  --ink-soft: #B7C0C7;
  --blueprint: #6FA0D8;
  --blueprint-deep: #8FB8E8;
  --amber: #F0B75A;
  --line: #333B42;
  --line-strong: #4A545C;
  --uptime: #5FBF85;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 0.5em 0;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 650; }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em 0; max-width: 62ch; color: var(--ink-soft); }

a { color: var(--blueprint); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blueprint);
  outline-offset: 3px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

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

/* ---------- Header / nav ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--gutter);
  max-width: var(--max-width);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 650;
  font-size: 1.15rem;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  width: 1.4rem;
  height: 1.4rem;
}

.brand-mark svg { width: 100%; height: 100%; display: block; }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 2px solid var(--blueprint);
  padding-bottom: 4px;
}

.nav-cta {
  border: 1px solid var(--ink);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink) !important;
  text-decoration: none !important;
}

.nav-cta:hover { background: var(--ink); color: var(--paper) !important; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--ink);
}

/* ---------- Services dropdown ---------- */

.nav-dropdown { position: relative; }

.dropdown-toggle {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
}

.dropdown-toggle:hover,
.dropdown-toggle[aria-expanded="true"],
.dropdown-toggle.current-section { color: var(--ink); }

.dropdown-caret { width: 9px; height: 9px; flex: none; transition: transform .15s ease; }
.dropdown-toggle[aria-expanded="true"] .dropdown-caret { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  min-width: 232px;
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 60;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu,
.dropdown-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dropdown-menu li { border-top: none !important; }

.dropdown-menu a {
  display: block;
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-radius: 2px;
}

.dropdown-menu a:hover { background: var(--paper); color: var(--ink); text-decoration: none; }
.dropdown-menu a[aria-current="page"] { color: var(--blueprint); }

.dropdown-divider { height: 1px; background: var(--line); margin: 0.35rem 0.2rem; }

@media (max-width: 760px) {
  .dropdown-toggle { width: 100%; justify-content: space-between; padding: 0.9rem var(--gutter); }
  .dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    border: none;
    background: var(--paper);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .2s ease;
  }
  .dropdown-menu.open { max-height: 260px; padding-bottom: 0.4rem; }
  .dropdown-menu a { padding: 0.65rem var(--gutter) 0.65rem calc(var(--gutter) + 1.1rem); }
  .dropdown-divider { display: none; }
}

@media (max-width: 760px) {
  .nav-links { position: fixed; inset: 64px 0 auto 0; background: var(--paper-raised);
    flex-direction: column; gap: 0; padding: 0.5rem 0; border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
  .nav-links.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-links li { border-top: 1px solid var(--line); }
  .nav-links a { display: block; padding: 0.9rem var(--gutter); }
  .nav-cta { margin: 0.9rem var(--gutter); display: block; text-align: center; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Drafting corner marks (structural, used only on schematic panels) ---------- */

.plate {
  position: relative;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 2rem;
}

.plate::before,
.plate::after,
.plate .corner-tl,
.plate .corner-br {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--blueprint);
  border-style: solid;
}

.plate::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.plate::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ---------- Hero ---------- */

.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

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

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--blueprint);
  margin-bottom: 1.2rem;
}

.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--uptime);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--uptime) 20%, transparent);
}

.hero h1 { color: var(--ink); max-width: 14ch; }
.hero .lede { font-size: 1.15rem; max-width: 46ch; }

.hero-actions { display: flex; gap: 1rem; margin-top: 1.8rem; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary { background: var(--blueprint); color: #fff !important; }
.btn-primary:hover { background: var(--blueprint-deep); }

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

.hero-diagram { width: 100%; height: auto; }

/* ---------- Stat strip ---------- */

.stat-strip {
  border-bottom: 1px solid var(--line);
  padding: 1.8rem 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  border-left: 1px solid var(--line);
  padding-left: 1.1rem;
}

.stat .num {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
}

.stat .label { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Sections ---------- */

section.block { padding: clamp(3rem, 7vw, 5.5rem) 0; }
section.block.divider { border-bottom: 1px solid var(--line); }
section.block.alt { background: var(--paper-raised); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head { max-width: 56ch; margin-bottom: 2.8rem; }
.section-head h2 { color: var(--ink); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

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

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

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

.pillar h3 { display: flex; align-items: baseline; gap: 0.6rem; color: var(--ink); }
.pillar .tag { font-family: var(--font-mono); font-size: 0.75rem; color: var(--blueprint); }

.service-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 2.2rem 0;
  border-top: 1px solid var(--line);
  align-items: start;
}

.service-row:last-child { border-bottom: 1px solid var(--line); }

@media (max-width: 760px) { .service-row { grid-template-columns: 1fr; gap: 0.6rem; } }

.service-row h3 { color: var(--ink); margin: 0; }
.service-row .index { font-family: var(--font-mono); font-size: 0.8rem; color: var(--blueprint); }

.service-list { list-style: none; padding: 0; margin: 0.9rem 0 0; }
.service-list li {
  padding-left: 1.1rem;
  position: relative;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.service-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em;
  width: 6px; height: 1px;
  background: var(--blueprint);
}

.quote-plate {
  padding: 2.5rem;
  border-left: 3px solid var(--amber);
  background: var(--paper-raised);
}

.quote-plate p { font-size: 1.15rem; color: var(--ink); max-width: none; }
.quote-plate .attr { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); }

.principle {
  border-top: 1px solid var(--line);
  padding: 1.6rem 0;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1.2rem;
}
.principle:last-child { border-bottom: 1px solid var(--line); }
.principle .n { font-family: var(--font-mono); color: var(--blueprint); font-size: 0.9rem; }
.principle h3 { color: var(--ink); margin-bottom: 0.3rem; }

/* ---------- CTA band ---------- */

.cta-band {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(3rem, 6vw, 4.5rem) 0;
}

.cta-band h2 { color: var(--paper); max-width: 20ch; }
.cta-band p { color: #C9CFD4; }
.cta-band .btn-primary { background: var(--amber); color: var(--ink) !important; }
.cta-band .btn-primary:hover { background: #f0b75a; }
.cta-band .btn-ghost { border-color: var(--paper); color: var(--paper) !important; }
.cta-band .btn-ghost:hover { background: var(--paper); color: var(--ink) !important; }

/* ---------- Forms ---------- */

.form-plate { max-width: 640px; }

.field { margin-bottom: 1.4rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
.field textarea { resize: vertical; min-height: 120px; }

.contact-info {
  display: grid;
  gap: 1.6rem;
}
.contact-info .item h3 { font-size: 0.95rem; color: var(--ink); margin-bottom: 0.3rem; }
.contact-info .item p { margin: 0; font-size: 0.92rem; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-grid nav { display: flex; gap: 1.5rem; }
.footer-grid nav a { color: var(--ink-soft); font-size: 0.9rem; }
.footer-note { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); }

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