/* ==========================================================================
   pilos.net — the subpages: docs, the legal pages, and the two card pages
   (/activate and /verify).

   Loaded after css/pilos.css, which supplies every token and the shared
   chrome (nav, footer, buttons, cards). Nothing here redefines a colour —
   if a value is not a var() it is a layout number.
   ========================================================================== */

/* --- Shared page shell -------------------------------------------------- */

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px var(--gutter) 96px;
}

.page-head { margin-bottom: 40px; }
.page-head h1 {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: var(--tracking-h2);
  font-weight: 620;
}

/* --- Prose -------------------------------------------------------------- */

/* One prose treatment, shared by the legal pages and the docs article, so
   a paragraph reads the same wherever it appears. */
.prose h2 {
  font-size: 23px;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin: 48px 0 12px;
}
.prose h2:first-of-type { margin-top: 0; }
.prose h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 28px 0 9px;
  color: var(--text);
}
.prose p,
.prose li {
  font-size: var(--t-body);
  line-height: 1.7;
  color: var(--muted);
}
.prose p { margin: 0 0 14px; max-width: 72ch; }
.prose ul,
.prose ol { margin: 0 0 18px; padding-left: 22px; max-width: 72ch; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--dim); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a {
  color: var(--accent-fg);
  border-bottom: 1px solid rgba(124, 92, 255, 0.35);
  transition: border-color 140ms ease, color 140ms ease;
}
.prose a:hover { color: var(--text); border-bottom-color: var(--accent); }
.prose code {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text);
}
.prose pre {
  margin: 0 0 18px;
  padding: 13px 15px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
}
.prose pre code { padding: 0; background: none; border: 0; }

.page-updated {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--dim);
  margin-top: 10px;
}

/* --- Docs --------------------------------------------------------------- */

.docs-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 52px;
  padding: 48px 0 96px;
}

.docs-side {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow-y: auto;
}
.docs-side h4 {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--dim);
  margin: 24px 0 8px;
}
.docs-side h4:first-child { margin-top: 0; }
.docs-side a {
  display: block;
  padding: 6px 11px;
  border-radius: var(--radius-chip);
  font-size: var(--t-sm);
  color: var(--muted);
  transition: background 140ms ease, color 140ms ease;
}
.docs-side a:hover { background: var(--raised); color: var(--text); }
.docs-side a.is-active {
  background: var(--accent-soft);
  color: var(--accent-fg);
  font-weight: 560;
}

.docs-main h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: var(--tracking-h2);
  font-weight: 620;
  margin-bottom: 12px;
}
.docs-main .lede {
  font-size: var(--t-lead);
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 44px;
  max-width: 62ch;
}
.docs-main h2 { scroll-margin-top: calc(var(--nav-h) + 24px); }

.h-anchor {
  color: var(--dim);
  opacity: 0;
  margin-left: 8px;
  border: 0;
  font-weight: 400;
  transition: opacity 140ms ease;
}
.docs-main h2:hover .h-anchor,
.h-anchor:focus-visible { opacity: 1; }

.docs-callout {
  margin: 18px 0 26px;
  padding: 15px 17px;
  border-radius: var(--radius-card);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 92, 255, 0.3);
}
.docs-callout p { margin: 0; }
.docs-callout strong { color: var(--accent-fg); }

.docs-divider { height: 1px; background: var(--border); border: 0; margin: 52px 0; }

/* --- Card pages: /activate and /verify ---------------------------------- */

.card-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--nav-h));
  padding: 56px var(--gutter) 72px;
}

.card-page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
}

.card-logo { width: 46px; height: 46px; border-radius: 11px; margin: 0 auto 18px; }

.card-page h1 {
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.card-page .sub {
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 20px;
}
.card-page .note {
  font-size: var(--t-sm);
  line-height: 1.6;
  color: var(--dim);
  margin-top: 18px;
}
.card-page .note a,
.card-page .sub a { color: var(--accent-fg); }
.card-page strong { color: var(--text); font-weight: 600; }

.btn-row { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }

.spinner {
  width: 22px; height: 22px;
  margin: 22px auto 0;
  border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  animation: pilos-spin 700ms linear infinite;
}
@keyframes pilos-spin { to { transform: rotate(360deg); } }

.key-box {
  margin: 20px 0;
  padding: 13px 15px;
  background: var(--code-bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-button);
  text-align: left;
}
.key-label {
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--dim);
  margin-bottom: 6px;
}
.key-value {
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--text);
  word-break: break-all;
}

/* The three states each page switches between. Class names are the contract
   with the inline scripts on those pages — do not rename without them. */
.error-state,
.fallback-state { display: none; }
.error-state.show,
.fallback-state.show { display: block; }
.loading-state.hidden { display: none; }

.resend-form { margin: 18px 0 4px; text-align: left; }
.fld { display: block; margin-bottom: 12px; }
.fld span {
  display: block;
  font-size: var(--t-sm);
  font-weight: 560;
  color: var(--muted);
  margin-bottom: 6px;
}
.fld input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: var(--t-body);
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius-button);
}
.fld input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.fld input::placeholder { color: var(--dim); }

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

@media (max-width: 980px) {
  .docs-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 32px 0 72px;
  }
  /* Stacked above the article, a single column of twelve links fills the
     whole first screen before the page's own title. Two columns halve it;
     the group headings still span and keep the sections legible. */
  .docs-side {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
  }
  .docs-side h4 { grid-column: 1 / -1; margin: 18px 0 6px; }
  .docs-side h4:first-child { margin-top: 0; }
}
