.container {
  width: min(100% - 4rem, var(--container));
  margin-inline: auto;
}

/* Header: a pill centered at the top of the screen. It stays visible while the page scrolls */

.site-header {
  position: fixed;
  inset: 1rem 0 auto;
  z-index: 100;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.site-header-pill {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  height: 4rem;
  padding: 0 0.75rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 24px -12px rgb(16 16 20 / 0.25);
  pointer-events: auto;
}

.site-header .brand { gap: 0.5rem; font-size: 1rem; }

.site-header .brand img {
  width: 1.75rem;
  height: 1.75rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.625rem 1rem;
  border-radius: 999px;
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-alt);
}

.site-header .site-header-cta { border-radius: 999px; }

/* The theme switch and the button, close together at the pill's right end */
.site-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The theme switch (js/main.js): a moon in light mode, to go dark, and a sun in dark mode, to go back.
   The phone menu's ☰ (js/main.js) looks the same, and shows only on phones */
.theme-toggle,
.menu-toggle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.theme-toggle:hover,
.menu-toggle:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.theme-toggle svg,
.menu-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme="dark"] .theme-moon,
:root:not([data-theme="dark"]) .theme-sun { display: none; }

/* The ☰ turns into an ✕ while its menu is open. It, the dimmed page behind its drawer
   (added by js/main.js) and the drawer's logo, theme row and button only show on phones */
.menu-toggle,
.menu-backdrop,
.site-nav .site-nav-brand,
.site-nav-footer { display: none; }
.menu-toggle[aria-expanded="true"] .menu-icon-open,
.menu-toggle[aria-expanded="false"] .menu-icon-close { display: none; }

/* Compact header: while the page scrolls down (js/main.js), the pill gets shorter, moves up
   and drops the wordmark. Scrolling back up brings the full one back */

.site-header.is-compact { inset: 0.5rem 0 auto; }

.is-compact .site-header-pill {
  gap: 1.5rem;
  height: 3rem;
  padding: 0 0.375rem 0 0.875rem;
}

.is-compact .brand { gap: 0; font-size: 0; }
.is-compact .brand img { width: 1.5rem; height: 1.5rem; }
.is-compact .site-nav a { padding: 0.375rem 0.75rem; font-size: var(--fs-small); }
.is-compact .site-header-cta { padding: 0.5rem 1rem; }
.is-compact .theme-toggle { width: 2.25rem; height: 2.25rem; }

/* Sections */

.section { padding-block: var(--section-pad); }

/* Their title starts the section, so links stop a little above it to give it the same room
   below the menu as the titles beside an image */
#agents,
#calls { scroll-margin-top: 1.5rem; }

.section-head {
  max-width: 60rem;
  margin: 0 auto 4.5rem;
  text-align: center;
}

.section-head h2 { margin-bottom: 1rem; }
.section-head p { font-size: var(--fs-lead); text-wrap: balance; }

/* Every title fades from ink to the brand violet, like the hero's */
.hero h1,
.section h2 {
  background: var(--gradient-heading);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* A small violet label in a terminal font above each section title */
.section .eyebrow {
  margin-bottom: 1rem;
  font: 500 1.125rem / 1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* Violet sections: the section sits on a lavender band across the page; titles and text stay as elsewhere.
   The band is a see-through tint, so the layout grid (css/grid.css) still shows through it */
.section-violet { background: var(--gradient-band); }

/* Hero: a tight stack of pretitle and title, then the demo.
   It ends with a section's padding, so the first section sits as far below as the others do */

.hero {
  padding-block: 3.5rem var(--section-pad);
  text-align: center;
}

/* A smaller line above the hero title that reads into it */
.hero-pretitle {
  margin-bottom: 1.5rem;
  font-size: var(--fs-pretitle);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

.hero h1 {
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.hero-shot { margin-top: 4rem; }

/* Feature rows: text beside a wider image. They alternate sides: .reverse puts the image on the left */

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 4.5rem;
  align-items: center;
}

.feature-row.reverse { grid-template-columns: 1.5fr 1fr; }
.feature-row.reverse .feature-text { order: 2; }

.feature-text h2 { margin-bottom: 1rem; }
.feature-text p { font-size: var(--fs-lead); }

/* Numbered steps: a number and a word or two above each image */

.steps {
  display: grid;
  gap: 2.5rem;
  max-width: 35rem;
  margin-inline: auto;
  list-style: none;
}

.step {
  display: grid;
  gap: 0.875rem;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.step-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 1rem;
}

/* Stacked media under a section head */

.media-stack {
  display: grid;
  gap: 3rem;
  justify-items: center;
}

/* Mobile: the text beside the phone, the pair centered on the page */

.mobile-row {
  display: grid;
  grid-template-columns: minmax(0, 32rem) auto;
  justify-content: center;
  gap: 6rem;
  align-items: center;
}

/* Closing call to action. Double padding below: the section above already ends with its own,
   so the space above the text is two paddings, and the same space below centers it before the footer */

.cta {
  padding-bottom: calc(var(--section-pad) * 2);
  text-align: center;
}
.cta h2 { margin-bottom: 1rem; }
.cta p { font-size: var(--fs-lead); }
.cta .btn { margin-top: 2.5rem; }

/* Legal pages */

.legal {
  max-width: 47.5rem;
  padding-block: 5rem;
}

.legal h1 {
  font-size: var(--fs-h2);
  margin-bottom: 1.5rem;
}

.legal p + p { margin-top: 1rem; }

/* Page not found (404.html): a short centered message and a way home, tall enough
   to keep the footer at the bottom of the screen */

.not-found {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1rem;
  min-height: 75vh;
  padding-block: 5rem;
  text-align: center;
}

.not-found-code {
  font-size: var(--fs-lead);
  font-weight: 600;
  color: var(--accent-text);
}

.not-found h1 { font-size: var(--fs-h2); text-wrap: balance; }
.not-found p { font-size: var(--fs-lead); }
.not-found .btn { margin-top: 1rem; }

/* Footer */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-muted);
  font-size: var(--fs-small);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-block: 4rem;
}

.site-footer .brand {
  gap: 0.75rem;
  font-size: 1.5rem;
  color: var(--footer-text);
}

.site-footer .brand img {
  width: 2.5rem;
  height: 2.5rem;
}

.footer-tagline {
  margin-top: 1.5rem;
  text-wrap: pretty;
  color: var(--footer-text);
}

/* The systems Zigzag runs on, as logos named by their title, which shows on hover */
.footer-platforms {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.footer-platforms svg {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
  transition: color var(--dur-fast) var(--ease);
}

.footer-platforms svg:hover { color: var(--footer-text); }

.footer-title {
  margin-bottom: 1rem;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--footer-text);
}

.footer-col a {
  display: block;
  padding-block: 0.25rem;
  transition: color var(--dur-fast) var(--ease);
}

.footer-col a:hover { color: var(--footer-text); }

/* The copyright on the left and the legal links on the right, under a thin line */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--footer-border);
}

.footer-legal {
  display: flex;
  gap: 1.5rem;
}

.footer-legal a { transition: color var(--dur-fast) var(--ease); }
.footer-legal a:hover { color: var(--footer-text); }

/* Tablets and phones turned sideways: feature rows stack, the text above its image */
@media (max-width: 1023px) {
  /* The menu's five links pack closer, so the pill still fits down to the phone layout */
  .site-header-pill { gap: 1.25rem; }
  .site-nav { gap: 0; }
  .site-nav a { padding-inline: 0.75rem; }

  .hero h1 { text-wrap: balance; }
}

/* Small tablets: the menu's links a step smaller too, for the narrowest screens before the phone menu */
@media (max-width: 900px) {
  .site-nav a { padding-inline: 0.5rem; font-size: var(--fs-small); }

  .feature-row,
  .feature-row.reverse {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .feature-row.reverse .feature-text { order: 0; }
  .feature-text { max-width: 40rem; }

  .mobile-row { gap: 3rem; }
}

/* Phones: one column everywhere, the text above its image */
@media (max-width: 760px) {
  .container { width: min(100% - 2.5rem, var(--container)); }

  /* The header pill keeps the logo and name, the theme switch, the button and the ☰, smaller.
     The links move into a drawer that the ☰ slides in from the right (js/main.js) */
  .site-header { inset: 0.75rem 0 auto; }
  .site-header-pill { gap: 1.25rem; height: 3.25rem; padding: 0 0.375rem 0 0.75rem; }
  .site-header .brand { gap: 0.5rem; font-size: 1rem; }
  .site-header .brand img { width: 1.5rem; height: 1.5rem; }
  .site-header .site-header-cta { padding: 0.625rem 0.75rem; font-size: 0.875rem; }
  .site-header-actions { gap: 0.125rem; }
  .theme-toggle,
  .menu-toggle { width: 2.25rem; height: 2.25rem; }

  /* The ☰ stays on top of the drawer, as its ✕, so it closes where it opened */
  .menu-toggle {
    position: relative;
    z-index: 3;
    display: grid;
  }

  /* The drawer: the screen's full height, sliding in from the right edge. Off screen while closed */
  .site-nav {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    width: min(20rem, 100% - 3rem);
    padding: 5rem 1rem 1.5rem;
    border-left: 1px solid var(--border);
    background: var(--surface);
    box-shadow: -16px 0 32px -12px rgb(16 16 20 / 0.3);
    visibility: hidden;
    transform: translateX(100%);
  }

  .is-menu-open .site-nav {
    visibility: visible;
    transform: none;
  }

  .site-nav a,
  .is-compact .site-nav a {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
  }

  /* The drawer's top: the logo and name, level with the ✕ */
  .site-header .site-nav .site-nav-brand {
    position: absolute;
    top: 2.375rem;
    left: 2rem;
    display: inline-flex;
    padding: 0;
    font-size: 1rem;
    font-weight: 800;
    transform: translateY(-50%);
  }

  .site-header .site-nav .site-nav-brand:hover { background: none; }

  .site-header.is-compact .site-nav .site-nav-brand { top: 1.875rem; }

  /* The drawer's bottom: the theme row and the button, under a line */
  .site-nav-footer {
    display: grid;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  .menu-theme {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--text);
    font: 600 var(--fs-body) / 1.2 var(--font-sans);
    cursor: pointer;
  }

  .menu-theme:hover { background: var(--bg-alt); }

  .menu-theme svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .site-header .site-nav a.site-nav-cta {
    padding: 1rem 2rem;
    border-radius: 999px;
    font-size: var(--fs-body);
    color: var(--accent-contrast);
  }

  .site-header .site-nav a.site-nav-cta:hover { background: var(--accent-hover); }

  /* Behind the drawer, the page dims; a tap on it closes the menu */
  .menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: block;
    background: rgb(16 16 20 / 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
  }

  .is-menu-open .menu-backdrop {
    opacity: 1;
    visibility: visible;
  }

  /* While the page scrolls down (js/main.js), the pill folds into just its ☰ and moves to the right edge;
     scrolling back up brings the whole pill back. The header keeps it centered, so it moves by left:
     half the screen, less the folded pill's own half (1.375rem) and the right margin (1.25rem) */
  .site-header-pill { position: relative; left: 0; }

  .site-header-pill > .brand,
  .site-header .site-header-cta,
  .site-header .theme-toggle { max-width: 8rem; overflow: hidden; }

  .site-header.is-compact { inset: 0.5rem 0 auto; }
  .is-compact .site-header-pill { left: calc(50% - 2.625rem); gap: 0; height: 2.75rem; padding: 0.25rem; }
  .is-compact .site-header-actions { gap: 0; }

  .is-compact .site-header-pill > .brand,
  .is-compact .site-header-cta,
  .is-compact .theme-toggle {
    max-width: 0;
    padding-inline: 0;
    border-width: 0;
    opacity: 0;
    visibility: hidden;
  }

  .is-compact .menu-toggle { width: 2.25rem; height: 2.25rem; }

  /* The drawer's logo keeps its size whatever the pill does */
  .site-header .site-nav .site-nav-brand img { width: 1.5rem; height: 1.5rem; }

  .hero { padding-block: 2rem var(--section-pad); }
  .hero h1 { text-wrap: balance; }
  .hero-shot { margin-top: 2.5rem; }

  .section-head { margin-bottom: 2.5rem; }

  .feature-row,
  .feature-row.reverse {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .feature-row.reverse .feature-text { order: 0; }

  /* Stacked above their image, the side titles and their text center, like the section titles */
  .feature-text { text-align: center; }

  .mobile-row {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2.5rem;
  }

  /* The logo and tagline take the full width, with Product below on the left
     and Resources and Company stacked beside it */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem 2rem;
    padding-block: 3rem;
  }

  .footer-grid > :first-child { grid-column: 1 / -1; }
  .footer-grid > :nth-child(2) { grid-row: span 2; }
  .footer-tagline { margin-top: 1rem; }
}
