/* weave docs — small extras layered on top of Tailwind */
:root {
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  overflow-x: clip;
  max-width: 100%;
}

/* Prevent grid children from forcing horizontal page scroll */
.docs-layout,
.docs-layout > article,
.docs-layout > main,
.docs-layout > aside {
  min-width: 0;
}

article,
main {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.font-mono,
code,
pre {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", monospace;
}

code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Woven gradient backdrop for hero */
.bg-weave {
  background:
    radial-gradient(60% 50% at 20% 0%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(50% 40% at 90% 10%, rgba(251, 191, 36, 0.12), transparent 60%),
    radial-gradient(40% 40% at 50% 100%, rgba(45, 212, 191, 0.10), transparent 60%),
    #020617;
}

/* Subtle thread pattern */
.bg-threads {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Code blocks */
.code-block {
  position: relative;
  max-width: 100%;
}

pre.code {
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  padding-right: 3.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #e2e8f0;
  max-width: 100%;
  margin: 0;
}

pre.code .tok-cmd {
  color: #fbbf24;
}

pre.code .tok-flag {
  color: #67e8f9;
}

pre.code .tok-str {
  color: #a7f3d0;
}

pre.code .tok-comment {
  color: #64748b;
  font-style: italic;
}

.code-block .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.7rem;
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  z-index: 1;
}

.code-block .copy-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #f1f5f9;
}

.code-block .copy-btn.copied {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

/* Anchor link target offset for fixed header */
:target {
  scroll-margin-top: 6rem;
}

/* Tabs (used on install / landing install block) */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.12);
  width: 100%;
  max-width: 100%;
}

.tab-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  color: #cbd5e1;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 120ms ease, color 120ms ease;
}

.tab-btn:hover {
  color: #f1f5f9;
}

.tab-btn[aria-selected="true"] {
  background: rgba(99, 102, 241, 0.22);
  color: #e0e7ff;
  box-shadow: inset 0 0 0 1px rgba(165, 180, 252, 0.25);
}

.tab-panel[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Responsive layout                                                    */
/* ------------------------------------------------------------------ */

header > div.site-header-bar,
header > div:has(#nav-toggle) {
  position: relative;
}

/* Scroll wrappers for wide tables */
.table-scroll,
.capability-matrix,
.terraform-parity,
.overflow-x-auto.rounded-lg:has(table),
.overflow-x-auto.rounded-xl:has(table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.capability-matrix table,
.terraform-parity table,
.table-scroll table {
  min-width: 36rem;
}

/* Definition lists in state cards */
.meta-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
}

/* Module catalog / section headers */
.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 1rem;
}

.module-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.5rem;
}

.module-card-meta .tf-label {
  font-size: 0.7rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Mobile TOC toggle (injected by site.js) */
.toc-toggle {
  display: none;
  width: 100%;
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.toc-toggle::after {
  content: " ▾";
  float: right;
  opacity: 0.7;
}

.toc-toggle[aria-expanded="true"]::after {
  content: " ▴";
}

/* Terminal / code panels that must scroll, not clip */
.scroll-panel {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

@media (max-width: 1023px) {
  #nav-menu.is-open {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    gap: 0.25rem;
    padding: 0.75rem 1rem 1rem;
    background: rgba(2, 6, 23, 0.97);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }

  #nav-menu.is-open a {
    padding: 0.55rem 0.35rem;
    border-radius: 0.375rem;
  }

  #nav-menu.is-open a:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .docs-layout > aside {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .docs-layout > aside .toc-label-desktop {
    display: none;
  }

  .toc-toggle {
    display: block;
  }

  .docs-layout > aside:not(.toc-expanded) .page-toc-nav {
    display: none;
  }

  .docs-layout > aside.toc-expanded .page-toc-nav {
    display: block;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.5rem;
    padding-right: 0.25rem;
  }

  .meta-dl {
    grid-template-columns: 1fr;
  }

  .meta-dl dt {
    margin-top: 0.5rem;
    color: #94a3b8;
  }

  .meta-dl dt:first-child {
    margin-top: 0;
  }

  pre.code {
    font-size: 0.75rem;
    padding: 0.75rem 3rem 0.75rem 0.85rem;
  }

  .section-heading h2 {
    font-size: 1.35rem;
  }
}

@media (max-width: 639px) {
  .hero-title {
    font-size: 1.875rem !important;
    line-height: 1.2 !important;
  }

  .hero-lead {
    font-size: 1rem !important;
  }
}
