/* ============================================================
   TillScale AI — Concept 1 “Enterprise”
   Swiss-precision light theme · ink navy · electric blue
   ============================================================ */

:root {
  --paper: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #0B1220;
  --ink-soft: #2A3342;
  --muted: #5A6472;
  --hairline: #E4E2D9;
  --accent: #2E5BFF;
  --accent-ink: #1E3FC0;
  --accent-soft: #EBF0FF;
  --dark: #0B1220;
  --dark-soft: #131C2E;
  --radius: 14px;
  --font-display: "Inter Tight", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 450;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

.visually-hidden,
.skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 8px; text-decoration: none;
}

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

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; }

h2 {
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: 650;
  line-height: 1.08;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 18px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 22px; height: 1px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 10px;
}
.eyebrow.light { color: #8FA6FF; }
.eyebrow.light::before { background: #8FA6FF; }

.section { padding: 110px 0; }
.section-head { max-width: 720px; margin-bottom: 64px; }
.section-lede { margin-top: 20px; font-size: 19px; color: var(--muted); }
.section-lede strong { color: var(--ink); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 600;
  padding: 15px 28px;
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), background 0.2s;
  will-change: transform;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(11, 18, 32, 0.12), 0 8px 24px -8px rgba(46, 91, 255, 0.5);
}
.btn-primary:hover {
  background: var(--accent-ink);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(11, 18, 32, 0.12), 0 14px 32px -8px rgba(46, 91, 255, 0.55);
}

.btn-ghost { color: var(--ink); padding: 15px 10px; }
.btn-ghost .arrow { transition: transform 0.3s var(--ease-out); display: inline-block; }
.btn-ghost:hover .arrow { transform: translateX(5px); }

.btn-light {
  background: #fff; color: var(--ink);
  box-shadow: 0 8px 30px -10px rgba(0, 0, 0, 0.5);
}
.btn-light:hover { transform: translateY(-2px); background: #F2F5FF; }

.btn-sm { padding: 11px 20px; font-size: 15px; }

:is(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(250, 250, 247, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
.nav.scrolled { border-bottom-color: var(--hairline); background: rgba(250, 250, 247, 0.92); }

.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
  height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; }
.brand-name { font-family: var(--font-display); font-weight: 650; font-size: 18px; letter-spacing: -0.01em; }
.brand-ai { color: var(--accent); }

.nav-links { display: flex; gap: 34px; }
.nav-links a {
  font-size: 15px; font-weight: 500; color: var(--ink-soft);
  text-decoration: none; position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1.5px; background: var(--accent);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

.nav-cta-group { display: flex; align-items: center; gap: 14px; }

.nav-toggle {
  display: none;
  background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px;
  flex-direction: column; justify-content: center; align-items: center; gap: 6px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); transition: transform 0.3s, opacity 0.3s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

.mobile-menu {
  display: none;
  flex-direction: column; gap: 4px;
  padding: 12px 28px 28px;
  border-bottom: 1px solid var(--hairline);
}
.mobile-menu a {
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: 20px;
  padding: 12px 0;
}
.mobile-menu .btn { justify-content: center; margin-top: 12px; }
.mobile-menu.open { display: flex; }

/* ---------- Hero ---------- */
.hero { padding: 168px 0 90px; position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(700px 420px at 85% 8%, rgba(46, 91, 255, 0.07), transparent 65%),
    linear-gradient(var(--hairline) 1px, transparent 1px) 0 0 / 100% 96px,
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px) 0 0 / 96px 100%;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 75%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}

.hero-h1 {
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.hero-h1 em { font-style: normal; color: var(--accent); position: relative; }

.hero-sub { margin-top: 26px; font-size: 19px; color: var(--muted); max-width: 520px; }

.hero-actions { margin-top: 38px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-actions.center { justify-content: center; }

.hero-note { margin-top: 18px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }

/* Hero diagram */
.hero-diagram { position: relative; }
.hero-diagram svg { width: 100%; height: auto; display: block; }

.dg-label { font: 600 13px var(--font-display); fill: var(--ink); letter-spacing: -0.01em; }
.dg-sub { font: 400 10.5px var(--font-mono); fill: var(--muted); }
.dg-sub.blue { fill: var(--accent-ink); }
.dg-engine-label { font: 500 11px var(--font-mono); fill: #A9B8E8; letter-spacing: 0.2em; }
.dg-engine-label.b { fill: #fff; }

.dg-node rect { filter: drop-shadow(0 2px 8px rgba(11, 18, 32, 0.05)); }

.engine-pulse { animation: enginePulse 3s ease-in-out infinite; }
@keyframes enginePulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.9; }
}

.engine-dots circle { animation: dotBlink 1.6s ease-in-out infinite; }
.engine-dots circle:nth-child(2) { animation-delay: 0.25s; }
.engine-dots circle:nth-child(3) { animation-delay: 0.5s; }
@keyframes dotBlink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.flow { stroke-dashoffset: 0; animation: flowDash 2.6s linear infinite; }
@keyframes flowDash { to { stroke-dashoffset: -40; } }

.packet { opacity: 0; }
.p1 { animation: packet1 4.2s var(--ease-out) infinite; }
.p2 { animation: packet2 4.2s var(--ease-out) infinite 1.4s; }
.p3 { animation: packet3 4.2s var(--ease-out) infinite 2.8s; }
@keyframes packet1 {
  0% { opacity: 0; transform: translate(96px, 96px); }
  8% { opacity: 1; }
  38% { opacity: 1; transform: translate(258px, 224px); }
  46% { opacity: 0; transform: translate(268px, 226px); }
  100% { opacity: 0; transform: translate(268px, 226px); }
}
@keyframes packet2 {
  0% { opacity: 0; transform: translate(96px, 230px); }
  8% { opacity: 1; }
  38% { opacity: 1; transform: translate(252px, 229px); }
  46% { opacity: 0; }
  100% { opacity: 0; transform: translate(252px, 229px); }
}
@keyframes packet3 {
  0% { opacity: 0; transform: translate(312px, 232px); }
  8% { opacity: 1; }
  38% { opacity: 1; transform: translate(430px, 326px); }
  46% { opacity: 0; }
  100% { opacity: 0; transform: translate(430px, 326px); }
}

/* Metrics strip */
.metrics-strip {
  margin-top: 84px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline);
}
.metric { padding: 28px 24px 6px 0; }
.metric + .metric { border-left: 1px solid var(--hairline); padding-left: 24px; }
.metric dt {
  font-family: var(--font-mono); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); order: 2;
}
.metric dd {
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 650; letter-spacing: -0.02em;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.metric { display: flex; flex-direction: column-reverse; }

/* ---------- Trust ---------- */
.trust { padding: 44px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); background: var(--surface); }
.trust .container { display: flex; align-items: center; gap: 40px; flex-wrap: wrap; }
.trust-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); flex-shrink: 0; }
.trust-logos {
  display: flex; gap: 38px; flex-wrap: wrap; list-style: none;
  font-family: var(--font-display); font-weight: 600; font-size: 16px;
  color: #9AA1AC; letter-spacing: 0.01em;
}
.trust-logos li { transition: color 0.3s; }
.trust-logos li:hover { color: var(--ink); }

/* ---------- Problem ---------- */
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.problem-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 34px 30px;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.problem-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -20px rgba(11, 18, 32, 0.15);
}
.problem-stat {
  font-family: var(--font-display);
  font-size: 46px; font-weight: 650; letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.problem-card h3 { font-size: 19px; font-weight: 650; margin: 14px 0 10px; line-height: 1.3; }
.problem-card p:last-child { color: var(--muted); font-size: 15.5px; }

.pivot { margin-top: 72px; border-left: 3px solid var(--accent); padding-left: 32px; max-width: 780px; }
.pivot-line { font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 29px); font-weight: 600; line-height: 1.35; letter-spacing: -0.015em; }
.pivot-line em { font-style: normal; color: var(--accent); }

/* ---------- Services (dark) ---------- */
.section-dark { background: var(--dark); color: #E8ECF5; }
.section-dark h2 { color: #fff; }
.section-dark .section-lede { color: #97A2B8; }

.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.service-card {
  position: relative;
  background: var(--dark-soft);
  border: 1px solid #202B42;
  border-radius: var(--radius);
  padding: 34px 30px 30px;
  overflow: hidden;
  transition: transform 0.4s var(--ease-out), border-color 0.4s;
}
.service-card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(420px 220px at var(--mx, 50%) var(--my, 0%), rgba(46, 91, 255, 0.14), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.service-card:hover { transform: translateY(-4px); border-color: #2E4270; }
.service-card:hover::before { opacity: 1; }

.service-num {
  font-family: var(--font-mono); font-size: 12px; color: #5E6F94;
  letter-spacing: 0.15em; margin-bottom: 40px;
}
.service-card h3 { font-size: 20px; font-weight: 650; color: #fff; margin-bottom: 12px; letter-spacing: -0.015em; }
.service-card p { font-size: 15px; color: #97A2B8; line-height: 1.65; }
.service-tag {
  margin-top: 22px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.03em;
  color: #8FA6FF !important;
  border-top: 1px solid #202B42;
  padding-top: 16px;
}

/* ---------- Case studies ---------- */
.case {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 56px;
  padding: 56px 0;
  border-top: 1px solid var(--hairline);
}
.case:last-child { border-bottom: 1px solid var(--hairline); }

.case-industry { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.case h3 { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 16px; }
.case-body { color: var(--muted); max-width: 60ch; }
.case-quote {
  margin-top: 22px; font-size: 16.5px; font-weight: 500;
  color: var(--ink-soft); font-style: italic; max-width: 54ch;
}
.case-quote span { display: block; margin-top: 6px; font-style: normal; font-size: 13.5px; color: var(--muted); font-weight: 450; }

.case-stats { display: flex; flex-direction: column; justify-content: center; gap: 0; }
.case-stats > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  padding: 18px 0;
}
.case-stats > div + div { border-top: 1px solid var(--hairline); }
.case-stats dt { font-size: 14.5px; color: var(--muted); }
.case-stats dd {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 650; letter-spacing: -0.02em;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Method ---------- */
.section-tint { background: linear-gradient(to bottom, #F3F2EC, var(--paper)); }
.method-steps {
  list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  counter-reset: step;
}
.method-step {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 34px 30px;
  position: relative;
}
.method-step::after {
  content: "→";
  position: absolute; top: 38px; right: -17px;
  font-size: 18px; color: var(--accent);
  z-index: 1;
}
.method-step:last-child::after { content: none; }
.method-phase { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 20px; }
.method-step h3 { font-size: 24px; font-weight: 650; margin-bottom: 12px; }
.method-step p:last-child { color: var(--muted); font-size: 15.5px; }

/* ---------- Testimonials ---------- */
.testimonials { padding-top: 0; }
.testimonial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.testimonial {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 32px 30px;
  display: flex; flex-direction: column; gap: 26px;
}
.testimonial blockquote { font-size: 16.5px; line-height: 1.6; color: var(--ink-soft); flex: 1; }
.testimonial blockquote::before { content: none; }
.testimonial figcaption { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.testimonial strong { color: var(--ink); font-weight: 600; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 650; font-size: 14px;
  flex-shrink: 0;
}

/* ---------- CTA ---------- */
.cta {
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(46, 91, 255, 0.35), transparent 70%),
    var(--dark);
  color: #E8ECF5;
}
.cta-inner { max-width: 760px; text-align: center; }
.cta h2 { color: #fff; }
.cta-sub { margin-top: 22px; font-size: 18.5px; color: #97A2B8; }
.cta-list {
  list-style: none;
  margin: 34px auto 0;
  display: inline-flex; flex-direction: column; gap: 12px;
  text-align: left;
}
.cta-list li { padding-left: 30px; position: relative; color: #C6CEDF; font-size: 16px; }
.cta-list li::before {
  content: "";
  position: absolute; left: 0; top: 7px;
  width: 15px; height: 8px;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.cta .hero-actions { margin-top: 40px; }
.cta-note { margin-top: 22px; font-family: var(--font-mono); font-size: 12.5px; color: #5E6F94; }

/* ---------- Footer ---------- */
.footer { background: var(--paper); border-top: 1px solid var(--hairline); padding: 56px 0 32px; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; flex-wrap: wrap; }
.footer-tag { margin-top: 14px; font-size: 14.5px; color: var(--muted); }
.footer-links { display: flex; gap: 28px; flex-wrap: wrap; }
.footer-links a { font-size: 14.5px; color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent-ink); }
.footer-base {
  margin-top: 48px; padding-top: 24px;
  border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.footer-base a { color: inherit; }

/* ---------- Reveal animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .flow, .packet, .engine-pulse, .engine-dots circle { animation: none !important; }
  .packet { display: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-diagram { max-width: 560px; }
  .services-grid, .problem-grid, .method-steps, .testimonial-grid { grid-template-columns: repeat(2, 1fr); }
  .method-step::after { content: none; }
  .metrics-strip { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: 0; padding-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--hairline); }
}

@media (max-width: 720px) {
  .section { padding: 76px 0; }
  .hero { padding: 130px 0 64px; }
  .nav-links { display: none; }
  .nav-cta-group .btn { display: none; }
  .nav-toggle { display: flex; }
  .mobile-menu.open { display: flex; }
  .mobile-menu .btn { display: inline-flex; }
  .services-grid, .problem-grid, .method-steps, .testimonial-grid { grid-template-columns: 1fr; }
  .case { grid-template-columns: 1fr; gap: 28px; padding: 44px 0; }
  .metrics-strip { grid-template-columns: 1fr 1fr; }
  .metric dd { font-size: 26px; }
  .trust .container { gap: 20px; }
  .trust-logos { gap: 22px; font-size: 14.5px; }
  .hero-sub { font-size: 17.5px; }
  .section-lede { font-size: 17px; }
  .pivot { padding-left: 22px; margin-top: 52px; }
}
