/* PetoAI shared design tokens + base corrections (UI_P0_RELEASE_V1).
   Loaded LAST on every page, so it only corrects: readable minimum text sizes, contrast of muted text, focus visibility,
   large-screen proportions, the shared navigation bar, user preferences (text size, contrast, motion) and print. */
:root {
  --pt-ink: #eef5fa; --pt-muted: #a9b9c4; --pt-muted-2: #93a6b3; --pt-bg: #07111a; --pt-panel: #0b1721;
  --pt-line: rgba(143, 171, 190, .22); --pt-orange: #ff7a1a; --pt-orange-2: #ffad5a; --pt-cyan: #49d5e8; --pt-focus: #ffad5a;
  --pt-fs-xs: 12px; --pt-fs-sm: 13px; --pt-fs-md: 15px; --pt-radius: 10px;
}
/* --- one palette for every page (shared token names; keskustelut.html had its own light/dark palette) --- */
:root { color-scheme: dark; --muted: #a9b9c4; --line: rgba(143, 171, 190, .22);
  --bg: #07111a; --panel: #0b1721; --text: #eef5fa; --accent: #49d5e8; }
.card h2, h2.card-title { font-size: 12px !important; letter-spacing: .1em; }
header span, .live span { font-size: max(12px, 1em); }
/* --- readable minimum sizes (owner P0.1: no 9–11 px text) --- */
.edition, .nav-label, .eyebrow, .badge, .num, .chip, .state { font-size: var(--pt-fs-xs) !important; letter-spacing: .06em; }
.composer-note, .settings-link, #connectionText, small, .value, .tech, .note, .lead, .why, .role, .sub, .hint, .meta, .muted, .caption, .foot {
  font-size: var(--pt-fs-sm) !important; }
p { font-size: max(var(--pt-fs-sm), 1em) !important; }
.pill, .state-tag, th, #generated, .pn-cap, .mono, dt, dd { font-size: max(12px, 1em) !important; }
.state-tag, .pill, th { font-size: 12px !important; }
/* --- contrast: muted text on the dark panels must reach >= 4.5:1 --- */
.nav-label, .edition, .composer-note, small, .sub, .note, .lead, .why, .meta, .muted, .hint, .caption, #live-text, .pn-cap, #generated, th { color: var(--pt-muted) !important; }
.side-link.dev { color: var(--pt-muted) !important; }
/* --- focus visibility for keyboard users --- */
:focus-visible { outline: 3px solid var(--pt-focus) !important; outline-offset: 2px !important; border-radius: 6px; }
a, button, summary, [tabindex] { scroll-margin: 80px; }
/* --- large screens: use the space (no tiny centred column) --- */
/* chat sidebar status cards: label left, value right, no awkward wrapping */
.capability { grid-template-columns: 9px minmax(0, 1fr) !important; row-gap: 2px; }
.capability .value { grid-column: 2; justify-self: start; letter-spacing: .04em; }
@media (min-width: 1700px) {
  .app { grid-template-columns: 320px minmax(0, 1fr) !important; }
  .content { width: min(1240px, calc(100% - 96px)) !important; }
  .composer { width: min(1240px, 100%) !important; }
  .message { max-width: 1120px !important; }
  .hero { min-height: 340px; }
  .side-link { font-size: 15px !important; padding: 9px 12px !important; }
}
@media (min-width: 2300px) {
  .topbar { min-height: 76px; } .title-block strong { font-size: 18px !important; } .title-block span, #connectionText { font-size: 14px !important; }
  .app { grid-template-columns: 360px minmax(0, 1fr) !important; }
  .content { width: min(1500px, calc(100% - 140px)) !important; }
  .composer { width: min(1500px, 100%) !important; }
  .message { max-width: 1360px !important; }
  .hero { min-height: 420px; }
  .hero h1 { font-size: 64px !important; }
  .hero p, .prompt, .prompts * { font-size: 17px !important; }
  #text { font-size: 17px !important; }
  .side-link { font-size: 17px !important; }
  .capability strong { font-size: 15px !important; }
  .capability small, .capability .value { font-size: 14px !important; }
}
/* --- shared navigation bar (petoai-nav.js) --- */
.pn-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 18px;
  background: rgba(7, 17, 26, .96); border-bottom: 1px solid var(--pt-line); font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif; }
.pn-bar .pn-brand { display: flex; align-items: center; gap: 8px; margin-right: 10px; color: var(--pt-ink); text-decoration: none; font-weight: 800; letter-spacing: -.01em; }
.pn-bar .pn-brand b { color: var(--pt-orange); }
.pn-bar a.pn, .pn-bar summary { color: #c9d5dc; text-decoration: none; padding: 8px 11px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.pn-bar a.pn:hover, .pn-bar summary:hover { color: #fff; border-color: var(--pt-line); }
.pn-bar a.pn.on { color: #14100c; background: var(--pt-orange); }
.pn-bar details { position: relative; }
.pn-bar details summary { list-style: none; }
.pn-bar details summary::-webkit-details-marker { display: none; }
.pn-bar details[open] summary { border-color: var(--pt-line); }
.pn-bar .pn-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; padding: 6px; background: #0b1721; border: 1px solid var(--pt-line);
  border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.45); display: grid; }
.pn-bar .pn-menu a { color: #d6e0e6; padding: 9px 11px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.pn-bar .pn-menu a:hover, .pn-bar .pn-menu a.on { background: rgba(255,122,26,.12); color: #fff; }
.pn-bar .pn-menu .pn-cap { padding: 6px 11px 2px; font-size: 12px; color: var(--pt-muted); letter-spacing: .08em; text-transform: uppercase; }
.pn-bar .pn-sp { flex: 1; }
nav.tabs.pn-hidden { display: none !important; }
@media (max-width: 700px) { .pn-bar { padding: 8px 10px; gap: 4px; } .pn-bar a.pn, .pn-bar summary { padding: 7px 8px; font-size: 13px; } .pn-bar .pn-brand span { display: none; } }
/* --- user preferences (petoai-prefs.js sets data-* on <html>) --- */
html[data-text-size="large"] body { zoom: 1.125; }
html[data-text-size="xlarge"] body { zoom: 1.25; }
html[data-high-contrast="true"] { --pt-muted: #dbe5eb; --pt-line: rgba(220, 235, 245, .45); }
html[data-high-contrast="true"] body { color: #ffffff; }
html[data-high-contrast="true"] .nav-label, html[data-high-contrast="true"] small, html[data-high-contrast="true"] .muted,
html[data-high-contrast="true"] .composer-note, html[data-high-contrast="true"] .sub, html[data-high-contrast="true"] .note { color: #e8f0f4 !important; }
html[data-reduce-motion="true"] *, html[data-reduce-motion="true"] *::before, html[data-reduce-motion="true"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html[data-show-developer="false"] .pn-dev, html[data-show-developer="false"] .dev-only { display: none !important; }
/* --- print: diagnostics print readable on paper --- */
@media print {
  .pn-bar, .sidebar, .composer-wrap, .mobile-nav, button, nav.tabs { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; zoom: 1 !important; }
  html body *, html body .sub, html body .muted, html body small { color: #111 !important; background: transparent !important; box-shadow: none !important; border-color: #999 !important; }
  .app { display: block !important; height: auto !important; }
  main, .main, #stage, .card, .panel { overflow: visible !important; height: auto !important; }
  a[href^="/"]::after { content: ""; }
}

/* short laptop screens (1366x768, 125-150 % scaling): keep the start content above the composer */
@media (min-width: 851px) and (max-height: 820px) {
  .content { padding-top: 24px !important; }
  .hero { min-height: 0 !important; padding: 26px 34px !important; }
  .hero h1 { font-size: clamp(30px, 3.2vw, 42px) !important; margin: 8px 0 10px !important; }
  .prompts { gap: 10px !important; }
}
