/* Inherits the Archimedes palette from ../styles.css, overrides for chat. */
:root {
  --brand: #992269;
  --brand-deep: #6f1a4d;
  --bg: #ffffff;
  --bg-muted: #faf5f8;
  --fg: #1b1418;
  --fg-muted: #5f5560;
  --rule: #e9dfe6;
  --warn: #b25b00;
}

* { box-sizing: border-box; }

html {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body {
  /* Transparent so the body::before background image is actually visible.
   * (When body has its own background, it paints onto the root canvas and
   * the z-index:-1 pseudo-element ends up behind it.) */
  margin: 0;
  padding: 0;
  background: transparent;
  min-height: 100vh;
}

/* Faded photograph of the Ceremonial Hall of the Academy of Athens. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('./assets/academy-hall-interior.jpg') center / cover no-repeat;
  opacity: 0.14;
  z-index: -1;
  pointer-events: none;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 6vh 24px 8vh;
}

.brandbar {
  display: flex;
  align-items: center;
  gap: 22px;     /* bigger gap now that the × separator is gone */
  margin: 0 0 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
/* Brand logos are sized for visual weight, not by a single height.
 * Archimedes: SVG wordmark, kept at 22px because it sets the line.
 * Athena RC: full vertical lockup (icon + "ATHENA / Research..." text)
 *   needs more height for the text to read but bound to 28px so it doesn't
 *   dwarf the others.
 * AUEB: horizontal lockup (Hermes head + Greek + English text) —
 *   keep it short, the long aspect ratio handles itself. */
.brandbar .brand-archimedes { height: 28px; width: auto; }
.brandbar .brand-athena    { height: 35px; width: auto; }
.brandbar .brand-aueb      { height: 20px; width: auto; }
@media (max-width: 600px) {
  .brandbar { gap: 14px; }
  .brandbar .brand-archimedes { height: 23px; }
  .brandbar .brand-athena    { height: 28px; }
  .brandbar .brand-aueb      { height: 16px; }
}
.brandbar .brand-x {
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 300;
  user-select: none;
}
.brandbar a {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--fg);
}
.brandbar a:hover,
.brandbar a:focus,
.brandbar a:visited {
  color: var(--fg);
  text-decoration: none;
}
.status-pill {
  margin-left: auto;
  display: inline-flex !important;       /* override .brandbar a { display:flex } */
  flex: 0 0 auto;                        /* never let the brandbar squeeze the pill */
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg);
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fff;
  gap: 8px !important;
  white-space: nowrap;
  cursor: help;
}
.status-pill .status-dot {
  flex: 0 0 auto;                        /* never compress the dot itself */
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--fg-muted);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.04);
}
.status-pill[data-state="ok"] {
  border-color: rgba(42,138,62,0.4);
  background: rgba(42,138,62,0.10);
  color: #1f6b30;
}
.status-pill[data-state="ok"] .status-dot {
  background: #2a8a3e;
  box-shadow: 0 0 0 2px rgba(42,138,62,0.22);
}
.status-pill[data-state="fallback"] {
  border-color: rgba(204,138,0,0.55);
  background: rgba(204,138,0,0.12);
  color: #8c5e00;
}
.status-pill[data-state="fallback"] .status-dot {
  background: #d49b00;
  box-shadow: 0 0 0 2px rgba(204,138,0,0.22);
}
.status-pill[data-state="down"] {
  border-color: rgba(178,91,0,0.55);
  background: rgba(178,91,0,0.12);
  color: var(--warn);
}
.status-pill[data-state="down"] .status-dot {
  background: #b25b00;
  box-shadow: 0 0 0 2px rgba(178,91,0,0.22);
}
@media (max-width: 600px) {
  .status-pill {
    padding: 5px 10px;
    font-size: 12px;
  }
  .status-pill .status-dot { width: 10px; height: 10px; }
}
.brandbar .session {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.themis-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -20px 0 36px;   /* tuck just below the brandbar's bottom border */
}
.themis-row .brand-themis {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  /* Source is the full Themis-of-Rhamnous statue (250×468 portrait); the
   * face only occupies the top ~15%. Scale the image up so the top 30%
   * of the source fills the circle vertically, then center the face. */
  background-image: url('./assets/themis-rhamnous.jpg');
  background-repeat: no-repeat;
  background-size: auto 120px;       /* 36 / (0.30 × 468) ≈ 36/140 of original height */
  background-position: center top;   /* show the upper 30% (head + shoulders) */
}
.themis-row .themis-label {
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--fg);
  line-height: 1.25;
}
.themis-row .themis-label strong {
  color: var(--brand);
  font-weight: 600;
}

.eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--brand);
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}
h1 .accent { color: var(--brand); }

.tagline {
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-muted);
  margin: 0 0 32px;
  max-width: 60ch;
}

.query-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-muted);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px;
}
.query-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  background: #fff;
  color: var(--fg);
}
.query-form textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.char-count {
  font-size: 12px;
  color: var(--fg-muted);
}
button {
  cursor: pointer;
  font: inherit;
}
.query-form button {
  background: var(--brand);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 500;
  transition: background 120ms ease;
}
.query-form button:hover { background: var(--brand-deep); }
.query-form button:disabled { background: var(--fg-muted); cursor: wait; }

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 4px;
}
.suggestions-label {
  font-size: 11.5px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.suggestions-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--fg-muted);
  opacity: 0.55;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease, opacity 120ms ease;
}
.chip:hover {
  border-style: solid;
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  opacity: 1;
}
.chip:disabled { opacity: 0.4; cursor: wait; }

.status {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: #fff;
}
.status p {
  margin: 0;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.status.error { border-color: var(--warn); }
.status.error p { color: var(--warn); }

/* Custom brown balance-scale in the style of the ⚖️ emoji.
 * Two SVG groups: .scale-post stays planted; .scale-beam (beam +
 * chains + pans) rotates around the apex finial. */
.thinking-spinner {
  display: inline-block;
  width: 3.2em;
  height: 2.8em;
  vertical-align: -0.9em;
  overflow: visible;
  filter: drop-shadow(0 1px 0.5px rgba(60,30,5,0.18));
}
.thinking-spinner .scale-beam {
  transform-origin: 32px 10px;     /* apex finial */
  animation: themis-balance 1.6s ease-in-out infinite;
}
.status.error .thinking-spinner .scale-beam,
.status.done  .thinking-spinner .scale-beam {
  animation: none;
  transform: rotate(0);
}
@keyframes themis-balance {
   0% { transform: rotate(-11deg); }
  50% { transform: rotate( 11deg); }
 100% { transform: rotate(-11deg); }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-spinner .scale-beam { animation: none; }
}

section.answer,
section.citations {
  margin-top: 32px;
}
section.answer h2,
section.citations h2 {
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 10px;
  font-weight: 600;
}

#answer-text {
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 16px;
}
#answer-text p { margin: 0 0 10px; }
#answer-text p:last-child { margin-bottom: 0; }
#answer-text ul, #answer-text ol { margin: 0 0 10px; padding-left: 24px; }
#answer-text li { margin: 2px 0; }
#answer-text h3, #answer-text h4, #answer-text h5 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 14px 0 6px;
}
#answer-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--bg-muted);
  padding: 1px 5px;
  border-radius: 4px;
}
#answer-text a.cite-ref {
  color: var(--brand-deep);
  text-decoration: underline;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Reasoning panel hidden for now — gpt-oss-120b doesn't expose
 * reasoning_content over the API, so there's nothing meaningful to show.
 * Force-hide regardless of the [hidden] attribute toggling in demo.js. */
details#thinking { display: none !important; }
details#thinking-OFF {
  background: var(--bg-muted);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--fg-muted);
}
details#thinking summary { cursor: pointer; user-select: none; }
details#thinking pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.4;
  max-height: 240px;
  overflow: auto;
}

.feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.feedback-label { font-size: 13px; color: var(--fg-muted); margin-right: 4px; }
.thumb {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 18px;
  line-height: 1;
}
.thumb:hover { border-color: var(--brand); }
.thumb.active { background: var(--bg-muted); border-color: var(--brand); }
.feedback-ack { font-size: 13px; color: var(--brand-deep); margin-left: 6px; }

ol#citations-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  counter-reset: cite;
}
ol#citations-list li {
  counter-increment: cite;
  background: var(--bg-muted);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  padding-left: 44px;
}
ol#citations-list li::before {
  content: attr(data-n);
  position: absolute;
  left: 14px;
  top: 14px;
  background: var(--brand);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}
.cite-leg {
  font-size: 12px;
  color: var(--fg-muted);
  margin: 0 0 4px;
}
.cite-leg a {
  color: var(--brand-deep);
  text-decoration: underline;
}
.cite-fek {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  margin: 0 0 6px;
  font-variant-numeric: tabular-nums;
}
.cite-fek-note {
  display: inline-block;
  margin-top: 1px;
  font-size: 10.5px;
  letter-spacing: 0;
  opacity: 0.5;
  /* no italic, no color change — keep it very subtle */
}
.cite-title {
  font-weight: 600;
  margin: 0 0 4px;
}
.cite-breadcrumb {
  font-size: 12px;
  color: var(--fg-muted);
  margin: 0 0 8px;
}
.cite-meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin: 0 0 8px;
}
.cite-meta .repeal-pill {
  display: inline-block;
  background: var(--warn);
  color: #fff;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
}
.cite-summary {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 8px;
  color: var(--fg);
}
.cite-summary .trim-pill {
  display: inline-block;
  background: var(--rule);
  color: var(--fg-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}
details.cite-full {
  font-size: 12px;
  color: var(--fg-muted);
}
details.cite-full summary {
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}
details.cite-full[open] summary {
  margin-bottom: 6px;
}
.cite-text {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: var(--fg);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px;
}

footer {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  margin-top: 48px;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.5;
}
footer p { margin: 0 0 6px; }
footer .footer-authors {
  color: var(--fg);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  margin: 6px 0;
}
footer .footer-disclaimer {
  font-size: 12px;
  font-style: italic;
  opacity: 0.85;
}
footer a { color: var(--brand-deep); text-decoration: underline; }
footer strong a { color: inherit; }
