/* EDS — responsive layer.
   Link this last in <head>, after eds-pages.css and any inline <style>, so these
   rules win over the page-level layout rules of equal specificity. */

/* ===================================================== */
/* ===============   RESPONSIVE LAYER   ================ */
/* ===================================================== */

/* Prevent horizontal page scroll on small screens */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg { max-width: 100%; height: auto; }

/* Hamburger button — hidden on desktop */
.a-nav-toggle {
  display: none;
  width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--eds-ink-300);
  cursor: pointer; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: border-color 0.2s;
}
.a-nav-toggle span {
  display: block; width: 18px; height: 1.5px; background: var(--eds-ink-800);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
nav.a-nav.open .a-nav-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
nav.a-nav.open .a-nav-toggle span:nth-child(2) { opacity: 0; }
nav.a-nav.open .a-nav-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
body.dark .a-nav-toggle { border-color: var(--eds-ink-700); }
body.dark .a-nav-toggle span { background: var(--eds-ink-200); }

/* ============ Tablet / small desktop (≤ 1024px) ============ */
@media (max-width: 1024px) {
  .eds-container, .eds-container-tight { padding-left: 24px; padding-right: 24px; }

  /* Drop hero columns into a 1-up stack but keep generous size */
  .a-hero { padding: 64px 0 56px; }
  .a-hero .grid { grid-template-columns: 1fr; gap: 48px; }
  .a-hero .mark-wrap .mark { max-width: 320px; margin: 0 auto; }
  .a-hero h1 { font-size: clamp(40px, 6vw, 64px); }

  /* Stats: 2x2 */
  .a-stats .grid { grid-template-columns: repeat(2, 1fr); gap: 32px 0; }
  .a-stats .cell { padding: 0 24px; }
  .a-stats .cell:nth-child(2n) { border-right: none; }
  .a-stats .cell:nth-child(odd) { padding-left: 0; }
  .a-stats .v { font-size: 38px; }

  /* Section heads stack */
  .a-section { padding: 72px 0; }
  .a-section-head { grid-template-columns: 1fr; gap: 24px; margin-bottom: 40px; align-items: start; }
  .a-section-head h2 { font-size: clamp(32px, 4.5vw, 44px); }

  /* Capabilities: 2 cols */
  .a-caps { grid-template-columns: repeat(2, 1fr); }

  /* Feature: stack */
  .a-feature { padding: 72px 0; }
  .a-feature .grid { grid-template-columns: 1fr; gap: 48px; }
  .a-feature h2 { font-size: clamp(30px, 4.2vw, 40px); }
  .a-graph { height: 420px; }

  /* Methodology: 2x2 */
  .a-methodology { padding: 72px 0; }
  .a-methodology .steps { grid-template-columns: repeat(2, 1fr); }

  /* CTA stack */
  .a-cta { padding: 80px 0; }
  .a-cta .grid { grid-template-columns: 1fr; gap: 48px; align-items: start; }
  .a-cta h2 { font-size: clamp(34px, 5vw, 48px); }

  /* Footer: 2-col grid (brand spans full row) */
  .a-footer .top { grid-template-columns: repeat(2, 1fr); gap: 40px; }
  .a-footer .brand-block { grid-column: 1 / -1; }

  /* Subhero (interior pages) */
  .a-subhero .grid { grid-template-columns: 1fr !important; gap: 24px !important; align-items: start !important; }

  /* Override inline-styled grids on Contact + Methodology */
  [style*="grid-template-columns:5fr 7fr"],
  [style*="grid-template-columns: 5fr 7fr"] { grid-template-columns: 1fr !important; gap: 40px !important; }
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ============ Mobile nav threshold (≤ 860px) ============ */
@media (max-width: 860px) {
  .a-nav .row { height: 64px; }
  .a-nav .brand .mark { height: 28px; }
  .a-nav .brand .name { font-size: 17px; }
  .a-nav .brand .sub { font-size: 8px; letter-spacing: 0.18em; margin-top: 3px; }

  /* Show hamburger, hide desktop nav list */
  .a-nav-toggle { display: inline-flex; }
  .a-nav ul {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--eds-ink-50);
    border-bottom: 1px solid var(--eds-ink-200);
    padding: 8px 24px 24px;
    transform: translateY(-12px);
    opacity: 0; pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
    z-index: 50;
  }
  body.dark .a-nav ul { background: var(--eds-ink-950); border-bottom-color: var(--eds-ink-800); }
  nav.a-nav { position: relative; }
  nav.a-nav.open ul { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .a-nav ul li { width: 100%; }
  .a-nav ul a {
    display: block; padding: 14px 0; font-size: 15px;
    border-bottom: 1px solid var(--eds-ink-200);
  }
  body.dark .a-nav ul a { border-bottom-color: var(--eds-ink-800); }
  .a-nav ul a.active::after { display: none; }
  /* Theme toggle inline inside the open menu */
  .a-nav ul li:has(> .a-theme-toggle),
  .a-nav ul li:has(> .eds-btn) { padding-top: 12px; }
  .a-nav ul .a-theme-toggle { width: auto; height: 40px; padding: 0 14px; }
  .a-nav ul a.eds-btn { display: flex; width: 100%; box-sizing: border-box; border-bottom-color: transparent; }

  /* Lock body scroll while menu is open */
  body.eds-nav-open { overflow: hidden; }
}

/* ============ Phone (≤ 768px) ============ */
@media (max-width: 768px) {
  .eds-container, .eds-container-tight { padding-left: 18px; padding-right: 18px; }

  /* Utility ticker — let it scroll horizontally instead of overflowing */
  .a-utility .row { gap: 16px; }
  .a-utility .ticker {
    overflow-x: auto; gap: 18px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .a-utility .ticker::-webkit-scrollbar { display: none; }
  .a-utility .row > div:last-child { display: none !important; } /* hide the Aperture link on phone (it is also in the nav) */

  /* Hero */
  .a-hero { padding: 48px 0 40px; }
  .a-hero .grid { gap: 36px; }
  .a-hero h1 { font-size: clamp(34px, 9vw, 44px); margin-bottom: 18px; }
  .a-hero .lede { font-size: 16px; margin-bottom: 28px; }
  .a-hero .meta-row { flex-wrap: wrap; gap: 20px 32px; }
  .a-hero .meta-item .v { font-size: 18px; }
  .a-hero .cta-row { flex-direction: column; align-items: stretch; }
  .a-hero .cta-row .eds-btn { width: 100%; }
  .a-hero .mark-wrap .mark-meta { position: static; margin-top: 12px; }
  body.dark .a-hero .mark-wrap { padding: 20px; }

  /* Stats — single column, no dividers */
  .a-stats { padding: 32px 0; }
  .a-stats .grid { grid-template-columns: 1fr; gap: 24px; }
  .a-stats .cell { padding: 0; border-right: none; border-bottom: 1px solid var(--eds-ink-800); padding-bottom: 20px; }
  .a-stats .cell:last-child { border-bottom: none; padding-bottom: 0; }
  .a-stats .v { font-size: 34px; }

  /* Capabilities single column */
  .a-caps { grid-template-columns: 1fr; }
  .a-cap { min-height: auto; padding: 24px 20px; }

  /* Methodology single column */
  .a-methodology { padding: 56px 0; }
  .a-methodology .steps { grid-template-columns: 1fr; }
  .a-methodology .step { min-height: auto; padding: 28px 22px; }
  .a-methodology .step .num { font-size: 44px; margin-bottom: 16px; }

  /* Coverage table — horizontal scroll wrapper */
  .a-coverage { padding: 56px 0; }
  .a-coverage .table-wrap,
  .a-coverage .eds-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .a-coverage .table { min-width: 640px; }

  /* Built-for marquee */
  .a-builtfor { padding: 36px 0; }
  .a-builtfor .row { gap: 20px; }
  .a-builtfor .items { gap: 20px 28px; }
  .a-builtfor .items span { font-size: 15px; }

  /* CTA */
  .a-cta { padding: 64px 0; }
  .a-cta h2 { font-size: clamp(28px, 7vw, 38px); }
  .a-cta p { font-size: 16px; }
  .a-cta .actions .btn { padding: 16px 18px; font-size: 16px; }

  /* Footer collapse to 1 col + group links */
  .a-footer { padding: 56px 0 32px; }
  .a-footer .top { grid-template-columns: 1fr; gap: 32px; padding-bottom: 36px; }
  .a-footer .brand-block { grid-column: auto; }
  .a-footer .bottom { flex-direction: column; gap: 8px; padding-top: 24px; }

  /* Override more inline-styled grids on Contact form */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }

  /* Section padding */
  .a-section { padding: 56px 0; }
  .a-feature { padding: 56px 0; }
  .a-feature .table .row { grid-template-columns: 24px 1fr auto; gap: 10px; font-size: 11px; }
  .a-graph { height: 320px; }
  .a-graph .corner { font-size: 9px; }
}

/* ============ Small phone (≤ 540px) ============ */
@media (max-width: 540px) {
  .a-hero h1 { font-size: clamp(30px, 9vw, 38px); }
  .a-section-head h2 { font-size: clamp(26px, 7.5vw, 34px); }
  .a-feature h2 { font-size: clamp(26px, 7.5vw, 32px); }
  .a-cta h2 { font-size: clamp(26px, 8vw, 32px); }

  /* Hide the brand subtitle on tiny screens to keep header tidy */
  .a-nav .brand .sub { display: none; }
}

