/* docs.vertexstudios.app. Tokens, buttons and the footer come from tokens.css; fields and toasts from panel.css. */

.docs-header {
  max-width: 96rem;
}

.docs-header .brand {
  gap: var(--s-2);
}

.docs-header__section {
  padding-left: var(--s-2);
  border-left: 1px solid var(--line-strong);
  color: var(--text-2);
  font-weight: 500;
}

.docs-account {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.docs-account__name {
  overflow: hidden;
  max-width: 12rem;
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--s-6);
  width: 100%;
  max-width: 96rem;
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) var(--s-7);
}

.docs-nav {
  position: sticky;
  top: var(--s-4);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.docs-nav__title {
  margin: 0 0 var(--s-1);
  padding: 0 var(--s-2);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.docs-nav__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 var(--s-3);
  padding: 0;
  list-style: none;
}

.docs-nav__link {
  display: block;
  padding: 6px var(--s-2);
  border-radius: var(--r-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  text-decoration: none;
}

.docs-nav__link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.docs-nav__link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.docs-nav__link--muted {
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding-top: var(--s-2);
}

.docs-nav__empty,
.docs-empty {
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.docs-main {
  min-width: 0;
}

.docs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-2) var(--s-4);
  margin-bottom: var(--s-5);
}

.docs-head__title {
  flex: 1 1 100%;
  margin: 0;
  font-size: var(--fs-2xl);
  line-height: 1.2;
}

.docs-head__lead {
  flex: 1 1 auto;
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
}

.docs-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.docs-head__actions form {
  margin: 0;
}

.docs-head--editor {
  position: sticky;
  top: 0;
  z-index: 3;
  align-items: center;
  margin-bottom: 0;
  padding: var(--s-2) 0;
  background: var(--bg);
}

.docs-lock {
  padding: 6px var(--s-2);
  border-radius: var(--r-2);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--s-3);
  margin: 0 0 var(--s-6);
  padding: 0;
  list-style: none;
}

.docs-card {
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
}

.docs-card__title {
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 600;
  text-decoration: none;
}

.docs-card__title:hover {
  color: var(--accent);
}

.docs-card__meta {
  margin: var(--s-1) 0 0;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.docs-create {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-2);
  max-width: 36rem;
}

.docs-create .field {
  flex: 1 1 18rem;
}

.docs-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.docs-access {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--s-3);
}

/* ---------- Document ---------- */

.doc {
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.55;
}

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

.doc h2 {
  margin: var(--s-6) 0 var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-2);
  background: var(--accent-soft);
  color: var(--text);
  font-size: var(--fs-xl);
}

.doc h3 {
  margin: var(--s-5) 0 var(--s-2);
  font-size: var(--fs-lg);
}

.doc h4 {
  margin: var(--s-4) 0 var(--s-1);
  font-size: var(--fs-md);
}

.doc p {
  margin: 0 0 var(--s-3);
}

.doc blockquote {
  margin: 0 0 var(--s-3);
  padding-left: var(--s-3);
  border-left: 3px solid var(--line-strong);
  color: var(--text-2);
}

.doc hr {
  margin: var(--s-5) 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.doc a {
  color: var(--accent);
}

.doc .doc-banner {
  color: var(--text-2);
}

.doc .text-red {
  color: #d92b2b;
  font-weight: 600;
}

:root[data-theme="dark"] .doc .text-red {
  color: #ff6b6b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .doc .text-red {
    color: #ff6b6b;
  }
}

.doc table {
  display: block;
  overflow-x: auto;
  width: max-content;
  max-width: 100%;
  margin: 0 0 var(--s-4);
  border-collapse: collapse;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.doc th,
.doc td {
  min-width: 6rem;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  text-align: left;
  vertical-align: top;
}

.doc thead th {
  background: var(--surface-3);
  font-weight: 600;
  white-space: nowrap;
}

.doc tbody th {
  background: var(--surface-2);
  font-weight: 600;
}

.doc td.tone-verbal,
.doc td.tone-warning,
.doc td.tone-kick,
.doc td.tone-temp,
.doc td.tone-appealable,
.doc td.tone-permanent,
.doc td.tone-allowed,
.doc td.tone-denied,
.doc td.tone-heading {
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

.doc .tone-verbal { background: #cfe2f3; color: #10233a; }
.doc .tone-warning { background: #4a86e8; color: #ffffff; }
.doc .tone-kick { background: #ffe8a6; color: #3d2f00; }
.doc .tone-temp { background: #f4a999; color: #3b120a; }
.doc .tone-appealable { background: #c0504d; color: #ffffff; }
.doc .tone-permanent { background: #e53935; color: #ffffff; }
.doc .tone-allowed { background: #6aa84f; color: #ffffff; }
.doc .tone-denied { background: #e06666; color: #ffffff; }
.doc .tone-heading { background: #a4c2f4; color: #10233a; }
.doc .tone-muted { background: var(--surface-3); color: var(--text-2); }

/* ---------- Editor ---------- */

.docs-editor {
  display: flex;
  flex-direction: column;
}

.docs-title-field {
  flex: 1 1 20rem;
  min-width: 0;
}

.docs-title-input {
  width: 100%;
  padding: 4px var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-xl);
  font-weight: 700;
}

.docs-title-input:hover {
  border-color: var(--line);
}

.docs-title-input:focus {
  border-color: var(--accent-line);
  outline: none;
  background: var(--surface);
}

.docs-status {
  color: var(--text-3);
  font-size: var(--fs-sm);
}

.docs-status[data-state="dirty"] {
  color: var(--warn);
}

.docs-status[data-state="error"] {
  color: var(--danger);
}

.docs-toolbar {
  position: sticky;
  top: 3.5rem;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
}

.docs-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding-right: var(--s-2);
  border-right: 1px solid var(--line);
}

.docs-toolbar__group:last-child {
  border-right: 0;
}

.docs-tool {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.docs-tool .text-red {
  color: #d92b2b;
}

.docs-tool:hover:not(:disabled) {
  background: var(--surface-3);
}

.docs-tool:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.docs-tool:disabled,
.docs-toolbar .select:disabled {
  opacity: 0.4;
  cursor: default;
}

.docs-toolbar .select {
  width: auto;
  min-height: 30px;
  font-size: var(--fs-sm);
}

.doc--editing {
  min-height: 60vh;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  outline: none;
}

.doc--editing:focus {
  border-color: var(--accent-line);
}

.doc--editing td:focus-within,
.doc--editing th:focus-within {
  box-shadow: inset 0 0 0 2px var(--accent-line);
}

.docs-dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}

.docs-dialog::backdrop {
  background: rgb(0 0 0 / 0.4);
}

.docs-dialog__title {
  margin: 0 0 var(--s-3);
  font-size: var(--fs-lg);
}

.docs-dialog__text {
  margin: 0 0 var(--s-3);
  color: var(--text-2);
}

.docs-dialog .btn-row {
  justify-content: flex-end;
  margin-top: var(--s-3);
}

@media (max-width: 52rem) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-4);
  }

  .docs-nav {
    position: static;
  }

  .docs-nav__list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .docs-toolbar {
    top: 0;
  }

  .docs-head--editor {
    position: static;
  }

  .doc--editing {
    padding: var(--s-3);
  }
}

@media print {
  .site-header,
  .site-footer,
  .cookie-banner,
  .docs-nav,
  .docs-head__actions {
    display: none;
  }

  .docs-layout {
    display: block;
    padding: 0;
  }

  .doc table {
    display: table;
    width: 100%;
  }
}
