/* Algoritika — static site */
:root {
  --navy: #0b2147;
  --navy-dark: #071630;
  --magenta: #c11b6c;
  --magenta-hover: #a01658;
  --magenta-light: rgba(193, 27, 108, 0.08);
  --white: #ffffff;
  --bg: #f8f9fb;
  --bg-alt: #eef1f6;
  --text: #1a2b4a;
  --text-muted: #5a6b85;
  --border: #d8dee8;
  --border-light: #e8ecf2;
  --radius: 6px;
  --radius-lg: 10px;
  --max-width: 1280px;
  --header-height: 72px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--magenta); text-decoration: none; }
a:hover { color: var(--magenta-hover); }
h1, h2, h3 { color: var(--navy); line-height: 1.25; margin: 0 0 0.75em; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 4rem 0; }
.section-alt { background: var(--bg); }
.skip-link {
  position: absolute; top: -100%; left: 1rem; z-index: 200;
  padding: 0.5rem 1rem; background: var(--navy); color: var(--white); border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  transition: background 0.3s, box-shadow 0.3s, height 0.3s;
}
.site-header.solid {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(11,33,71,0.06);
}
.site-header.hero-mode {
  background: transparent;
  border-bottom: 1px solid transparent;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-height); gap: 1.5rem;
}
.logo img { height: 28px; width: auto; }
.logo img.inverted { filter: brightness(0) invert(1); }
.main-nav ul { display: flex; gap: 0.25rem; }
.main-nav a {
  padding: 0.5rem 0.875rem; font-size: 0.9375rem; font-weight: 500;
  border-radius: var(--radius); transition: color 0.15s, background 0.15s;
}
.site-header.solid .main-nav a { color: var(--navy); }
.site-header.solid .main-nav a:hover,
.site-header.solid .main-nav a[aria-current="page"] { color: var(--magenta); background: var(--magenta-light); }
.site-header.hero-mode .main-nav a { color: rgba(255,255,255,0.9); }
.site-header.hero-mode .main-nav a:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; cursor: pointer; }
.site-header.hero-mode .nav-toggle { border-color: rgba(255,255,255,0.3); color: white; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.75rem 1.5rem; font-size: 0.9375rem; font-weight: 600;
  border-radius: var(--radius); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: all 0.15s;
}
.btn-primary { background: var(--magenta); color: var(--white); border-color: var(--magenta); }
.btn-primary:hover { background: var(--magenta-hover); border-color: var(--magenta-hover); color: var(--white); }
.btn-secondary { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--navy); background: var(--bg); color: var(--navy); }
.btn-secondary-light { color: var(--white); border-color: rgba(255,255,255,0.3); }
.btn-secondary-light:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.6); color: var(--white); }

/* Hero — Opus / Stripe-inspired editorial */
.hero {
  --scroll-progress: 0;
  --stack-step: 0;
  background: var(--navy-dark);
  color: var(--white);
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--header-height) + 3rem);
}
.hero-glow {
  position: absolute;
  top: -30%;
  right: -15%;
  width: min(70vw, 720px);
  height: min(70vw, 720px);
  background: radial-gradient(circle, rgba(193, 27, 108, 0.14) 0%, transparent 68%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 44rem;
  padding-bottom: 3rem;
  will-change: transform, opacity;
  transform: translateY(calc(var(--scroll-progress) * -24px));
  opacity: calc(1 - var(--scroll-progress) * 0.35);
}
.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(193, 27, 108, 0.12);
  border: 1px solid rgba(193, 27, 108, 0.28);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  margin-bottom: 1.25rem;
}
.hero h1 {
  color: var(--white);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}
.hero-accent {
  background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.72) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead {
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(1.0625rem, 2vw, 1.1875rem);
  line-height: 1.65;
  max-width: 38rem;
  margin-bottom: 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Platform stack strip */
.hero-stack {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  padding: 1.25rem 0;
}
.hero-stack .container {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.hero-stack .container::-webkit-scrollbar { display: none; }
.hero-stack-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: fit-content;
  max-width: 100%;
}
.hero-stack-item {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  transition: color 0.35s, background 0.35s, box-shadow 0.35s;
}
.hero-stack-item.is-active {
  color: var(--white);
  background: rgba(193, 27, 108, 0.18);
  box-shadow: 0 0 0 1px rgba(193, 27, 108, 0.35);
}
.hero-stack-line {
  flex-shrink: 0;
  width: 2rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(193,27,108,0.45), rgba(255,255,255,0.08));
  opacity: 0.3;
  transition: opacity 0.35s;
}
.hero-stack-line.is-lit { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .hero-inner { transform: none !important; opacity: 1 !important; }
  .hero-stack-item { transition: none; }
  .delivery-line-fill { transform: none !important; }
}

/* Section headings */
.section-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--magenta); margin-bottom: 0.75rem; display: block; }
.section h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-bottom: 1rem; }
.section-intro { color: var(--text-muted); font-size: 1.0625rem; max-width: 42rem; margin-bottom: 2.5rem; }

#capabilities,
#work,
#how-we-work { scroll-margin-top: calc(var(--header-height) + 1.5rem); }

/* Capabilities grid */
.capabilities-section { background: var(--bg); }
.capabilities-header { max-width: 40rem; margin-bottom: 2.5rem; }
.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
}
.cap-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.cap-card:hover {
  border-color: rgba(193, 27, 108, 0.35);
  box-shadow: 0 8px 32px rgba(11, 33, 71, 0.08);
  transform: translateY(-2px);
}
.cap-card h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}
.cap-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}
.cap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.cap-tags span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--navy);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag { padding: 0.35rem 0.85rem; font-size: 0.875rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }

/* System flow */
.flow-progress { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.flow-step-btn {
  padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600;
  border-radius: 999px; border: none; cursor: pointer; transition: all 0.15s;
  background: var(--bg); color: var(--text-muted);
}
.flow-step-btn.active { background: var(--magenta); color: var(--white); }
.flow-step-btn.done { background: var(--navy); color: rgba(255,255,255,0.7); }
.flow-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.flow-card {
  padding: 1.25rem; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); opacity: 0.4; transition: all 0.3s;
}
.flow-card.active { opacity: 1; border-color: var(--magenta); box-shadow: 0 4px 20px rgba(11,33,71,0.08); transform: scale(1.02); }
.flow-card.done { opacity: 0.7; }
.flow-card h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.flow-card li { font-size: 0.875rem; color: var(--text-muted); padding-left: 1rem; position: relative; margin-bottom: 0.35rem; }
.flow-card li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 5px; height: 5px; border-radius: 50%; background: var(--magenta); }

/* Delivery timeline — scroll-drawn line (Next.js parity) */
.delivery-timeline-h {
  display: none;
  position: relative;
  margin-top: 0.5rem;
}
.delivery-line-track {
  position: absolute;
  top: 2rem;
  left: 0;
  right: 0;
  height: 2px;
  pointer-events: none;
}
.delivery-line-bg {
  position: absolute;
  inset: 0;
  background: var(--border);
}
.delivery-line-fill {
  position: absolute;
  inset: 0;
  background: var(--magenta);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}
.delivery-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}
.delivery-step {
  position: relative;
  padding-top: 3rem;
}
.delivery-dot {
  position: absolute;
  top: calc(2rem - 7px);
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border);
  box-shadow: 0 0 0 2px var(--bg);
  z-index: 1;
  transition: border-color 0.2s, background 0.2s;
}
.delivery-step.is-reached .delivery-dot {
  background: var(--magenta);
  border-color: var(--magenta);
}
.delivery-step h3 {
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.delivery-step li {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  padding-left: 0;
}
.delivery-step li::before { display: none; }

.delivery-timeline-v {
  display: block;
  position: relative;
  margin-top: 0.5rem;
  padding-left: 1.75rem;
}
.delivery-v-track {
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  pointer-events: none;
}
.delivery-v-track .delivery-line-bg {
  position: absolute;
  inset: 0;
  background: var(--border);
}
.delivery-line-fill-v {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleY(0);
  transform-origin: top center;
}
.delivery-v-steps { position: relative; z-index: 1; }
.delivery-timeline-v .delivery-step {
  display: flex;
  gap: 1rem;
  padding-top: 0;
  margin-bottom: 1.75rem;
}
.delivery-timeline-v .delivery-step:last-child { margin-bottom: 0; }
.delivery-timeline-v .delivery-dot {
  position: relative;
  top: auto;
  left: auto;
  flex-shrink: 0;
  margin-left: -1.75rem;
  margin-top: 0.15rem;
}

@media (min-width: 1024px) {
  .delivery-timeline-h { display: block; }
  .delivery-timeline-v { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .delivery-line-fill-v { transform: none !important; }
}

/* Engagements 2x2 */
.engagement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.engagement-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.engagement-toggle {
  width: 100%; text-align: left; padding: 1.25rem; background: none; border: none;
  cursor: pointer; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  font-weight: 700; color: var(--navy); font-size: 1rem; font-family: var(--font);
}
.engagement-toggle:hover { background: var(--bg); }
.engagement-toggle .icon { color: var(--magenta); font-size: 1.25rem; flex-shrink: 0; }
.engagement-body { display: none; padding: 0 1.25rem 1.25rem; border-top: 1px solid var(--border-light); }
.engagement-card.open .engagement-body { display: block; }
.engagement-body p { color: var(--text-muted); font-size: 0.9375rem; margin-top: 1rem; }
.engagement-body h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--magenta); margin: 1rem 0 0.5rem; }
.engagement-body li { font-size: 0.875rem; color: var(--text-muted); padding-left: 1rem; position: relative; margin-bottom: 0.3rem; }
.engagement-body li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 5px; height: 5px; border-radius: 50%; background: var(--magenta); }

/* Qualification */
.qual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.qual-list li { display: flex; gap: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; font-size: 0.9375rem; }
.qual-list li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--magenta); flex-shrink: 0; margin-top: 0.55em; }
.qual-negative { padding: 1.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.qual-negative h3 { font-size: 1.125rem; margin-bottom: 1rem; }
.qual-negative li { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; padding-left: 1rem; position: relative; }
.qual-negative li::before { content: "—"; position: absolute; left: 0; }

/* Why */
.why-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2.5rem; }
.why-card { padding: 1.25rem; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.why-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.why-card p { font-size: 0.875rem; color: var(--text-muted); margin: 0; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.compare-table th, .compare-table td { padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.compare-table thead { background: var(--bg-alt); }
.compare-table th { font-weight: 600; color: var(--navy); }
.compare-table td { color: var(--text-muted); }

/* CTA band */
.cta-band { background: var(--navy-dark); color: var(--white); padding: 4rem 0; text-align: center; }
.cta-band h2 { color: var(--white); margin-bottom: 1rem; }
.cta-band p { color: rgba(255,255,255,0.7); max-width: 36rem; margin: 0 auto 0.75rem; }
.cta-band .fine { font-size: 0.875rem; color: rgba(255,255,255,0.5); margin-bottom: 2rem; }

/* Page hero (inner) */
.page-hero { padding: calc(var(--header-height) + 3rem) 0 2rem; background: var(--bg); border-bottom: 1px solid var(--border-light); }
.page-hero h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
.page-hero p { color: var(--text-muted); font-size: 1.125rem; max-width: 42rem; }

/* Form */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--navy); margin-bottom: 0.4rem; }
input, select, textarea {
  width: 100%; padding: 0.75rem 1rem; font-family: var(--font); font-size: 0.9375rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-light); }
textarea { min-height: 120px; resize: vertical; }
.form-success { display: none; padding: 1.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.form-success.visible { display: block; }
.form-error {
  display: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: rgba(193, 27, 108, 0.06);
  border: 1px solid rgba(193, 27, 108, 0.25);
  border-radius: var(--radius-lg);
  color: var(--navy);
  font-size: 0.9375rem;
}
.form-error.visible { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.contact-layout { display: grid; grid-template-columns: 1fr 1.4fr; gap: 3rem; }

/* Footer */
.site-footer { background: var(--navy-dark); color: rgba(255,255,255,0.7); padding: 3rem 0 2rem; font-size: 0.9375rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-logo { display: inline-block; }
.footer-logo img { height: 28px; width: auto; filter: brightness(0) invert(1); }
.footer-nav h4, .footer-connect h4 { color: var(--white); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem; }
.footer-nav a, .footer-connect a { color: rgba(255,255,255,0.65); font-size: 0.9375rem; display: block; padding: 0.25rem 0; }
.footer-nav a:hover, .footer-connect a:hover { color: var(--white); }
.footer-bottom { padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; font-size: 0.8125rem; color: rgba(255,255,255,0.45); }
.footer-bottom a { color: rgba(255,255,255,0.45); }

/* Mobile menu */
.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: var(--navy-dark); padding: 5rem 2rem 2rem;
}
.mobile-menu.open { display: flex; flex-direction: column; gap: 0.5rem; }
.mobile-menu a { color: var(--white); font-size: 1.5rem; font-weight: 600; padding: 0.75rem 0; }
.mobile-menu a:hover { color: var(--magenta); }

/* Work / case study */
.case-study { padding: 2rem; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 2rem; }
.case-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--magenta); }
.case-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; }
.case-field h4 { font-size: 0.8125rem; color: var(--navy); margin-bottom: 0.35rem; }
.case-field p { font-size: 0.9375rem; color: var(--text-muted); margin: 0; }

/* Build block (capabilities page) */
.build-block { padding: 2rem 0; border-bottom: 1px solid var(--border-light); }
.build-block:last-child { border-bottom: none; }

/* Responsive */
@media (max-width: 1024px) {
  .flow-cards { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr 1fr; }
  .qual-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .hero { padding-top: calc(var(--header-height) + 2rem); }
  .hero-inner { padding-bottom: 2rem; }
  .main-nav, .header-cta { display: none; }
  .nav-toggle { display: flex; }
  .engagement-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
