/*
 * docs.vitral.dev shell, Prism (option A). Tokens come from
 * /assets/brand/tokens.css (www/brand). Amber is used only for the current
 * page rule, the important callout rule, the active product underline and
 * the focus ring.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font: 400 16px/1.7 var(--font-sans);
  font-feature-settings: "ss01" on;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cobalt-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

kbd {
  font: 500 11px/1 var(--font-mono);
  color: var(--text-3);
  border: 1px solid var(--lead-strong);
  border-radius: 4px;
  padding: 3px 5px;
  background: var(--surface-1);
}

.icon {
  display: block;
  width: 16px;
  height: 16px;
  flex: none;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-sm);
}

.skip-link:focus {
  top: 12px;
}

/* --- Header ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--lead);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.lockup {
  display: block;
  height: 28px;
  width: auto;
  aspect-ratio: 1162 / 320;
}

.brand-tag {
  font: 500 12px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-left: 10px;
  border-left: 1px solid var(--lead-strong);
}

.product-switcher {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.product-link {
  position: relative;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text-2);
  border-radius: var(--r-sm);
}

.product-link:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--surface-1);
}

.product-link.is-current {
  color: var(--text);
}

.product-link.is-current::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -14px;
  height: 2px;
  background: var(--amber);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  height: 34px;
  padding: 0 8px 0 10px;
  font: 400 13.5px/1 var(--font-sans);
  color: var(--text-3);
  background: var(--surface-1);
  border: 1px solid var(--lead-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.search-trigger:hover {
  color: var(--text-2);
  border-color: var(--text-3);
}

.search-trigger kbd {
  margin-left: auto;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-1);
  border-color: var(--lead);
  text-decoration: none;
}

.theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.console-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--cobalt);
  border-radius: var(--r-sm);
}

.console-link:hover {
  background: var(--cobalt-hover);
  text-decoration: none;
}

.menu-button {
  display: none;
}

/* --- Shell ----------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - 61px);
}

.sidebar {
  position: sticky;
  top: 61px;
  align-self: start;
  height: calc(100vh - 61px);
  overflow-y: auto;
  padding: 28px 16px 48px 24px;
  border-right: 1px solid var(--lead);
  background: var(--bg);
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-switch {
  display: none;
  gap: 6px;
  margin: 0 0 20px;
}

.sidebar-switch-link {
  flex: 1;
  padding: 7px 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-2);
  border: 1px solid var(--lead-strong);
  border-radius: var(--r-sm);
}

.sidebar-product {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.nav-group {
  padding: 14px 0;
  border-top: 1px solid var(--lead);
}

.nav-group-label {
  margin: 0 0 8px;
  font: 500 11.5px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-left: -12px;
  padding: 5px 10px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text-2);
  border-left: 2px solid transparent;
}

a.nav-link:hover {
  color: var(--text);
  text-decoration: none;
  border-left-color: var(--lead-strong);
}

.nav-link.is-current {
  color: var(--text);
  border-left-color: var(--amber);
}

.nav-link.is-soon {
  color: var(--text-3);
  cursor: default;
}

.soon {
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border: 1px solid var(--lead-strong);
  border-radius: 999px;
  padding: 3px 7px;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 760px) 220px;
  justify-content: center;
  gap: 56px;
  padding: 48px 48px 96px;
  min-width: 0;
}

/* --- Article --------------------------------------------------------------- */

.article {
  min-width: 0;
}

.article > :first-child {
  margin-top: 0;
}

.article h1,
.article h2,
.article h3,
.article h4 {
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.article h1 {
  margin: 0 0 20px;
  font-size: 40px;
  letter-spacing: -0.035em;
}

.article h2 {
  margin: 48px 0 14px;
  padding-top: 24px;
  font-size: 26px;
  border-top: 1px solid var(--lead);
}

.article h3 {
  margin: 32px 0 10px;
  font-size: 19px;
}

.article h4 {
  margin: 24px 0 8px;
  font-size: 16px;
}

.article p,
.article ul,
.article ol {
  margin: 0 0 16px;
}

.article li + li {
  margin-top: 4px;
}

.article strong {
  color: var(--text);
  font-weight: 600;
}

.article hr {
  border: 0;
  border-top: 1px solid var(--lead);
  margin: 32px 0;
}

.article :not(pre) > code {
  font: 0.86em/1.4 var(--font-mono);
  color: var(--text);
  background: var(--surface-1);
  border: 1px solid var(--lead);
  border-radius: 4px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

.article a code {
  color: var(--cobalt-text);
}

figure.code {
  margin: 0 0 20px;
  background: var(--surface-1);
  border: 1px solid var(--lead-strong);
  border-radius: var(--r);
  overflow: hidden;
}

figure.code figcaption {
  padding: 8px 14px;
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--lead);
}

figure.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font: 13px/1.65 var(--font-mono);
  color: var(--text);
  tab-size: 2;
}

.table-wrap {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--lead);
  border-radius: var(--r);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.table-wrap th,
.table-wrap td {
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--lead);
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.table-wrap th {
  font: 500 11.5px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-1);
}

.callout {
  margin: 0 0 20px;
  padding: 12px 18px;
  border: 1px solid var(--lead);
  border-left: 2px solid var(--cobalt-text);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--cobalt-wash);
  color: var(--text-2);
}

.callout-important {
  border-left-color: var(--amber);
  background: var(--amber-wash);
}

.callout > :last-child {
  margin-bottom: 0;
}

/* Docs home */

.product-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 8px 0 32px;
  border: 1px solid var(--lead-strong);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--glass);
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 20px 24px;
  color: var(--text-2);
  border-left: 1px solid var(--lead);
  background-image: linear-gradient(var(--slant), var(--cobalt-wash), transparent 55%);
}

.product-card:first-child {
  border-left: 0;
}

.product-card:hover {
  text-decoration: none;
  background-color: var(--surface-1);
}

.product-card-status {
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.product-card-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.product-card-summary {
  font-size: 14px;
  line-height: 1.55;
}

/* Page actions */

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--lead);
}

.action {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font: 500 12.5px/1 var(--font-mono);
  color: var(--text-2);
  background: var(--surface-1);
  border: 1px solid var(--lead-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.action:hover {
  color: var(--text);
  border-color: var(--text-3);
  text-decoration: none;
}

/* On-page TOC */

.toc {
  position: sticky;
  top: 101px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  font-size: 13px;
}

.toc-title {
  margin: 0 0 10px;
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--lead);
}

.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
}

.toc .toc-3 a {
  padding-left: 24px;
}

/* --- Footer ---------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--lead);
  background: var(--bg-deep);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 24px;
  font-size: 13.5px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-brand p {
  margin: 0;
  color: var(--text-3);
}

.lockup-footer {
  height: 18px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.footer-links a {
  color: var(--text-2);
}

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

.footer-github {
  display: inline-flex;
}

.footer-legal {
  margin: 0;
  color: var(--text-3);
  font: 12px/1 var(--font-mono);
}

/* --- Search palette ------------------------------------------------------- */

dialog.search {
  width: min(640px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  color: var(--text-2);
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--lead-strong);
  border-top-color: var(--edge-light);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

dialog.search[open] {
  display: flex;
  flex-direction: column;
}

dialog.search::backdrop {
  background: rgba(9, 11, 17, 0.55);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--lead);
  color: var(--text-3);
}

.search-box input {
  flex: 1;
  height: 52px;
  font: 400 16px/1 var(--font-sans);
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
}

.search-results a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
}

.search-results a:hover,
.search-results [aria-selected="true"] a {
  background: var(--cobalt-wash);
  text-decoration: none;
}

.search-crumb {
  display: block;
  font: 500 11px/1.5 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.search-empty {
  margin: 0;
  padding: 20px;
  color: var(--text-3);
}

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

@media (max-width: 1180px) {
  .main {
    grid-template-columns: minmax(0, 760px);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 920px) {
  .header-row {
    gap: 10px;
    padding: 0 14px;
  }

  .menu-button {
    display: inline-grid;
  }

  .product-switcher,
  .search-trigger-label,
  .search-trigger kbd {
    display: none;
  }

  .search-trigger {
    min-width: 0;
    width: 34px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }

  .shell {
    display: block;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 61px;
    left: 0;
    right: 0;
    z-index: 15;
    /* Explicit height: with align-self: start (desktop rule) Chrome sizes a
       fixed box to its content instead of to top/bottom insets. */
    align-self: auto;
    height: calc(100vh - 61px);
    height: calc(100dvh - 61px);
    border-right: 0;
  }

  .nav-open .sidebar {
    display: block;
  }

  .sidebar-switch {
    display: flex;
  }

  .main {
    display: block;
    padding: 28px 20px 72px;
  }

  .article h1 {
    font-size: 30px;
  }

  .product-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-card {
    border-left: 0;
    border-top: 1px solid var(--lead);
  }

  .product-card:first-child {
    border-top: 0;
  }

  .footer-links {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .console-link {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.nav-link.is-external::after {
  content: "↗";
  margin-left: 0.35em;
  font-size: 0.8em;
  color: var(--text-3);
}
