/* ==========================================================================
   OnPurpose Guide — panel styles (guide.css)
   A right-hand drawer on desktop; a full-screen sheet on phones.
   ========================================================================== */
html.guide-open { overflow: hidden; }
@media (min-width: 641px) { html.guide-open { overflow: auto; } }

.guide { position: fixed; inset: 0; z-index: 250; }
.guide[hidden] { display: none; }
.guide__scrim { position: absolute; inset: 0; background: rgba(7, 17, 29, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.guide__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  box-shadow: -30px 0 80px -30px rgba(7, 17, 29, .55);
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.guide.is-entering .guide__panel { animation: guide-in var(--dur-3, 760ms) var(--ease-out, ease) both; }
.guide.is-entering .guide__scrim { animation: guide-fade var(--dur-2, 380ms) ease both; }
@keyframes guide-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes guide-fade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 640px) {
  .guide__panel { width: 100%; padding-left: env(safe-area-inset-left, 0px); box-shadow: none; }
  .guide.is-entering .guide__panel { animation-name: guide-up; }
  @keyframes guide-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Header */
.guide__head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .75rem;
  padding: 1rem 1rem 1rem 1.25rem; background: var(--navy-950); color: var(--ivory);
  border-bottom: 1px solid rgba(194, 162, 122, .35);
}
.guide__mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(194, 162, 122, .45); border-radius: 50%; }
.guide__mark .burst { --burst-size: 30px; }
.guide__title { font-family: var(--font-serif); font-size: 1.45rem; line-height: 1.1; letter-spacing: -.005em; }
.guide__mode { display: flex; align-items: center; gap: .45rem; margin-top: .2rem; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .04em; color: var(--mist); line-height: 1.35; }
.guide__mode-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--mist); }
.guide__panel[data-mode="ai"] .guide__mode-dot, .guide__panel[data-mode="endpoint"] .guide__mode-dot { background: var(--st-verified); box-shadow: 0 0 0 3px rgba(63, 122, 87, .3); }
.guide__panel[data-mode="search"] .guide__mode-dot { background: var(--st-demo); border-radius: 1px; }
.guide__panel[data-mode="checking"] .guide__mode-dot { animation: guide-pulse 1.2s ease-in-out infinite; }
@keyframes guide-pulse { 50% { opacity: .3; } }
.guide__icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid transparent; border-radius: 50%; background: none; color: inherit; }
.guide__icon svg { width: 18px; height: 18px; }
.guide__icon:hover { border-color: rgba(246, 241, 231, .35); }
.guide__icon:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }

/* Conversation */
.guide__log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; scroll-behavior: smooth; }
.guide__log:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: -2px; }
.guide__intro { padding-bottom: 1.25rem; border-bottom: 1px solid var(--line-on-light); }
.guide__hello { font-family: var(--font-serif); font-size: 1.5rem; line-height: 1.2; letter-spacing: -.005em; }
.guide__sub { margin-top: .6rem; font-size: .875rem; color: var(--slate); line-height: 1.55; }
.guide__starters { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.guide__chip {
  display: inline-flex; align-items: center; min-height: 40px; padding: .45rem .8rem; border: 1px solid var(--line-on-light-strong); border-radius: 999px;
  background: var(--white); color: var(--ink); font-size: .8125rem; font-weight: 600; line-height: 1.3; text-align: left; text-decoration: none; cursor: pointer;
  transition: border-color var(--dur-1, 180ms), background-color var(--dur-1, 180ms);
}
.guide__chip:hover { border-color: var(--gold-deep); background: var(--ivory); }
.guide__chip--accent { background: var(--navy-900); color: var(--ivory); border-color: var(--navy-900); }
.guide__chip--accent:hover { background: var(--navy-700); border-color: var(--navy-700); }
.guide__chip[disabled] { opacity: .5; pointer-events: none; }

.guide__msg { display: flex; flex-direction: column; min-width: 0; }
.guide__msg--user { align-items: flex-end; }
.guide__bubble { max-width: 88%; padding: .7rem .95rem; border-radius: 14px 14px 3px 14px; background: var(--navy-900); color: var(--ivory); font-size: .9375rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.guide__answer { font-size: .9375rem; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.guide__answer > * + * { margin-top: .7rem; }
.guide__answer ul, .guide__answer ol { padding-left: 1.15rem; }
.guide__answer li + li { margin-top: .3rem; }
.guide__answer a { color: var(--gold-ink); }
.guide__answer mark { background: color-mix(in srgb, var(--gold) 32%, transparent); color: inherit; padding: 0 .1em; }
.guide__lede { font-weight: 650; }
.guide__cite {
  display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .3em; margin-left: .15em; vertical-align: .2em;
  border: 1px solid currentColor; border-radius: 999px; font-family: var(--font-mono); font-size: .65em; line-height: 1; text-decoration: none; color: var(--gold-ink);
}
.guide__cite:hover { background: var(--gold-ink); color: var(--paper); }
.guide__thinking { display: inline-flex; align-items: center; gap: .3rem; color: var(--slate); font-size: .875rem; }
.guide__thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-deep); animation: guide-dot 1.1s ease-in-out infinite; }
.guide__thinking span:nth-child(2) { animation-delay: .15s; }
.guide__thinking span:nth-child(3) { animation-delay: .3s; margin-right: .35rem; }
@keyframes guide-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.guide__note { align-self: center; max-width: 90%; padding: .5rem .8rem; border: 1px dashed var(--line-on-light-strong); font-family: var(--font-mono); font-size: .7rem; color: var(--slate); text-align: center; }
.guide__badge { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .02em; color: var(--slate); }

/* Quoted passages (document search mode) */
.guide__quote { margin: 0; padding: .9rem 1rem; border: 1px solid var(--line-on-light); border-left: 2px solid var(--gold-deep); background: var(--white); }
.guide__quote + .guide__quote { margin-top: .6rem; }
.guide__quote blockquote { margin: 0; font-size: .9rem; line-height: 1.6; }
.guide__quote figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-top: .7rem; font-size: .78rem; }
.guide__quote figcaption a { font-weight: 650; color: var(--ink); }
.guide__src-meta { font-family: var(--font-mono); font-size: .66rem; color: var(--slate); }

/* Sources & pathways */
.guide__sources-label { font-family: var(--font-sans); font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
.guide__sources ol { list-style: none; padding: 0; margin-top: .45rem; display: grid; gap: .35rem; }
.guide__sources a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .6rem; align-items: start; padding: .5rem .6rem; border: 1px solid var(--line-on-light); text-decoration: none; color: inherit; background: var(--white); }
.guide__sources a:hover { border-color: var(--gold-deep); }
.guide__src-n { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--gold-deep); font-family: var(--font-mono); font-size: .7rem; color: var(--gold-ink); }
.guide__src-body { display: grid; gap: .1rem; min-width: 0; }
.guide__src-title { font-size: .8125rem; font-weight: 650; line-height: 1.35; }
.guide__paths { display: grid; gap: .4rem; }
.guide__path { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .85rem; background: var(--navy-900); color: var(--ivory); text-decoration: none; border-radius: var(--radius-s); }
.guide__answer .guide__path { color: var(--ivory); }
.guide__path strong { display: block; font-size: .875rem; }
.guide__path span span { display: block; font-size: .75rem; color: var(--mist); margin-top: .1rem; }
.guide__path svg { width: 16px; height: 16px; flex: none; color: var(--gold); transition: transform var(--dur-2, 380ms) var(--ease-out, ease); }
.guide__path:hover svg { transform: translateX(3px); }
.guide__pagelist { list-style: none; padding: 0 !important; display: grid; gap: .3rem; }
.guide__pagelist li { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; }
.guide__pagelist span { font-family: var(--font-mono); font-size: .66rem; color: var(--slate); text-transform: uppercase; letter-spacing: .05em; }

/* Enquiry builder */
.guide__builder { padding: 1rem; border: 1px solid var(--line-on-light); background: var(--white); }
.guide__bform { display: grid; gap: .3rem; margin-top: .75rem; }
.guide__bform label { margin-top: .5rem; font-size: .8125rem; font-weight: 650; }
.guide__bform input, .guide__bform select, .guide__bform textarea { width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--line-on-light-strong); border-radius: var(--radius-s); background: var(--paper); font-size: .9rem; }
.guide__bform textarea { resize: vertical; }
.guide__bform input:focus, .guide__bform select:focus, .guide__bform textarea:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.guide__bform .btn { margin-top: .9rem; justify-self: start; }
.guide__summary { margin: .6rem 0 0; padding: .85rem; max-height: 260px; overflow: auto; white-space: pre-wrap; border: 1px solid var(--line-on-light); background: var(--paper); font-family: var(--font-mono); font-size: .75rem; line-height: 1.6; color: var(--ink); }
.guide__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

/* Composer */
.guide__composer { position: relative; display: flex; align-items: flex-end; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--line-on-light); background: var(--white); }
.guide__composer textarea {
  flex: 1; min-width: 0; min-height: 48px; max-height: 160px; padding: .75rem .9rem; resize: none;
  border: 1px solid var(--line-on-light-strong); border-radius: 12px; background: var(--paper); font-size: 1rem; line-height: 1.4; color: var(--ink);
}
.guide__composer textarea:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.guide__send, .guide__stop { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 48px; border-radius: 12px; border: 0; font-weight: 650; font-size: .875rem; }
.guide__send { width: 48px; background: var(--navy-900); color: var(--gold-soft); }
.guide__send svg { width: 18px; height: 18px; }
.guide__send:hover { background: var(--navy-700); }
.guide__stop { padding: 0 1rem; background: var(--ivory); color: var(--ink); border: 1px solid var(--line-on-light-strong); }
.guide__stop span { width: 10px; height: 10px; background: currentColor; border-radius: 2px; }
.guide__send[hidden], .guide__stop[hidden] { display: none; }
.guide__foot { padding: .6rem 1rem .8rem; background: var(--white); font-size: .7rem; line-height: 1.45; color: var(--slate); }
.guide__foot a { color: var(--gold-ink); }

@media (prefers-reduced-motion: reduce) {
  .guide__thinking span, .guide__panel[data-mode="checking"] .guide__mode-dot { animation: none; }
  .guide__log { scroll-behavior: auto; }
}
