/* Ghalina website: the assistant box («اسأل مساعد غالينا» / "Ask Ghalina's assistant", contract v31). Used on the home
   pages (with home.css) and the manual (with site.css); colours come from either page's tokens, with fallbacks.
   The question box has a soft light travelling round its edge (gold → champagne → plum), static under reduced motion.
   The answer appears in a plum leather card with gold source links. */

@property --ask-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root { --hv-in: 120ms; --hv-out: 200ms; }
.ask {
  --ask-gold: #d4af6a;
  --ask-champagne: #f3e2bf;
  --ask-plum: #6b3a63;
  --ask-plum-deep: #4a2545;
  --ask-surface: var(--surface, #fdf9f0);
  --ask-text: var(--text, #221420);
  --ask-muted: var(--muted, #56455a);
  --ask-ink: var(--gold-ink, var(--on-ac, #7a5a33));
  --ask-focus: var(--focus, var(--plum, #4a2545));
  display: grid;
  gap: 14px;
  max-width: 44rem;
  margin-inline: auto;
  color: var(--ask-text);
}

.ask-section { padding-block: clamp(36px, 5vw, 72px); }
.ask-card { padding: clamp(20px, 5vw, 32px); background: var(--surface); }

.ask__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ask-ink);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
html[lang="ar"] .ask__kicker, .ask[data-ask-lang="ar"] .ask__kicker { letter-spacing: 0; text-transform: none; font-size: 1rem; }

.ask__spark {
  width: 14px;
  height: 14px;
  background: conic-gradient(from 45deg, var(--ask-gold), var(--ask-champagne), var(--ask-plum), var(--ask-gold));
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.ask__title {
  font-size: clamp(1.6rem, 1.15rem + 1.9vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.ask[data-ask-lang="ar"] .ask__title { line-height: 1.5; letter-spacing: 0; }

.ask__intro { color: var(--ask-muted); font-size: 1.0625rem; }

.ask__form { display: grid; gap: 8px; margin-top: 4px; }
.ask__label { font-weight: 700; }

/* The flowing edge: a rotating conic gradient behind a 2px gap, and a blurred copy of it as a soft glow. */
.ask__glow {
  --ask-angle: 0deg;
  position: relative;
  padding: 2px;
  border-radius: 24px;
  background: conic-gradient(
    from var(--ask-angle),
    var(--ask-plum-deep) 0deg,
    var(--ask-plum) 50deg,
    var(--ask-gold) 110deg,
    var(--ask-champagne) 150deg,
    var(--ask-gold) 190deg,
    var(--ask-plum) 250deg,
    var(--ask-plum-deep) 360deg
  );
  isolation: isolate;
  transition: transform var(--hv-out) ease-out, box-shadow var(--hv-out) ease-out;
}
.ask__glow:hover, .ask__glow:focus-within { transition-duration: var(--hv-in); }
.ask__glow::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: -1;
  border-radius: inherit;
  background: inherit;
  filter: blur(14px);
  opacity: 0.35;
  transition: opacity var(--hv-out) ease-out;
}
/* The idle "ready" breath: a slow gold halo behind the box (low intensity; static under reduced motion). */
.ask__glow::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 0 20px 1px rgb(212 175 106 / 0.5);
  opacity: 0.3;
  transition: opacity var(--hv-out) ease-out;
  pointer-events: none;
}
.ask__glow:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgb(74 37 69 / 0.55); }
.ask__glow:hover::before { opacity: 0.55; }
.ask__glow:hover::after { opacity: 0.65; }
.ask__glow:hover::before, .ask__glow:hover::after, .ask__glow:focus-within::before, .ask__glow:focus-within::after { transition-duration: var(--hv-in); }
.ask__glow:focus-within::before { opacity: 0.75; }
.ask__glow:focus-within::after { opacity: 0.95; animation: none; }
.ask__glow:focus-within { box-shadow: 0 0 0 4px rgb(212 175 106 / 0.45); }

@media (prefers-reduced-motion: no-preference) {
  .ask__glow { animation: ask-flow 7s linear infinite; }
  .ask__glow::after { animation: ask-breathe 5.5s ease-in-out infinite; }
  .ask__caret { animation: ask-caret 1.3s steps(1) infinite; }
  .ask__dot { animation: ask-dot 2.8s ease-in-out infinite; }
  .ask[data-busy] .ask__glow { animation-duration: 2.2s; }
}

@keyframes ask-flow {
  to { --ask-angle: 360deg; }
}
@keyframes ask-breathe {
  50% { opacity: 0.62; }
}
@keyframes ask-caret {
  50% { opacity: 0; }
}
@keyframes ask-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgb(212 175 106 / 0.55); }
  60% { box-shadow: 0 0 0 6px rgb(212 175 106 / 0); }
}

.ask__field {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  background: var(--ask-surface);
}

.ask__inputwrap { position: relative; flex: 1; min-width: 0; display: flex; }
.ask__inputwrap .ask__input { width: 100%; }
/* A soft gold caret in the placeholder area: invites typing; gone once the box is focused or filled. */
.ask__caret {
  position: absolute;
  inset-inline-start: 12px;
  top: 15px;
  width: 2px;
  height: 1.35em;
  border-radius: 1px;
  background: var(--ask-gold);
  pointer-events: none;
  transition: visibility 0s 0.3s;
}
.ask__inputwrap:focus-within .ask__caret,
.ask__inputwrap:has(.ask__input:not(:placeholder-shown)) .ask__caret { display: none; }

.ask__input {
  min-width: 0;
  min-height: 56px;
  max-height: 12rem;
  padding: 15px 14px;
  padding-inline-start: 24px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ask-text);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.5;
  /* Grows with its text (assistant.js); no native grip or scrollbar. Past max-height it scrolls with a thin themed bar. */
  resize: none;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--ask-gold) transparent;
}
.ask__input.is-scroll { overflow-y: auto; }
.ask__input::-webkit-scrollbar { width: 6px; }
.ask__input::-webkit-scrollbar-track { background: transparent; }
.ask__input::-webkit-scrollbar-thumb { background: var(--ask-gold); border-radius: 3px; }
.ask__input::placeholder { color: var(--ask-muted); opacity: 0.85; transition: opacity var(--hv-out) ease-out; }
.ask__input:focus::placeholder { transition-duration: var(--hv-in); }
.ask__input:focus::placeholder { opacity: 0; }
.ask__input:focus { outline: none; }
.ask__glow:has(.ask__input:focus-visible) { outline: 3px solid var(--ask-focus); outline-offset: 3px; }

.ask__buttons { display: flex; gap: 6px; }

.ask__btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--hv-out) ease-out, background-color var(--hv-out) ease-out, box-shadow var(--hv-out) ease-out;
}
.ask__btn:hover, .ask__btn:focus-visible, .ask__btn:active { transition-duration: var(--hv-in); }
.ask__btn svg { width: 24px; height: 24px; }
.ask__btn:focus-visible { outline: 3px solid var(--ask-focus); outline-offset: 2px; }
.ask__btn:disabled { cursor: progress; opacity: 0.6; }
.ask__btn--send {
  background: linear-gradient(150deg, #60305a, var(--ask-plum-deep) 60%, #2f182c);
  color: #fff6e8;
  box-shadow: 0 0 0 1px rgb(212 175 106 / 0.7);
}
[dir="rtl"] .ask__btn--send svg { transform: scaleX(-1); }
.ask__btn--mic {
  background: transparent;
  color: var(--ask-plum);
  box-shadow: inset 0 0 0 1.5px rgb(212 175 106 / 0.8);
}
.ask__btn--mic[aria-pressed="true"] {
  background: var(--ask-gold);
  color: #2a1c05;
  box-shadow: 0 0 0 4px rgb(212 175 106 / 0.3);
}
@media (prefers-reduced-motion: no-preference) {
  .ask__btn:hover:not(:disabled) { transform: translateY(-1px); }
  .ask__btn--mic[aria-pressed="true"] { animation: ask-listen 1.4s ease-in-out infinite; }
}
@keyframes ask-listen {
  50% { box-shadow: 0 0 0 9px rgb(212 175 106 / 0.12); }
}

/* The honeypot: out of sight and out of reach (the form's bots fill it in). */
.ask__hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Under the box: "Ready to answer" with a pulsing dot, and the Gemini credit (our own sparkle, not Google's logo). */
.ask__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 0; }
.ask__ready, .ask__credit { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--ask-muted); font-size: 0.875rem; }
.ask__ready { transition: opacity 0.3s ease; }
.ask[data-busy] .ask__ready { opacity: 0; }
.ask__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ask-gold); }
.ask__credit-spark { width: 15px; height: 15px; color: var(--ask-gold); flex: none; }
.ask__credit bdi { font-weight: 700; color: var(--ask-text); }
html[lang="ar"] .ask__ready, html[lang="ar"] .ask__credit, .ask[data-ask-lang="ar"] .ask__ready, .ask[data-ask-lang="ar"] .ask__credit { font-size: 0.9375rem; }

.ask__status { min-height: 1.5em; color: var(--ask-muted); font-size: 0.9375rem; }
.ask__status:empty { min-height: 0; }

/* The answer: plum leather with a gold hairline. */
.ask__answer {
  display: grid;
  gap: 12px;
  padding: clamp(18px, 4vw, 26px);
  border-radius: 22px;
  background: var(--leather, linear-gradient(160deg, #60305a 0%, #4a2545 55%, #2f182c 100%));
  color: #fff6e8;
  box-shadow: inset 0 0 0 1px rgb(226 196 138 / 0.55), 0 24px 44px -28px rgb(60 25 55 / 0.7);
  font-size: 1.0625rem;
  line-height: 1.6;
}
.ask__answer:empty { display: none; }
.ask__answer p { margin: 0; }
.ask__answer ul { display: grid; gap: 6px; margin: 0; padding-inline-start: 22px; list-style: none; }
.ask__answer li { position: relative; }
.ask__answer li::before {
  content: "";
  position: absolute;
  inset-inline-start: -16px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e9cf9a;
}
.ask__answer a { color: #f3d58a; text-underline-offset: 3px; }
.ask__answer a:focus-visible { outline: 2px solid #f3d58a; outline-offset: 2px; }
.ask__answer--note { background: var(--ask-surface); color: var(--ask-text); box-shadow: inset 0 0 0 1.5px rgb(212 175 106 / 0.6); }
.ask__answer--note a { color: var(--ask-plum); }

.ask__sources { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid rgb(226 196 138 / 0.35); font-size: 0.9375rem; }
.ask__sources-title { color: #eadbe5; font-weight: 700; }
.ask__sources ul { padding-inline-start: 0; }
.ask__sources li::before { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .ask__answer.is-new { animation: ask-in 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
}
@keyframes ask-in {
  from { opacity: 0; transform: translateY(8px); }
}

.ask__note { color: var(--ask-muted); font-size: 0.875rem; line-height: 1.55; }
.ask__note a { color: inherit; }

@media (max-width: 480px) {
  .ask__field { flex-direction: column; align-items: stretch; }
  .ask__buttons { justify-content: flex-end; }
}

/* Dark (theme.css, only when the visitor chose it): champagne icons and links, a gold focus ring. */
[data-theme="dark"] .ask { --ask-focus: var(--g-focus, #e9cf9a); }
[data-theme="dark"] .ask__btn--mic,
[data-theme="dark"] .ask__answer--note a { color: var(--g-link, #ecd29c); }
[data-theme="dark"] .ask__glow:hover { box-shadow: 0 14px 28px -18px rgb(0 0 0 / 0.7); }

/* On the home pages the assistant sits in the FAQ side column, under the manual link (owner, 2026-10-10). */
.ask-section--side { padding-block: 8px 0; width: 100%; }
.ask-section--side .ask { max-width: none; margin-inline: 0; }
@media (min-width: 900px) { .faq__head:has(.ask-section--side) { position: static !important; } }

/* "Read the full manual" / "Or browse the manual" links (home pages, beside the FAQ and the assistant box): ivory pill, gold rim, plum text.
   Hover fades the fill to plum with gold text; the arrow mirrors in Arabic. */
.manual-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  min-height: 48px;
  padding: 8px 22px;
  border-radius: 999px;
  background: var(--g-surface, #fdf9f0);
  color: var(--g-link, #4a2545);
  box-shadow: inset 0 0 0 1.5px var(--g-rim, rgb(203 166 115 / 0.55)), 0 10px 24px -18px rgb(140 106 68 / 0.7);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--hv-out) ease-out, color var(--hv-out) ease-out, box-shadow var(--hv-out) ease-out;
}
.manual-link:hover, .manual-link:focus-visible, .manual-link:active, .manual-link:hover svg, .manual-link:focus-visible svg { transition-duration: var(--hv-in); }
.manual-link svg { flex: none; width: 1.15em; height: 1.15em; color: var(--g-gold-text, #7a5a33); transition: color var(--hv-out) ease-out, transform var(--hv-out) ease-out; }
[dir="rtl"] .manual-link svg, html[lang="ar"] .manual-link svg { transform: scaleX(-1); }
.manual-link:hover, .manual-link:focus-visible { background: var(--plum, #4a2545); color: #e9cf9a; box-shadow: inset 0 0 0 1.5px #d4af6a; }
.manual-link:hover svg, .manual-link:focus-visible svg { color: #e9cf9a; }
.manual-link:focus-visible { outline: 3px solid #d4af6a; outline-offset: 3px; }
html[lang="ar"] .manual-link { font-weight: 600; }
/* In dark the hover fills with gold and the words turn deep plum, so it stays clearly visible. */
[data-theme="dark"] .manual-link:hover, [data-theme="dark"] .manual-link:focus-visible { background: var(--metal-soft, #e2c48a); color: #2a1426; box-shadow: inset 0 0 0 1.5px #f3e2bf; }
[data-theme="dark"] .manual-link:hover svg, [data-theme="dark"] .manual-link:focus-visible svg { color: #2a1426; }
[data-theme="dark"] .manual-link:focus-visible { outline-color: #e9cf9a; }
.manual-link--block { min-height: 56px; padding-inline: 28px; font-size: 1.125rem; }
.ask__browse { margin: 0; display: flex; }
