/* PNGToolbox identity layer — "precision instrument" look.
   Loaded after styles.css on every page; retunes the theme tokens and adds the
   editorial components used by the guide pages. Nothing here touches the tool
   widgets: they keep the class names the scripts already expect. */

:root {
  --pt-paper: #f7f7f3;
  --pt-ink: #10161d;
  --pt-rule: #e2e1da;
  --pt-rule-strong: #c9c8c0;
  --pt-accent: #0b6f5c;
  --pt-accent-ink: #075343;
  --pt-amber: #b4691a;
  --pt-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --accent: #0b6f5c;
  --accent-dark: #075343;
  --accent-soft: rgba(11, 111, 92, 0.09);
  --accent-line: rgba(11, 111, 92, 0.3);
  --bg: var(--pt-paper);
  --ink: var(--pt-ink);
  --line: var(--pt-rule);
  --radius: 8px;
  --radius-lg: 10px;
}
:root.dark {
  --pt-paper: #0e1116;
  --pt-ink: #e8ecef;
  --pt-rule: #242a33;
  --pt-rule-strong: #333c47;
  --pt-accent: #34bd8e;
  --pt-accent-ink: #6fd9b4;
  --pt-amber: #e2a04c;
  --accent: #34bd8e;
  --accent-dark: #6fd9b4;
  --accent-soft: rgba(52, 189, 142, 0.14);
  --accent-line: rgba(52, 189, 142, 0.4);
  --bg: var(--pt-paper);
  --ink: var(--pt-ink);
  --line: var(--pt-rule);
}

/* ---------- chrome ---------- */
.topbar { border-bottom: 1px solid var(--pt-rule); background: color-mix(in srgb, var(--pt-paper) 92%, transparent); backdrop-filter: saturate(140%) blur(8px); }
.brand span { font-weight: 800; letter-spacing: -0.02em; }
.topbar nav a { font-family: var(--pt-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.site-footer { border-top: 1px solid var(--pt-rule); font-size: 0.9rem; }
.footer-col strong { font-family: var(--pt-mono); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; color: var(--ink-2, #4c4f58); }

/* ---------- layout primitives ---------- */
.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.wrap-narrow { width: min(74ch, 100% - 2.5rem); margin-inline: auto; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 3rem; align-items: start; padding-block: 2.5rem 4rem; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; gap: 1.5rem; } }

.crumb { font-family: var(--pt-mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--ink-2, #4c4f58); padding-top: 1.5rem; display: flex; gap: 0.45rem; flex-wrap: wrap; }
.crumb a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--pt-rule-strong); }
.crumb a:hover { color: var(--pt-accent); }

.eyebrow { font-family: var(--pt-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pt-accent); margin: 0 0 0.6rem; }
h1.article-title { font-size: clamp(1.95rem, 4.4vw, 3rem); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 1rem; font-weight: 800; }
.deck { font-size: clamp(1.02rem, 1.6vw, 1.2rem); line-height: 1.6; color: var(--ink-2, #4c4f58); margin: 0 0 1.4rem; max-width: 68ch; }
.authorline { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; align-items: center; font-size: 0.82rem; color: var(--ink-3, #8b8e98); border-top: 1px solid var(--pt-rule); border-bottom: 1px solid var(--pt-rule); padding: 0.7rem 0; margin-bottom: 2rem; font-family: var(--pt-mono); }
.authorline strong { color: var(--ink-2, #4c4f58); font-weight: 600; }

.prose { font-size: 1.06rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); letter-spacing: -0.02em; margin-top: 2.6em; padding-top: 0.9em; border-top: 1px solid var(--pt-rule); }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-size: 1.18rem; margin-top: 2em; }
.prose h2, .prose h3 { scroll-margin-top: 84px; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li + li { margin-top: 0.4em; }
.prose a { color: var(--pt-accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose code { font-family: var(--pt-mono); font-size: 0.88em; background: var(--accent-soft); padding: 0.12em 0.38em; border-radius: 4px; }
.prose pre { background: #10161d; color: #e6ecef; padding: 1rem 1.1rem; border-radius: 8px; overflow-x: auto; font-size: 0.85rem; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose blockquote { border-left: 3px solid var(--pt-accent); margin: 1.6rem 0; padding-left: 1.2rem; font-size: 1.12rem; color: var(--ink-2, #4c4f58); }

.rail { position: sticky; top: 84px; font-size: 0.9rem; }
.rail h2 { font-family: var(--pt-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3, #8b8e98); margin: 0 0 0.7rem; }
.rail ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--pt-rule); }
.rail li { margin: 0; }
.rail a { display: block; padding: 0.32rem 0 0.32rem 0.85rem; color: var(--ink-2, #4c4f58); text-decoration: none; border-left: 2px solid transparent; margin-left: -1px; }
.rail a:hover { color: var(--pt-accent); border-left-color: var(--pt-accent); }
@media (max-width: 1000px) { .rail { position: static; } .rail ol { display: flex; gap: 0.4rem; overflow-x: auto; border-left: 0; padding-bottom: 0.4rem; } .rail a { white-space: nowrap; border: 1px solid var(--pt-rule); border-radius: 999px; padding: 0.3rem 0.75rem; } }

.keyfacts { border: 1px solid var(--pt-rule); border-left: 3px solid var(--pt-accent); background: color-mix(in srgb, var(--pt-accent) 5%, transparent); padding: 1.1rem 1.25rem; border-radius: 6px; }
.keyfacts h2 { margin: 0 0 0.6rem; font-family: var(--pt-mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--pt-accent); border: 0; padding: 0; }
.keyfacts ul { margin: 0; padding-left: 1.2em; }
.callout { border: 1px solid var(--pt-rule); border-top: 3px solid var(--pt-amber); background: color-mix(in srgb, var(--pt-amber) 6%, transparent); padding: 1rem 1.2rem; border-radius: 6px; font-size: 0.98rem; }
.callout strong { display: block; margin-bottom: 0.25rem; }
.specbox { border: 1px dashed var(--pt-rule-strong); border-radius: 6px; padding: 1rem 1.2rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--pt-rule); border: 1px solid var(--pt-rule); border-radius: 8px; overflow: hidden; margin: 1.6rem 0; }
.stat { background: var(--pt-paper); padding: 1rem 1.1rem; }
.stat b { display: block; font-family: var(--pt-mono); font-size: 1.5rem; line-height: 1.1; letter-spacing: -0.02em; color: var(--pt-accent); }
.stat span { display: block; margin-top: 0.3rem; font-size: 0.82rem; color: var(--ink-2, #4c4f58); }

.table-scroll { overflow-x: auto; margin: 1.6rem 0; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data caption { text-align: left; font-size: 0.8rem; color: var(--ink-3, #8b8e98); font-family: var(--pt-mono); padding-bottom: 0.5rem; }
table.data th, table.data td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--pt-rule); text-align: left; vertical-align: top; }
table.data thead th { font-family: var(--pt-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2, #4c4f58); border-bottom: 1.5px solid var(--pt-rule-strong); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--pt-mono); font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--pt-accent) 4%, transparent); }
table.data .best { color: var(--pt-accent-ink); font-weight: 700; }

.figure { margin: 1.8rem 0; }
.figure svg, .figure img { width: 100%; height: auto; display: block; border: 1px solid var(--pt-rule); border-radius: 8px; background: var(--pt-paper); }
.figure figcaption { margin-top: 0.6rem; font-size: 0.84rem; color: var(--ink-2, #4c4f58); }
.figure figcaption a { color: var(--pt-accent-ink); }

.pill { display: inline-block; font-family: var(--pt-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--pt-rule-strong); border-radius: 999px; padding: 0.18rem 0.6rem; color: var(--ink-2, #4c4f58); margin: 0 0.35rem 0.35rem 0; }

.cta-band { border: 1px solid var(--pt-rule); background: var(--pt-ink); color: #f2f5f6; border-radius: 10px; padding: 1.4rem 1.5rem; margin: 2.4rem 0; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.cta-band h2 { margin: 0; font-size: 1.15rem; color: #fff; border: 0; padding: 0; }
.cta-band p { margin: 0.35rem 0 0; font-size: 0.92rem; color: #c3cdd4; }
.cta-band a.btn { background: var(--pt-accent); color: #fff; padding: 0.7rem 1.15rem; border-radius: 6px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.cta-band a.btn:hover { background: var(--pt-accent-ink); }

.related { border-top: 1px solid var(--pt-rule); margin-top: 3rem; padding-top: 1.5rem; }
.related h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.related-grid a { display: block; border: 1px solid var(--pt-rule); border-radius: 8px; padding: 0.9rem 1rem; text-decoration: none; color: inherit; }
.related-grid a:hover { border-color: var(--pt-accent); }
.related-grid strong { display: block; font-size: 0.97rem; margin-bottom: 0.25rem; }
.related-grid span { font-size: 0.85rem; color: var(--ink-2, #4c4f58); }

.hub-list { display: grid; gap: 1px; background: var(--pt-rule); border: 1px solid var(--pt-rule); border-radius: 8px; overflow: hidden; }
.hub-item { background: var(--pt-paper); padding: 1.05rem 1.2rem; display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 1rem; align-items: baseline; text-decoration: none; color: inherit; }
.hub-item .tag { font-family: var(--pt-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pt-accent); }
.hub-item h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.hub-item p { margin: 0; font-size: 0.92rem; color: var(--ink-2, #4c4f58); }
.hub-item:hover { background: color-mix(in srgb, var(--pt-accent) 4%, transparent); }
@media (max-width: 640px) { .hub-item { grid-template-columns: 1fr; gap: 0.3rem; } }

.source-list { font-size: 0.88rem; color: var(--ink-2, #4c4f58); }
.meta-note { font-size: 0.84rem; color: var(--ink-3, #8b8e98); font-family: var(--pt-mono); }

@media print { .rail, .cta-band, .site-footer, .topbar { display: none; } .layout { grid-template-columns: 1fr; } }
/* Overflow guards: a grid item defaults to min-width:auto, which lets a wide
   data table stretch the whole page on narrow screens. */
main { min-width: 0; }
.layout > main { min-width: 0; }
@media (max-width: 1000px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.figure svg { max-width: 100%; }

/* Long unbroken strings (URLs in source lists) must not stretch the column. */
.prose p, .prose li { overflow-wrap: break-word; }
.prose a { overflow-wrap: anywhere; }
