/* ===========================================================================
   ASK A LOCAL

   A traveller is walking, in a market, in a taxi, or standing outside at
   night. Everything here is built for that: one thumb, big targets, almost
   no typing, and nothing that can trap the send button behind a keyboard.

   Loaded ON DEMAND by static/js/ask_local.js — the first tap on the floating
   button injects this file. The floating button itself is styled in
   base.html, so it can appear instantly without waiting for a request.

   Every colour is a base.html token. Nothing here invents a palette.
   =========================================================================== */

.al-root {
    position: fixed;
    inset: 0;
    /* Equal to the navbar's z-index and later in the DOM, so the sheet paints
       over the fixed header without needing a number above the maximum. */
    z-index: 2147483647;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.al-root[hidden] { display: none; }

.al-scrim {
    position: absolute;
    inset: 0;
    background: rgba(11, 31, 58, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.28s ease;
    border: 0;
    padding: 0;
    width: 100%;
}

.al-root.is-open .al-scrim { opacity: 1; }

.al-sheet {
    position: relative;
    width: min(560px, 100%);
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    background: var(--surface, #fff);
    border-radius: 30px 30px 0 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .9),
        0 -24px 70px rgba(11, 31, 58, 0.34);
    transform: translateY(102%);
    transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
    /* Lifted by JS when the on-screen keyboard shrinks the visual viewport,
       so the composer and its Send button are never behind the keyboard. */
    margin-bottom: var(--al-keyboard, 0px);
    overflow: hidden;
}

.al-root.is-open .al-sheet { transform: translateY(0); }

/* ---------- head ---------- */

.al-head {
    position: relative;
    padding: 14px 54px 14px 20px;
    border-bottom: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    background: linear-gradient(180deg, rgba(244, 248, 255, 0.9), rgba(255, 255, 255, 0));
    flex: 0 0 auto;
}

.al-grab {
    display: block;
    width: 44px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 4px;
    background: linear-gradient(90deg,
        rgba(30, 79, 145, .14), rgba(30, 79, 145, .32), rgba(30, 79, 145, .14));
}

.al-head h2 {
    width: fit-content;
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--ink, #16355f);
    letter-spacing: -0.01em;
    line-height: 1.2;
    background: linear-gradient(100deg,
        var(--blue-deep, #153766), var(--blue, #1e4f91) 60%,
        var(--orange, #ef8b2c) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.al-sub {
    margin-top: 3px;
    font-size: 0.85rem;
    color: var(--muted, #647898);
    line-height: 1.45;
}

.al-close {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink, #16355f);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.al-close:hover { background: rgba(30, 79, 145, 0.08); }
.al-close:focus-visible { outline: 3px solid var(--gold, #c89a32); outline-offset: 2px; }

/* ---------- scrolling body ---------- */

.al-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px 20px 20px;
}

.al-step[hidden] { display: none; }

/* ---------- step 1: the quick choices ---------- */

.al-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

/* Colour stories, by position. The choice list is a fixed, ordered set
   (local_help.CATEGORIES), so position is identity - no extra classes.
   --ca is the icon/accent colour, --cb its soft tile. */
.al-choices .al-choice:nth-child(1) { --ca: #1e4f91; --cb: #e8f0fc; }
.al-choices .al-choice:nth-child(2) { --ca: #7c3aed; --cb: #f2ebfe; }
.al-choices .al-choice:nth-child(3) { --ca: #b45309; --cb: #fdf1dc; }
.al-choices .al-choice:nth-child(4) { --ca: #17614f; --cb: #e2f2ed; }
.al-choices .al-choice:nth-child(5) { --ca: #be123c; --cb: #fdeaee; }
.al-choices .al-choice:nth-child(6) { --ca: #0369a1; --cb: #e3f3fc; }
.al-choices .al-choice:nth-child(7) { --ca: #47566e; --cb: #eef1f6; }

.al-choice {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 62px;
    padding: 12px 14px;
    text-align: left;
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    border-radius: 16px;
    background: var(--surface, #fff);
    color: var(--ink, #16355f);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.25;
    cursor: pointer;
    --ca: #1e4f91;
    --cb: #f4f8ff;
    box-shadow: 0 1px 2px rgba(11, 31, 58, .04);
    transition: border-color 0.22s ease, background 0.22s ease,
                transform 0.2s ease, box-shadow 0.25s ease;
}

.al-choice:hover {
    border-color: rgba(30, 79, 145, 0.34);
    border-color: color-mix(in srgb, var(--ca) 42%, #fff);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px -14px rgba(30, 79, 145, .38);
}

.al-choice:active { transform: scale(0.985); }

.al-choice:focus-visible { outline: 3px solid var(--gold, #c89a32); outline-offset: 2px; }

.al-choice i {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--cb, #f4f8ff);
    color: var(--ca, #1e4f91);
    font-size: 1rem;
    box-shadow: inset 0 0 0 1px rgba(11, 31, 58, .05);
}

/* Arrival: a quiet stagger when the sheet opens. Scoped to the open sheet,
   so the /ask fallback page renders instantly with no animation to wait
   through. */
.al-root.is-open .al-choice {
    animation: alChoiceIn .4s cubic-bezier(.22, 1, .36, 1) backwards;
}

.al-root.is-open .al-choice:nth-child(1) { animation-delay: .03s; }
.al-root.is-open .al-choice:nth-child(2) { animation-delay: .07s; }
.al-root.is-open .al-choice:nth-child(3) { animation-delay: .11s; }
.al-root.is-open .al-choice:nth-child(4) { animation-delay: .15s; }
.al-root.is-open .al-choice:nth-child(5) { animation-delay: .19s; }
.al-root.is-open .al-choice:nth-child(6) { animation-delay: .23s; }
.al-root.is-open .al-choice:nth-child(7) { animation-delay: .27s; }
.al-root.is-open .al-choice:nth-child(8) { animation-delay: .32s; }

@keyframes alChoiceIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97);
    }
}

/* "I need a Buddy with me" is a different kind of answer, so it reads as a
   different kind of choice — full width, warm, and last. */
.al-choice.al-choice-wide {
    grid-column: 1 / -1;
    border: 1px solid rgba(239, 139, 44, 0.32);
    background: var(--surface-warm, #fff4e6);
    background:
        linear-gradient(#fff8ef, #fff3e2) padding-box,
        linear-gradient(120deg,
            rgba(239, 139, 44, .55), rgba(200, 154, 50, .3)) border-box;
    border-color: transparent;
}

.al-choice.al-choice-wide:hover {
    box-shadow: 0 14px 30px -14px rgba(239, 139, 44, .5);
}

.al-choice.al-choice-wide i {
    background: linear-gradient(135deg, var(--orange, #ef8b2c), #d96f14);
    color: #fff;
    box-shadow: 0 8px 18px -8px rgba(239, 139, 44, .6);
}

.al-note,
.al-footnote {
    margin-top: 14px;
    font-size: 0.76rem;
    line-height: 1.55;
    color: var(--muted, #647898);
}

.al-note a,
.al-footnote a { color: var(--blue, #1e4f91); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- step 2: compose ---------- */

.al-picked {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 7px 12px 7px 10px;
    border: 1px solid rgba(30, 79, 145, 0.22);
    border-radius: 999px;
    background: var(--surface-soft, #f4f8ff);
    color: var(--blue, #1e4f91);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.al-picked i { font-size: 0.72rem; }

.al-field { margin-bottom: 12px; }

.al-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink, #16355f);
}

.al-optional { font-weight: 500; color: var(--muted, #647898); }

.al-input,
.al-textarea,
.al-select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    border-radius: 14px;
    background: var(--surface, #fff);
    color: var(--ink, #16355f);
    font: inherit;
    /* 16px minimum: anything smaller makes iOS Safari zoom the page on
       focus, which throws the sheet off the screen. */
    font-size: 1rem;
    line-height: 1.45;
}

.al-textarea { min-height: 104px; resize: vertical; }

.al-input:focus,
.al-textarea:focus,
.al-select:focus {
    outline: none;
    border-color: rgba(30, 79, 145, 0.5);
    box-shadow: 0 0 0 3px rgba(30, 79, 145, 0.12);
}

.al-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 10px;
}

/* The honeypot. Off-screen rather than display:none, so a bot that skips
   hidden fields still finds it. */
.al-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ---------- attachment controls ---------- */

.al-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.al-tool {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    border-radius: 14px;
    background: var(--surface, #fff);
    color: var(--ink, #16355f);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.al-tool:hover { background: var(--surface-soft, #f4f8ff); }
.al-tool:focus-visible { outline: 3px solid var(--gold, #c89a32); outline-offset: 2px; }
.al-tool[disabled] { opacity: 0.5; cursor: not-allowed; }
.al-tool i { color: var(--blue, #1e4f91); }

.al-tool.is-on {
    border-color: rgba(239, 139, 44, 0.55);
    background: var(--surface-warm, #fff4e6);
}

.al-tool.is-on i { color: var(--orange, #ef8b2c); }

.al-tool.is-rec i { animation: alPulse 1.1s ease-in-out infinite; }

@keyframes alPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ---------- attachment previews ---------- */

.al-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.al-files:empty { display: none; }

.al-file {
    position: relative;
    width: 74px;
    height: 74px;
    border-radius: 14px;
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    overflow: hidden;
    background: var(--surface-soft, #f4f8ff);
    display: grid;
    place-items: center;
    color: var(--blue, #1e4f91);
}

.al-file img { width: 100%; height: 100%; object-fit: cover; display: block; }

.al-file-audio {
    width: auto;
    min-width: 150px;
    padding: 0 14px;
    gap: 8px;
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 650;
}

.al-file-x {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(11, 31, 58, 0.72);
    color: #fff;
    font-size: 0.74rem;
    cursor: pointer;
}

.al-file-x:focus-visible { outline: 2px solid var(--gold, #c89a32); outline-offset: 1px; }

.al-file-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(30, 79, 145, 0.16);
}

.al-file-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--orange, #ef8b2c);
    transition: width 0.25s ease;
}

/* ---------- footer actions ---------- */

.al-foot {
    flex: 0 0 auto;
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    background: var(--surface, #fff);
    display: grid;
    gap: 8px;
}

.al-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 52px;
    padding: 14px 20px;
    border: 0;
    border-radius: 16px;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.22s ease, background 0.2s ease;
}

.al-btn:focus-visible { outline: 3px solid var(--gold, #c89a32); outline-offset: 2px; }

.al-btn-primary {
    background: linear-gradient(135deg, var(--blue, #1e4f91) 0%, var(--orange, #ef8b2c) 100%);
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .22),
        0 12px 30px rgba(30, 79, 145, 0.24);
}

.al-btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.06) saturate(1.05);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .22),
        0 16px 36px rgba(30, 79, 145, 0.3);
}
.al-btn-primary[disabled] { opacity: 0.62; cursor: not-allowed; transform: none; box-shadow: none; }

.al-btn-ghost {
    background: rgba(30, 79, 145, 0.06);
    color: var(--ink, #16355f);
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    min-height: 46px;
    font-size: 0.9rem;
}

.al-btn-ghost:hover { background: rgba(30, 79, 145, 0.1); }

/* ---------- feedback ---------- */

.al-msg {
    margin-top: 10px;
    padding: 11px 13px;
    border-radius: 13px;
    font-size: 0.84rem;
    line-height: 1.5;
}

.al-msg[hidden] { display: none; }
.al-msg.err { background: #fdecec; color: #8f2323; border: 1px solid #f3c9c9; }
.al-msg.ok { background: #e9f7ef; color: #1c6b3f; border: 1px solid #bfe6cf; }
.al-msg.info { background: var(--surface-soft, #f4f8ff); color: var(--ink, #16355f); border: 1px solid var(--line, rgba(30, 79, 145, 0.14)); }

.al-spin {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: alSpin 0.7s linear infinite;
}

@keyframes alSpin { to { transform: rotate(360deg); } }

/* ---------- step 3: sent ---------- */

.al-done { text-align: center; padding: 10px 4px 4px; }

.al-done-ico {
    width: 62px;
    height: 62px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--gold, #c89a32), var(--orange, #ef8b2c));
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 12px 30px rgba(239, 139, 44, 0.26);
    animation: alDonePop .5s cubic-bezier(.34, 1.56, .64, 1) backwards;
}

@keyframes alDonePop {
    from {
        opacity: 0;
        transform: scale(.55) rotate(-8deg);
    }
}

.al-done h3 { font-size: 1.16rem; color: var(--ink, #16355f); margin-bottom: 7px; }
.al-done p { font-size: 0.9rem; color: var(--muted, #647898); line-height: 1.6; }

.al-ref {
    display: inline-block;
    margin-top: 12px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface-soft, #f4f8ff);
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--blue, #1e4f91);
}

/* ===========================================================================
   THE THREAD — used by /ask/<token> and by the sheet after an answer
   =========================================================================== */

.al-thread { display: grid; gap: 12px; }

.al-bubble {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.al-bubble-you {
    justify-self: end;
    background: var(--blue, #1e4f91);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.al-bubble-staff {
    justify-self: start;
    background: var(--surface-soft, #f4f8ff);
    color: var(--ink, #16355f);
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    border-bottom-left-radius: 6px;
}

.al-who {
    display: block;
    margin-bottom: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.72;
}

.al-att {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.al-att img {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    background: rgba(255, 255, 255, 0.25);
}

.al-att audio { width: 100%; min-width: 220px; }

.al-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--surface-soft, #f4f8ff);
    color: var(--blue, #1e4f91);
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
}

.al-state.is-answered {
    background: #e9f7ef;
    color: #1c6b3f;
    border-color: #bfe6cf;
}

/* The one Buddy prompt, shown only after a real answer. */
.al-convert {
    margin-top: 16px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(239, 139, 44, 0.3);
    background: var(--surface-warm, #fff4e6);
    background:
        linear-gradient(#fff8ef, #fff3e2) padding-box,
        linear-gradient(120deg,
            rgba(239, 139, 44, .5), rgba(30, 79, 145, .22)) border-box;
    border-color: transparent;
}

.al-convert p {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink, #16355f);
    margin-bottom: 11px;
}

.al-convert a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--blue, #1e4f91) 0%, var(--orange, #ef8b2c) 100%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 750;
    text-decoration: none;
}

/* ===========================================================================
   DESKTOP — a centred dialog rather than a sheet
   =========================================================================== */

@media (min-width: 700px) {
    .al-root { align-items: center; padding: 24px; }

    .al-sheet {
        border-radius: 26px;
        max-height: min(86dvh, 760px);
        transform: translateY(18px) scale(0.985);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
        box-shadow: 0 30px 80px rgba(11, 31, 58, 0.34);
        margin-bottom: 0;
    }

    .al-root.is-open .al-sheet { transform: translateY(0) scale(1); opacity: 1; }

    .al-grab { display: none; }
    .al-head { padding-top: 18px; }
    .al-foot { padding-bottom: 16px; }
}

@media (max-width: 380px) {
    .al-choices { grid-template-columns: 1fr; }
    .al-body { padding: 14px 15px 18px; }
    .al-head { padding-left: 15px; }
    .al-foot { padding-left: 15px; padding-right: 15px; }
    .al-row { grid-template-columns: 1fr; }
}


/* ===========================================================================
   THE VIETNAM DESK - search the gathered data, or ask a person.

   The bar sits above the quick choices; results render as "notes from the
   Desk": sharp-cornered cards with a gold hairline and a footnote naming
   the source and its checked date - the same cinema-ticket language as the
   Plan-my-Vietnam card. Classic, not chatbot.
   =========================================================================== */

.al-desk { margin-bottom: 14px; }

/* The hidden attribute is a UA rule with the lowest precedence there is,
   so any explicit display beats it silently - the same defect home.css
   documents on the availability strip. While Desk results are on screen
   the tiles and footnotes yield; these two lines are what make that true. */
.al-choices[hidden] { display: none; }
.al-footnote[hidden] { display: none; }

.al-desk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 6px 8px 6px 15px;
    border: 1px solid rgba(30, 79, 145, 0.24);
    border-radius: 16px;
    background: var(--surface, #fff);
    box-shadow:
        inset 0 1px 2px rgba(11, 31, 58, .04),
        0 2px 8px rgba(11, 31, 58, .05);
    transition: border-color .2s ease, box-shadow .25s ease;
}

.al-desk-bar:focus-within {
    border-color: rgba(30, 79, 145, 0.55);
    box-shadow:
        inset 0 1px 2px rgba(11, 31, 58, .04),
        0 0 0 3px rgba(30, 79, 145, 0.12);
}

.al-desk-bar > i {
    color: var(--blue, #1e4f91);
    font-size: 0.95rem;
    flex: 0 0 auto;
}

.al-desk-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    font: inherit;
    /* 16px floor: anything smaller makes iOS zoom the sheet on focus. */
    font-size: 1rem;
    color: var(--ink, #16355f);
    outline: none;
}

.al-desk-input::placeholder { color: var(--muted, #647898); opacity: .8; }
.al-desk-input::-webkit-search-cancel-button { display: none; }

.al-desk-clear {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: var(--surface-soft, #f4f8ff);
    color: var(--ink, #16355f);
    font-size: 0.85rem;
    cursor: pointer;
}

.al-desk-clear:focus-visible { outline: 3px solid var(--gold, #c89a32); outline-offset: 2px; }

.al-desk-hint {
    margin: 7px 2px 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--muted, #647898);
}

.al-desk-results { margin-top: 12px; display: grid; gap: 10px; }
.al-desk-results[hidden] { display: none; }

.al-desk-status,
.al-desk-empty {
    font-size: 0.85rem;
    color: var(--muted, #647898);
    line-height: 1.55;
    padding: 4px 2px;
}

/* ---- one note from the Desk ---- */

.al-deskcard {
    position: relative;
    padding: 13px 14px 11px;
    border: 1px solid transparent;
    /* Sharp corners on purpose - the Desk speaks in tickets, like the
       Plan-my-Vietnam card. The gold hairline is the same voice. */
    border-radius: 0;
    background: #fff;
    background:
        linear-gradient(#fffdf9, #fff) padding-box,
        linear-gradient(165deg,
            rgba(30, 79, 145, .18),
            rgba(30, 79, 145, .07) 45%,
            rgba(200, 154, 50, .45)) border-box;
    box-shadow: 0 2px 10px rgba(11, 31, 58, .05);
    animation: alChoiceIn .32s cubic-bezier(.22, 1, .36, 1) backwards;
}

.al-deskcard-kicker {
    display: block;
    margin-bottom: 4px;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold, #c89a32);
}

.al-deskcard h4 {
    font-size: 0.94rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--ink, #16355f);
    margin-bottom: 5px;
}

.al-deskcard p {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--ink, #16355f);
    opacity: .88;
}

/* A price is only ever a real range with its basis - the engine refuses to
   emit anything else - so it may look confident. */
.al-deskcard-price {
    margin-top: 7px;
    padding: 6px 10px;
    border: 1px solid rgba(200, 154, 50, .35);
    background: #fdf7ea;
    font-size: 0.78rem !important;
    font-weight: 700;
    color: #7a5b13 !important;
    opacity: 1 !important;
}

.al-deskcard-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px dashed rgba(30, 79, 145, .16);
}

.al-deskcard-src {
    font-size: 0.7rem;
    color: var(--muted, #647898);
}

.al-deskcard-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    font-size: 0.76rem;
    font-weight: 750;
    color: var(--blue, #1e4f91);
    text-decoration: none;
}

.al-deskcard-link:hover { color: var(--orange, #ef8b2c); }
.al-deskcard-link:focus-visible { outline: 3px solid var(--gold, #c89a32); outline-offset: 2px; }

.al-desk-ask { width: 100%; margin-top: 4px; }

/* ---- the composed Desk answer (AI, grounded in the notes) ---- */
.al-aicard {
    background: #fffdf8;
    background:
        linear-gradient(#fffdf8, #fff9ef) padding-box,
        linear-gradient(150deg,
            rgba(200, 154, 50, .6),
            rgba(200, 154, 50, .25) 45%,
            rgba(30, 79, 145, .3)) border-box;
    animation: alChoiceIn .4s cubic-bezier(.22, 1, .36, 1) backwards;
}

.al-aianswer {
    font-size: 0.92rem !important;
    font-weight: 600;
    line-height: 1.65 !important;
    color: var(--ink, #16355f) !important;
    opacity: 1 !important;
}

/* ---- instant answers inside the composer ----
   A whisper above the send button: at most two cards, never a wall, and
   sending stays one motion away. */
.al-instant { margin-bottom: 12px; }

.al-instant-head {
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gold, #c89a32);
    margin-bottom: 2px;
}

.al-instant-head i { margin-right: 4px; }

.al-instant-foot {
    font-size: 0.74rem;
    color: var(--muted, #647898);
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .al-scrim,
    .al-sheet,
    .al-btn,
    .al-choice { transition: none; }
    .al-sheet { transform: none; opacity: 1; }
    .al-choice:hover { transform: none; }
    .al-root.is-open .al-choice,
    .al-deskcard,
    .al-done-ico { animation: none; }
    .al-tool.is-rec i { animation: none; }
    .al-spin { animation-duration: 1.6s; }
}

/* ===========================================================================
   THE STANDALONE PAGE (/ask and /ask/<token>)

   Same components, laid out as a page for the no-JavaScript path and for
   anybody who opened the link in a new tab.
   =========================================================================== */

.al-page {
    max-width: 640px;
    margin: 0 auto;
    padding: calc(96px + env(safe-area-inset-top, 0px)) clamp(16px, 5vw, 28px) 64px;
}

.al-page-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--surface-soft, #f4f8ff);
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    color: var(--blue, #1e4f91);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.al-page h1 {
    margin: 14px 0 8px;
    font-size: clamp(1.7rem, 5vw, 2.3rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--ink, #16355f);
}

.al-page-lede {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--muted, #647898);
    margin-bottom: 24px;
}

.al-card {
    background: var(--surface, #fff);
    border: 1px solid var(--line, rgba(30, 79, 145, 0.14));
    border-radius: 22px;
    padding: clamp(18px, 4vw, 26px);
    box-shadow: var(--shadow, 0 18px 48px rgba(30, 79, 145, 0.12));
}

.al-card + .al-card { margin-top: 16px; }

.al-emergency {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(200, 60, 60, 0.24);
    background: #fdf3f3;
}

.al-emergency h2 {
    font-size: 0.95rem;
    color: #8f2323;
    margin-bottom: 10px;
}

.al-emergency-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.al-emergency-row a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 15px;
    border-radius: 13px;
    background: #fff;
    border: 1px solid rgba(200, 60, 60, 0.3);
    color: #8f2323;
    font-size: 0.88rem;
    font-weight: 750;
    text-decoration: none;
}

.al-emergency p { font-size: 0.8rem; line-height: 1.6; color: #6f3030; }
