/*
 * thykes.com — the site's own styles: layout and the few patterns Thykes does not
 * ship (the top bar shell, the search trigger, link pills, the table of contents,
 * the index tiles, the example stage). Every color, space, radius, type and shadow
 * value is a Thykes token from /v0/tokens.css.
 *
 * The only literals are the page grid below (--site-*): Thykes has no layout-width
 * tokens, and these are the measures the approved mockups fix. Rules: site/CLAUDE.md.
 */

:root {
  --site-topbar: 64px;
  --site-sidebar: 240px;
  --site-prose: 720px;
  --site-wide: 912px;
  --site-toc: 200px;
  --site-search: 240px;
  --site-logo: 42px;         /* a 28px mark plus its built-in clear space (1/4 of the mark, each side) */
  --site-hero-logo: 168px;   /* a 112px mark plus clear space */
  --site-hero-logo-small: 120px;
  --site-tile-preview: 168px;
  --site-picker: 112px;
  --tk-sidebar-width: var(--site-sidebar);
}

/* ---------------------------------------------------------------- base */

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

html {
  /* the vertical scrollbar's room is kept even on a short tab, so the layout never shifts */
  scrollbar-gutter: stable;
  background: var(--surface-page);
  color: var(--text-default);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-body-md);
  -webkit-text-size-adjust: 100%;
  scroll-padding-block-start: calc(var(--site-topbar) + var(--space-24));
}

body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--surface-page);
}

@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

main:focus {
  outline: none;
}

a:focus-visible,
button:focus-visible,
[tabindex]:not(main):focus-visible {
  outline: var(--focus-ring-width) solid var(--border-accent-focus);
  outline-offset: var(--focus-ring-offset);
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  inset-block-start: var(--space-8);
  inset-inline-start: var(--space-8);
  z-index: var(--z-toast);
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-8);
  background: var(--surface-raised);
  box-shadow: var(--shadow-2);
  color: var(--text-default);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

.logo {
  display: block;
  color: var(--text-default);
}

/* ------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-24);
  block-size: var(--site-topbar);
  padding-inline: var(--space-16) var(--space-24);
  background: var(--surface-page);
}

.topbar-logo {
  display: block;
  flex: none;
  border-radius: var(--radius-8);
}

.topbar-logo .logo {
  block-size: var(--site-logo);
  inline-size: auto;
}

.topbar-sections {
  flex: none;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  margin-inline-start: auto;
}

.topbar-mobile {
  display: none;
  align-items: center;
  gap: var(--space-4);
  margin-inline-start: auto;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  inline-size: var(--site-search);
  block-size: var(--space-32);
  padding-inline: var(--space-8) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-8);
  background: var(--surface-page);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
  cursor: pointer;
}

@media (hover: hover) {
  .search-trigger:hover {
    background-image: linear-gradient(var(--state-hover), var(--state-hover));
  }
}

.search-trigger tk-icon {
  color: var(--icon-secondary);
}

.search-trigger-label {
  flex: 1;
  text-align: start;
}

.primary-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
}

.primary-dot {
  inline-size: var(--space-10);
  block-size: var(--space-10);
  border-radius: var(--radius-full);
  background: var(--fill-accent);
  box-shadow: inset 0 0 0 1px var(--border-default);
}

.primary-picker tk-select {
  inline-size: var(--site-picker);
}

.meta-link tk-icon {
  vertical-align: text-top;
}

.topbar-sections::part(list) {
  gap: var(--space-24);
}

/* tk-sidebar-nav-item keeps its 20px icon box even with no icon slotted; the docs
   rows have no icons, so the label returns to the row's inset (a DS gap, logged). */
tk-sidebar-nav-item:not(:has(> [slot='icon']))::part(icon) {
  display: none;
}

/* --------------------------------------------------------------- shell */

.shell {
  display: grid;
  grid-template-columns: var(--site-sidebar) minmax(0, 1fr);
}

.docs-sidebar {
  position: sticky;
  inset-block-start: var(--site-topbar);
  block-size: calc(100dvh - var(--site-topbar));
}

/* The docs shell reads as one surface: the panel takes the page surface instead of the
   library's default surface/raised (gray/800 in dark, a lighter grey than the page).
   A consumer choice for a docs layout, logged in OWED §8; the library default stays. */
.docs-sidebar::part(panel) {
  background: var(--surface-page);
  border-inline-end: 0; /* whitespace, not a line, separates it from the page (owner) */
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group + .nav-group {
  margin-block-start: var(--space-24);
}

.nav-group-label {
  margin: 0 0 var(--space-4);
  padding-inline: var(--space-8);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-body-xs);
  font-weight: var(--font-weight-medium);
}

.main {
  min-inline-size: 0;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, var(--site-prose)) var(--site-toc);
  column-gap: var(--space-64);
  justify-content: center;
  padding: var(--space-48) var(--space-48) var(--space-96);
}

.page--wide {
  grid-template-columns: minmax(0, var(--site-wide));
}

.page--wide .toc {
  display: none;
}

.doc {
  min-inline-size: 0;
}

/* ------------------------------------------------------------ doc head */

.doc-header h1 {
  margin: 0;
  font-size: var(--font-size-4xl);
  line-height: var(--line-height-heading-4xl);
  font-weight: var(--font-weight-semibold);
}

.doc-lede {
  margin: var(--space-12) 0 0;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-body-lg);
}

.doc-lede code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8) var(--space-24);
  margin-block-start: var(--space-24);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

.doc-tabs {
  display: block;
  margin-block-start: var(--space-40);
}

.doc-body {
  margin-block-start: var(--space-48);
}

.doc-panel:focus-visible {
  outline-offset: var(--space-8);
  border-radius: var(--radius-8);
}

.doc-section + .doc-section {
  margin-block-start: var(--space-64);
}

.doc-section > * + * {
  margin-block-start: var(--space-16);
}

.doc-section > :is(.example, tk-table, tk-code-block) {
  margin-block: var(--space-24);
}

.doc-section > :first-child {
  margin-block-start: 0;
}

.doc-section > :last-child {
  margin-block-end: 0;
}

.doc-section tk-code-block,
.doc-section tk-table {
  display: block;
}

/* ------------------------------------------------------------- example */

.example {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-8);
}

.doc-section > *,
.doc-panel {
  min-inline-size: 0;
}

.example-stage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-12);
  min-block-size: var(--space-96);
  padding: var(--space-48);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-16);
  background: var(--surface-page);
  color: var(--text-default);
  overflow-wrap: anywhere;
}

.example-stage--flow {
  display: block;
  text-align: center;
}

.example-stage > :is(tk-field, tk-banner, tk-section-message, tk-table, tk-data-table, tk-accordion,
  tk-tree, tk-code-block, tk-tab-bar, tk-empty-state, tk-progress-bar, tk-slider, tk-scroll-area,
  tk-splitter, tk-aspect-ratio, tk-checkbox-group, tk-radio-group, tk-divider, tk-navigation-menu,
  tk-prose, tk-text, tk-input, tk-textarea, tk-select, tk-combobox, tk-multiselect, tk-country-select,
  tk-phone-input, tk-date-picker, tk-time-picker, tk-number-input, tk-search-field, tk-inline-edit,
  tk-collapsible, tk-sidebar, tk-pagination, tk-breadcrumb, form, header, div, p, ul, ol, table) {
  flex: 1 1 100%;
}

.example-stage > :is(tk-field, tk-input, tk-textarea, tk-select, tk-combobox, tk-multiselect,
  tk-country-select, tk-phone-input, tk-date-picker, tk-time-picker, tk-number-input,
  tk-search-field, tk-inline-edit, tk-checkbox-group, tk-radio-group, form) {
  max-inline-size: calc(var(--site-prose) / 2);
}

.example-stage > tk-sidebar {
  block-size: calc(var(--space-96) * 3);
}

.example-stage > tk-divider[orientation='vertical'] {
  flex: none;
  block-size: var(--space-32);
}

/* ---------------------------------------------------------------- toc */

.toc {
  position: sticky;
  inset-block-start: calc(var(--site-topbar) + var(--space-48));
  align-self: start;
  max-block-size: calc(100dvh - var(--site-topbar) - var(--space-96));
  overflow-y: auto;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

.toc:not(:has(.toc-list:not([hidden]))) {
  visibility: hidden;
}

.toc-title {
  margin: 0 0 var(--space-12);
  font-weight: var(--font-weight-medium);
}

.toc-list {
  display: grid;
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list a {
  display: block;
  border-radius: var(--radius-4);
  color: var(--text-secondary);
  text-decoration: none;
}

@media (hover: hover) {
  .toc-list a:hover {
    color: var(--text-default);
  }
}

.toc-list a[aria-current='true'] {
  color: var(--text-default);
  font-weight: var(--font-weight-medium);
}

/* -------------------------------------------------------------- tiles */

.tile-group + .tile-group {
  margin-block-start: var(--space-64);
}

.tile-group h2 {
  margin: 0;
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-heading-2xl);
  font-weight: var(--font-weight-semibold);
}

.tile-group-blurb {
  margin: var(--space-8) 0 var(--space-24);
  color: var(--text-secondary);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-40) var(--space-24);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  min-inline-size: 0;
}

.tile-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  block-size: var(--site-tile-preview);
  padding: var(--space-16);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-16);
  background: var(--surface-page);
  color: var(--text-default);
}

@media (hover: hover) {
  .tile:hover .tile-preview {
    border-color: var(--border-default);
  }
}

.tile-name {
  margin: var(--space-16) 0 0;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-heading-lg);
  font-weight: var(--font-weight-semibold);
}

.tile-name a {
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-4);
}

.tile-name a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-16);
}

.tile-name a:focus-visible {
  outline: none;
}

.tile-name a:focus-visible::after {
  outline: var(--focus-ring-width) solid var(--border-accent-focus);
  outline-offset: var(--focus-ring-offset);
}

@media (hover: hover) {
  .tile-name a:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }
}

.tile-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: var(--space-4) 0 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

/* tile previews (site markup, tokens only) */
.pv-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-8); }
.pv-col { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-8); }
.pv-center { align-items: center; text-align: center; }
.pv-wide { inline-size: 100%; }
.pv-small { zoom: 0.62; }
.pv-strong { font-weight: var(--font-weight-semibold); }
.pv-muted { color: var(--text-secondary); font-size: var(--font-size-sm); line-height: var(--line-height-body-sm); }
.pv-text { font-size: var(--font-size-sm); line-height: var(--line-height-body-sm); }
.pv-swatches { display: flex; gap: var(--space-8); }
.pv-swatches span { inline-size: var(--space-32); block-size: var(--space-32); border-radius: var(--radius-8); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.pv-type { font-size: var(--font-size-6xl); line-height: var(--line-height-heading-6xl); font-weight: var(--font-weight-semibold); }
.pv-bars { display: flex; flex-direction: column; gap: var(--space-4); }
.pv-bars span { block-size: var(--space-6); background: var(--icon-tertiary); }
.pv-corners { display: flex; gap: var(--space-16); }
.pv-corners span { inline-size: var(--space-40); block-size: var(--space-40); border: 1px solid var(--border-default); background: var(--surface-subtle); }
.pv-card { inline-size: calc(var(--space-64) * 2); block-size: var(--space-80); border-radius: var(--radius-12); background: var(--surface-raised); box-shadow: var(--shadow-2); }
.pv-focus { outline: var(--focus-ring-width) solid var(--border-accent-focus); outline-offset: var(--focus-ring-offset); border-radius: var(--radius-8); }
.pv-curve { inline-size: calc(var(--space-80) * 2); color: var(--text-default); }
.pv-icons { display: grid; grid-template-columns: repeat(4, auto); gap: var(--space-16) var(--space-24); color: var(--icon-default); }
.pv-ratios { display: flex; align-items: flex-end; gap: var(--space-12); }
.pv-ratios span { inline-size: var(--space-96); border-radius: var(--radius-8); background: var(--surface-sunken); }
.pv-toast { padding: var(--space-8) var(--space-16); border-radius: var(--radius-full); background: var(--surface-inverse); color: var(--text-inverse); font-size: var(--font-size-sm); line-height: var(--line-height-body-sm); box-shadow: var(--shadow-2); }
.pv-panel { display: flex; flex-direction: column; gap: var(--space-8); min-inline-size: calc(var(--space-96) * 2); padding: var(--space-16); border-radius: var(--radius-16); background: var(--surface-raised); box-shadow: var(--shadow-2); font-size: var(--font-size-sm); line-height: var(--line-height-body-sm); text-align: start; }
.pv-panel-small { min-inline-size: 0; padding: var(--space-8) var(--space-12); }
.pv-panel strong { font-weight: var(--font-weight-semibold); font-size: var(--font-size-md); }
.pv-actions { display: flex; justify-content: flex-end; gap: var(--space-8); }
.pv-sheet { display: flex; justify-content: flex-end; align-self: stretch; inline-size: 100%; }
.pv-menu { min-inline-size: calc(var(--space-80) * 2); padding: var(--space-4); gap: 0; }
.pv-menu span { padding: var(--space-6) var(--space-12); border-radius: var(--radius-12); }
.pv-menu span:first-child { background: var(--state-hover); }
.pv-danger { color: var(--text-error); }
.pv-tip { padding: var(--space-4) var(--space-8); border-radius: var(--radius-8); background: var(--surface-inverse); color: var(--text-inverse); font-size: var(--font-size-xs); line-height: var(--line-height-body-xs); }
.pv-nav { display: flex; flex-direction: column; inline-size: calc(var(--space-96) * 2); }
.pv-image { display: flex; align-items: center; justify-content: center; inline-size: calc(var(--space-64) * 2); block-size: var(--space-80); border-radius: var(--radius-12); background: var(--surface-sunken); color: var(--icon-secondary); }
.pv-code { white-space: nowrap; padding: var(--space-8) var(--space-12); border: 1px solid var(--border-subtle); border-radius: var(--radius-8); background: var(--syntax-surface); color: var(--syntax-keyword); font-family: var(--font-family-mono); font-size: var(--font-size-sm); line-height: var(--line-height-body-sm); }
.pv-scroll { display: flex; flex-direction: column; gap: var(--space-8); inline-size: calc(var(--space-80) * 2); block-size: var(--space-80); overflow: hidden; mask-image: linear-gradient(to bottom, black 60%, transparent); }
.pv-scroll span { flex: none; block-size: var(--space-12); border-radius: var(--radius-4); background: var(--surface-sunken); }
.pv-split { display: flex; inline-size: calc(var(--space-96) * 2); block-size: var(--space-80); }
.pv-split span { flex: 1; border-radius: var(--radius-8); background: var(--surface-subtle); }
.pv-split i { inline-size: 1px; margin-inline: var(--space-8); background: var(--border-strong); }
.pv-skeleton { display: flex; align-items: center; gap: var(--space-12); inline-size: calc(var(--space-96) * 2); }
.pv-skeleton tk-skeleton[lines] { flex: 1; }
.pv-emoji { display: flex; gap: var(--space-8); font-size: var(--font-size-2xl); line-height: var(--line-height-heading-2xl); }
.pv-words { display: grid; grid-template-columns: auto auto; align-items: center; gap: var(--space-8) var(--space-24); font-size: var(--font-size-sm); }
.pv-words tk-badge { justify-self: end; }
.pv-prose { max-inline-size: calc(var(--space-96) * 2 + var(--space-24)); font-size: var(--font-size-sm); }

/* -------------------------------------------- generated doc blocks */

.tk-prose .icon-grid,
.tk-prose .swatches {
  list-style: none;
  padding-inline-start: 0;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--space-96) + var(--space-4)), 1fr));
  gap: var(--space-16);
  margin: var(--space-24) 0 0;
  padding: 0;
  list-style: none;
}

.tk-prose .icon-grid li,
.tk-prose .swatches li {
  margin: 0;
}

.icon-grid li {
  display: grid;
  justify-items: center;
  gap: var(--space-8);
  margin: 0;
}

.icon-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  block-size: var(--space-64);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-12);
  color: var(--icon-default);
}

.icon-name {
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-body-xs);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin: var(--space-24) 0 0;
  padding: 0;
  list-style: none;
}

.swatches li {
  margin: 0;
}

.swatch {
  display: grid;
  justify-items: center;
  gap: var(--space-8);
  min-inline-size: var(--space-64);
  padding: var(--space-8);
  border: 0;
  border-radius: var(--radius-12);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--font-size-xs);
  line-height: var(--line-height-body-xs);
  cursor: pointer;
}

@media (hover: hover) {
  .swatch:hover {
    background: var(--state-hover);
  }
}

.swatch-dot {
  inline-size: var(--space-24);
  block-size: var(--space-24);
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

.swatch[aria-pressed='true'] {
  color: var(--text-default);
  font-weight: var(--font-weight-medium);
}

.swatch[aria-pressed='true'] .swatch-dot {
  outline: 2px solid var(--text-default);
  outline-offset: 2px;
}

.word-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-16);
  margin-block-end: var(--space-16);
}

.word-filter tk-search-field {
  flex: 1 1 calc(var(--space-96) * 3);
  max-inline-size: calc(var(--space-80) * 4);
}

/* ------------------------------------------------------------ footer */

.site-footer {
  display: flex;
  gap: var(--space-16);
  max-inline-size: calc(var(--site-prose) + var(--site-toc) + var(--space-64));
  margin-inline: auto;
  padding: 0 var(--space-48) var(--space-48);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

/* ------------------------------------------------------------ search */

.search-dialog {
  --_results-max: 60dvh;
}

.search-field {
  display: block;
}

.search-results {
  max-block-size: var(--_results-max);
  margin-block-start: var(--space-12);
  overflow-y: auto;
  scrollbar-width: thin;
}

.search-results:empty {
  display: none;
}

.search-group-label {
  margin: var(--space-12) 0 var(--space-4);
  padding-inline: var(--space-12);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-body-xs);
  font-weight: var(--font-weight-medium);
}

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

.search-result {
  display: block;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-12);
  color: var(--text-default);
  text-decoration: none;
}

.search-result.is-active {
  background: var(--state-hover);
}

@media (hover: hover) {
  .search-result:hover {
    background: var(--state-hover);
  }
}

.search-result-title {
  font-weight: var(--font-weight-medium);
}

.search-result-crumb {
  margin-inline-start: var(--space-8);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.search-result-snippet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

.search-empty {
  margin: var(--space-16) var(--space-12);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.search-hints {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-24);
  margin-block-start: var(--space-16);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

.search-hints span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
}

/* ------------------------------------------------------- mobile menu */

/* A full-screen menu (Thykes has no full-screen modal; tk-sheet is an edge panel over a
   scrim): a native modal <dialog>, edge to edge on the page surface, no scrim, no
   corners. Its first row repeats the top bar, with Close where Menu was. */
.menu-screen {
  position: fixed;
  inset: 0;
  inline-size: 100%;
  max-inline-size: none;
  block-size: 100dvh;
  max-block-size: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-page);
  color: var(--text-default);
}

.menu-screen::backdrop {
  background: transparent;
}

.menu-screen[open] {
  display: flex;
  flex-direction: column;
}

@media (prefers-reduced-motion: no-preference) {
  .menu-screen[open] {
    animation: menu-screen-in var(--duration-160) var(--ease-default);
  }
}

@keyframes menu-screen-in {
  from { opacity: 0; }
}

html.menu-open {
  overflow: hidden;
}

.menu-screen-bar {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  block-size: var(--space-56);
  padding-inline: var(--space-8) var(--space-12);
  background: var(--surface-page);
}

.menu-screen-nav {
  flex: 1;
  padding: var(--space-8) var(--space-16) var(--space-24);
}

.menu-screen tk-sidebar-nav-item::part(item) {
  min-block-size: calc(var(--space-40) + var(--space-4)); /* a 44px touch row */
  font-size: var(--font-size-md);
  line-height: var(--line-height-body-md);
}

.menu-screen .nav-group-label {
  margin-block-start: var(--space-8);
}

.nav-group--sections {
  margin-block-end: var(--space-32);
}

.menu-screen-tools {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-16) var(--space-24);
  padding: var(--space-16) var(--space-24) var(--space-32);
}

/* ---------------------------------------------------- language switch */

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
  font-weight: var(--font-weight-medium);
}

.lang-switch > * {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-6);
}

.lang-current {
  color: var(--text-default);
  background: var(--fill-default);
}

.lang-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.lang-link:active {
  color: var(--text-default);
}

@media (hover: hover) {
  .lang-link:hover {
    color: var(--text-default);
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }
}

.doc-note {
  margin: 0 0 var(--space-16);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
}

/* -------------------------------------------------------------- home */

.home {
  display: flex;
  flex-direction: column;
  min-block-size: 100dvh;
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-16);
  padding: var(--space-16) var(--space-24);
}

.home-top-logo {
  margin-inline-end: auto;
  border-radius: var(--radius-8);
}

.home-top-logo .logo {
  block-size: var(--site-logo);
}

.home-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-48) var(--space-32);
  text-align: center;
}

.home-mark {
  margin: 0;
}

.logo--hero {
  block-size: var(--site-hero-logo);
  inline-size: auto;
}

.home-tagline {
  max-inline-size: calc(var(--space-96) * 4);
  margin: var(--space-8) 0 0;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-body-lg);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-12);
  margin-block-start: var(--space-40);
}

.home-footer {
  padding: var(--space-24) var(--space-24) var(--space-32);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-body-xs);
  text-align: center;
}

.notfound-code {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
}

.notfound-title {
  margin: var(--space-8) 0 0;
  font-size: var(--font-size-4xl);
  line-height: var(--line-height-heading-4xl);
  font-weight: var(--font-weight-semibold);
}

/* link pills: navigation that looks like a large round button (Thykes' button is
   for actions only and has no link form) */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-16); /* 20px line + 2 × 8 = the 36px large button */
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-body-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  white-space: nowrap;
}

.pill--primary {
  background: var(--fill-accent);
  color: var(--text-accent-on-fill);
}

@media (hover: hover) {
  .pill--primary:hover {
    background: var(--fill-accent-hover);
  }
}

.pill--primary:active {
  background: var(--fill-accent-active);
}

.pill--secondary {
  background: var(--surface-subtle);
  color: var(--text-default);
}

@media (hover: hover) {
  .pill--secondary:hover {
    background-image: linear-gradient(var(--state-hover), var(--state-hover));
  }
}

.pill--secondary:active {
  background-image: linear-gradient(var(--state-press), var(--state-press));
}

.pill--ghost {
  color: var(--text-default);
}

.pill--ghost:active {
  background: var(--state-accent-hover);
}

@media (hover: hover) {
  .pill--ghost:hover {
    background: var(--state-accent-hover);
  }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1279px) {
  .page {
    grid-template-columns: minmax(0, var(--site-prose));
  }

  .page--wide {
    grid-template-columns: minmax(0, var(--site-wide));
  }

  .toc {
    display: none;
  }
}

/* a narrow desktop: the top bar keeps one line (the search trigger narrows) */
@media (max-width: 1199px) {
  .topbar-tools {
    gap: var(--space-12);
  }

  .search-trigger {
    inline-size: calc(var(--space-80) * 2);
  }
}

@media (max-width: 1023px) {
  .topbar {
    gap: var(--space-16);
    block-size: var(--space-56);
    padding-inline: var(--space-8) var(--space-12);
  }

  .topbar-sections,
  .topbar-tools {
    display: none;
  }

  .topbar-mobile {
    display: flex;
  }

  html {
    scroll-padding-block-start: calc(var(--space-56) + var(--space-16));
  }

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

  .docs-sidebar {
    display: none;
  }

  .page,
  .page--wide {
    padding: var(--space-24) var(--space-16) var(--space-64);
  }

  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    padding-inline: var(--space-16);
  }
}

@media (max-width: 600px) {
  .doc-header h1 {
    font-size: var(--font-size-3xl);
    line-height: var(--line-height-heading-3xl);
  }

  .doc-body {
    margin-block-start: var(--space-40);
  }

  .doc-section + .doc-section {
    margin-block-start: var(--space-48);
  }

  .example-stage {
    padding: var(--space-24) var(--space-16);
  }

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

  .logo--hero {
    block-size: var(--site-hero-logo-small);
  }

  .home-actions {
    flex-direction: column;
    align-self: stretch;
  }

  .home-actions .pill {
    inline-size: 100%;
  }

  .home-actions .pill--ghost {
    inline-size: auto;
    align-self: center;
  }
}

.toc-list[hidden],
.doc-panel[hidden] {
  display: none;
}
