/*
  "Hoku", the public guide on vaacoaching.com. Every rule of the widget lives here and starts with .hk-, so it never touches the rest of the
  site. It reads only the site's variables (--lagoon, --ink, --bg, --muted, --link) and has its own fallbacks, so it looks right in light and
  dark mode whatever the page design does. No inline styles are needed (content security policy); no fonts or images are loaded.
*/
.hk-widget {
    --hk-accent: var(--lagoon, #2bbede);
    --hk-on-accent: #0c171b;              /* dark text on the lagoon: 8:1 contrast (white on lagoon would be too weak) */
    --hk-head: #17191b;                   /* charcoal header in light and dark */
    --hk-ink: var(--ink, #17191b);
    --hk-bg: var(--bg, #ffffff);
    --hk-muted: var(--muted, #5b6168);
    --hk-link: var(--link, #0a6a80);
    --hk-line: rgb(127 127 127 / .35);
    --hk-soft: rgb(127 127 127 / .14);
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--hk-ink);
}

.hk-widget *, .hk-widget *::before, .hk-widget *::after { box-sizing: border-box; }

.hk-widget [hidden] { display: none !important; }

.hk-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---- the floating pill ---- */
.hk-launcher {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1.15rem .7rem .95rem;
    border: 0;
    border-radius: 999px;
    background: var(--hk-accent);
    color: var(--hk-on-accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 22px rgb(0 0 0 / .28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.hk-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgb(0 0 0 / .32); }
.hk-launcher:focus-visible,
.hk-close:focus-visible,
.hk-reset:focus-visible,
.hk-chip:focus-visible,
.hk-send:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 2px; }
.hk-icon { flex: none; }
.hk-launcher-label { white-space: nowrap; }

/* ---- the panel ---- */
.hk-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: 380px;
    max-width: calc(100vw - 24px);
    height: min(560px, calc(100vh - 110px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--hk-bg);
    color: var(--hk-ink);
    border: 1px solid var(--hk-line);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgb(0 0 0 / .32);
    animation: hk-pop .22s ease-out;
}

.hk-head {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .8rem .9rem;
    background: var(--hk-head);
    color: #fff;
    border-bottom: 3px solid var(--hk-accent);
    flex: none;
}
.hk-avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--hk-accent);
    color: var(--hk-on-accent);
}
.hk-head-text { flex: 1; min-width: 0; }
.hk-head-text strong { display: block; font-size: 1.02rem; line-height: 1.15; }
.hk-head-text span { display: block; font-size: .78rem; color: #cfd6db; }
.hk-reset,
.hk-close {
    flex: none;
    border: 0;
    border-radius: 9px;
    background: rgb(255 255 255 / .14);
    color: #fff;
    font: inherit;
    font-size: .78rem;
    cursor: pointer;
}
.hk-reset { padding: .35rem .65rem; }
.hk-close { display: grid; place-items: center; width: 34px; height: 34px; }
.hk-reset:hover, .hk-close:hover { background: rgb(255 255 255 / .28); }
.hk-head .hk-reset:focus-visible, .hk-head .hk-close:focus-visible { outline-color: #fff; }

/* ---- messages ---- */
.hk-log {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    overscroll-behavior: contain;
}
.hk-msg {
    max-width: 88%;
    padding: .6rem .85rem;
    border-radius: 14px;
    font-size: .93rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.hk-bot { align-self: flex-start; background: var(--hk-soft); color: var(--hk-ink); border-bottom-left-radius: 4px; }
.hk-user { align-self: flex-end; background: var(--hk-accent); color: var(--hk-on-accent); border-bottom-right-radius: 4px; }
.hk-msg a { color: var(--hk-link); font-weight: 600; text-decoration: underline; }
.hk-user a { color: inherit; }

.hk-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.hk-chip {
    padding: .4rem .8rem;
    border: 1px solid var(--hk-link);
    border-radius: 999px;
    background: transparent;
    color: var(--hk-link);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
}
.hk-chip:hover { background: var(--hk-soft); }

.hk-typing { display: inline-flex; align-items: center; gap: 4px; padding: .8rem .9rem; }
.hk-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--hk-muted); animation: hk-blink 1.2s infinite; }
.hk-typing span:nth-child(2) { animation-delay: .2s; }
.hk-typing span:nth-child(3) { animation-delay: .4s; }

/* ---- the question box ---- */
.hk-form {
    flex: none;
    display: flex;
    gap: .5rem;
    padding: .7rem .8rem;
    border-top: 1px solid var(--hk-line);
    background: var(--hk-bg);
}
.hk-form input {
    flex: 1;
    min-width: 0;
    padding: .6rem .95rem;
    border: 1px solid var(--hk-line);
    border-radius: 999px;
    background: transparent;
    color: var(--hk-ink);
    font: inherit;
    font-size: 16px;   /* 16px stops iPhones zooming into the box */
}
.hk-form input::placeholder { color: var(--hk-muted); opacity: 1; }
.hk-form input:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 1px; border-color: transparent; }
.hk-send {
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--hk-accent);
    color: var(--hk-on-accent);
    cursor: pointer;
}
.hk-send:disabled { opacity: .55; cursor: default; }
.hk-foot {
    flex: none;
    margin: 0;
    padding: .1rem .9rem .7rem;
    font-size: .72rem;
    line-height: 1.35;
    color: var(--hk-muted);
    text-align: center;
    background: var(--hk-bg);
}

@keyframes hk-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes hk-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .hk-panel { animation: none; }
    .hk-launcher { transition: none; }
    .hk-launcher:hover { transform: none; }
    .hk-typing span { animation: none; opacity: .7; }
}

/* ---- phones: the panel becomes a sheet across the bottom of the screen ---- */
@media (max-width: 560px) {
    .hk-widget { right: 14px; bottom: 14px; }
    .hk-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: min(88vh, 640px);
        height: min(88dvh, 640px);
        border-radius: 18px 18px 0 0;
        border-width: 1px 0 0;
    }
    .hk-widget.hk-open .hk-launcher { display: none; }
}

/* ---- two views: "Ask" and "Send a message" ---- */
.hk-widget {
    --hk-danger: var(--danger, #a1221b);
    --hk-ok: var(--ok, #135e35);
    --hk-ok-bg: var(--ok-bg, #dcf4e5);
}
.hk-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hk-tabs {
    flex: none;
    display: flex;
    background: var(--hk-bg);
    border-bottom: 1px solid var(--hk-line);
}
.hk-tab {
    flex: 1;
    padding: .65rem .5rem .55rem;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--hk-muted);
    font: inherit;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}
.hk-tab:hover { color: var(--hk-ink); }
.hk-tab[aria-selected="true"] { color: var(--hk-ink); border-bottom-color: var(--hk-accent); }
.hk-tab:focus-visible { outline: 3px solid var(--hk-link); outline-offset: -3px; }

/* the button under an answer that can't help */
.hk-cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    padding: .55rem 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--hk-accent);
    color: var(--hk-on-accent);
    font: inherit;
    font-size: .88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.hk-cta:hover { filter: brightness(.95); }
.hk-cta:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 2px; }
.hk-cta-quiet { background: transparent; color: var(--hk-link); border: 1px solid var(--hk-link); }

/* ---- the message form ---- */
.hk-scroll { flex: 1; overflow-y: auto; padding: 1rem; overscroll-behavior: contain; }
.hk-lead { margin: 0 0 .9rem; font-size: .92rem; }
.hk-minor { padding: .8rem .9rem; border-radius: 12px; background: var(--hk-soft); }
.hk-minor:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 2px; }
.hk-field { position: relative; display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.hk-field label { font-size: .82rem; font-weight: 700; }
.hk-field input,
.hk-field select,
.hk-field textarea {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--hk-line);
    border-radius: 10px;
    background: transparent;
    color: var(--hk-ink);
    font: inherit;
    font-size: 16px;   /* 16px stops iPhones zooming into the box */
}
.hk-field option { background: var(--hk-bg); color: var(--hk-ink); }
.hk-field textarea { min-height: 6.5rem; resize: vertical; line-height: 1.4; }
.hk-field input:focus-visible,
.hk-field select:focus-visible,
.hk-field textarea:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 1px; border-color: transparent; }
.hk-field [aria-invalid="true"],
.hk-check [aria-invalid="true"] { border-color: var(--hk-danger); box-shadow: 0 0 0 1px var(--hk-danger); }
.hk-count { align-self: flex-end; font-size: .75rem; color: var(--hk-muted); }
.hk-error { margin: .15rem 0 .6rem; font-size: .8rem; font-weight: 600; color: var(--hk-danger); }
.hk-field .hk-error { margin: 0; }
.hk-form-error { padding: .55rem .75rem; border-radius: 10px; border: 1px solid var(--hk-danger); }
.hk-check { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .55rem; font-size: .84rem; line-height: 1.35; }
.hk-check input { flex: none; width: 1.15rem; height: 1.15rem; margin: .1rem 0 0; accent-color: var(--hk-link); }
.hk-check input:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 2px; }
.hk-check a { color: var(--hk-link); font-weight: 600; }
.hk-submit {
    width: 100%;
    margin-top: .5rem;
    padding: .7rem 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--hk-accent);
    color: var(--hk-on-accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.hk-submit:disabled { opacity: .6; cursor: default; }
.hk-submit:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 2px; }
.hk-note { margin: .7rem 0 0; font-size: .72rem; line-height: 1.35; color: var(--hk-muted); text-align: center; }

/* the honeypot: out of sight and out of the tab order; people never see it, bots fill it in */
.hk-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---- the "message sent" state ---- */
.hk-sent { display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; padding: 1rem; border-radius: 14px; background: var(--hk-ok-bg); color: var(--hk-ink); }
.hk-sent:focus-visible { outline: 3px solid var(--hk-link); outline-offset: 2px; }
.hk-sent-title { margin: 0; font-size: 1.05rem; color: var(--hk-ok); }
.hk-sent p { margin: 0; font-size: .92rem; }
.hk-sent-ref { font-weight: 700; letter-spacing: .03em; }

/* the corner button would sit on the footer's last line: the footer makes room for it (added by the widget's script) */
.hk-footer-pad { padding-bottom: calc(var(--s-6, 2.5rem) + 3.5rem); }
