/* ============================================================
   Page components.

   The shared vocabulary for the permanent pages: status notes,
   empty / no-results / error / coming-soon states, search, accessible
   accordions, and the documentation structure.

   Everything here uses the design tokens from site.css, so the pages
   stay visually identical to the rest of the site.
   ============================================================ */

/* ---------------- development status ---------------- */

/* A single honest status line. Driven by SITE.status in site.js so it
   can be switched off in one place when the application ships. */
.status-note {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 17px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}
.status-note svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}
.status-note p {
  font-size: 0.885rem;
  line-height: 1.65;
  color: var(--text-2);
}
.status-note b {
  color: var(--text);
  font-weight: 540;
}
.status-note a {
  color: var(--accent-2);
}

/* Public relay status bar, injected site-wide by site.js until the relay is
   reachable by the public. */
.relay-notice {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
}
.relay-notice-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  flex-wrap: wrap;
}
.relay-notice-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--accent-line);
  background: var(--accent-dim);
  color: var(--accent);
}
.relay-notice-icon svg {
  width: 15px;
  height: 15px;
}
.relay-notice p {
  flex: 1 1 320px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-2);
}
.relay-notice b {
  color: var(--text);
  font-weight: 560;
}
.relay-notice-link {
  font-size: 0.8rem;
  color: var(--accent-2);
  white-space: nowrap;
}
.relay-notice-link:hover {
  text-decoration: underline;
}

/* Release notes on the download page. */
.release-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.release-notes .check-list li {
  font-size: 0.86rem;
}
.release-notes.is-swapping {
  animation: noteSwap 260ms cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes noteSwap {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .release-notes.is-swapping { animation: none; }
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 12px;
  border-radius: 99px;
  border: 1px solid var(--accent-line);
  background: var(--accent-dim);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--accent-2);
  white-space: nowrap;
}
.status-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

/* ---------------- state blocks ---------------- */

/* One shared shape for every "there is nothing here" situation, so an
   unfinished area never looks like a bug. */
.state {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 44px 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.006));
}
.state[hidden] {
  display: none;
}
.state--flush {
  border: 0;
  background: none;
  border-radius: 0;
}
.state-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text-3);
  margin-bottom: 16px;
}
.state-icon svg {
  width: 19px;
  height: 19px;
}
.state h3 {
  font-size: 1rem;
  margin-bottom: 9px;
}
.state p {
  font-size: 0.875rem;
  line-height: 1.62;
  color: var(--text-4);
  max-width: 48ch;
}
.state .btn-row {
  justify-content: center;
  margin-top: 20px;
}

/* Variants only change the accent, never the shape. */
.state--soon .state-icon {
  border-color: var(--accent-line);
  background: var(--accent-dim);
  color: var(--accent);
}
.state--error .state-icon {
  border-color: rgba(220, 90, 90, 0.35);
  background: rgba(220, 90, 90, 0.08);
  color: #efb6b6;
}
.state--empty .state-icon {
  color: var(--text-4);
}
.state--disabled {
  border-style: dashed;
}
.state--disabled .state-icon {
  color: var(--text-4);
}

/* An inline "coming later" marker, for use next to a heading rather
   than as a whole block. */
.soon-tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border-radius: 99px;
  border: 1px dashed var(--border-2);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-4);
  white-space: nowrap;
  vertical-align: middle;
}

/* The standard sentence for anything not yet built. Never leave a
   feature looking finished when it is not. */
.doc-soon {
  display: flex;
  gap: 12px;
  padding: 15px 17px;
  margin: 16px 0;
  border: 1px dashed var(--border-2);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.014);
  font-size: 0.875rem;
  line-height: 1.62;
  color: var(--text-4);
}
.doc-soon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--text-4);
}

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

.searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 15px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.3);
  transition: border-color var(--t), box-shadow var(--t);
  max-width: 520px;
}
.searchbar:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
.searchbar svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-4);
}
.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 7px 0;
}
.searchbar input::placeholder {
  color: var(--text-4);
}
.searchbar input:focus {
  outline: none;
}
.search-clear {
  flex-shrink: 0;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  font-size: 0.76rem;
  cursor: pointer;
  transition: color var(--t), background var(--t);
}
.search-clear:hover {
  color: var(--text);
  background: var(--panel-2);
}
.search-clear[hidden] {
  display: none;
}

.search-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 14px;
  font-size: 0.79rem;
  color: var(--text-4);
  min-height: 20px;
}
.search-meta b {
  color: var(--text-2);
  font-weight: 520;
}

/* Hidden by the search filter. */
[data-searchable].is-filtered {
  display: none;
}
[data-search-group].is-filtered {
  display: none;
}

/* Per-section copy-link anchor, revealed on heading hover. */
.doc-anchor {
  margin-left: 9px;
  font-size: 0.82em;
  font-weight: 500;
  color: var(--text-4);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
h2:hover > .doc-anchor,
.doc-anchor:focus {
  opacity: 1;
}
.doc-anchor:hover,
.doc-anchor.is-copied {
  color: var(--accent-2);
  opacity: 1;
}

/* Inline highlight for key feature terms in the documentation. */
.doc-hl {
  color: var(--text);
  font-weight: 600;
  background: var(--panel-3);
  border-bottom: 1px solid var(--accent-line);
  padding: 1px 5px 0;
  border-radius: 4px 4px 2px 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Back-to-top button, shown once the reader has scrolled the docs. */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: rgba(12, 17, 24, 0.9);
  color: var(--text-2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--t), visibility var(--t), transform var(--t), color var(--t),
    border-color var(--t);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.back-to-top:hover {
  color: var(--text);
  border-color: var(--accent-line);
}
.back-to-top svg {
  width: 18px;
  height: 18px;
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: none;
  }
}

/* ---------------- accordion ---------------- */

.acc {
  border-top: 1px solid var(--border);
}
.acc-item {
  border-bottom: 1px solid var(--border);
}

.acc-trigger {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 19px 4px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  transition: color var(--t);
}
.acc-trigger:hover {
  color: var(--accent-2);
}
.acc-trigger .chev {
  margin-left: auto;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-4);
  transition: transform var(--t), color var(--t);
}
.acc-item.is-open .acc-trigger .chev {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Without JavaScript the panel is simply open, so the content is always
   reachable. The `.has-js` gate is what makes it collapsible. */
.has-js .acc-panel {
  display: none;
}
.has-js .acc-item.is-open .acc-panel {
  display: block;
  animation: accReveal 180ms cubic-bezier(0.22, 0.68, 0.32, 1);
}
@keyframes accReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.acc-panel .acc-body {
  padding: 0 44px 22px 4px;
  font-size: 0.905rem;
  line-height: 1.68;
  color: var(--text-2);
  max-width: 78ch;
}
.acc-panel .acc-body p + p {
  margin-top: 12px;
}
.acc-panel .acc-body ul {
  margin: 12px 0;
  padding-left: 20px;
}
.acc-panel .acc-body li {
  margin-bottom: 7px;
}
.acc-panel .acc-body a {
  color: var(--accent-2);
  border-bottom: 1px solid var(--accent-line);
}

/* ---------------- category headings ---------------- */

.cat {
  margin: 40px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.cat:first-child {
  margin-top: 0;
}
.cat h2 {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-3);
}
.cat .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.cat .count {
  font-size: 0.72rem;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

/* ---------------- documentation extras ---------------- */

/* A long index needs to scroll independently, or it pushes the page. */
@media (min-width: 901px) {
  .docs-side {
    max-height: calc(100vh - var(--nav-h) - 56px);
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
  }
}

.docs-side-group {
  margin-top: 14px;
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 0 0 7px 14px;
}
.docs-side nav > .docs-side-group:first-child {
  margin-top: 0;
}

.docs-side .doc-sub {
  padding-left: 26px;
  font-size: 0.815rem;
  color: var(--text-4);
}
.docs-side .doc-sub.is-active {
  color: var(--text-2);
}

.doc-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.doc-heading h2 {
  font-size: 1.35rem;
  padding-bottom: 0;
  border-bottom: 0;
  margin-bottom: 0;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.865rem;
}
.docs-content th,
.docs-content td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.docs-content th {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-4);
  white-space: nowrap;
}
.docs-content td {
  color: var(--text-2);
}
.docs-content td:first-child {
  color: var(--text);
  white-space: nowrap;
}

/* ---------------- legal / prose ---------------- */

.prose {
  max-width: 76ch;
}
.prose h2 {
  font-size: 1.24rem;
  margin: 44px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.prose h2:first-of-type {
  margin-top: 0;
}
.prose h3 {
  font-size: 0.95rem;
  margin: 24px 0 9px;
}
.prose p {
  font-size: 0.925rem;
  line-height: 1.72;
  color: var(--text-2);
  margin-bottom: 13px;
}
.prose ul,
.prose ol {
  margin: 13px 0;
  padding-left: 22px;
  color: var(--text-2);
  font-size: 0.925rem;
  line-height: 1.7;
}
.prose li {
  margin-bottom: 8px;
}
.prose li::marker {
  color: var(--text-4);
}
.prose a {
  color: var(--accent-2);
  border-bottom: 1px solid var(--accent-line);
}
.prose strong {
  color: var(--text);
  font-weight: 540;
}

.toc {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--panel);
  padding: 18px 20px;
  margin-bottom: 40px;
}
.toc h2 {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-4);
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}
.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 26px;
  font-size: 0.855rem;
}
.toc li {
  margin-bottom: 7px;
  break-inside: avoid;
}

/* ---------------- 404 ---------------- */

.error-page {
  min-height: calc(100vh - var(--nav-h) - 220px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 80px 24px;
}
.error-code {
  font-family: var(--font-mono);
  font-size: clamp(3.4rem, 11vw, 5.6rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.42);
  margin-bottom: 22px;
}

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

@media (max-width: 700px) {
  .toc ol {
    columns: 1;
  }
  .acc-body {
    padding-right: 4px !important;
  }
  .state {
    padding: 32px 20px;
  }
}
