/* L7 Admin Guard — documentation
 * Two views: the docs landing (cards) and a single document
 * (left rail = all docs, centre = prose, right rail = this doc's TOC).
 */

/* ================= Landing ================= */

.doc-index {
  padding-top: 120px;
}

.doc-index-head {
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
  margin-bottom: clamp(36px, 5vw, 60px);
}

.doc-index-head h1 {
  font-size: clamp(34px, 5vw, 60px);
}

.doc-index-head .lead {
  margin: 0 auto;
  max-width: 62ch;
}

.doc-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  transition: transform .25s var(--ease-out), border-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}

.doc-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-ring);
  box-shadow: var(--shadow-md);
}

.doc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.doc-card-icon svg {
  width: 24px;
  height: 24px;
}

.doc-card h2 {
  font-size: clamp(20px, 1.8vw, 24px);
  letter-spacing: -0.02em;
}

.doc-card p {
  color: var(--fg-muted);
  font-size: 14.5px;
  line-height: 1.62;
  margin: 0;
}

.doc-card-audience {
  font-size: 13px;
  color: var(--fg-soft);
  line-height: 1.5;
}

.doc-card-audience b {
  color: var(--fg-muted);
  font-weight: 600;
}

.doc-card-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-card-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}

.doc-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
}

.doc-card:hover .doc-card-cta svg {
  transform: translateX(3px);
}

.doc-card-cta svg {
  transition: transform .25s var(--ease-out);
}

/* Quick entry points */
.doc-quick {
  margin-top: clamp(40px, 5vw, 64px);
}

.doc-quick-title {
  font-size: clamp(19px, 1.6vw, 22px);
  margin-bottom: 18px;
}

.doc-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.doc-quick-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: color-mix(in oklab, var(--surface) 55%, transparent);
  transition: border-color .2s, background-color .2s;
}

.doc-quick-item:hover {
  border-color: var(--accent-ring);
  background: var(--surface);
}

.doc-quick-item > svg {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--fg-faint);
  align-self: center;
}

.doc-quick-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  padding-top: 3px;
}

.doc-quick-body {
  display: grid;
  gap: 4px;
}

.doc-quick-name {
  font-weight: 600;
  font-size: 15px;
}

.doc-quick-desc {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* Not translated yet */
.doc-soon {
  max-width: 620px;
  margin: 0 auto;
  padding: 44px 36px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.doc-soon h2 {
  font-size: clamp(24px, 2.6vw, 32px);
}

.doc-soon p {
  color: var(--fg-muted);
  max-width: 46ch;
}

/* Help band */
.doc-help {
  margin-top: clamp(48px, 6vw, 80px);
  padding: 28px 32px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 60%), var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.doc-help h3 {
  font-size: clamp(19px, 1.8vw, 24px);
  margin-bottom: 6px;
}

.doc-help p {
  color: var(--fg-muted);
  font-size: 14.5px;
  margin: 0;
}

/* ================= Article layout ================= */

.doc-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 236px;
  gap: clamp(24px, 3vw, 52px);
  align-items: start;
  padding-top: 40px;
  padding-bottom: clamp(60px, 7vw, 110px);
}

.doc-rail {
  position: sticky;
  top: 88px;
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* --- left rail: all documents --- */
.doc-nav {
  display: grid;
  gap: 6px;
  padding-right: 8px;
}

.doc-nav-title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 10px 6px;
}

.doc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}

.doc-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-xs);
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.35;
  transition: background-color .18s, color .18s;
}

.doc-nav a:hover {
  background: var(--surface);
  color: var(--fg);
}

.doc-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--fg);
  font-weight: 600;
}

.doc-nav-icon {
  display: flex;
  color: var(--accent);
  flex-shrink: 0;
}

.doc-nav-icon svg {
  width: 16px;
  height: 16px;
}

.doc-nav-all {
  margin-top: 10px;
  padding: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-soft);
  border-top: 1px solid var(--hairline);
}

.doc-nav-all:hover {
  color: var(--accent);
}

/* --- right rail: table of contents --- */
.doc-toc {
  padding-left: 4px;
}

.doc-toc-summary {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0 12px 10px;
  list-style: none;
  cursor: default;
  /* The desktop rail is a permanently open <details>; only the mobile copy
     is interactive. */
  pointer-events: none;
}

.doc-toc-summary::-webkit-details-marker {
  display: none;
}

.doc-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--hairline);
}

.doc-toc-list a {
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg-soft);
  transition: color .18s, border-color .18s;
}

.doc-toc-list a:hover {
  color: var(--fg);
}

.doc-toc-list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.doc-toc-num {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: .6;
  padding-top: 2px;
}

.doc-toc-mobile {
  display: none;
  margin-bottom: 28px;
}

/* ================= Article head ================= */

.doc-article {
  min-width: 0;
}

.doc-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.doc-breadcrumbs a {
  color: var(--fg-muted);
  font-weight: 600;
}

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

.doc-breadcrumbs > span[aria-hidden] {
  color: var(--fg-faint);
}

.doc-title {
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -0.03em;
}

.doc-lead {
  margin-top: 14px;
  max-width: 68ch;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--hairline);
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--fg-muted);
  background: color-mix(in oklab, var(--surface) 60%, transparent);
}

.doc-chip svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

/* ================= Prose ================= */

.doc-content {
  padding-top: 8px;
  max-width: 74ch;
  font-size: 16px;
  line-height: 1.72;
  color: var(--fg-muted);
}

.doc-content p {
  margin: 16px 0;
}

.doc-content strong {
  color: var(--fg);
  font-weight: 600;
}

.doc-content a:not(.doc-anchor) {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in oklab, var(--link) 40%, transparent);
}

.doc-content a:not(.doc-anchor):hover {
  text-decoration-color: currentColor;
}

.doc-h {
  color: var(--fg);
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  scroll-margin-top: 92px;
}

.doc-h2 {
  font-size: clamp(23px, 2.4vw, 31px);
  margin: 52px 0 18px;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
}

.doc-content > .doc-h2:first-child {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}

.doc-h3 {
  font-size: clamp(18px, 1.7vw, 21px);
  margin: 34px 0 12px;
}

.doc-h4 {
  font-size: 16.5px;
  margin: 26px 0 10px;
}

.doc-h-num {
  font-family: var(--font-mono);
  font-size: .58em;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0;
  flex-shrink: 0;
}

.doc-anchor {
  font-family: var(--font-mono);
  font-size: .5em;
  color: var(--fg-faint);
  opacity: 0;
  transition: opacity .18s;
}

.doc-h:hover .doc-anchor {
  opacity: 1;
}

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

/* lists */
.doc-list {
  margin: 16px 0;
  padding-left: 22px;
  display: grid;
  gap: 9px;
}

.doc-list li::marker {
  color: var(--accent);
}

.doc-list-nested {
  margin: 9px 0 4px;
  gap: 7px;
}

/* blockquote / note */
.doc-note {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--accent-soft);
  color: var(--fg-muted);
  font-size: 15px;
}

.doc-note strong {
  color: var(--fg);
}

/* code */
.doc-content code {
  font-family: var(--font-mono);
  font-size: .87em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--fg);
  word-break: break-word;
}

.doc-code {
  position: relative;
  margin: 24px 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  overflow: hidden;
}

.doc-code pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--fg);
}

.doc-code code {
  background: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

.doc-code-lang {
  position: absolute;
  top: 10px;
  left: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.doc-code:has(.doc-code-lang) pre {
  padding-top: 34px;
}

.doc-code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--fg-soft);
  opacity: 0;
  transition: opacity .18s, color .18s, border-color .18s;
}

.doc-code:hover .doc-code-copy,
.doc-code-copy:focus-visible {
  opacity: 1;
}

.doc-code-copy:hover {
  color: var(--accent);
  border-color: var(--accent-ring);
}

.doc-code-copy::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  box-shadow: 3px -3px 0 -1.6px var(--surface), 3px -3px 0 0 currentColor;
}

.doc-code-copy.is-copied::before {
  width: 6px;
  height: 11px;
  border-width: 0 1.8px 1.8px 0;
  border-radius: 0;
  box-shadow: none;
  transform: rotate(45deg) translate(-1px, -2px);
  color: var(--ok);
}

/* screenshots */
.doc-figure {
  margin: 28px 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.doc-figure-zoom {
  display: block;
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  overflow: hidden;
  transition: border-color .2s var(--ease-out), box-shadow .25s var(--ease-out);
}

.doc-figure-zoom:hover {
  border-color: var(--accent-ring);
  box-shadow: var(--shadow-md);
}

.doc-figure img {
  width: 100%;
  height: auto;
}

.doc-figure figcaption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-soft);
  text-align: center;
  max-width: 60ch;
}

.doc-inline-img {
  display: inline-block;
  vertical-align: text-bottom;
  max-height: 1.5em;
  width: auto;
}

/* tables */
.doc-table-wrap {
  margin: 24px 0;
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.doc-table th,
.doc-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}

.doc-table thead th {
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0;
  white-space: nowrap;
}

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

.doc-table tbody tr:hover {
  background: color-mix(in oklab, var(--surface) 55%, transparent);
}

.doc-table td strong {
  color: var(--fg);
}

.doc-hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--hairline);
}

/* ================= Pager ================= */

.doc-pager {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.doc-pager-item {
  display: grid;
  gap: 4px;
  padding: 18px 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  transition: border-color .2s, background-color .2s;
}

.doc-pager-item:hover {
  border-color: var(--accent-ring);
  background: var(--surface);
}

.doc-pager-item.next {
  text-align: right;
}

.doc-pager-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.doc-pager-name {
  font-weight: 600;
  color: var(--fg);
}

/* ================= Responsive ================= */

@media (max-width: 1160px) {
  .doc-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .doc-rail-right {
    display: none;
  }

  .doc-toc-mobile {
    display: block;
  }

  .doc-toc-mobile .doc-toc {
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: 14px 6px 6px;
  }

  .doc-toc-mobile .doc-toc-summary {
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .doc-toc-mobile .doc-toc-summary::after {
    content: "+";
    font-size: 15px;
  }

  .doc-toc-mobile .doc-toc[open] .doc-toc-summary::after {
    content: "–";
  }
}

@media (max-width: 900px) {
  .doc-cards,
  .doc-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 24px;
  }

  .doc-rail-left {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 8px;
  }

  .doc-nav {
    padding: 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    background: var(--surface);
  }

  .doc-nav ul {
    grid-auto-flow: column;
    grid-auto-columns: minmax(140px, 1fr);
    overflow-x: auto;
  }

  .doc-nav-all {
    display: none;
  }
}

@media (max-width: 640px) {
  .doc-index {
    padding-top: 96px;
  }

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

  .doc-card {
    padding: 22px;
  }

  .doc-content {
    font-size: 15.5px;
  }

  .doc-pager-item.next {
    text-align: left;
  }

  .doc-help {
    padding: 24px;
  }
}
