/* Homepage "Ask a question" bubble — loaded on index.html only */
.ask-widget {
  --ask-bg: #9a6b3f;
  --ask-bg-dark: #7a5230;
  --ask-fg: #faf8f5;
  font-family: var(--font-body, "Source Sans 3", system-ui, sans-serif);
}
.ask-bubble {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 40; /* below sticky header (50) so the mobile menu stays on top */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.25rem;
  padding: 0.7rem 1.15rem 0.7rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: var(--ask-bg);
  color: var(--ask-fg);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(44, 42, 40, 0.28);
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.ask-bubble:hover { background: var(--ask-bg-dark); transform: translateY(-1px); }
.ask-bubble:focus-visible { outline: 3px solid #2c2a28; outline-offset: 3px; }
.ask-bubble svg { width: 1.5rem; height: 1.5rem; flex: none; }
.ask-bubble[aria-expanded="true"] .ask-bubble-open { display: none; }
.ask-bubble:not([aria-expanded="true"]) .ask-bubble-close { display: none; }

.ask-panel {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 4rem);
  z-index: 45;
  width: min(22.5rem, calc(100vw - 2rem));
  max-height: calc(100vh - var(--header-h, 4.25rem) - 6.5rem);
  max-height: calc(100dvh - var(--header-h, 4.25rem) - 6.5rem);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 1.05rem 1.1rem 1rem;
  background: #fff;
  color: var(--ink, #2c2a28);
  border: 1px solid var(--line, #ebe6df);
  border-top: 5px solid var(--ask-bg);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(44, 42, 40, 0.24);
}
.ask-panel[hidden] { display: none; }
.ask-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.ask-panel h2 {
  margin: 0;
  font-family: var(--font-body, "Source Sans 3", system-ui, sans-serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink, #2c2a28);
}
.ask-close {
  flex: none;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.3rem 0 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted, #6b6560);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.ask-close:hover { background: var(--cream, #faf8f5); color: var(--ink, #2c2a28); }
.ask-close:focus-visible { outline: 3px solid var(--ask-bg); outline-offset: 1px; }
.ask-intro { margin: 0 0 0.75rem; font-size: 0.92rem; color: var(--muted, #6b6560); line-height: 1.4; }
.ask-field { margin: 0 0 0.7rem; }
.ask-field label { display: block; margin-bottom: 0.2rem; font-size: 0.9rem; font-weight: 600; }
.ask-field .ask-req { color: var(--ask-bg); }
.ask-field input,
.ask-field textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border: 1px solid #cfc7bd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #2c2a28);
  font: inherit;
  font-size: 1rem; /* 16px avoids iOS zoom */
  line-height: 1.35;
}
.ask-field textarea { min-height: 6rem; resize: vertical; }
.ask-field input:focus,
.ask-field textarea:focus { outline: 2px solid var(--ask-bg); outline-offset: 0; border-color: var(--ask-bg); }
.ask-count { display: block; margin-top: 0.15rem; font-size: 0.78rem; color: var(--muted, #6b6560); text-align: right; }
.ask-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.ask-error { margin: 0 0 0.65rem; padding: 0.5rem 0.65rem; border-radius: 8px; background: #fbeaea; color: #8a2222; font-size: 0.9rem; line-height: 1.35; }
.ask-error a { color: #8a2222; font-weight: 600; }
.ask-submit {
  display: block;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--ask-bg);
  color: var(--ask-fg);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.ask-submit:hover { background: var(--ask-bg-dark); }
.ask-submit:focus-visible { outline: 3px solid #2c2a28; outline-offset: 2px; }
.ask-submit[disabled] { opacity: 0.7; cursor: progress; }
.ask-alt { margin: 0.6rem 0 0; font-size: 0.88rem; color: var(--muted, #6b6560); text-align: center; }
.ask-alt a, .ask-success a { color: var(--accent-dark, #7a5230); font-weight: 600; }
.ask-success { padding: 0.5rem 0 0.25rem; text-align: center; }
.ask-success p { margin: 0 0 0.5rem; }
.ask-success .ask-success-main { font-size: 1.1rem; font-weight: 600; color: var(--ink, #2c2a28); }

@media (max-width: 600px) {
  .ask-bubble {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.95rem 0.55rem 0.75rem;
    font-size: 0.9rem; /* ~14.4px */
  }
  .ask-bubble svg { width: 1.2rem; height: 1.2rem; }
  .ask-panel { left: 0.75rem; right: 0.75rem; width: auto; bottom: calc(max(0.75rem, env(safe-area-inset-bottom)) + 3.6rem); }
}
@media (prefers-reduced-motion: reduce) {
  .ask-bubble { transition: none; }
  .ask-bubble:hover { transform: none; }
}
