/* ============================================================
   Kneuralabs — Sections
   Hero, stats, gaps, services, deliverables, timeline,
   principles, contact, CTA strip, restyle helpers, motion.
   ============================================================ */

/* ── Hero ── */
.hero {
  padding-top: 80px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 64px;
  align-items: end;
}
h1.display {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(48px, 7.2vw, 116px);
  line-height: .95;
  letter-spacing: -.025em;
  margin: 24px 0 0;
  text-wrap: balance;
}
h1.display em { font-style: italic; font-weight: 340; color: var(--accent); }
.hero-side {
  font-size: 15.5px;
  color: var(--ink-2);
  max-width: 34ch;
  line-height: 1.55;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

.marks {
  margin-top: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--ink-2);
}
.marks span { display: inline-flex; align-items: center; gap: 10px; }
.marks .sq {
  width: 7px; height: 7px;
  background: var(--ink);
  transform: rotate(45deg);
  animation: tickPulse 2.4s var(--ease-in-out) infinite;
}
.marks span:nth-child(2) .sq { animation-delay: .4s; }
.marks span:nth-child(3) .sq { animation-delay: .8s; }
@keyframes tickPulse {
  0%, 100% { transform: rotate(45deg) scale(1); opacity: 1; }
  50% { transform: rotate(45deg) scale(1.25); opacity: .55; }
}

@media (max-width: 980px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } }
/* Single-column hero: keep marks row left-aligned — reset the right-floating last item */
@media (max-width: 980px) {
  .marks span[style] { margin-left: 0 !important; }
  .marks { flex-wrap: wrap; }
}
/* Tablet portrait — hero no longer needs full desktop vertical clearance */
@media (max-width: 820px) {
  .hero { padding-top: 64px; padding-bottom: 44px; }
}
@media (max-width: 600px) {
  .hero { padding-top: 56px; padding-bottom: 40px; }
  .marks { margin-top: 40px; gap: 18px; }
  h1.display { font-size: clamp(33px, 8.8vw, 56px); }
}

/* ── Stat strip ── */
.stats { padding-top: 36px; padding-bottom: 36px; border-bottom: 1px solid var(--rule); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.stat .n {
  font-family: var(--serif);
  font-size: 48px;
  line-height: 1;
  letter-spacing: -.02em;
  font-weight: 400;
  display: inline-block;
}
.stat .l {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 10px;
}
.stat .sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
@media (max-width: 820px) { .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 20px; } }
@media (max-width: 420px) { .stat .n { font-size: 38px; } }

/* ── Gap list ── */
.gaps { border-top: 1px solid var(--ink); }
.gap {
  display: grid;
  grid-template-columns: 80px 1fr 1.4fr;
  gap: 32px;
  padding: 28px 8px;
  border-bottom: 1px solid var(--rule);
  transition: background-color var(--dur-s) var(--ease-out);
}
.gap:hover { background: var(--hover-fill); }
.gap .idx { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--ink-2); }
.gap h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.gap p { color: var(--ink-2); font-size: 15px; line-height: 1.55; }
@media (max-width: 820px) {
  .gap { grid-template-columns: 56px 1fr; gap: 14px; }
  .gap p { grid-column: 1 / -1; }
}

/* ── Service cards ── */
.services {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.svc {
  background: var(--paper);
  padding: 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 520px;
  transition: transform var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out), box-shadow var(--dur-s) var(--ease-out);
}
.svc:hover { background: var(--paper-2); transform: translateY(-2px); }
html[data-theme="dark"] .svc:hover { box-shadow: var(--shadow-card); }
.svc .tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.svc .id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  transition: transform var(--dur-s) var(--ease-spring);
}
html[data-theme="dark"] .svc .id { color: #0B0C0F; }
.svc.feature .id { background: var(--accent); color: var(--on-accent); }
.svc:hover .id { transform: scale(1.08) rotate(-3deg); }
.svc h3 {
  font-family: var(--serif);
  font-weight: 380;
  font-size: 30px;
  letter-spacing: -.015em;
  line-height: 1.1;
}
.svc > p { color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.svc ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--ink);
}
.svc ul li { display: flex; gap: 12px; align-items: baseline; }
.svc ul li::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink);
  flex: none;
  transform: translateY(-2px);
}
.svc .foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
  font-size: 13px;
  color: var(--ink-2);
}
.svc .foot a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; position: relative; }
.svc .foot a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transition: right var(--dur-m) var(--ease-out);
}
.svc:hover .foot a::after { right: 0; }
@media (max-width: 1180px) { .services { grid-template-columns: repeat(2, 1fr); } .svc { min-height: 460px; } }
@media (max-width: 640px) { .services { grid-template-columns: 1fr; } .svc { min-height: 0; } }

/* ── Services page rows ── */
.svc-row { padding-top: 64px; padding-bottom: 64px; border-bottom: 1px solid var(--rule); }
.svc-row-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 64px; }
.svc-row .id-big {
  font-family: var(--serif);
  font-size: 140px;
  line-height: .85;
  letter-spacing: -.03em;
  color: var(--accent);
  font-weight: 300;
}
.svc-row h2 {
  font-family: var(--serif);
  font-weight: 380;
  font-size: 42px;
  letter-spacing: -.02em;
  margin: 8px 0 14px;
  line-height: 1.08;
}
.svc-row .lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  max-width: 48ch;
  margin: 0 0 20px;
}
.svc-row .meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-top: 18px;
}
.svc-row .meta span { display: inline-flex; align-items: center; gap: 8px; }
.svc-row .meta .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

.deliverables {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.deliv {
  background: var(--paper);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  transition: transform var(--dur-s) var(--ease-out), background-color var(--dur-s) var(--ease-out), box-shadow var(--dur-s) var(--ease-out);
}
.deliv:hover { background: var(--paper-2); transform: translateY(-2px); }
html[data-theme="dark"] .deliv:hover { box-shadow: var(--shadow-card); }
.deliv .n { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--ink-2); }
.deliv h4 { font-family: var(--serif); font-weight: 400; font-size: 18px; margin: 0; letter-spacing: -.01em; line-height: 1.25; }
.deliv p { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
@media (max-width: 980px) { .svc-row-grid { grid-template-columns: 1fr; gap: 28px; } .svc-row .id-big { font-size: 96px; } }
@media (max-width: 680px) { .deliverables { grid-template-columns: 1fr; } }

/* ── Approach timeline ── */
.approach { padding-top: 64px; padding-bottom: 64px; border-bottom: 1px solid var(--rule); }
.timeline { position: relative; margin-top: 40px; }
.timeline::before { content: ""; position: absolute; left: 120px; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.t-row { display: grid; grid-template-columns: 120px 1fr; gap: 48px; padding: 28px 0; position: relative; }
.t-row::before {
  content: "";
  position: absolute;
  left: 116px;
  top: 36px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--ink);
}
.t-row.active::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--accent);
}
.t-week {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-top: 6px;
}
.t-body h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.2; }
.t-body p { color: var(--ink-2); font-size: 15px; line-height: 1.6; max-width: 60ch; }
@media (max-width: 720px) {
  .timeline::before { left: 60px; }
  .t-row { grid-template-columns: 60px 1fr; gap: 20px; }
  .t-row::before { left: 56px; }
}

/* ── Timeline motion — line draws, nodes pop, active node breathes.
   Transform-only, staggered with the row reveal (--rd), reduced-motion
   safe, and overflow-free on every viewport. ── */
.timeline::before {
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform var(--dur-xl) var(--ease-soft) 80ms;
}
.timeline:has(.t-row.revealed)::before { transform: scaleY(1); }
.t-row::before {
  transform: scale(0);
  transition: transform var(--dur-s) var(--ease-spring),
              background-color var(--dur-s) var(--ease-out),
              box-shadow var(--dur-s) var(--ease-out);
  transition-delay: var(--rd, 0ms);
}
.t-row.revealed::before { transform: scale(1); }
.t-row.active.revealed::before { animation: tlNodePulse 2.8s var(--ease-out) 700ms infinite; }

/* Content enters: fade + slide up + slight right drift */
.t-row.sr .t-week {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-m) var(--ease-soft), transform var(--dur-m) var(--ease-soft);
}
.t-row.sr.revealed .t-week {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--rd, 0ms) + 60ms);
}
.t-row.sr .t-body {
  opacity: 0;
  transform: translate3d(10px, 16px, 0);
}
.t-row.sr.revealed .t-body {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-l) var(--ease-soft) var(--rd, 0ms),
              transform var(--dur-l) var(--ease-soft) var(--rd, 0ms);
}

@keyframes tlNodePulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--accent),
             0 0 0 5px color-mix(in oklab, var(--accent) 0%, transparent); }
  50%      { box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--accent),
             0 0 0 14px color-mix(in oklab, var(--accent) 25%, transparent); }
}

@keyframes tlLineGlow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

html:not(.js) .timeline::before,
html:not(.js) .t-row::before { transform: none; }
html:not(.js) .t-row.sr .t-body,
html:not(.js) .t-row.sr .t-week { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .timeline::before, .t-row::before { transform: none !important; transition: none !important; }
  .t-row.active.revealed::before { animation: none !important; }
  .t-row.sr .t-body,
  .t-row.sr .t-week { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ── Principles ── */
.princ {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 40px;
}
.princ > div { background: var(--paper); padding: 28px; min-height: 200px; }
.princ h4 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 14px 0 8px; letter-spacing: -.01em; }
.princ p { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.princ .num { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--accent); }
@media (max-width: 1080px) and (min-width: 561px) { .princ { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .princ { grid-template-columns: 1fr; } .princ > div { min-height: 0; } }

/* ── Contact ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  padding-top: 72px;
  padding-bottom: 72px;
}
.contact-grid h1 {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(36px, 5vw, 68px);
  letter-spacing: -.02em;
  line-height: 1.02;
  margin: 18px 0 18px;
}
.contact-grid h1 em { font-style: italic; color: var(--accent); }
.contact-grid .lede { font-size: 17px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.contact-info { display: flex; flex-direction: column; margin-top: 32px; font-size: 14.5px; }
.contact-info .row { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 14px 0; border-top: 1px solid var(--rule); }
.contact-info .row:last-child { border-bottom: 1px solid var(--rule); }
.contact-info .lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.contact-info .val a { color: var(--ink); font-weight: 500; }
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; padding-bottom: 48px; } }
@media (max-width: 480px) {
  .contact-info .row { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
}

/* ── CTA strip ── */
.cta-strip {
  padding: 96px 0;
  background: var(--ink);
  color: var(--paper);
  position: relative;
  overflow: hidden;
}
.cta-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 80% at 80% 20%, oklch(0.3 0.12 50 / .6), transparent 60%);
  pointer-events: none;
}
html[data-theme="dark"] .cta-strip {
  background: linear-gradient(135deg, #0E0F14 0%, #1A1C24 55%, #14161D 100%);
  color: var(--ink);
}
html[data-theme="dark"] .cta-strip::before {
  background: radial-gradient(70% 90% at 80% 15%, color-mix(in oklab, var(--accent) 38%, transparent), transparent 60%);
  opacity: .6;
}
.cta-strip .frame { position: relative; }
.cta-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 64px; align-items: end; }
.cta-strip h2 {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(36px, 5vw, 72px);
  letter-spacing: -.02em;
  line-height: 1.02;
  margin-top: 18px;
}
.cta-strip h2 em { font-style: italic; color: oklch(0.78 0.1 70); }
html[data-theme="dark"] .cta-strip h2 em { color: oklch(0.84 0.10 70); }
.cta-strip p { color: rgba(255,255,255,.69); font-size: 15.5px; max-width: 48ch; line-height: 1.6; margin: 0 0 18px; }
html[data-theme="dark"] .cta-strip p { color: var(--ink-2); }
.cta-strip .btn-primary { background: var(--paper); color: var(--ink); }
.cta-strip .btn-primary:hover { background: var(--accent); color: var(--on-accent); }
.cta-strip .btn-ghost { border-color: rgba(255,255,255,.34); color: var(--paper); }
.cta-strip .btn-ghost:hover { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] .cta-strip .btn-primary { background: var(--ink); color: var(--paper); }
html[data-theme="dark"] .cta-strip .btn-primary:hover { background: var(--accent); color: var(--on-accent); }
@media (max-width: 820px) { .cta-strip { padding-top: 64px; padding-bottom: 64px; } .cta-grid { grid-template-columns: 1fr; gap: 24px; } }

/* ── Prose / restyled inner pages (about, careers, journey, legal, etc.) ── */
.prose { max-width: 72ch; }
.prose > * + * { margin-top: 18px; }
.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -.015em;
  margin-top: 56px;
  line-height: 1.15;
}
.prose h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -.01em;
  margin-top: 36px;
}
.prose p, .prose li { color: var(--ink-2); font-size: 16px; line-height: 1.7; }
.prose ul, .prose ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--ink); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 40px;
}
.card-grid > article {
  background: var(--paper);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background-color var(--dur-s) var(--ease-out);
}
.card-grid > article:hover { background: var(--paper-2); }
.card-grid .n { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; }
.card-grid h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: -.01em; margin: 0; }
.card-grid p { color: var(--ink-2); font-size: 14.5px; line-height: 1.55; margin: 0; }
.card-grid .role-meta { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule); }

/* ── Scroll reveal ── */
.sr {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  filter: blur(7px);
  will-change: opacity, transform, filter;
  transition:
    opacity var(--dur-m) var(--ease-soft),
    transform var(--dur-l) var(--ease-soft),
    filter var(--dur-m) var(--ease-soft);
  transition-delay: var(--rd, 0ms);
}
.sr-left  { transform: translate3d(-26px, 0, 0); }
.sr-right { transform: translate3d(26px, 0, 0); }
.sr-scale { transform: scale(.96); }
.sr.revealed {
  opacity: 1;
  transform: none;
  filter: none;
}
.sr.revealed { will-change: auto; }

/* No-JS / failed-load safety — content must never stay hidden if the
   motion layer never runs. (scroll.js adds .js synchronously when present.) */
html:not(.js) .sr,
html:not(.js) .reveal-char { opacity: 1; transform: none; filter: none; }

/* Hero headline — word-grouped character reveal */
.reveal-word { display: inline-block; white-space: nowrap; }
.reveal-char {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, .62em, 0) rotate(2deg);
  filter: blur(5px);
  transition:
    opacity var(--dur-m) var(--ease-out),
    transform var(--dur-l) var(--ease-spring),
    filter var(--dur-m) var(--ease-out);
  transition-delay: var(--rd, 0ms);
}
.reveal-char.is-in { opacity: 1; transform: none; filter: none; }
.reveal-char.space { width: .32em; }

/* ── Load choreography — hero settles in on first paint ── */
html.js:not(.is-ready) .hero .eyebrow,
html.js:not(.is-ready) .hero-side,
html.js:not(.is-ready) .hero-actions,
html.js:not(.is-ready) .marks,
html.js:not(.is-ready) .svc-hero .eyebrow,
html.js:not(.is-ready) .svc-hero .lede {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
}
.hero .eyebrow, .hero-side, .hero-actions, .marks,
.svc-hero .eyebrow, .svc-hero .lede {
  transition:
    opacity var(--dur-m) var(--ease-soft),
    transform var(--dur-l) var(--ease-soft);
}
html.is-ready .hero-side    { transition-delay: 90ms; }
html.is-ready .hero-actions { transition-delay: 160ms; }
html.is-ready .marks        { transition-delay: 230ms; }
html.is-ready .svc-hero .lede { transition-delay: 120ms; }

/* ── Premium micro-interactions ── */
nav.primary a, .cta-mini, .btn, .foot-col a, .svc, .deliv,
.card-grid > article, .gap, details summary .pm, .theme-toggle,
.brand-img, .contact-info .row {
  transition-timing-function: var(--ease-soft);
}
.btn { transition: transform var(--dur-s) var(--ease-spring), background-color var(--dur-s) var(--ease-out), color var(--dur-s) var(--ease-out), border-color var(--dur-s) var(--ease-out), box-shadow var(--dur-s) var(--ease-out); }
.btn-primary:hover { box-shadow: 0 10px 30px -12px color-mix(in oklab, var(--accent) 70%, transparent); }
.btn-ghost:hover { box-shadow: 0 10px 28px -16px rgba(0,0,0,.4); }

/* Animated underline for textual links */
.prose a, .foot-meta a, .contact-info .val a, .form-success a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  text-decoration: none;
  transition: background-size var(--dur-s) var(--ease-soft), color var(--dur-xs) var(--ease-out);
}
.prose a:hover, .foot-meta a:hover, .contact-info .val a:hover, .form-success a:hover {
  background-size: 100% 1px;
}

/* Footer column links — quiet slide on hover */
.foot-col a { transition: color var(--dur-xs) var(--ease-out), transform var(--dur-s) var(--ease-soft); }
.foot-col a:hover { transform: translateX(4px); }

/* Card / tile lift refinement */
.svc, .deliv, .card-grid > article {
  transition: transform var(--dur-s) var(--ease-soft), background-color var(--dur-s) var(--ease-out), box-shadow var(--dur-m) var(--ease-soft);
}

/* FAQ disclosure — smoother toggle */
details summary .pm { transition: transform var(--dur-s) var(--ease-spring), background-color var(--dur-xs) var(--ease-out), color var(--dur-xs) var(--ease-out); }
details[open] summary { color: var(--ink); }

/* Reusable reduced-motion safety for the new layer */
@media (prefers-reduced-motion: reduce) {
  .reveal-word, .reveal-char { opacity: 1 !important; transform: none !important; filter: none !important; }
  html.js:not(.is-ready) .hero .eyebrow,
  html.js:not(.is-ready) .hero-side,
  html.js:not(.is-ready) .hero-actions,
  html.js:not(.is-ready) .marks,
  html.js:not(.is-ready) .svc-hero .eyebrow,
  html.js:not(.is-ready) .svc-hero .lede { opacity: 1; transform: none; }
}

/* Stat number rise */
.stat.revealed .n { animation: numRise var(--dur-xl) var(--ease-soft) both; }
@keyframes numRise {
  0% { opacity: 0; transform: translateY(28px); letter-spacing: .04em; }
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; letter-spacing: -.02em; }
}

/* ============================================================
   Mobile rebuild — one coherent phone/tablet system.
   Loaded last; single source of truth for small screens.
   ============================================================ */
@media (max-width: 760px) {
  /* Header */
  .topbar { gap: 12px; min-height: 64px; padding: 12px 0; }

  /* Rhythm — generous, safe-area-aware gutters */
  .frame {
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
  .section, .svc-row, .approach { padding-top: 56px; padding-bottom: 56px; }
  .svc-hero { padding-top: 52px; padding-bottom: 36px; }
  .hero { padding-top: 40px; padding-bottom: 40px; }
  .stats { padding-top: 28px; padding-bottom: 28px; }
  .contact-grid { padding-top: 44px; padding-bottom: 44px; gap: 28px; }
  .cta-strip { padding-top: 56px; padding-bottom: 56px; }

  /* Hero — sized to wrap cleanly without touching the edges */
  .hero-grid { gap: 26px; }
  h1.display {
    font-size: clamp(32px, 8.4vw, 46px);
    margin-top: 16px;
    line-height: 1.04;
    overflow-wrap: break-word;
  }
  .hero-side { max-width: none; font-size: 16px; }
  .svc-hero h1 { font-size: clamp(34px, 9.4vw, 48px); line-height: 1.05; }
  .svc-hero .lede, .contact-grid .lede { max-width: none; font-size: 16px; }
  .eyebrow { font-size: 10.5px; letter-spacing: .14em; }

  /* Buttons — full-width, comfortable touch targets */
  .hero-actions { gap: 12px; margin-top: 22px; }
  .hero-actions .btn { width: 100%; justify-content: center; padding: 16px 20px; font-size: 15px; }

  /* Section heads */
  .section-head { gap: 12px; margin-bottom: 28px; }
  .section-head h2 { font-size: clamp(28px, 8vw, 40px); }
  .section-head p { font-size: 15px; max-width: none; }

  /* Stats — two clean columns */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 18px; }
  .stat .n { font-size: clamp(30px, 11vw, 44px); }

  /* Gap list — single column */
  .gap { grid-template-columns: 1fr; gap: 8px; padding: 22px 2px; }
  .gap h3 br { display: none; }
  .gap h3 { font-size: 20px; }

  /* Desktop-tuned hard breaks fight the wrap at phone widths — let
     text-wrap:balance rag these display headings cleanly instead. */
  h1.display br,
  .svc-hero h1 br,
  .contact-grid h1 br { display: none; }

  /* Service cards — remove artificial height floor so content drives card size */
  .svc { min-height: 0; }

  /* Service rows */
  .svc-row-grid { gap: 24px; }
  .svc-row .id-big { font-size: 80px; }
  .svc-row h2 { font-size: 32px; }
  .svc-row .lede { font-size: 16px; max-width: none; }

  /* Marks row wraps cleanly */
  .marks { margin-top: 30px; gap: 14px 18px; font-size: 11px; }
  .marks span[style] { margin-left: 0 !important; flex-basis: 100%; }

  /* FAQ */
  .faq details summary { padding: 20px 2px; }

  /* Footer — clear the home indicator on iPhone Pro models */
  footer.footer { padding: 40px 0 calc(28px + env(safe-area-inset-bottom, 0px)); }
  .foot-grid { gap: 28px; padding-bottom: 28px; }
  .foot-col a { padding: 12px 0; }

  /* Forms */
  .row2 { grid-template-columns: 1fr; }
  form.card { padding: 24px 20px; }

  /* Theme toggle — comfortable touch target */
  .theme-toggle { width: 42px; height: 42px; }
}

@media (max-width: 400px) {
  .frame {
    padding-left: max(26px, env(safe-area-inset-left, 0px));
    padding-right: max(26px, env(safe-area-inset-right, 0px));
  }
  .topbar-actions { gap: 8px; }
  .brand { font-size: 19px; gap: 8px; }
  .brand-img { width: 30px; height: 30px; }
  h1.display { font-size: clamp(28px, 8.6vw, 38px); }
  .section-head h2 { font-size: clamp(26px, 8vw, 34px); }
  .stats-grid { grid-template-columns: 1fr; gap: 18px; }
  .stat .n { font-size: 34px; }
  .marks { margin-top: 24px; }
}
