/* Custom layer on top of Pico.css. Pico handles typography, forms, buttons,
   tables, code, links, containers, and light/dark theming. This file styles
   only the bespoke widgets Pico doesn't cover, reusing Pico's theme variables
   (--pico-*) so everything tracks Pico's palette and dark mode automatically. */

/* Pin the root font size. Pico's default scales it up to 131% on wide
   viewports, which reads as "zoomed in"; 100% keeps a normal 16px base. */
:root {
  font-size: 100%;
  --add-bg: #e6ffed;
  --del-bg: #ffeef0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --add-bg: #133a1e;
    --del-bg: #3a1416;
  }
}

/* Sticky application header. */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--pico-border-color);
  position: sticky;
  top: 0;
  background: var(--pico-background-color);
  z-index: 10;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  color: var(--pico-color);
  text-decoration: none;
}
.site-header .search {
  flex: 1;
  margin: 0;
}
.site-header .search input {
  margin: 0;
  max-width: 28rem;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-nav form {
  margin: 0;
}
.site-nav button {
  margin: 0;
  width: auto;
  padding: 0.35rem 0.7rem;
}
.site-nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
}
.breadcrumb [aria-current="page"] {
  color: var(--pico-color);
  font-weight: 600;
}

/* Breadcrumb trail. */
.breadcrumb {
  padding: 0.6rem 1.25rem;
  color: var(--pico-muted-color);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--pico-border-color);
}
.breadcrumb .sep {
  margin: 0 0.4rem;
  color: var(--pico-border-color);
}

/* Reading column. */
.content {
  max-width: 72ch;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.meta {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

/* Tag pills. */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}
.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  font-size: 0.8rem;
  text-decoration: none;
}

.cols {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.cols section {
  flex: 1;
  min-width: 12rem;
}
.linklist {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

/* Version-history timeline. */
.history {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--pico-border-color);
}
.history li {
  padding: 0.5rem 0 0.5rem 1rem;
}
.history .when {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}
.history .controls {
  margin-left: 0.5rem;
}

/* Change-kind badges. */
.badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--pico-code-background-color);
  color: var(--pico-muted-color);
}
.badge.deleted {
  background: var(--del-bg);
}
.badge.created {
  background: var(--add-bg);
}

.result {
  margin: 1.2rem 0;
}
.result .excerpt {
  color: var(--pico-muted-color);
}

/* Version diff (legacy styles; retained only for any non-shell pages). */
.compare-form {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.compare-form label {
  margin: 0;
}
.compare-form select {
  margin: 0;
}
.compare-form button {
  margin: 0;
  width: auto;
}
.diff-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  margin: 0.5rem 0;
}
.diff-legend .swatch {
  padding: 0 0.4rem;
  border-radius: 3px;
}
.diff-legend .add {
  background: var(--add-bg);
}
.diff-legend .del {
  background: var(--del-bg);
}
.diff {
  font-family: var(--pico-font-family-monospace);
  white-space: pre-wrap;
  font-size: 0.9rem;
}
.diff .add {
  background: var(--add-bg);
}
.diff .del {
  background: var(--del-bg);
}

.banner {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  padding: 0.6rem 1rem;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1.5rem;
}
.banner a {
  color: inherit;
}
.empty {
  color: var(--pico-muted-color);
}

/* Auth pages (login, verify, link-sent): a narrow centered column. */
.auth {
  max-width: 26rem;
  margin: 4rem auto;
  padding: 0 1.25rem;
}

/* Dev-only magic-link shortcut on the login page. */
a.devbtn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #b58100;
  color: #fff;
  text-decoration: none;
  border-radius: var(--pico-border-radius);
}

/* ---------------------------------------------------------------------------
   Account pages (My API keys, Admin · Users). Standalone pages that match the
   app shell's dark chrome (shell.css) up top, with a compact light content
   area below. Inputs/buttons are deliberately small and inline — these are
   utility forms, not the chunky full-width Pico defaults.
   --------------------------------------------------------------------------- */

/* Match the accent to the app's blue (shell.css --chrome-accent: #0a84ff)
   instead of Pico's default primary, so buttons/links/accents on the dark
   account pages match the wiki chrome. Scoped to data-theme="dark", which only
   the account pages set, so login (light) is untouched. */
[data-theme="dark"] {
  --pico-primary: #0a84ff;
  --pico-primary-background: #0a84ff;
  --pico-primary-border: #0a84ff;
  --pico-primary-underline: rgba(10, 132, 255, 0.5);
  --pico-primary-hover: #3a9bff;
  --pico-primary-hover-background: #3a9bff;
  --pico-primary-hover-border: #3a9bff;
  --pico-primary-focus: rgba(10, 132, 255, 0.4);
  --pico-primary-inverse: #fff;

  /* Neutral dark surfaces matching the home chrome (#1e1e1e), replacing Pico's
     navy-blue dark palette. */
  --pico-background-color: #1e1e1e;
  --pico-card-background-color: #252526;
  --pico-card-sectioning-background-color: #2d2d2d;
  --pico-form-element-background-color: #2d2d2d;
  --pico-form-element-active-background-color: #2d2d2d;
  --pico-form-element-border-color: #444;
  --pico-muted-border-color: #333;
  --pico-table-border-color: #333;
}
.account-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: #1e1e1e;
  border-bottom: 1px solid #333;
}
.account-topbar .brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.account-topbar nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.account-topbar nav a {
  color: #ccc;
  font-size: 0.85rem;
  text-decoration: none;
}
.account-topbar nav a:hover {
  color: #fff;
}
.account-topbar .user {
  color: #999;
  font-size: 0.82rem;
}
.account-topbar form {
  margin: 0;
}
.account-topbar button {
  margin: 0;
  width: auto;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  background: transparent;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
}
.account-topbar button:hover {
  background: #2d2d2d;
  color: #fff;
}

/* Compact content column. */
.account-page {
  max-width: 60rem;
  margin: 1.75rem auto;
  padding: 0 1.25rem;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.page-head h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.1;
}
.page-head .back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--pico-color);
  text-decoration: none;
  border: 1px solid var(--pico-border-color);
}
.page-head .back:hover {
  background: var(--pico-secondary-background);
  color: var(--pico-primary-inverse);
}
.account-page h1 {
  font-size: 1.4rem;
  margin: 0;
}
.account-page h2 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.6rem;
}

/* Small, humane inputs + buttons (override Pico's full-width chunkiness). */
.account-page input:not([type="checkbox"]) {
  margin: 0;
  width: auto;
  height: auto;
  padding: 0.3rem 0.55rem;
  font-size: 0.9rem;
}
.account-page button {
  margin: 0;
  width: auto;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}
.account-page .secondary {
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
}

/* One-row forms: input(s) + submit sit on a single line. */
.inline-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0;
}
.inline-form input[name="name"],
.inline-form input[name="email"] {
  min-width: 14rem;
}

/* Read-only "what this key will have" hint. */
.granted {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
}

/* One-time token reveal. */
.token-box {
  border-left: 4px solid var(--pico-primary);
  padding: 0.6rem 0.9rem;
  margin: 0 0 1.25rem;
}
.token-box code {
  user-select: all;
}
.token-box .copy-btn {
  margin-top: 0.6rem;
}

/* Inline scope checkboxes (admin page). */
.scope-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  border: 0;
  padding: 0.2rem 0;
  margin: 0.3rem 0;
}
.scope-row label {
  font-size: 0.85rem;
  margin: 0;
}
.account-page article {
  padding: 0.9rem 1.1rem;
}
