/* Perspt Book & PSP Catalog — "Hózhó Terminal Precision" theme.
   Distinct visual language built around Obsidian Slate, Phosphor Emerald,
   Electric Cyan, and Solar Amber, fully synchronized with Guidedog's light,
   dark, and OS-auto color schemes. */

:root {
  --gd-bg: #f7faf9;
  --gd-bg-soft: #eef4f2;
  --gd-bg-code: #eef4f2;
  --gd-bg-hover: #dfebe7;
  --gd-border: #d5e3de;
  --gd-border-strong: #b6ccc4;
  --gd-text: #090d16;
  --gd-text-soft: #263345;
  --gd-muted: #526377;
  --perspt-emerald: #059669;
  --perspt-cyan: #0284c7;
  --perspt-amber: #d97706;
  --perspt-surface-card: #ffffff;
}

:root[data-theme="dark"] {
  --gd-bg: #070b12;
  --gd-bg-soft: #0e1524;
  --gd-bg-code: #0e1524;
  --gd-bg-hover: #172236;
  --gd-border: #1c293f;
  --gd-border-strong: #2c3f5e;
  --gd-text: #f0f6fc;
  --gd-text-soft: #c9d6e6;
  --gd-muted: #8b9eb7;
  --perspt-emerald: #10b981;
  --perspt-cyan: #38bdf8;
  --perspt-amber: #f59e0b;
  --perspt-surface-card: #0c121e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --gd-bg: #070b12;
    --gd-bg-soft: #0e1524;
    --gd-bg-code: #0e1524;
    --gd-bg-hover: #172236;
    --gd-border: #1c293f;
    --gd-border-strong: #2c3f5e;
    --gd-text: #f0f6fc;
    --gd-text-soft: #c9d6e6;
    --gd-muted: #8b9eb7;
    --perspt-emerald: #10b981;
    --perspt-cyan: #38bdf8;
    --perspt-amber: #f59e0b;
    --perspt-surface-card: #0c121e;
  }
}

/* Use native text flow so paragraphs remain selectable and adapt to any width. */
.gd-header { border-top: 3px solid var(--perspt-emerald); }
.gd-brand-name { font-weight: 800; letter-spacing: -0.02em; }
.gd-article { font: 1rem/1.75 system-ui, -apple-system, "Segoe UI", sans-serif; }
.gd-article :is(p, li, dd) { text-align: left; hyphens: none; overflow-wrap: break-word; }
.gd-article strong { font-weight: 750; color: var(--gd-text); }
.gd-article :is(h1, h2, h3, h4, .rubric) { text-wrap: balance; color: var(--gd-text); }
.gd-article h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 850; letter-spacing: -0.04em; line-height: 1.12; margin-bottom: 1.2rem; }
.gd-article h2 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.025em; line-height: 1.25; border-top: 1px solid var(--gd-border); padding-top: 1rem; margin-top: 2.6rem; }
.gd-article h3 { font-weight: 750; font-size: 1.2rem; }
.gd-article .lead { font-size: 1.2rem; line-height: 1.65; color: var(--gd-text-soft); margin-bottom: 2rem; }
.gd-article a { text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.gd-article a:focus-visible { outline: 2px solid var(--perspt-emerald); outline-offset: 3px; }
.gd-article :is(div.highlight, pre.literal-block) { border: 1px solid var(--gd-border-strong); border-left: 3px solid var(--perspt-emerald); border-radius: 6px; }
.gd-article :is(code, pre, kbd, samp) { hyphens: none; }
.gd-article pre { overflow-x: auto; white-space: pre; }
.gd-article table { font-size: 0.95rem; }
.gd-article th { font-weight: 750; text-align: left; }
.gd-article td { text-align: left; vertical-align: top; }
.gd-article table thead th { border-bottom: 2px solid var(--perspt-emerald); }
.gd-article .admonition { border-radius: 6px; box-shadow: none; }
.gd-article figure { margin: 2rem 0; }
.gd-article figure > img { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--gd-border); border-radius: 6px; }
.gd-article figcaption { font-size: 0.9rem; line-height: 1.6; color: var(--gd-muted); text-align: left; margin-top: 0.8rem; }
.gd-article .line-block { text-align: left; }
@media print {
  .gd-article { color: #111; background: #fff; }
  .gd-article a { color: inherit; }
}
.gd-article figure > a { display: block; cursor: zoom-in; }
.gd-article figure > a::after { content: "Open figure at full size"; display: block; font-size: 0.8rem; margin-top: 0.5rem; }
/* Keep section links visible at every screen size. */
.gd-header .rellinks { display: flex; }
.gd-header .rellinks a { font-weight: 700; color: var(--gd-text-soft); }
.gd-header .rellinks a[aria-current] { color: var(--perspt-emerald); text-decoration: underline; text-underline-offset: 0.25em; }
.gd-header .rellinks a:focus-visible { outline: 2px solid var(--perspt-emerald); outline-offset: 4px; }
@media (max-width: 60rem) {
  :root { --gd-header: 6rem; }
  .gd-header {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) minmax(6rem, 0.9fr) 2.25rem;
    grid-template-rows: 3rem 2.75rem;
    align-content: center;
    column-gap: 0.5rem;
    row-gap: 0;
  }
  .gd-header .gd-menu { grid-column: 1; grid-row: 1; }
  .gd-header .gd-brand { grid-column: 2; grid-row: 1; overflow: hidden; }
  .gd-header .gd-version { display: none; }
  .gd-header .gd-search { grid-column: 3; grid-row: 1; margin-left: 0; width: 100%; min-width: 0; }
  .gd-header .theme-toggle { grid-column: 4; grid-row: 1; }
  .gd-header .rellinks { grid-column: 1 / -1; grid-row: 2; gap: 1.5rem; height: 100%; align-items: center; }
  .gd-header .rellinks a { display: inline-flex; align-items: center; min-height: 2.75rem; }
}
