/* REQ-143, UI-038, DES-085 - public AskGRADUS chat page.
   Tokens, header and footer are copied from the axlflo.ai site (read-only reference);
   re-sync them periodically (see the deployment runbook). Motion: transform and opacity only. */
:root {
  --indigo: #4626bd; --indigo-hover: #351c96; --purple: #b124f6; --coral: #ea4e43;
  --bg: #fff; --fg: #000; --body: #666; --muted: #f7f4fc; --wash: #f3eefc;
  --card: #fff; --primary: #4626bd; --on-primary: #fff;
  --border: color-mix(in oklab, #4626bd 18%, white);
  --rail: linear-gradient(90deg, #4626bd 0%, #4626bd 50%, #b124f6 90%, #ea4e43 100%);
  --page:
    radial-gradient(ellipse 82% 46% at 6% -4%, color-mix(in oklab, #4626bd 16%, transparent), transparent 64%),
    radial-gradient(ellipse 68% 40% at 98% 46%, color-mix(in oklab, #b124f6 12%, transparent), transparent 66%),
    radial-gradient(ellipse 48% 30% at 78% 102%, color-mix(in oklab, #ea4e43 9%, transparent), transparent 68%);
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  color-scheme: light;
}
html.dark {
  --bg: #0c0914; --fg: #f4f0ff; --body: #b7b0c9; --muted: #1a1528; --wash: #161022;
  --card: #14101f; --primary: #8b74f0; --indigo-hover: #6d4de0;
  --border: color-mix(in oklab, #b124f6 28%, transparent);
  --page:
    radial-gradient(ellipse 82% 46% at 6% -4%, color-mix(in oklab, #4626bd 22%, transparent), transparent 64%),
    radial-gradient(ellipse 68% 40% at 98% 46%, color-mix(in oklab, #b124f6 16%, transparent), transparent 66%),
    radial-gradient(ellipse 48% 30% at 78% 102%, color-mix(in oklab, #ea4e43 10%, transparent), transparent 68%);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-padding-top: 6.75rem; }
body {
  font-family: Figtree, system-ui, sans-serif; font-weight: 400;
  background: var(--bg) var(--page); background-attachment: fixed;
  color: var(--fg); min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 999px; }
.skip:focus { left: 8px; }

/* header: floating bar, as on axlflo.ai */
header { position: fixed; inset: 0 0 auto 0; z-index: 20; padding: 12px 16px; pointer-events: none; }
.bar {
  pointer-events: auto; max-width: 1152px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 999px; border: 1px solid color-mix(in oklab, #4626bd 8%, transparent);
  background: color-mix(in oklab, var(--bg) 55%, transparent); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  padding: 8px 20px; box-shadow: 0 8px 32px rgba(70, 38, 189, 0.08);
}
html.dark .bar { border-color: rgba(177, 36, 246, 0.18); box-shadow: 0 12px 40px rgba(8, 5, 16, 0.45); background: rgba(20, 16, 31, 0.55); }
.logo img { height: 28px; width: auto; display: block; }
.logo .d, .fbrand .d { display: none; }
html.dark .logo .l, html.dark .fbrand .l { display: none; }
html.dark .logo .d, html.dark .fbrand .d { display: block; }
.links { display: flex; align-items: center; gap: 2px; border-radius: 999px; border: 1px solid color-mix(in oklab, #4626bd 12%, transparent); background: var(--card); padding: 4px; box-shadow: 0 4px 20px rgba(70, 38, 189, 0.1); }
html.dark .links { border-color: rgba(177, 36, 246, 0.22); background: #1a1528; }
.links a { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--fg); transition: color 0.12s var(--ease), background 0.12s var(--ease); }
.links a:hover { color: var(--primary); background: color-mix(in oklab, var(--muted) 70%, transparent); }
.links a[aria-current] { color: var(--primary); background: var(--muted); }
.links i { width: 1px; height: 12px; background: color-mix(in oklab, #4626bd 16%, transparent); margin: 0 2px; }
.right { display: flex; align-items: center; gap: 6px; }
.tt { width: 44px; height: 44px; border-radius: 999px; border: 0; background: transparent; color: var(--fg); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tt:hover { color: var(--primary); }
.login { font-size: 14px; font-weight: 500; padding: 0 10px; min-height: 40px; display: inline-flex; align-items: center; transition: color 0.12s var(--ease); }
.login:hover { color: var(--primary); }
.cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 999px; padding: 10px 24px; font: 500 14px Figtree, sans-serif; background: var(--primary); color: #fff; border: 0; cursor: pointer; transition: transform 0.12s var(--ease), background 0.22s var(--ease); }
.cta:hover { background: var(--indigo-hover); transform: translateY(-1px); }
.burger { display: none; }
.sun { display: none; }
html.dark .sun { display: block; }
html.dark .moon { display: none; }

/* mobile menu */
#mobile-menu { position: fixed; inset: 0; z-index: 40; background: var(--bg); padding: 80px 24px 24px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
#mobile-menu[hidden] { display: none; }
#mobile-menu a.nav { display: flex; align-items: center; min-height: 48px; font-size: 16px; font-weight: 500; }
#mobile-menu a.nav[aria-current] { color: var(--primary); }
#mobile-menu .top { position: absolute; top: 12px; left: 24px; right: 16px; display: flex; align-items: center; justify-content: space-between; }
#mobile-menu .cta { margin-top: 16px; }

/* layout */
main { flex: none; max-width: 1152px; width: 100%; margin: 0 auto; padding: 96px 24px 20px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0 28px; height: max(100dvh, 610px); grid-template-rows: auto minmax(0, 1fr); }
.intro { grid-column: 1 / -1; }
main > section { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.crumb { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--body); margin-bottom: 10px; }
.crumb a:hover { color: var(--primary); }
.crumb b { color: var(--primary); font-weight: 600; }
h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
h1 .g { background: var(--rail); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.tag { font-family: Spectral, serif; font-style: italic; font-size: 16px; color: var(--body); margin: 6px 0 14px; }
/* REQ-147: the card takes the rest of the window; the widget fills it (absolute, so its height is definite). */
.chat-card { position: relative; flex: 1 1 auto; min-height: 380px; }
.chat-card > div { position: absolute !important; inset: 0; height: auto !important; }
.fine { font-size: 12px; line-height: 1.5; color: var(--body); padding: 0 4px; }

/* side column */
aside { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.card.grow { flex: 1 1 auto; display: flex; flex-direction: column; }
.card.grow ul { flex: 1 1 auto; display: flex; flex-direction: column; }
.card.grow li { flex: 1 1 0; display: flex; align-items: center; min-height: 40px; }
.card.grow li > button, .card.grow li > a { padding: 0; }
.card.demo { margin-top: auto; flex: none; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.card h2 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--body); font-weight: 600; margin-bottom: 12px; }
.card ul { list-style: none; padding: 0; }
.card li { border-top: 1px solid var(--border); font-size: 14px; }
.card li:first-child { border-top: 0; }
.card li button { all: unset; box-sizing: border-box; width: 100%; padding: 10px 0; cursor: pointer; color: var(--fg); transition: color 0.12s var(--ease); }
.card li button:hover { color: var(--primary); }
.card li button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.card li a { display: block; padding: 10px 0; color: var(--fg); transition: color 0.12s var(--ease); }
.card li a:hover { color: var(--primary); }
.note { margin-top: 8px; font-size: 13px; color: var(--primary); }
.note[hidden] { display: none; }
/* The demo card is a normal light card with the site's purple pill button, like "Get in Touch" in the header. */
.card.demo p { font-family: Spectral, serif; font-style: italic; font-size: 17px; margin-bottom: 14px; }
.card.demo .cta { width: 100%; }

/* REQ-159, DES-091, UI-042 - side column accordion and the Explore GRADUS tree. Until the settings arrive the boxes show open, as
   before; page.js then adds aside.acc-mode, which opens one box at a time (Explore first). */
.acc-hd { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; }
.acc-hd:focus-visible, .tree button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.chev { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: 0 4px 3px 0; transition: transform 0.15s var(--ease); }
.card.acc.open .chev { transform: rotate(225deg); margin-bottom: -3px; }
aside.acc-mode .card.acc:not(.open) .acc-body { display: none; }
aside.acc-mode .card.acc:not(.open) h2 { margin-bottom: 0; }
aside.acc-mode .card.grow { flex: none; display: block; }
aside.acc-mode .card.grow ul { display: block; }
aside.acc-mode .card.grow li { display: block; min-height: 0; }
aside.acc-mode .card.grow li > button, aside.acc-mode .card.grow li > a { padding: 10px 0; }
.tree, .tree ul { list-style: none; padding: 0; }
.tree li { border-top: 1px solid var(--border); }
.tree > li:first-child { border-top: 0; }
.tree .row { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 0; font-size: 14px; color: var(--fg); cursor: pointer; transition: color 0.12s var(--ease); }
.tree .row:hover, .tree li.open > .row { color: var(--primary); }
.tree .cnt { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 999px; background: var(--wash); color: var(--body); font-size: 11px; line-height: 18px; vertical-align: 1px; }
.tree .mark { flex: none; width: 16px; text-align: center; color: var(--body); }
.tree ul { margin: 0 0 6px 12px; padding-left: 12px; border-left: 2px solid var(--border); }
.tree ul li { border-top: 0; }
.tree ul .row { font-size: 13px; padding: 8px 0; }
.tree .desc { font-size: 13px; line-height: 1.5; color: var(--body); padding: 0 0 6px; }
.tree .line { display: flex; align-items: center; gap: 6px; }
.tree .line .row { flex: 1; }
.tree .info { all: unset; box-sizing: border-box; flex: none; width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 50%; text-align: center; font: italic 600 12px/18px Spectral, serif; color: var(--body); cursor: pointer; }
.tree .info:hover, .tree li.open > .line .info { color: var(--primary); border-color: var(--primary); }
.tree li:not(.open) > .body { display: none; }

/* footer: as on axlflo.ai */
footer { border-top: 1px solid color-mix(in oklab, #4626bd 10%, transparent); background: var(--bg); margin-top: 20px; }
.ax-rail { display: block; height: 6px; background: var(--rail); }
.fwrap { max-width: 1152px; margin: 0 auto; padding: 40px 24px; }
.fgrid { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; }
.fbrand img { height: 30px; width: auto; display: block; margin-bottom: 14px; }
.fbrand p { font-size: 11px; letter-spacing: 0.12em; color: var(--body); }
.fcols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 24px; }
.fcols h3 { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.2em; color: var(--primary); margin-bottom: 12px; }
.fcols a { display: block; font-size: 14px; color: var(--body); padding: 9px 0; transition: color 0.12s var(--ease); }
.fcols a:hover { color: var(--primary); }
.legal { max-width: 880px; margin: 36px auto 0; padding-top: 24px; border-top: 1px solid color-mix(in oklab, #4626bd 10%, transparent); text-align: center; font-size: 12px; line-height: 1.6; color: var(--body); }

@media (max-width: 1023px) {
  .links, .login, header .cta { display: none; }
  .burger { display: inline-flex; }
}
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: auto; padding-top: 84px; padding-inline: 16px; height: auto; }
  main > section { display: block; }
  .card.grow li { flex: none; }
  .chat-card { flex: none; height: clamp(400px, calc(100dvh - 232px), 720px); }
  aside { order: 2; overflow: visible; }
  .fgrid { grid-template-columns: 1fr; }
  .fcols { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

@media (max-height: 820px) and (min-width: 901px) {
  aside { gap: 10px; }
  .card { padding: 12px 16px; }
  .card h2 { margin-bottom: 2px; }
  .card li button, .card li a { font-size: 13px; }
  .card.grow li { min-height: 32px; }
  .card.demo h2, .card.demo p { display: none; }
  .fine { font-size: 11px; }
}

/* REQ-155, DES-088 - phones: compact heading and header so the whole chat card, message box included, is on screen. */
@media (max-width: 600px) {
  header { padding: 8px 12px; }
  .bar { padding: 6px 14px; }
  .logo img { height: 22px; }
  main { padding-top: 72px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .crumb { display: none; }
  h1 { font-size: 24px; }
  .tag { font-size: 13px; line-height: 1.4; margin: 4px 0 10px; }
  .chat-card { height: clamp(360px, calc(100dvh - 176px), 720px); }
}
