/*
 * Ask St. Stan's guide. Design direction: docs/design.md (read it before changing this file).
 * Colours come from the building: limestone trim, stained-glass lead, the parish red,
 * the blue ray of the Divine Mercy image, yellow Chicago brick. Use only the names below.
 * Type: Antykwa Półtawskiego (a Polish typeface of the 1920s) for headings,
 * Atkinson Hyperlegible Next (made for readers with low vision) for everything else.
 */

@font-face {
  font-family: "Antykwa Poltawskiego";
  src: url("../fonts/antpoltcond-regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-ext-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --limestone: #EDEBE6;  /* page background */
  --paper: #FFFFFF;      /* answer surface, input background */
  --lead: #1E2433;       /* body text, headings */
  --sanctuary: #7A1F2B;  /* primary buttons, active language, focus rings, question headings */
  --mercy: #2F5D8A;      /* "Sources differ" marker and label */
  --brick: #C29A4E;      /* decoration only: the expressway drawing, the QR panel edge. Never text. */
  --muted: #5A5F6B;      /* dates, notes, source details */
  /* Hairline rules between rows: decoration, mixed from the named colours. */
  --rule: color-mix(in srgb, var(--muted) 35%, var(--limestone));

  --display: "Antykwa Poltawskiego", Georgia, serif;
  --text: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;

  --reading-scale: 1;
  --tap: 56px;
  --measure: 62ch;
  --radius: 6px;
  font-size: 20px;
}
html.kiosk { font-size: 24px; --tap: 72px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 10rem; scroll-padding-bottom: 10rem; }

body {
  margin: 0;
  background: var(--limestone);
  color: var(--lead);
  font-family: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 20; background: var(--paper); color: var(--sanctuary); padding: .5rem 1rem; }

:focus-visible { outline: 3px solid var(--sanctuary); outline-offset: 2px; }

/* Every button has a border (transparent where none shows), so Windows
   high-contrast mode can draw it. */
button { font: inherit; cursor: pointer; color: inherit; border: 2px solid transparent; }
button:disabled { cursor: default; opacity: .45; }

/* ---------- Header ---------- */
.masthead { padding: 1rem 1.25rem 0; }
.masthead-inner {
  max-width: 64rem; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem;
  align-items: center; justify-content: space-between;
}
.title {
  margin: 0; display: flex; align-items: center; gap: .6rem;
  font-family: var(--display); font-weight: 400;
  font-size: 2.4rem; line-height: 1.05;
}
.mark { width: 2.2rem; height: 2.2rem; fill: var(--sanctuary); flex: none; }
.mark .mark-sun { fill: var(--brick); }

.langs { display: flex; gap: .4rem; }
.lang {
  min-height: 44px; padding: .25rem 1rem; border-radius: 999px;
  border-color: var(--lead); background: transparent; color: var(--lead); font-size: .9rem;
}
.lang[aria-pressed="true"] { background: var(--sanctuary); border-color: var(--sanctuary); color: var(--paper); font-weight: 700; }

.masthead { padding-bottom: .4rem; }

/* ---------- Home screen: greeting and question box, with the expressway drawing beside them ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; grid-template-rows: auto auto 1fr; column-gap: 2.5rem; align-items: start; }
.hero > #welcome-slot, .hero > .asker { grid-column: 1; }
.hero > .art { grid-column: 2; grid-row: 1 / span 3; }
body.has-chat .hero { display: block; }
body.has-chat .art { display: none; }

/* The expressway drawing: the one memorable thing. A schematic, not a map; brick on
   limestone, decoration only. The lanes draw themselves once (see .play). */
.art { margin: 0; }
.art svg { display: block; width: 100%; height: auto; cursor: pointer; }
.art-rails path { stroke: var(--brick); vector-effect: non-scaling-stroke; }
.art-road path { stroke: var(--brick); stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: 0; }
.art-road .art-centre { stroke-width: 1.2; }
.art-rails path { stroke-width: 1.5; }
.art-rails .art-ties { stroke-width: 12; stroke-dasharray: 2 6; vector-effect: none; }
.art-church rect { fill: color-mix(in srgb, var(--brick) 22%, var(--limestone)); stroke: var(--brick); stroke-width: 3; vector-effect: non-scaling-stroke; }
.art-church path { stroke: var(--brick); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.art.play .art-road path { animation: reveal 1.2s ease-out .2s both; }
@keyframes reveal { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.art figcaption { margin-top: .3rem; }
.art-ask { font-size: .9rem; }

/* ---------- Layout ---------- */
.layout {
  max-width: 64rem; margin: 0 auto;
  padding: .5rem 1.25rem 4rem;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem;
}
html.kiosk .layout { grid-template-columns: minmax(0, 1fr) 15rem; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  margin-bottom: 1rem; color: var(--muted); font-size: .8rem;
}
.textsize { display: flex; align-items: center; gap: .35rem; }
.size-btn {
  min-width: 44px; min-height: 44px;
  border-color: var(--lead); background: var(--paper); color: var(--lead); font-size: .9rem; font-weight: 700;
}
.size-btn-large { font-size: 1.15rem; }
.quiet {
  min-height: 44px; padding: .25rem 1rem;
  border-color: var(--lead); background: transparent; color: var(--lead); font-size: .9rem;
}

/* ---------- Conversation ---------- */
.log { font-size: calc(1rem * var(--reading-scale)); }
.msg { margin: 0 0 1.5rem; max-width: calc(var(--measure) + 3rem); }
.msg p { margin: 0 0 .7em; }

/* A dialogue, read top to bottom like a script: each turn is labelled with who speaks.
   Not a chat app: no bubbles, no left and right sides. */
.exchange { margin: 1.6rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
/* The newest exchange fills at least a screen, so it can always be brought up under the question bar. */
#current > .exchange:last-child { min-height: calc(100vh - 10rem); }
body.has-chat .layout { padding-bottom: 10rem; }
.speaker {
  display: flex; align-items: center; gap: .4em;
  margin: 0 0 .35em; font-size: .8em; font-weight: 700; color: var(--muted);
}
.speaker-guide { color: var(--lead); }
.sun { width: 1.5em; height: 1.5em; fill: var(--brick); flex: none; }
.turn-you { margin: 0 0 1.3rem; max-width: var(--measure); font-family: var(--text); font-weight: 400; font-size: 1em; }
.turn-you .said { display: block; font-size: 1.2em; line-height: 1.4; color: var(--lead); }

/* The guide's reply: the only thing on white paper. */
.msg-guide {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.1rem 1.4rem; line-height: 1.6;
  hyphens: auto; -webkit-hyphens: auto;
}
.msg-guide > .msg-body > :last-child, .msg-guide .card:last-child > :last-child { margin-bottom: 0; }

/* The welcome is the guide's first turn, spoken before any question: no surface. */
.msg-welcome .msg-guide { background: none; border: 0; padding: 0; }
.msg-welcome .lede { font-size: 1.2em; line-height: 1.5; max-width: var(--measure); }
.minor { margin: 1.4em 0 .4em; font-family: var(--text); font-weight: 700; font-size: .8em; color: var(--lead); }

/* Shortcuts on the home screen: page controls, not the guide speaking, so they are
   smaller and quieter than the conversation. They fold away once a conversation starts. */
.starters { margin: 1.6rem 0 0; max-width: calc(var(--measure) + 10rem); }
body.has-chat .starters { display: none; }
.starters .minor { margin: 1.4em 0 .45em; }
.starters .minor:first-child, .starters .kiosk-note + .minor { margin-top: 0; }

/* Suggested questions: compact rows with a hairline between; two columns when there is room. */
.suggestions { list-style: none; margin: 0; padding: 0; }
.suggestions li { border-bottom: 1px solid var(--rule); }
@media (min-width: 701px) {
  .suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
}
.suggestion {
  display: flex; align-items: center; gap: .6em;
  width: 100%; min-height: 44px; text-align: left;
  padding: .4rem 0; border-radius: 0; background: transparent;
  font-size: .95em; line-height: 1.35; color: var(--lead);
}
.suggestion::before {
  content: ""; flex: none; width: .4em; height: .4em;
  border-right: 2px solid var(--sanctuary); border-bottom: 2px solid var(--sanctuary); transform: rotate(-45deg);
}
.suggestion:hover { color: var(--sanctuary); }
.suggestion:active { background: var(--paper); color: var(--sanctuary); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  min-height: 40px; padding: .2rem .9rem; border-radius: 999px;
  border-color: var(--lead); background: transparent; color: var(--lead); font-size: .9em;
}
.chip:hover { border-color: var(--sanctuary); color: var(--sanctuary); }
.chip:active { background: var(--sanctuary); border-color: var(--sanctuary); color: var(--paper); }

.next { margin-top: 1.2em; padding-top: .9em; border-top: 1px solid var(--rule); }
.next-intro { margin: 0 0 .2em; font-weight: 700; }
.next-list { list-style: none; margin: 0; padding: 0; }
.next-btn {
  display: flex; align-items: center; gap: .6em; width: 100%; min-height: 44px; padding: .25em 0;
  background: none; text-align: left; color: var(--sanctuary); font-size: 1.05em; line-height: 1.3;
}
.next-btn::before {
  content: ""; flex: none; width: .45em; height: .45em;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}
.next-btn:hover { text-decoration: underline; }

.kiosk-note { font-weight: 700; margin: 0 0 1em; }
.thinking { color: var(--muted); margin: 0; }

.answer p { margin: 0 0 .7em; max-width: var(--measure); }
.cite {
  font-size: .68em; font-weight: 700; color: var(--lead);
  margin-left: .12em; vertical-align: super; line-height: 0;
}

/* General background: a limestone box inside the answer, never the archive's own voice. */
.background {
  margin: .9em 0; padding: .7em 1em; max-width: var(--measure);
  background: var(--limestone); border-radius: var(--radius); color: var(--lead);
}
.background p { margin: 0; }
.background .background-label { font-size: .8em; font-weight: 700; color: var(--muted); margin-bottom: .25em; }

.answer-title {
  margin: 0 0 .5em; font-family: var(--display); font-weight: 400;
  font-size: 1.5em; line-height: 1.2; color: var(--sanctuary);
}

.fine { font-size: .8em; color: var(--muted); }
.ai-note { margin-top: .8em; }

/* Sources differ: one label and a thin bar beside the text. Disagreement between
   sources is part of the honest picture, so this is calm blue, not a warning. */
.differ-label { margin: 0 0 .2em; color: var(--mercy); font-size: .8em; font-weight: 700; }
.differ-inline { margin-left: .5em; }
.differ-text { border-left: 3px solid var(--mercy); padding-left: .8em; }

/* Where this comes from */
.sources-block { font-size: .85em; }
.sources-block .minor { font-size: 1em; margin-top: 1.1em; }
.cited { margin: 0; padding-left: 1.4em; }
.cited > li { margin-bottom: .2em; }
/* Each cited card is one compact line: its title, a "Sources differ" label if needed,
   and how many sources it has. Tapping the line opens the list of publications. */
.cited-card > summary, .card-sources > summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .15em .6em;
  min-height: 32px; padding: .2em 0; cursor: pointer; list-style: none;
}
.cited-card > summary::-webkit-details-marker, .card-sources > summary::-webkit-details-marker { display: none; }
.cited-card > summary::after, .card-sources > summary::after {
  content: ""; align-self: center; width: .4em; height: .4em; margin-left: .1em;
  border-right: 2px solid var(--lead); border-bottom: 2px solid var(--lead); transform: rotate(45deg) translateY(-25%);
}
.cited-card[open] > summary::after, .card-sources[open] > summary::after { transform: rotate(-135deg); }
.src-count { color: var(--muted); font-size: .92em; }
.card-sources { margin-top: .8em; }
.cited-card .src-list, .card-sources .src-list { margin: .1em 0 .4em; }
.cited-title { font-weight: 700; }
.src-list { margin: .15em 0 0; padding-left: 0; list-style: none; color: var(--muted); font-size: .94em; }
.src-list li { margin: .1em 0; }
.src-list a, .office a { color: var(--lead); }

/* Archive cards (offline answers, topics, About) */
.card { margin: 0 0 1.1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.card:last-child { border-bottom: 0; padding-bottom: 0; }
.card-title {
  margin: 0 0 .3em; font-family: var(--display); font-weight: 400;
  font-size: 1.5em; line-height: 1.2; color: var(--lead);
}
.card-text { max-width: var(--measure); }

/* Related cards: titles only, tap to open in place. */
.related { margin: .4em 0 0; }
.related-card { border-bottom: 1px solid var(--rule); }
.related-card:last-child { border-bottom: 0; }
.related-card summary {
  min-height: var(--tap); display: flex; align-items: center; gap: .6em;
  padding: .4em 0; cursor: pointer; list-style: none;
}
.related-card summary::-webkit-details-marker { display: none; }
.related-card summary::before {
  content: ""; flex: none; width: .5em; height: .5em;
  border-right: 2px solid var(--lead); border-bottom: 2px solid var(--lead);
  transform: rotate(-45deg); margin-right: .15em;
}
.related-card[open] summary::before { transform: rotate(45deg); }
.related-title { font-family: var(--display); font-size: 1.3em; line-height: 1.2; }
.related-body { padding: 0 0 .9em 1.25em; }

/* Parish office: a calm panel that leads the answer when the archive can't help. */
.office { margin: 0 0 1em; }
.office + .card, .office + p { margin-top: 1em; padding-top: 1em; border-top: 1px solid var(--rule); }
.office .office-heading {
  margin: 0 0 .4em; font-family: var(--display); font-weight: 400;
  font-size: 1.5em; line-height: 1.2; color: var(--sanctuary);
}
.office p { margin: .15em 0; }
.office-name { font-weight: 700; }
.msg-body > .office:not(:first-child) { margin-top: 1.2em; padding-top: 1em; border-top: 1px solid var(--rule); }

/* ---------- Kiosk rail ---------- */
.rail { align-self: start; position: sticky; top: 1rem; font-size: .8rem; }
.qr-block { background: var(--paper); border-top: 4px solid var(--brick); padding: 1rem; text-align: center; }
.qr-block h2 { font-family: var(--display); font-weight: 400; font-size: 1.5rem; line-height: 1.2; margin: 0 0 .6rem; color: var(--lead); }
.qr svg { width: 100%; max-width: 12rem; height: auto; display: block; margin: 0 auto; }
.qr-url { margin: .5rem 0 0; color: var(--muted); word-break: break-word; }
.rail-note { color: var(--muted); margin: 1rem 0 0; }

/* ---------- Question box ----------
   Home screen: right under the guide's greeting, the most prominent thing on the page.
   In a conversation: pinned at the bottom of the screen, next to the newest message. */
.asker { margin: 1.2rem 0 0; max-width: calc(var(--measure) + 10rem); }
body.has-chat .asker {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  margin: 0; max-width: none;
  background: var(--limestone); border-top: 1px solid var(--rule);
  padding: .7rem 1.25rem calc(.5rem + env(safe-area-inset-bottom));
}
body.has-chat .ask-row, body.has-chat .composer-note { max-width: 64rem; margin-left: auto; margin-right: auto; }
.ask-row { display: flex; gap: .5rem; align-items: flex-end; }
.ask-bar textarea {
  flex: 1; min-height: 3.6rem; max-height: 180px; resize: none;
  padding: .95rem 1rem; border: 3px solid var(--lead); border-radius: var(--radius);
  background: var(--paper); color: var(--lead); font-family: var(--text); font-size: 1.2rem; line-height: 1.3;
}
.ask-bar textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); opacity: 1; }
.ask-bar textarea:focus { border-color: var(--sanctuary); outline: 3px solid var(--sanctuary); outline-offset: 2px; }
.ask-row .restart { min-height: 3.6rem; }
.send {
  min-height: 3.6rem; padding: 0 1.8rem;
  background: var(--sanctuary); color: var(--paper); font-weight: 700; font-size: 1.05rem;
}
.send:hover:not(:disabled) { background: var(--lead); }
.mic {
  width: 3.6rem; min-height: 3.6rem;
  border-color: var(--lead); background: var(--paper); display: grid; place-items: center;
}
.mic svg { width: 1.4rem; height: 1.4rem; fill: var(--lead); }
.mic[aria-pressed="true"] { background: var(--sanctuary); border-color: var(--sanctuary); }
.mic[aria-pressed="true"] svg { fill: var(--paper); }

.composer-note { margin: .45rem 0 0; font-size: .7rem; color: var(--muted); }
.mic-note { font-weight: 700; }
.inline-link {
  background: none; border-width: 0; padding: .2rem .15rem; min-height: 32px;
  color: var(--lead); text-decoration: underline; font-size: inherit;
}

/* Kiosk "Still reading?" prompt. The large shadow is a dimming screen, not a drop shadow. */
.idle-banner {
  position: fixed; left: 50%; top: 30%; transform: translateX(-50%); z-index: 30;
  width: min(30rem, 92vw); padding: 1.4rem 1.5rem; text-align: center;
  background: var(--paper); border-top: 6px solid var(--brick); box-shadow: 0 0 0 100vmax rgba(30, 36, 51, .55);
  font-family: var(--display); font-size: 1.5rem; line-height: 1.25;
}
.idle-banner p { margin: 0 0 1rem; }
.idle-banner .send { padding: 0 2rem; font-family: var(--text); }

.noscript { max-width: 40rem; margin: 2rem auto; padding: 1rem; background: var(--paper); }

/* ---------- Kiosk ---------- */
html.kiosk body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
html.kiosk textarea { user-select: text; -webkit-user-select: text; }
html.kiosk .composer-note > span[data-i18n] { display: none; }
html.kiosk .layout, html.kiosk .masthead-inner, html.kiosk body.has-chat .ask-row, html.kiosk body.has-chat .composer-note { max-width: 80rem; }
html.kiosk .suggestion { min-height: var(--tap); }
/* Portrait kiosk home: fill the height. A larger greeting, the drawing in the middle,
   the shortcuts lower down and in one column, within easy reach. */
html.kiosk .hero { display: block; }
html.kiosk .msg-welcome .lede { font-size: 1.35em; }
html.kiosk .art { max-width: 13.5rem; margin: .8rem 0 0; }
html.kiosk .art-ask { font-size: 1.05rem; }
html.kiosk .starters { margin-top: 1.2rem; }
html.kiosk .suggestions { grid-template-columns: minmax(0, 1fr); }
html.kiosk .cited-card > summary, html.kiosk .card-sources > summary { min-height: var(--tap); }
html.kiosk .next-btn { min-height: var(--tap); }
html.kiosk .lang, html.kiosk .chip, html.kiosk .quiet, html.kiosk .inline-link { min-height: var(--tap); }
html.kiosk .size-btn { min-width: var(--tap); min-height: var(--tap); }
html.kiosk .inline-link { padding: 0 .6rem; }
html.kiosk .title { font-size: 2rem; }
html.kiosk .masthead-inner { column-gap: 1rem; }

/* ---------- Small screens ---------- */
@media (max-width: 700px) {
  :root { font-size: 18px; }
  .masthead { padding: .8rem .9rem 0; }
  .title { font-size: 1.9rem; }
  .mark { width: 1.9rem; height: 1.9rem; }
  .langs { width: 100%; }
  .lang { flex: 1; }
  .layout { padding: .4rem .9rem 3rem; }
  body.has-chat .layout { padding-bottom: 9rem; }
  .msg-guide { padding: .9rem 1rem; }
  body.has-chat .asker { padding: .5rem .7rem calc(.4rem + env(safe-area-inset-bottom)); }
  .ask-bar textarea { font-size: 1.05rem; padding: .75rem .7rem; min-height: 3.2rem; }
  .send { padding: 0 .9rem; font-size: 1rem; min-height: 3.2rem; }
  .mic { width: 3.2rem; min-height: 3.2rem; }
  .composer-note { font-size: .7rem; }
  body.has-chat .composer-note > span[data-i18n] { display: none; }
  .hero { display: block; }
  .art { max-width: 15rem; margin: 1.4rem 0 0; }
  #textsize-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 900px) {
  html.kiosk .layout { grid-template-columns: minmax(0, 1fr); }
  html.kiosk .rail { position: static; }
}

@media (forced-colors: active) {
  .msg-guide, .background { border: 1px solid CanvasText; }
  .differ-text { border-left-color: CanvasText; }
}

@media (prefers-reduced-motion: reduce) {
  .art.play .art-road path { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- App frame: a chat, not a page ----------
   The header (title, languages, text size) stays pinned at the top; in a conversation the
   question box stays pinned at the bottom, and only the conversation scrolls between them. */
.masthead { position: sticky; top: 0; z-index: 6; background: var(--limestone); border-bottom: 1px solid var(--rule); padding-bottom: 0; }
.masthead .toolbar { max-width: 64rem; margin: .35rem auto 0; padding-bottom: .45rem; }
html.kiosk .masthead .toolbar { max-width: 80rem; }

/* Your questions: a soft bubble on the right. */
.turn-you {
  margin-left: auto; width: fit-content; max-width: min(34rem, 85%);
  background: color-mix(in srgb, var(--sanctuary) 7%, var(--paper));
  border-radius: 14px 14px 4px 14px; padding: .55rem .95rem;
}
.exchange { border-top: 0; padding-top: .4rem; }

/* The guide: its sun is its avatar, beside each reply. It turns while the guide is
   thinking and writing, and once when touched; never under reduced motion. */
.turn-guide { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .6rem; align-items: start; }
.turn-guide > .speaker-guide { margin: .35rem 0 0; }
.turn-guide .sun { width: 2.2rem; height: 2.2rem; }
.turn-guide[aria-busy="true"] .sun { animation: sun-turn 2.4s linear infinite; }
.turn-guide .sun:hover, .turn-guide .sun:active { animation: sun-turn 1.2s ease-in-out 1; }
@keyframes sun-turn { to { transform: rotate(360deg); } }
.thinking { font-style: italic; }

/* Parish office: collapsible. */
.office > summary {
  display: flex; align-items: center; gap: .5em; min-height: 44px;
  cursor: pointer; list-style: none;
}
.office > summary::-webkit-details-marker { display: none; }
.office > summary::after {
  content: ""; width: .45em; height: .45em; margin-left: .2em;
  border-right: 2px solid var(--lead); border-bottom: 2px solid var(--lead); transform: rotate(45deg) translateY(-25%);
}
.office[open] > summary::after { transform: rotate(-135deg); }
.office .office-heading { margin: 0; }
html.kiosk .office > summary { min-height: var(--tap); }

/* Read aloud. */
.listen-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .9em; }
.listen {
  min-height: 40px; padding: .2rem 1rem; border-radius: 999px;
  border-color: var(--lead); background: transparent; color: var(--lead); font-size: .85em;
}
.listen[aria-pressed="true"] { background: var(--sanctuary); border-color: var(--sanctuary); color: var(--paper); }
.listen-volume { width: 7rem; accent-color: var(--sanctuary); }
.listen-note { width: 100%; margin: 0; }
html.kiosk .listen { min-height: var(--tap); }

/* The drawing's streets, school and towers. */
.art-streets path { stroke: color-mix(in srgb, var(--muted) 22%, var(--limestone)); stroke-width: 8; }
.art-label { font-family: var(--text); font-size: 13px; fill: var(--muted); }
.art-label-strong { fill: var(--lead); font-weight: 700; }
.art-school path {
  fill: color-mix(in srgb, var(--muted) 14%, var(--limestone));
  stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke;
}
.art-tower { fill: color-mix(in srgb, var(--brick) 40%, var(--limestone)); stroke: var(--brick); stroke-width: 3; vector-effect: non-scaling-stroke; }
.art-cupola { fill: var(--brick); }

@media (max-width: 700px) {
  .turn-guide { grid-template-columns: 1.9rem minmax(0, 1fr); column-gap: .45rem; }
  .turn-guide .sun { width: 1.8rem; height: 1.8rem; }
  .turn-you { max-width: 90%; }
}
@media (prefers-reduced-motion: reduce) {
  .turn-guide[aria-busy="true"] .sun, .turn-guide .sun:hover, .turn-guide .sun:active { animation: none; }
}
.art-cross { stroke: var(--brick); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

/* Later additions to the church: drawn lighter and thinner than the original building. */
.art-addition path {
  fill: color-mix(in srgb, var(--muted) 10%, var(--limestone));
  stroke: var(--brick); stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .85;
}
.art-school path.art-school-inner { fill: none; stroke-dasharray: 2 3; stroke-width: 1; }

/* ---------- Question box, round 3 ----------
   One box, like other AI chat tools: the microphone and the Ask button sit inside it,
   at its bottom right. The box shows focus while you type in it. */
.ask-row {
  align-items: flex-end; gap: .35rem;
  border: 3px solid var(--lead); border-radius: 1.6rem; background: var(--paper);
  padding: .3rem .35rem .3rem .2rem;
}
.ask-row:focus-within { border-color: var(--sanctuary); outline: 3px solid var(--sanctuary); outline-offset: 2px; }
.ask-bar .ask-row textarea {
  border: 0; background: transparent; min-height: 3rem; padding: .7rem .8rem; border-radius: 1.2rem;
}
.ask-bar .ask-row textarea:focus { outline: none; }
.ask-tools { display: flex; align-items: center; gap: .3rem; flex: none; }
.ask-row .icon-btn {
  width: 3rem; height: 3rem; min-height: 0; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
}
.ask-row .icon-btn svg { width: 1.45rem; height: 1.45rem; }
.ask-row .mic { border-color: transparent; background: transparent; }
.ask-row .mic svg { fill: var(--lead); }
.ask-row .mic:hover { background: color-mix(in srgb, var(--lead) 8%, var(--paper)); }
.ask-row .mic[aria-pressed="true"] { background: var(--sanctuary); }
.ask-row .mic[aria-pressed="true"] svg { fill: var(--paper); }
.send-btn { background: var(--sanctuary); border-color: var(--sanctuary); }
.send-btn svg { fill: var(--paper); }
.send-btn:hover:not(:disabled) { background: var(--lead); border-color: var(--lead); }
.ask-row .icon-btn:focus-visible { outline: 3px solid var(--lead); outline-offset: 2px; }
.toolbar .restart { min-height: 44px; }
html.kiosk .ask-row .icon-btn { width: var(--tap); height: var(--tap); }
html.kiosk .ask-row .icon-btn svg { width: 1.9rem; height: 1.9rem; }
html.kiosk .toolbar .restart { min-height: var(--tap); }
@media (max-width: 700px) {
  .ask-bar .ask-row textarea { min-height: 2.8rem; padding: .6rem .6rem; }
  .ask-row .icon-btn { width: 2.75rem; height: 2.75rem; }
}

/* The church drawing's apse and roof lines; the later building's roof lines. */
.art-church path.art-roofline, .art-addition path.art-roofline { stroke-width: 1; fill: none; }
.art-church path { fill: color-mix(in srgb, var(--brick) 22%, var(--limestone)); stroke: var(--brick); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

/* The newest reply's sun turns once every 15 seconds while the guide is idle (thinking and
   touching still turn it, by the rules above). Never under reduced motion. */
.guide-current .sun { animation: sun-idle 15s ease-in-out infinite; }
@keyframes sun-idle { 0%, 88% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .guide-current .sun { animation: none; } }
