/* ==========================================================================
   LaTeX-on-HTTP documentation — YtoTech design system.
   CMU Sans Serif body text + JetBrains Mono code typography, red/blue YtoTech
   palette, squared corners, light/dark themes. All assets are served from this
   site.
   ========================================================================== */

/* -------------------------------- Fonts --------------------------------- */

/* Computer Modern Unicode, the OpenType/METATYPE1 revival of Knuth's Computer
   Modern. Hosted locally so the docs keep their LaTeX voice offline and without
   third-party requests. */

@font-face {
  font-family: "CMU Sans Serif";
  src: url("../fonts/cmusans10-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "CMU Sans Serif";
  src: url("../fonts/cmusans10-oblique.woff2") format("woff2");
  font-style: oblique;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "CMU Sans Serif";
  src: url("../fonts/cmusans10-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "CMU Sans Serif";
  src: url("../fonts/cmusans10-boldoblique.woff2") format("woff2");
  font-style: oblique;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrainsmono-variable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrainsmono-italic-variable.woff2") format("woff2-variations");
  font-style: italic;
  font-weight: 100 800;
  font-display: swap;
}

/* ------------------------------- Tokens --------------------------------- */

:root {
  --font-sans: "CMU Sans Serif", "Computer Modern Sans Serif", "Latin Modern Sans",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Source Code Pro", ui-monospace,
    "SFMono-Regular", Consolas, monospace;

  /* YtoTech brand: red from "Yto", blue from "Tech". */
  --accent: #b14040;
  --accent-strong: #8f3030;
  --accent-soft: rgba(177, 64, 64, 0.08);
  --accent-blue: #383866;
  --accent-blue-strong: #2b2b50;
  --accent-blue-soft: rgba(56, 56, 102, 0.08);
  --on-accent: #ffffff;

  --bg: #ffffff;
  --bg-surface: #faf8f4;
  --bg-surface-2: #f4f0ea;
  --bg-sidebar: #fcfbf8;
  --bg-code: #f8f5f0;
  --bg-inline-code: rgba(177, 64, 64, 0.07);

  --text: #221f1c;
  --text-soft: #23201e;
  --text-faint: #746b62;

  --border: #e6ded6;
  --border-strong: #d2c6bb;

  --method-get: #3f6b4f;
  --method-get-bg: rgba(63, 107, 79, 0.1);
  --method-post: #383866;
  --method-post-bg: rgba(56, 56, 102, 0.1);
  --method-delete: #a23333;
  --method-delete-bg: rgba(162, 51, 51, 0.1);

  --code-comment: #746b62;
  --code-punctuation: #5f5850;
  --code-string: #a63b3b;
  --code-number: #8a5a2b;
  --code-keyword: #383866;
  --code-function: #6b3f73;

  --shadow: 0 1px 2px rgba(51, 36, 26, 0.08);
  --radius: 0px;
  --radius-sm: 0px;

  --sidebar-width: 272px;
  --content-max: 48rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #e39a96;
    --accent-strong: #f0b1ac;
    --accent-soft: rgba(227, 154, 150, 0.12);
    --accent-blue: #b7b9e2;
    --accent-blue-strong: #cdcff0;
    --accent-blue-soft: rgba(183, 185, 226, 0.12);
    --on-accent: #16151c;

    --bg: #16151c;
    --bg-surface: #1d1b24;
    --bg-surface-2: #24212c;
    --bg-sidebar: #191820;
    --bg-code: #1c1a23;
    --bg-inline-code: rgba(227, 154, 150, 0.12);

    --text: #ece8e2;
    --text-soft: #bdb6ad;
    --text-faint: #8e8780;

    --border: #322e3a;
    --border-strong: #443e4e;

    --method-get: #8fbe9d;
    --method-get-bg: rgba(143, 190, 157, 0.12);
    --method-post: #b7b9e2;
    --method-post-bg: rgba(183, 185, 226, 0.12);
    --method-delete: #e39a96;
    --method-delete-bg: rgba(227, 154, 150, 0.12);

    --code-comment: #9a9188;
    --code-punctuation: #b0a79d;
    --code-string: #e39a96;
    --code-number: #d7b07a;
    --code-keyword: #b7b9e2;
    --code-function: #d4a6d9;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  }
}

/* Manual theme override (data-theme on <html>), taking precedence. */
html[data-theme="dark"] {
  --accent: #e39a96;
  --accent-strong: #f0b1ac;
  --accent-soft: rgba(227, 154, 150, 0.12);
  --accent-blue: #b7b9e2;
  --accent-blue-strong: #cdcff0;
  --accent-blue-soft: rgba(183, 185, 226, 0.12);
  --on-accent: #16151c;
  --bg: #16151c;
  --bg-surface: #1d1b24;
  --bg-surface-2: #24212c;
  --bg-sidebar: #191820;
  --bg-code: #1c1a23;
  --bg-inline-code: rgba(227, 154, 150, 0.12);
  --text: #ece8e2;
  --text-soft: #bdb6ad;
  --text-faint: #8e8780;
  --border: #322e3a;
  --border-strong: #443e4e;
  --method-get: #8fbe9d;
  --method-get-bg: rgba(143, 190, 157, 0.12);
  --method-post: #b7b9e2;
  --method-post-bg: rgba(183, 185, 226, 0.12);
  --method-delete: #e39a96;
  --method-delete-bg: rgba(227, 154, 150, 0.12);
  --code-comment: #9a9188;
  --code-punctuation: #b0a79d;
  --code-string: #e39a96;
  --code-number: #d7b07a;
  --code-keyword: #b7b9e2;
  --code-function: #d4a6d9;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --accent: #b14040;
  --accent-strong: #8f3030;
  --accent-soft: rgba(177, 64, 64, 0.08);
  --accent-blue: #383866;
  --accent-blue-strong: #2b2b50;
  --accent-blue-soft: rgba(56, 56, 102, 0.08);
  --on-accent: #ffffff;
  --bg: #ffffff;
  --bg-surface: #faf8f4;
  --bg-surface-2: #f4f0ea;
  --bg-sidebar: #fcfbf8;
  --bg-code: #f8f5f0;
  --bg-inline-code: rgba(177, 64, 64, 0.07);
  --text: #221f1c;
  --text-soft: #4a4540;
  --text-faint: #746b62;
  --border: #e6ded6;
  --border-strong: #d2c6bb;
  --method-get: #3f6b4f;
  --method-get-bg: rgba(63, 107, 79, 0.1);
  --method-post: #383866;
  --method-post-bg: rgba(56, 56, 102, 0.1);
  --method-delete: #a23333;
  --method-delete-bg: rgba(162, 51, 51, 0.1);
  --code-comment: #746b62;
  --code-punctuation: #5f5850;
  --code-string: #a63b3b;
  --code-number: #8a5a2b;
  --code-keyword: #383866;
  --code-function: #6b3f73;
  --shadow: 0 1px 2px rgba(51, 36, 26, 0.08);
}

/* ------------------------------- Base ----------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 1rem;
  border-radius: 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------ Layout ---------------------------------- */

.layout {
  display: flex;
  min-height: 100vh;
  border-top: 4px solid var(--accent);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1rem 1.5rem;
}

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3rem 2.5rem 3.5rem;
}

/* Wide pages (e.g. the playground) use the full main column instead of the
   prose measure; their intro text keeps a readable line length. */
.content-wide {
  max-width: none;
}

.content-wide h1,
.content-wide .page-lead {
  max-width: var(--content-max);
}

.content-footer {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  padding: 1rem 2.5rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
}

.content-footer p {
  margin: 0;
}

/* ------------------------------ Sidebar --------------------------------- */

.brand {
  padding: 0.25rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.brand-link {
  display: block;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 170px;
  height: auto;
}

.brand-logo-dark {
  display: none;
}

html[data-theme="dark"] .brand-logo-light {
  display: none;
}

html[data-theme="dark"] .brand-logo-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light {
    display: none;
  }

  :root:not([data-theme="light"]) .brand-logo-dark {
    display: block;
  }
}

.brand-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.94rem;
  color: var(--accent-blue);
  margin-top: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.nav-group {
  margin-bottom: 1.1rem;
}

.nav-group-title {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-blue);
  padding: 0 0.75rem;
  margin-bottom: 0.4rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  display: block;
  padding: 0.28rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--text-soft);
  font-size: 0.97rem;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-item.is-active {
  border-left-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-by {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}

.sidebar-by a {
  display: inline-block;
  line-height: 0;
}

.ytotech-logo {
  display: block;
  width: 92px;
  height: auto;
}

.ytotech-logo-dark {
  display: none;
}

html[data-theme="dark"] .ytotech-logo-light {
  display: none;
}

html[data-theme="dark"] .ytotech-logo-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ytotech-logo-light {
    display: none;
  }

  :root:not([data-theme="light"]) .ytotech-logo-dark {
    display: block;
  }
}

.sidebar-link {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
}

.sidebar-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ------------------------------ Topbar ---------------------------------- */

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 30;
}

.topbar-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.topbar-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-icon {
  display: block;
}

.theme-icon-dark {
  display: none;
}

html[data-theme="dark"] .theme-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-icon-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-light {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-icon-dark {
    display: block;
  }
}

/* ---------------------------- Typography -------------------------------- */

.content h1,
.content h2,
.content h3,
.content h4 {
  line-height: 1.22;
  color: var(--text);
  text-wrap: balance;
}

.content h1 {
  font-size: 2.65rem;
  margin: 0 0 1rem;
  font-weight: 400;
  letter-spacing: 0.005em;
}

.content h2 {
  font-size: 1.62rem;
  margin: 2.8rem 0 0.9rem;
  padding-top: 0.4rem;
  font-weight: 700;
  color: var(--accent);
  scroll-margin-top: 1.5rem;
}

.content h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.7rem;
  font-weight: 700;
  color: var(--accent-blue);
  scroll-margin-top: 1.5rem;
}

.content h4 {
  color: var(--accent-blue);
}

.content h2 + h3 {
  margin-top: 1.3rem;
}

.content p {
  margin: 0.8rem 0;
  color: var(--text-soft);
}

.content strong {
  color: var(--text);
  font-weight: 700;
}

.content ul,
.content ol {
  color: var(--text-soft);
  padding-left: 1.45rem;
}

.content li {
  margin: 0.35rem 0;
}

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

.content h1 + p,
.content .page-lead {
  font-size: 1.1rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-variant-ligatures: none;
}

p code,
li code,
td code,
h2 code,
h3 code,
h4 code {
  background: var(--bg-inline-code);
  color: var(--accent-strong);
  border-radius: 0;
  padding: 0.1em 0.32em;
  font-weight: 500;
}

.dim {
  color: var(--text-faint);
}

/* Anchor links on headings */
.heading-anchor {
  margin-left: 0.4rem;
  opacity: 0;
  font-size: 0.85em;
  text-decoration: none;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

/* --------------------------- Endpoint header ----------------------------- */

.endpoint-signature {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 0.4rem;
}

.endpoint-path {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  padding: 0;
}

.http-method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.17rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 0;
}

.http-method-get {
  color: var(--method-get);
  background: var(--method-get-bg);
}

.http-method-post {
  color: var(--method-post);
  background: var(--method-post-bg);
}

.http-method-delete {
  color: var(--method-delete);
  background: var(--method-delete-bg);
}

/* ------------------------------ Tables ---------------------------------- */

.table-wrapper {
  overflow-x: auto;
  margin: 1.2rem 0;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 0;
}

table.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.param-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-blue);
  background: var(--bg-surface);
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.param-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.param-table tr:last-child td {
  border-bottom: none;
}

.param-table tbody tr:hover {
  background: var(--bg-surface);
}

.param-table td.param-description {
  color: var(--text-soft);
}

.param-name {
  font-weight: 700;
  color: var(--accent-strong);
  background: none;
  padding: 0;
}

.param-required {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  margin-top: 0.25rem;
}

.param-type {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* ------------------------------ Code ------------------------------------ */

.code-tabs {
  margin: 1.2rem 0 1.5rem;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 0;
  overflow: hidden;
  background: var(--bg-code);
}

.code-tabs-bar {
  display: flex;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  overflow-x: auto;
}

.code-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.code-tab:hover {
  color: var(--text);
}

.code-tab.is-active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.code-tab-panel {
  position: relative;
}

.code-tab-panel[hidden] {
  display: none;
}

/* Prism output */
.code-tab-panel pre[class*="language-"],
.prose pre[class*="language-"],
pre[class*="language-"] {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: transparent;
  font-size: 0.83rem;
  line-height: 1.65;
  tab-size: 4;
}

pre[class*="language-"] code {
  font-family: var(--font-mono);
}

.code-copy-button {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 0;
  padding: 0.22rem 0.55rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.code-tab-panel:hover .code-copy-button,
pre:hover .code-copy-button {
  opacity: 1;
}

.code-copy-button:hover {
  color: var(--text);
}

.code-copy-button.is-copied {
  color: var(--method-get);
  opacity: 1;
}

/* Markdown-rendered code blocks in guides */
.prose pre[class*="language-"] {
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-blue);
  border-radius: 0;
  background: var(--bg-code);
  margin: 1.2rem 0 1.5rem;
}

/* Syntax colours, keyed to the YtoTech palette. */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: var(--code-comment);
  font-style: italic;
}

.token.punctuation {
  color: var(--code-punctuation);
}

.token.string,
.token.char,
.token.attr-value,
.token.selector,
.token.builtin,
.token.inserted {
  color: var(--code-string);
}

.token.number,
.token.boolean,
.token.constant,
.token.symbol {
  color: var(--code-number);
}

.token.property,
.token.tag,
.token.keyword,
.token.attr-name,
.token.operator,
.token.entity,
.token.url,
.token.variable {
  color: var(--code-keyword);
}

.token.function,
.token.class-name {
  color: var(--code-function);
}

.token.deleted {
  color: var(--method-delete);
}

.token.important,
.token.bold {
  font-weight: 700;
}

.token.italic {
  font-style: italic;
}

/* ------------------------------ Callouts -------------------------------- */

.callout {
  margin: 1.2rem 0;
  padding: 0.9rem 1.1rem;
  border-radius: 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-surface);
  color: var(--text-soft);
  font-size: 0.97rem;
}

.callout p {
  margin: 0.3rem 0;
}

.callout p:first-child {
  margin-top: 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-warning {
  border-left-color: #d97706;
  background: color-mix(in srgb, #d97706 7%, var(--bg-surface));
}

.callout-tip {
  border-left-color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 5%, var(--bg-surface));
}

/* ------------------------------- Hero ----------------------------------- */

.hero {
  padding: 1rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.2rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 0.7rem;
}

.hero p {
  font-size: 1.12rem;
  max-width: 44rem;
  margin: 0 0 0.4rem;
}

.hero-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 0;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--on-accent);
}

.button-secondary {
  background: var(--bg);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.button-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button:focus-visible,
.topbar-button:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------- Cards ---------------------------------- */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  display: block;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-blue);
  border-radius: 0;
  padding: 1rem 1.15rem;
  background: transparent;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.card:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--bg-surface);
}

.card-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

.card-description {
  color: var(--text-soft);
  font-size: 0.93rem;
  line-height: 1.6;
}

/* --------------------------- Playground --------------------------------- */

.playground {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.1rem;
  /* Equal-height panels, so both sides use the room of the taller one. */
  align-items: stretch;
  margin-top: 1.2rem;
}

@media (max-width: 1100px) {
  .playground {
    grid-template-columns: 1fr;
  }
}

.pg-panel {
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent-blue);
  border-radius: 0;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pg-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pg-panel-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  /* Fill the panel below its header; scroll within the capped height. */
  flex: 1;
  min-height: 0;
  max-height: 78vh;
  overflow-y: auto;
}

/* Footer below the scrollable body: the action buttons stay visible without
   scrolling through the form. */
.pg-panel-footer {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pg-panel-footer .pg-hint:empty {
  display: none;
}

.pg-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pg-label {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--accent-blue);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.pg-input,
.pg-select,
.pg-textarea {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 0.45rem 0.65rem;
  width: 100%;
}

.pg-textarea {
  min-height: 190px;
  line-height: 1.5;
  resize: vertical;
  white-space: pre;
}

/* The endpoint field groups are flex columns sharing the panel body's gap, and
   stretch so their growable fields receive the leftover panel height. The
   :not([hidden]) guard keeps JS toggling working (an author display value
   would otherwise beat the UA's [hidden] rule). */
#pg-build-fields:not([hidden]),
#pg-simple-fields:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1 1 auto;
}

/* Flex children that grow into the leftover panel height; their textarea
   fills the field in turn. Growth only ever adds height (auto basis). */
.pg-grow {
  flex: 1 1 auto;
}

.pg-grow > .pg-textarea {
  flex: 1 1 auto;
}

.pg-input:focus,
.pg-select:focus,
.pg-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}

.pg-row {
  display: flex;
  gap: 0.6rem;
}

.pg-row > * {
  flex: 1;
  min-width: 0;
}

.pg-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.91rem;
  color: var(--text-soft);
  cursor: pointer;
}

.pg-check input {
  accent-color: var(--accent);
}

.pg-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.3rem 1rem;
}

.pg-resources {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pg-resource {
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.6rem 0.7rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  background: var(--bg-surface);
}

.pg-resource .pg-input,
.pg-resource .pg-select {
  font-size: 0.82rem;
  padding: 0.32rem 0.5rem;
}

.pg-resource-value {
  grid-column: 1 / -1;
}

.pg-resource-value .pg-textarea {
  min-height: 84px;
  font-size: 0.82rem;
}

.pg-remove {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-faint);
  border-radius: 0;
  width: 1.7rem;
  height: 1.7rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 1rem;
}

.pg-remove:hover {
  color: var(--method-delete);
  border-color: var(--method-delete);
}

.pg-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.pg-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
}

/* The active response panel fills the leftover panel height; the :not([hidden])
   guard keeps the `hidden` attribute working (panels are toggled from JS). */
[data-response-panel]:not([hidden]) {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.pg-response-empty:not([hidden]) {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.9rem;
  padding: 2.2rem 1rem;
  text-align: center;
}

.pg-status-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.pg-status-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 0;
}

.pg-status-ok {
  color: var(--method-get);
  background: var(--method-get-bg);
}

.pg-status-error {
  color: var(--method-delete);
  background: var(--method-delete-bg);
}

.pg-pdf-frame {
  width: 100%;
  /* Stretch to the panel height; the 78vh body cap keeps it scroll-free. */
  flex: 1;
  height: auto;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #525659;
}

.pg-json-view {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.85rem 1rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.pg-json-view .json-key {
  color: var(--code-keyword);
}

.pg-json-view .json-string {
  color: var(--code-string);
}

.pg-json-view .json-number,
.pg-json-view .json-boolean,
.pg-json-view .json-null {
  color: var(--code-number);
}

.pg-error-banner {
  border: 1px solid var(--method-delete);
  background: var(--method-delete-bg);
  color: var(--method-delete);
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
}

/* ------------------------------ Misc ------------------------------------ */

details.endpoint-mode {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0;
  margin: 1.2rem 0;
  background: var(--bg);
}

details.endpoint-mode > summary {
  cursor: pointer;
  padding: 0.8rem 1.1rem;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

details.endpoint-mode > summary::before {
  content: "▸";
  color: var(--text-faint);
  transition: transform 0.15s ease;
}

details.endpoint-mode[open] > summary::before {
  transform: rotate(90deg);
}

details.endpoint-mode > .endpoint-mode-body {
  padding: 0 1.1rem 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

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

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .topbar {
    display: flex;
  }

  .content {
    padding: 1.5rem 1.2rem 2.5rem;
  }

  .content-footer {
    padding: 1rem 1.2rem 2rem;
  }
}

@media print {
  .sidebar,
  .topbar,
  .code-copy-button {
    display: none;
  }
}
