/* BWI site shell + responsive layer.
   Desktop: sticky header, 4-column footer. Phones (<=760px): app shell — compact top app bar,
   bottom tab bar, swipe rails, collapsible LEO sections, stacked comparison cards.
   Most page markup still carries inline styles, so the overrides below need !important. */

:root { --appbar-h: 56px; --tabbar-h: 60px; --gutter: 32px; }

/* ---------- accessibility helpers ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--saf); color: var(--navy); padding: 10px 14px; border-radius: var(--radius-btn); font: 600 14px var(--font-head); text-decoration: none; }
.skip:focus { top: 12px; }
header :focus-visible, footer :focus-visible, .tabbar :focus-visible, .on-dark :focus-visible { outline-color: var(--saf); }
[id] { scroll-margin-top: 88px; }
.btn-primary:hover { color: var(--navy); }
.on-dark .btn-ghost:hover { border-color: var(--white); background: rgba(255,255,255,.06); color: var(--white); }

/* ---------- header ---------- */
.site-head { position: sticky; top: 0; z-index: 50; background: var(--navy); padding-top: env(safe-area-inset-top); }
.head-row { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); min-height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--white); font: 700 17px var(--font-head); }
.brand svg { flex: none; }
.brand .logo { width: 96px; height: 39px; }
.mainnav { display: flex; gap: 4px; margin-left: auto; font: 600 14.5px var(--font-head); }
.mainnav a { color: var(--on-dark); text-decoration: none; padding: 10px 12px; border-radius: var(--radius-btn-sm); }
.mainnav a:hover { color: var(--white); }
.mainnav a[aria-current="page"] { color: var(--white); box-shadow: inset 0 -2px 0 var(--saf); border-radius: 0; }

/* ---------- footer ---------- */
.site-foot { background: var(--navy7); color: var(--on-dark); font-size: 14px; padding: 48px 0 calc(24px + env(safe-area-inset-bottom)); }
.foot-grid { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-grid h2 { font: 600 12px/1.3 var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--saf); margin-bottom: 12px; }
.foot-grid nav, .foot-grid > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.foot-grid a { color: var(--on-dark); text-decoration: none; }
.foot-grid a:hover { color: var(--white); }
.foot-brand p { max-width: 36ch; margin: 6px 0; }
.foot-brand .brand { color: var(--white); }
.foot-base { max-width: var(--wrap); margin: 32px auto 0; padding: 20px var(--gutter) 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; }
.tabbar { display: none; }

/* ---------- section heads: stacked numeral / eyebrow / h2 everywhere ---------- */
.sec-head-row { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }

/* ---------- case timeline as a list (phones only; the wide strip shows on desktop) ---------- */
.steps-m, .steps-m-note { display: none; }

/* ---------- desktop / tablet layout fixes ---------- */
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr) !important; }
  .contact-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; }
}
@media (min-width: 761px) {
  .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .leo-quad { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 960px) {
  .zig > .zig-media { order: -1; min-height: 0 !important; }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .proof { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .proof .stat { border-bottom: 1px solid var(--line); }
  .proof .stat:nth-child(2n) { border-right: 0; }
  .proof .stat:nth-last-child(-n+2) { border-bottom: 0; }
}

/* ---------- LEO collapsible sections (wrapped by mobile.js) ---------- */
.m-acc > summary { display: none; }
.m-acc-body { display: flex; flex-direction: column; }

/* ================= phones: app shell ================= */
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

  /* top app bar */
  .head-row { min-height: var(--appbar-h); gap: 12px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .site-head { background: rgba(11,27,63,.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,.08); }
  .brand { font-size: 16px; gap: 8px; }
  .brand .logo { width: 84px; height: 34px; }
  .mainnav { display: none; }
  .head-cta { margin-left: auto; height: 40px; }

  /* bottom tab bar */
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 max(4px, env(safe-area-inset-left)) env(safe-area-inset-bottom);
    background: var(--navy); border-top: 1px solid rgba(255,255,255,.1); box-shadow: 0 -8px 24px -12px rgba(11,27,63,.5); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px;
    color: rgba(201,210,232,.75); text-decoration: none; font: 600 11px/1 var(--font-head); -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current="page"] { color: var(--white); }
  .tabbar a[aria-current="page"] svg { stroke: var(--saf); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 24px; height: 3px; border-radius: 0 0 3px 3px; background: var(--saf); }
  .tabbar a:active { background: rgba(255,255,255,.06); }

  /* gutters, section rhythm, type */
  main [style*="padding: 0 32px"] { padding-left: max(16px, env(safe-area-inset-left)) !important; padding-right: max(16px, env(safe-area-inset-right)) !important; }
  main section[style*="padding: 80px 0"], main section[style*="padding: 72px 0"], main section[style*="padding: 64px 0"] { padding-top: 48px !important; padding-bottom: 48px !important; }
  .hero { padding-top: 28px !important; padding-bottom: 40px !important; }
  .hero.hero-overlap { padding-bottom: 96px !important; }
  .hero h1 { font-size: 32px !important; letter-spacing: -.6px !important; }
  .hero.hero-overlap h1 { font-size: 34px !important; }
  .hero p[style*="font-size: 18px"] { font-size: 16.5px !important; }
  .hero .btn { width: 100%; height: 48px; }
  .hero .dial, .hero [style*="500 11px 'JetBrains Mono'"] { display: none !important; }
  .hero-art { max-width: none !important; justify-self: stretch !important; }
  .hero-art > .rv { position: static !important; width: 100% !important; }
  h2[style*="font-size: 34px"] { font-size: 26px !important; line-height: 1.2 !important; }
  h2[style*="font-size: 30px"], h2[style*="font-size: 28px"] { font-size: 24px !important; line-height: 1.2 !important; }
  .chnum, [style*="font: 200 88px"], [style*="font: 200 112px"] { font-size: 48px !important; letter-spacing: -1.5px !important; }
  .btn-sm { height: 40px; }
  a.more { display: inline-flex; align-items: center; min-height: 44px; }
  .hero p > a[href="index.html"] { display: inline-flex; align-items: center; min-height: 44px; }
  .steps-m { display: grid; gap: 0; margin: 24px 0 0; padding: 0; list-style: none; counter-reset: st; }
  .steps-m li { counter-increment: st; display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); font: 600 15px var(--font-head); color: var(--navy); }
  .steps-m li::before { content: counter(st); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--blue-50); color: var(--blue); font: 700 13px var(--font-head); }
  .steps-m li:last-child::before { background: var(--teal); color: var(--white); }
  .steps-m-note { display: block; margin: 12px 0 0; font-size: 14px; color: var(--muted); }

  /* stats 2x2 */
  .proof, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .proof .stat, .facts > div { border-right: 0 !important; border-bottom: 1px solid var(--line); padding: 16px !important; }
  .proof .stat:nth-child(odd), .facts > div:nth-child(odd) { border-right: 1px solid var(--line) !important; }
  .proof .stat:nth-last-child(-n+2), .facts > div:nth-last-child(-n+2) { border-bottom: 0; }
  .proof b { font-size: 26px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  /* swipe rails */
  .m-rail { display: grid !important; grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: 85%;
    gap: 12px !important; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    margin-left: -16px !important; margin-right: -16px !important; padding: 4px 16px 12px !important; scroll-padding-inline: 16px; scrollbar-width: none; }
  .m-rail::-webkit-scrollbar { display: none; }
  .m-rail > * { scroll-snap-align: start; min-width: 0; }
  .rail-dots { display: flex; justify-content: center; gap: 6px; margin-top: -4px; }
  .rail-dots i { width: 6px; height: 6px; border-radius: 3px; background: #CDD5E3; transition: width .2s, background .2s; }
  .rail-dots i.on { width: 18px; background: var(--blue); }
  .on-dark .rail-dots i { background: rgba(255,255,255,.25); }
  .on-dark .rail-dots i.on { background: var(--saf); }

  /* services: illustration above its own text, 3-up sub-grids stack */
  .zig-media { padding: 16px !important; }
  main [style*="min-height: 320px"], main [style*="min-height: 340px"], main [style*="min-height: 260px"] { min-height: 200px !important; }
  .sub3 { grid-template-columns: 1fr !important; }

  /* wide 1160px strips are unreadable at phone width: hide (content is repeated in text) */
  .m-wrap[data-slot="home-proof"], .m-wrap[data-slot="svc-approach"], .m-wrap[data-slot="svc-roles"],
  .m-wrap[data-slot="leo-yaml"], .m-wrap[data-slot="leo-quality-gate"], .m-wrap[data-slot="leo-ai-loop"],
  .m-wrap[data-slot="leo-proof"], .m-wrap[data-slot="leo-connectors"], .m-wrap[data-slot="case-timeline"],
  .m-wrap[data-slot="about-story"], #how svg[viewBox^="0 0 1160"], svg[aria-label^="Gurugram, BWI"] { display: none !important; }

  /* LEO collapsible sections */
  .m-acc > summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 16px; list-style: none; cursor: pointer;
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--white); font: 600 15px var(--font-head); color: var(--navy); }
  .m-acc > summary::-webkit-details-marker { display: none; }
  .m-acc > summary::after { content: ""; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
  .m-acc[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
  .m-acc[open] > summary { margin-bottom: 16px; }
  .on-dark .m-acc > summary { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); color: var(--white); }

  /* comparison table -> stacked cards */
  .cmp-wrap { overflow: visible !important; border: 0 !important; background: none !important; }
  .cmp { min-width: 0 !important; display: block; }
  .cmp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cmp tbody { display: block; }
  .cmp tr { display: block; background: var(--white); border: 1px solid var(--line) !important; border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 12px; }
  .cmp th[scope="row"] { display: block; font: 600 16px/1.35 var(--font-head) !important; color: var(--navy); padding: 0 0 8px !important; border-bottom: 1px solid var(--line); }
  .cmp td { display: grid; grid-template-columns: 44% 1fr; gap: 8px; padding: 8px 0 !important; font-size: 14.5px; }
  .cmp td::before { content: attr(data-label); font: 600 11.5px/1.5 var(--font-head); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

  /* contact: form first, single column */
  .contact-grid { display: flex !important; flex-direction: column; gap: 24px !important; }
  .contact-intro { display: contents !important; }
  .contact-intro > * { order: 2; }
  .contact-intro > h1, .contact-intro > h1 + p { order: 0; }
  .contact-grid > form, .contact-grid > #sentBox { order: 1; }
  .contact-intro > [style*="max-width: 440px"] { display: none; }
  form.cf { grid-template-columns: 1fr; padding: 20px; }
  .cf input[type=text], .cf input[type=email] { height: 48px; }
  .contact-grid > form, .contact-grid > #sentBox { width: 100%; min-width: 0; }
  .cf .row .btn { width: 100%; height: auto; min-height: 48px; padding: 12px 20px; white-space: normal; text-align: center; line-height: 1.3; }
  .stage { height: 44px !important; }

  .foot-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .foot-brand { grid-column: 1 / -1; }
}

@media (max-width: 360px) {
  .brand { font-size: 0; }
  .brand .logo { width: 84px; height: 34px; }
  .tabbar a { font-size: 10.5px; }
}

/* ---------- motion + print ---------- */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .m-rail { scroll-snap-type: none; } }
@media print {
  .site-head, .tabbar, .skip { display: none !important; }
  .rv { animation: none !important; opacity: 1 !important; transform: none !important; }
  body { padding-bottom: 0; }
}
