/* Domain presentation: the logos, masthead, welcome card and palette of a domain
   config's `presentation`, applied by domain-presentation.js, which sets
   html[data-chat-theme]. Every color is a custom property. The defaults below
   are neutral, drawn from variables.css; `presentation.palette` in the domain
   config overrides any of them, or any token of variables.css, by name
   without "--" (e.g. `presentation-surface`, `accent`). */
:root {
  --presentation-page: var(--bg-tertiary);         /* behind the chat card */
  --presentation-surface: var(--bg-primary);       /* header, messages, starters */
  --presentation-rule: var(--accent);              /* band across the card's top */
  --presentation-header-rule: var(--border-default);
  --presentation-ink: var(--primary);              /* masthead and welcome text */
  --presentation-text: var(--text-secondary);      /* welcome description */
  --presentation-muted: var(--text-muted);         /* domain name, source note */
  --presentation-eyebrow: var(--accent-dark);
  --presentation-ornament: var(--accent-light);
  --presentation-control-border: var(--border-control);  /* 3:1 edges, WCAG 1.4.11 */
  --presentation-card-border: var(--border-light);
  --presentation-card-start: var(--bg-secondary);  /* welcome card gradient */
  --presentation-card-end: var(--bg-primary);
  --presentation-starter-border: var(--border-control);
  --presentation-user-border: var(--border-light);
  --presentation-focus: var(--accent);
}
html[data-chat-theme] {
  --chat-max-width: 1060px;
  background: var(--presentation-page);
}
html[data-chat-theme] body { background: transparent; }
html[data-chat-theme] .chat-page { border-top: 5px solid var(--presentation-rule); }
html[data-chat-theme] .chat-header {
  border-bottom: 2px solid var(--presentation-header-rule);
  background: var(--presentation-surface);
}
/* Logos, then the masthead, on one row; the connection status below. */
html[data-chat-theme] .toolbar-brand { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; flex-shrink: 1; min-width: 0; }
html[data-chat-theme] .toolbar-connection { flex-basis: 100%; }
/* At the largest text size on a phone, the name wraps under the monogram
   rather than being cut off (the brand row above may shrink for it). */
.domain-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.domain-monogram {
  margin: 0;
  font: bold 2rem/1 Georgia, 'Times New Roman', serif;
  letter-spacing: -.07em;
  color: var(--presentation-ink);
}
.domain-name { max-width: 7rem; font-size: .85rem; line-height: 1.2; color: var(--presentation-muted); }
/* A name without a monogram is the masthead itself. */
.domain-brand--name-only .domain-name {
  max-width: 14rem; font-size: 1.05rem; font-weight: 600; color: var(--presentation-ink);
}
html[data-chat-theme] .toolbar-logos { gap: 12px; }
html[data-chat-theme] .toolbar-logos:not(:empty) + .domain-brand {
  padding-left: 14px; border-left: 1px solid var(--presentation-control-border);
}
html[data-chat-theme] .toolbar-connection:empty { display: none; }
html[data-chat-theme] .toolbar-btn { border-color: var(--presentation-control-border); }
html[data-chat-theme] .toolbar-btn--success {
  background: var(--bg-secondary); border-color: var(--presentation-control-border); color: var(--presentation-ink);
}
html[data-chat-theme] .chat-messages { background: var(--presentation-surface); }
.domain-welcome {
  position: relative;
  padding: 24px 26px;
  margin-bottom: 24px;
  border: 1px solid var(--presentation-card-border);
  border-radius: 12px;
  background: linear-gradient(115deg, var(--presentation-card-start) 0%, var(--presentation-card-end) 75%);
  color: var(--presentation-ink);
  overflow: hidden;
}
.domain-welcome[hidden], .domain-welcome [hidden] { display: none; }
.domain-welcome::after {
  content: "✦";
  content: "✦" / "";  /* decorative: no text for screen readers */
  position: absolute; right: 22px; top: -6px;
  font-size: 100px; color: var(--presentation-ornament); opacity: .2;
  pointer-events: none;
}
.domain-eyebrow {
  margin: 0 0 12px;
  color: var(--presentation-eyebrow);
  font-size: .72rem; font-weight: 700; letter-spacing: .11em;
}
.domain-heading {
  position: relative; z-index: 1;
  max-width: 650px; margin: 0 0 12px;
  font: 600 clamp(1.8rem, 4vw, 2.7rem)/1.12 Georgia, 'Times New Roman', serif;
  letter-spacing: -.025em;
}
.domain-description { max-width: 620px; margin: 0; line-height: 1.5; color: var(--presentation-text); }
.domain-starters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 20px 0 12px; }
.domain-starter {
  min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--presentation-starter-border); border-radius: 6px;
  background: var(--presentation-surface); color: var(--presentation-ink);
  font: inherit; font-size: .9rem; font-weight: 600;
  line-height: 1.3; cursor: pointer; text-align: start;
}
.domain-starter:hover {
  background: var(--presentation-ink); color: var(--text-inverse); border-color: var(--presentation-ink);
}
.domain-source-note { margin: 0; font-size: .8rem; color: var(--presentation-muted); }
.message-suggestions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 2px; }
/* presentation.pinned_suggestions: the suggested questions in a row above the
   conversation, which stays put while the conversation scrolls. */
.domain-pinned-suggestions {
  flex-shrink: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--presentation-card-border);
  background: var(--presentation-surface);
}
.domain-pinned-suggestions[hidden] { display: none; }
html[data-chat-theme] :is(button, a, textarea):focus-visible {
  outline: 3px solid var(--presentation-focus); outline-offset: 3px;
}
html[data-chat-theme] .message-content { border-radius: 12px; }
html[data-chat-theme] .message.user .message-content { border: 1px solid var(--presentation-user-border); }
html[data-chat-theme] .chat-send-btn { background: var(--accent); }
html[data-chat-theme] .chat-send-btn:hover { background: var(--accent-dark); }
html[data-chat-theme] .chat-input:focus { border-color: var(--accent); }
@media (max-width: 650px) {
  .domain-welcome { padding: 20px 18px; }
  .domain-starters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .message-suggestions { grid-template-columns: minmax(0, 1fr); }
  /* Two columns, as in the welcome card. Past two rows the row scrolls, so
     the conversation keeps the screen. */
  .domain-pinned-suggestions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 8.5rem; overflow-y: auto; padding: var(--space-2) var(--space-4);
  }
  .domain-heading { font-size: 1.9rem; }
  html[data-chat-theme] .toolbar-actions { gap: 6px; }
  html[data-chat-theme] .chat-header { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-chat-theme] .message { animation: none; }
}

.domain-voter-resources {
  flex-shrink: 0;
  border-top: 1px solid var(--presentation-card-border);
  background: var(--presentation-surface);
  color: var(--presentation-ink);
}
.domain-resources-summary {
  min-height: 44px;
  box-sizing: border-box;
  padding: 12px 24px;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.domain-resources-content {
  max-height: min(40vh, 20rem);
  overflow-y: auto;
  padding: 0 24px 12px;
  font-size: .9rem;
  line-height: 1.5;
}
.domain-resources-description { margin: 0 0 8px; }
.domain-resource-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.domain-resource-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  color: var(--presentation-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
.domain-resource-link:hover { color: var(--accent-dark); }
.domain-resources-note { margin: 8px 0 0; font-size: .85em; color: var(--presentation-muted); }
.message-voter-resource {
  box-sizing: border-box;
  max-width: 100%;
  padding: 14px 16px;
  margin-top: 10px;
  border: 1px solid var(--presentation-card-border);
  border-radius: 8px;
  background: var(--presentation-surface);
  color: var(--presentation-ink);
  font-size: .9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.domain-resource-card-title { margin: 0 0 8px; font: inherit; font-weight: 700; }
.source-publisher { margin-top: 3px; color: var(--text-muted); font-size: .8rem; overflow-wrap: anywhere; }

.domain-resources-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* The privacy notice: one line under the message box, opening to its details. */
.domain-privacy-notice {
  flex-shrink: 0;
  margin: 0;
  padding: 0 24px max(4px, env(safe-area-inset-bottom));
  background: var(--presentation-surface);
  color: var(--presentation-muted);
  font-size: .8rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
p.domain-privacy-notice { padding-top: 6px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
/* The notice takes the home-indicator inset; the message box keeps its own padding. */
.chat-input-area:has(+ .domain-privacy-notice) { padding-bottom: var(--space-3); }
.domain-privacy-summary {
  min-height: 44px;
  box-sizing: border-box;
  padding: 12px 0;
  cursor: pointer;
}
.domain-privacy-content {
  max-height: min(35vh, 16rem);
  overflow-y: auto;
  padding-bottom: 8px;
}
.domain-privacy-text { margin: 0 0 6px; }
.domain-privacy-summary:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
@media (max-width: 650px) {
  .domain-privacy-notice { padding-left: 16px; padding-right: 16px; }
}
