/* Reusable layout primitives shared across site pages.
   Tokens come from index.css. */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Content layout: a centered band at --content-width with side fillers
   that grow into any remaining viewport space. Sides hold a min-width
   of --pad-4 until the viewport collapses below 630px, at which point
   they disappear and the center takes the full width. */
.content {
  display: flex;
}
.content__side {
  flex: 1;
  min-width: var(--pad-4);
}
.content__center {
  flex: 0 1 var(--content-width);
}
@media (max-width: 630px) {
  .content__side {
    display: none;
  }
}

/* Button — mirrors the heavy and ghost (skeleton) variants of
   components/shared/lib/Button.tsx so site pages match the SPA. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--pad-2);
  padding: var(--pad-2) var(--pad-3);
  font-family: inherit;
  font-size: var(--font-3);
  border: none;
  border-radius: var(--rad-3);
  cursor: pointer;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 1px;
}
.btn--heavy {
  color: var(--font-color-inverse);
  background: var(--font-color);
}
.btn--ghost {
  color: var(--font-color);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--highlight);
}

/* Quarter grid — divides .content__center into 4 equal columns.
   .col-half spans 2 of 4 (50%), .col-quarter spans 1 of 4 (25%).
   Responsive: 4-col → 2-col at 900px → 1-col at 640px.
   Gap defaults to --pad-7; override with inline style if needed. */
.quarter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.col-half { grid-column: span 2; }
.col-quarter { grid-column: span 1; }
@media (max-width: 900px) {
  .quarter-grid { grid-template-columns: repeat(2, 1fr); }
  .col-half { grid-column: span 2; }
}
@media (max-width: 640px) {
  .quarter-grid { grid-template-columns: 1fr; }
  .col-half { grid-column: span 1; }
}

/* Sidebar layout — a sticky 1/4-width sidebar on the left with a
   3/4-width main content area on the right. The sidebar sticks below
   the header while scrolling through the content; when the content
   ends, the sidebar scrolls away with it. Stacks at 900px (sidebar
   on top, content below). */
.sidebar-layout {
  display: flex;
  align-items: flex-start;
}
.sidebar {
  flex: 0 0 25%;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  scrollbar-width: none;
  padding: var(--pad-9) var(--pad-4) var(--pad-9) 0;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--pad-1);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-main {
  flex: 1;
  min-width: 0;
  border-left: 1px dashed var(--highlight-dark);
  padding: var(--pad-9) 0 var(--pad-9) var(--pad-4);
}
@media (max-width: 900px) {
  .sidebar-layout {
    flex-direction: column;
  }
  .sidebar {
    flex: none;
    width: 100%;
    position: static;
    max-height: none;
    padding-top: var(--pad-6);
    padding-bottom: var(--pad-6);
  }
  .sidebar-main {
    border-left: none;
    padding: var(--pad-6) 0;
    border-top: 1px dashed var(--highlight-dark);
    margin-top: 0;
  }
}

/* Ask-AI banner — "Skip the reading" callout with a copy-to-clipboard
   URL button. Used on docs/setup pages to nudge users toward pasting
   the page link into their AI instead of reading manually. */
.ask-ai {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pad-4);
  padding: var(--pad-4);
  background: var(--highlight-transparent);
  border-radius: var(--rad-3);
}
.ask-ai__text {
  display: flex;
  flex-direction: column;
  gap: var(--pad-1);
}
.ask-ai__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--font-3);
  font-weight: 600;
  color: var(--font-color);
}
.ask-ai__body {
  margin: 0;
  font-size: var(--font-3);
  color: var(--font-color-light);
  line-height: 1.4;
}
.ask-ai__url {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--font-3);
  color: var(--font-color);
  background: transparent;
  border: none;
  padding: var(--pad-2) var(--pad-3);
  border-radius: var(--rad-2);
  box-shadow: inset 0 0 0 1px var(--highlight);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.ask-ai__url:hover {
  background: var(--highlight);
}
.ask-ai__url:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 1px;
}
@media (max-width: 640px) {
  .ask-ai {
    flex-direction: column;
    align-items: flex-start;
  }
  .ask-ai__url {
    align-self: stretch;
    text-align: center;
  }
}

/* Sidebar links — TOC-style nav links for the sticky sidebar. */
.sidebar__link {
  font-size: var(--font-4);
  color: var(--font-color-light);
  text-decoration: none;
  transition: color 0.15s ease;
  display: block;
  padding: var(--pad-2) var(--pad-3);
  border-radius: var(--rad-1);
}
.sidebar__link:hover {
  color: var(--font-color);
}
.sidebar__link:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: -2px;
  border-radius: var(--rad-3);
}

.sidebar__badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--highlight-transparent);
  color: var(--font-color-light);
  margin-left: 6px;
  vertical-align: middle;
}

/* Page header — title + subtitle + ask-ai for sidebar-layout pages. */
.page-title {
  font-family: var(--font-display);
  font-size: var(--font-8);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--font-color);
  margin: 0 0 var(--pad-4);
}
.page-subtitle {
  font-size: var(--font-4);
  line-height: 1.5;
  color: var(--font-color-light);
  margin: 0;
  max-width: 800px;
}
.page-ask-ai {
  margin-top: var(--pad-5);
}

/* Agent section headings — icon + name side by side. */
.agent-heading {
  font-family: var(--font-display);
  font-size: var(--font-6);
  font-weight: 600;
  color: var(--font-color);
  margin: 0 0 var(--pad-4);
  display: flex;
  align-items: center;
  gap: var(--pad-2);
}
.agent-heading__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  transform: scale(1.2);
}
.agent-body {
  font-size: var(--font-3);
  line-height: 1.6;
  color: var(--font-color-light);
  margin: 0;
  max-width: 700px;
}
.agent-steps {
  font-size: var(--font-4);
  line-height: 1.6;
  color: var(--font-color);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--pad-3);
  max-width: 700px;
}
.agent-steps strong {
  color: var(--font-color);
  font-weight: 600;
}
.agent-steps__link {
  color: var(--font-color);
  font-weight: 500;
}
.agent-steps__link:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
.agent-steps__code {
  display: block;
  overflow-x: auto;
  margin-top: var(--pad-2);
  font-family: var(--font-mono);
  font-size: var(--font-3);
  color: var(--font-color);
  background: var(--highlight-transparent);
  padding: var(--pad-2) var(--pad-3);
  border-radius: var(--rad-2);
  border: none;
  outline: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.agent-steps__code:hover {
  background: var(--highlight);
}
.agent-steps__code:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 1px;
}

/* OS tabs — macOS / Linux / Windows selector above a code block. */
.os-tabs {
  margin-top: var(--pad-2);
  max-width: 80%;
}
.os-tabs__bar {
  display: flex;
  gap: 0;
}
.os-tabs__btn {
  font-family: var(--font-body);
  font-size: var(--font-2);
  padding: var(--pad-1) var(--pad-3);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--font-color-light);
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.os-tabs__btn:hover {
  color: var(--font-color);
}
.os-tabs__btn--active {
  color: var(--font-color);
  border-bottom-color: var(--font-color);
}
.os-tabs__btn:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 1px;
  border-radius: 2px;
}
.os-tabs__panel {
  display: none;
}
.os-tabs__panel--active {
  display: block;
}
.os-tabs__panel .agent-steps__code {
  margin-top: 0;
  border-radius: 0 0 var(--rad-2) var(--rad-2);
}

/* Header — shared nav bar + mobile menu used across site pages.
   Includes desktop nav links (hidden at 700px), burger menu (shown at
   700px), mobile menu overlay with fade + scroll lock, and the
   menu-open body class that fades out content centers. */
.header-logo:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
.header-nav a:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
.mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--font-color-inverse);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.content__center {
  transition: opacity 0.2s ease;
}
.menu-open .content__center {
  opacity: 0;
}
.mobile-menu .content__center,
#header .content__center {
  opacity: 1 !important;
}
#header {
  transition: background 0.2s ease;
}
.menu-open #header {
  background: var(--font-color-inverse);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu.mobile-menu--open {
  opacity: 1;
  pointer-events: auto;
  background: var(--font-color-inverse);
}
.mobile-menu__link {
  font-family: var(--font-display);
  font-size: var(--font-5);
  font-weight: 500;
  color: var(--font-color);
  padding-bottom: var(--pad-5);
  border-bottom: 1px solid var(--highlight);
  text-decoration: none;
}
.mobile-menu__link:hover { opacity: 0.7; }
.mobile-menu__link:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
.header-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--rad-2);
}
.header-burger:hover {
  background: var(--highlight);
}
.header-burger:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 1px;
}
.burger-line {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--font-color);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.header-burger--open .burger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.header-burger--open .burger-line:nth-child(2) {
  opacity: 0;
}
.header-burger--open .burger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}
@media (max-width: 700px) {
  .header-nav { display: none !important; }
  .header-burger { display: inline-flex; }
}

/* CTA grid — "Start building today" section with half-width hero
   (title + subtitle + buttons) and two quarter-width feature cards.
   Depends on .quarter-grid, .col-half, .col-quarter above. */
.cta-grid__hero {
  display: flex;
  flex-direction: column;
  gap: var(--pad-4);
  padding: var(--pad-9) var(--pad-4);
}
.cta-grid__title {
  font-family: var(--font-display);
  font-size: var(--font-7);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--font-color);
  margin: 0;
}
.cta-grid__subtitle {
  font-size: var(--font-4);
  line-height: 1.5;
  color: var(--font-color-light);
  margin: 0;
  max-width: 90%;
}
.cta-grid__buttons {
  display: flex;
  gap: var(--pad-3);
  flex-wrap: wrap;
}
.cta-grid__card {
  display: flex;
  flex-direction: column;
  gap: var(--pad-3);
  padding: var(--pad-9) var(--pad-4);
}
.cta-grid__card-title {
  font-family: var(--font-display);
  font-size: var(--font-4);
  font-weight: 600;
  color: var(--font-color);
  margin: 0;
}
.cta-grid__card-body {
  font-size: var(--font-3);
  line-height: 1.5;
  color: var(--font-color-light);
  margin: 0;
}
.cta-grid__link {
  font-size: var(--font-3);
  font-weight: 500;
  color: var(--font-color);
  text-decoration: none;
  align-self: flex-start;
}
.cta-grid__link:hover {
  text-decoration: underline;
}
.cta-grid__link:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
@media (max-width: 900px) {
  .cta-grid__hero,
  .cta-grid__card {
    padding-top: 0;
    padding-bottom: 0;
  }
  .cta-grid__hero { padding-top: var(--pad-9); }
  .cta-grid__card:last-child { padding-bottom: var(--pad-9); }
}
@media (max-width: 640px) {
  .cta-grid__subtitle,
  .cta-grid__card-body {
    max-width: 70%;
  }
  .cta-grid__buttons .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}

/* Footer grid — shared 4-column footer used across site pages.
   Depends on .quarter-grid and .col-quarter above. Light vertical
   dividers between columns collapse at 2-col and 1-col breakpoints. */
.footer-grid__col {
  padding: var(--pad-5) var(--pad-4);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}
.footer-grid__col:last-child { box-shadow: none; }
.footer-grid__title {
  font-family: var(--font-display);
  font-size: var(--font-3);
  font-weight: 700;
  color: var(--font-color-inverse);
  margin: 0 0 var(--pad-3);
}
.footer-grid__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--pad-2);
}
.footer-grid__list a {
  font-size: var(--font-3);
  color: var(--font-color-inverse);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.footer-grid__list a:hover { opacity: 1; }
.footer-grid__list a:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
.footer-grid__address {
  font-style: normal;
  font-size: var(--font-3);
  line-height: 1.5;
  opacity: 0.7;
  margin: 0 0 var(--pad-2);
}
.footer-grid__email {
  font-size: var(--font-3);
  color: var(--font-color-inverse);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.footer-grid__email:hover { opacity: 1; }
.footer-grid__email:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
#row-5 a:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
  border-radius: 2px;
}
@media (max-width: 900px) {
  .footer-grid__col { box-shadow: none; }
  .footer-grid__col:nth-child(odd) {
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.1);
  }
}
@media (max-width: 640px) {
  .footer-grid__col,
  .footer-grid__col:nth-child(odd) { box-shadow: none; }
}
