/* MadX — services one-pager */

:root {
  --navy: #171b26;
  --navy-2: #222534;
  --ink: #e8eaf0;
  --muted: #a3aab8;
  --accent: #48b1df;
  --accent-2: #2c8cb3;
  --card: #ffffff;
  --paper: #f5f6f8;
  --text: #262a33;
  --max: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--paper);
  line-height: 1.6;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.narrow { max-width: 760px; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(23, 27, 38, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand img { display: block; }

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.nav-list a:hover,
.nav-list a:focus { color: var(--accent); }

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(72, 177, 223, 0.045) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(72, 177, 223, 0.045) 1px, transparent 1px) 0 0 / 44px 44px,
    radial-gradient(ellipse at 30% 20%, rgba(72, 177, 223, 0.18), transparent 55%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  color: var(--ink);
  text-align: center;
  padding: 6rem 0 6.5rem;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

.hero::before {
  background: var(--accent);
  opacity: 0.28;
  top: -140px;
  left: -100px;
}

.hero::after {
  background: #5b7cfa;
  opacity: 0.16;
  bottom: -180px;
  right: -120px;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero-net {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-term {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  margin: 0 0 1.25rem;
}

.term-stack {
  position: relative;
  display: inline-block;
  text-align: left;
  height: 1.5em;
  max-width: 100%;
  min-width: min(calc(32ch + 4px), 100%);
  vertical-align: bottom;
}

.term-line {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
  max-width: 100%;
  letter-spacing: 0;
  border-right: 2px solid var(--accent);
  padding-right: 2px;
  visibility: hidden;
}

/* Static fallback (reduced motion / no animation): show first phrase only */
.term-line:first-child { visibility: visible; }

.term-line:nth-child(1) { --w: calc(26ch + 4px); }
.term-line:nth-child(2) { --w: calc(25ch + 4px); }
.term-line:nth-child(3) { --w: calc(31ch + 4px); }
.term-line:nth-child(4) { --w: calc(32ch + 4px); }

.hero-mark {
  width: min(240px, 50vw);
  height: auto;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 auto 1rem;
  max-width: 26ch;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0) 44%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 56%) 200% 0 / 250% 100% no-repeat,
    linear-gradient(105deg, #fff 38%, var(--accent) 72%, #d9f0fb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 60ch;
  margin: 0 auto 2rem;
}

.btn {
  display: inline-block;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 0.8rem 1.8rem;
  border-radius: 6px;
  transition: filter 200ms ease, transform 200ms ease;
}

.btn:hover,
.btn:focus { filter: brightness(1.1); transform: translateY(-1px); }

/* Track record strip */

.proof {
  background: var(--navy);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.75rem 0;
}

.proof-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}

.proof-list strong {
  display: block;
  color: var(--accent);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.proof-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Sections */

.section { padding: 4.5rem 0; }

.section-alt { background: var(--navy-2); color: var(--ink); }

.section h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 0 0 0.5rem;
}

/* Prose pages (privacy) */

.section h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  margin: 0 0 0.5rem;
}

.narrow h2 { margin-top: 2.25rem; font-size: 1.3rem; }

.narrow a { color: var(--accent-2); }

.narrow h3 { margin-top: 2.25rem; font-size: 1.15rem; }

/* Leadership */

.leader-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

.leader-grid p:first-child { margin-top: 0; }

.leader-photo {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

@media (max-width: 640px) {
  .leader-grid { grid-template-columns: 1fr; }
  .leader-photo { max-width: 220px; }
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.link-row a {
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
  text-decoration: none;
}

.link-row a:hover,
.link-row a:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.06); }

.pub-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.pub-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pub-list li:last-child { border-bottom: none; }

.pub-list span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.section-lead {
  color: inherit;
  opacity: 0.8;
  max-width: 70ch;
  margin: 0 0 2.5rem;
}

/* Service cards */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 700px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--card);
  border: 1px solid #e2e5ea;
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(23, 27, 38, 0.06);
}

.card h3 { margin: 0 0 0.6rem; font-size: 1.15rem; }

.card p { margin: 0; color: #4a4f5a; font-size: 0.97rem; }

/* Capabilities */

.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 0;
}

.cred {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.cred dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.cred dd { margin: 0; font-weight: 600; }

.cred dd a { color: var(--ink); }

/* Contact */

.contact-block { font-style: normal; margin-top: 1rem; }

.contact-block p { margin-top: 1.5rem; }

.section-alt a { color: var(--accent); }

.section-alt a.btn,
a.btn { color: #fff; }

/* Footer */

.site-footer {
  background: var(--navy);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem 0;
}

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

.site-footer a { color: var(--accent); text-decoration: none; }

.site-footer a:hover { text-decoration: underline; }

.social {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Small screens */

@media (max-width: 640px) {
  .hero { padding: 4rem 0; }
  .section { padding: 3rem 0; }
  .header-inner { flex-direction: column; gap: 0.5rem; }

  /* Keep all five nav links on one row; scroll silently if it ever overflows */
  .header-inner nav {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .header-inner nav::-webkit-scrollbar { display: none; }

  .nav-list {
    flex-wrap: nowrap;
    gap: 0.75rem;
  }

  .nav-list a {
    font-size: 0.8rem;
    letter-spacing: 0;
    white-space: nowrap;
  }
}

/* ============================================================
   Polish & motion — pure CSS, no JavaScript.
   Everything animated sits behind prefers-reduced-motion; scroll
   reveals additionally sit behind @supports so unsupported
   browsers render content normally.
   ============================================================ */

::selection { background: var(--accent); color: #fff; }

main section[id] { scroll-margin-top: 4.5rem; }

/* Section heading accent bars (main page only) */

:where(#services, #capabilities, #about, #leadership, #contact) h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Nav underline slide */

.nav-list a {
  position: relative;
  padding-bottom: 4px;
}

.nav-list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms ease;
}

.nav-list a:hover::after,
.nav-list a:focus::after { transform: scaleX(1); }

/* Hover micro-interactions */

.card {
  transition: transform 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
}

.card:hover {
  transform: perspective(900px) rotateX(1.5deg) translateY(-7px) scale(1.02);
  border-color: var(--accent);
  box-shadow:
    0 24px 48px rgba(23, 27, 38, 0.22),
    0 8px 18px rgba(23, 27, 38, 0.12),
    0 0 0 1px rgba(72, 177, 223, 0.35),
    0 0 24px rgba(72, 177, 223, 0.18);
}

.cred {
  transition: border-color 250ms ease, background 250ms ease, transform 250ms ease;
}

.cred:hover {
  border-color: rgba(72, 177, 223, 0.55);
  background: rgba(72, 177, 223, 0.1);
  transform: perspective(700px) rotateX(1.5deg) translateY(-4px) scale(1.02);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(72, 177, 223, 0.15);
}

.btn { box-shadow: 0 4px 14px rgba(72, 177, 223, 0.35); }

.btn:hover,
.btn:focus { box-shadow: 0 6px 22px rgba(72, 177, 223, 0.55); }

.leader-photo {
  transition: transform 300ms ease, box-shadow 300ms ease;
}

.leader-photo:hover {
  transform: scale(1.03) rotate(-1deg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.pub-list a { text-decoration-color: transparent; transition: text-decoration-color 200ms ease; }

.pub-list a:hover,
.pub-list a:focus { text-decoration-color: currentColor; }

/* Proof strip shimmer line */

.proof { position: relative; }

.proof::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 20%, var(--accent) 50%, transparent 80%);
  background-size: 200% 100%;
  opacity: 0.7;
}

/* Motion (opt-out respected) */

@media (prefers-reduced-motion: no-preference) {

  /* Hero entrance choreography */
  .hero-mark,
  .hero-term,
  .hero h1,
  .hero-sub,
  .hero .btn {
    animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .hero-term { animation-delay: 150ms; }
  .hero h1 { animation-delay: 250ms; }
  .hero-sub { animation-delay: 400ms; }
  .hero .btn { animation-delay: 550ms; }

  /* Rotating typed terminal phrases: each owns a 4s slot of a 16s cycle */
  .term-line {
    width: 0;
    animation:
      term-cycle 16s linear infinite,
      caret 900ms step-end infinite;
  }

  .term-line:nth-child(1) { animation-timing-function: steps(26), step-end; animation-delay: 900ms, 0s; }
  .term-line:nth-child(2) { animation-timing-function: steps(25), step-end; animation-delay: 4.9s, 0s; }
  .term-line:nth-child(3) { animation-timing-function: steps(31), step-end; animation-delay: 8.9s, 0s; }
  .term-line:nth-child(4) { animation-timing-function: steps(32), step-end; animation-delay: 12.9s, 0s; }

  /* Hero background life: grid drift, orbs, headline sheen sweep */
  .hero { animation: grid-pan 14s linear infinite; }

  .hero h1 {
    animation:
      rise 700ms cubic-bezier(0.22, 1, 0.36, 1) 250ms both,
      sheen 9s linear 3s infinite;
  }

  .hero::before { animation: drift 14s ease-in-out infinite alternate; }
  .hero::after { animation: drift 18s ease-in-out infinite alternate-reverse; }

  /* Proof strip shimmer sweep */
  .proof::before { animation: shimmer 6s linear infinite; }

  /* Scroll-driven reveals */
  @supports (animation-timeline: view()) {
    .card,
    .cred,
    .pub-list li,
    .proof-list li,
    .leader-grid {
      animation: rise-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(40px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes term-cycle {
  0% { width: 0; visibility: visible; }
  12%, 21% { width: var(--w); visibility: visible; }
  25% { width: 0; visibility: visible; }
  25.02%, 100% { width: 0; visibility: hidden; }
}

@keyframes caret {
  50% { border-color: transparent; }
}

@keyframes drift {
  to { transform: translate3d(90px, 55px, 0) scale(1.22); }
}

@keyframes grid-pan {
  to { background-position: 44px 44px, 44px 44px, 0 0, 0 0; }
}

@keyframes sheen {
  from { background-position: 250% 0, 0 0; }
  to { background-position: -150% 0, 0 0; }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
