/* Additions on top of the canvas markup.
   Desktop (>960px) looks exactly like the canvas, except the header is pinned
   (sticky) on every screen size; everything else only adapts it to tablets and phones. The canvas uses inline styles, so overrides need !important. */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 81px; }
@media (max-width: 960px) { html { scroll-padding-top: 69px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { overflow-x: clip; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid #FF4F00; outline-offset: 3px; }

#contact [aria-invalid="true"] { border-color: #B91C1C !important; }
[data-if][hidden], [hidden] { display: none !important; }

/* ---------- Header: pinned to the top on every screen size ---------- */

header { position: sticky; top: 0; z-index: 50; }

/* Active nav link: the section currently on screen (set by main.js).
   Desktop: bold + the design's orange link underline. */
#nav-links a:not([href="#contact"]) { transition: color .15s ease; }
#nav-links a.is-active {
  color: #0A0A0A !important;
  font-weight: 600 !important;
  text-decoration: underline !important;
  text-decoration-color: #FF4F00 !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 8px;
}

/* ---------- Menu button (tablet + phone) ---------- */

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  margin-left: auto;
  background: #FFFFFF; color: #0A0A0A;
  border: 1px solid #0A0A0A; border-radius: 0;
  cursor: pointer;
}

@media (max-width: 960px) {
  header nav { padding-top: 12px !important; padding-bottom: 12px !important; row-gap: 0 !important; }

  .nav-toggle { display: inline-flex; }
  #nav-links {
    display: none !important;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 8px 0 12px;
  }
  #nav-links.is-open { display: flex !important; }
  #nav-links a { padding: 14px 0 !important; border-bottom: 1px solid #E4E4E7; font-size: 16px !important; }
  #nav-links a[href="#contact"] { margin-top: 12px; border-bottom: 0; text-align: center; padding: 14px 20px !important; }
  /* Phone menu: active item gets the design's orange square marker instead of an underline */
  #nav-links a.is-active { text-decoration: none !important; display: flex !important; align-items: center; gap: 10px; }
  #nav-links a.is-active::before { content: ""; width: 8px; height: 8px; background: #FF4F00; flex: none; }
}

/* ---------- Tablet ---------- */

@media (max-width: 960px) {
  /* Section intros: stack the "01 / Services" label above the heading */
  section div[style*="gap: 24px 48px"] { gap: 16px !important; }
  section div[style*="gap: 24px 48px"] > * { flex-basis: 100% !important; }
}

@media (min-width: 601px) and (max-width: 960px) {
  /* Hero credibility strip: keep all three on one row */
  #top div[style*="minmax(240px"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* ---------- Phone ---------- */

@media (max-width: 600px) {
  /* Tighter vertical rhythm */
  #services > div, #cost > div, #approach > div, #about > div,
  section[aria-labelledby="stack-h"] > div, #contact > div {
    padding-top: 64px !important; padding-bottom: 64px !important; gap: 40px !important;
  }
  #engage > div { padding-bottom: 64px !important; gap: 32px !important; }
  #top > div { padding-top: 40px !important; gap: 36px !important; }

  /* Display type: the desktop tracking is too tight at phone sizes */
  h1 { font-size: 2.75rem !important; line-height: 1.04 !important; letter-spacing: -0.02em !important; }
  h2 { font-size: 2rem !important; line-height: 1.1 !important; letter-spacing: -0.015em !important; }
  h3 { letter-spacing: -0.01em !important; }
  #contact h2 { font-size: 2.25rem !important; }

  /* Hero */
  #top p[style*="font-size: 1.25rem"] { font-size: 1.1rem !important; }
  #top a[href="#contact"], #top a[href="#services"] { flex: 1 1 100%; text-align: center; }
  #top div[style*="border-top: 1px solid #0A0A0A"] > div { padding: 14px 0 !important; }

  /* Single-column grids that never overflow small phones */
  [style*="minmax(300px"], [style*="minmax(240px"] { grid-template-columns: minmax(0, 1fr) !important; }

  /* Cards */
  #services article, #engage article { padding: 24px !important; }
  #cost div[style*="padding: 28px"] { padding: 22px !important; }
  #cost div[style*="border-left: 4px"] { padding: 22px !important; }

  /* How we work: smaller step numbers */
  #approach ol { gap: 28px !important; }
  #approach ol > li > span:first-child { font-size: 2.5rem !important; }

  /* About: uptime + stats in two columns */
  #about div[style*="border: 1px solid #0A0A0A"] { gap: 12px !important; }
  #about dl { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #about dl > div { padding: 18px 16px !important; }
  #about dd { font-size: 1.85rem !important; }
  #about dt { font-size: 13px !important; line-height: 1.45; }
  #about h3 { font-size: 1.5rem !important; }

  /* Stack */
  section[aria-labelledby="stack-h"] h2 { font-size: 1.5rem !important; }
  section[aria-labelledby="stack-h"] > div > div { padding: 24px 0 28px !important; gap: 16px !important; }
  section[aria-labelledby="stack-h"] li { font-size: 13px; }


  /* Footer */
  footer > div { padding-top: 40px !important; padding-bottom: 32px !important; }
  footer nav { gap: 0 24px !important; }
  footer nav a { padding: 10px 0 !important; }
}
