/*  The careers assistant: a button that expands.

    Scoped under .ci- so nothing here can reach the rest of the site. The widget sits on every
    page, which makes a stray selector a sitewide bug rather than a local one.

    ── Colour, as tokens ─────────────────────────────────────────────────────────────────────
    Black, blue and orange. Blue carries the visitor's own words and the primary action; orange
    marks what the assistant found — a match score, a place in the queue, an unread reply. One
    job each is what stops a panel from becoming eight colours.

    Light only, deliberately. The careers site is light, and a widget that flipped to black on
    a visitor whose laptop happens to be in dark mode would sit on the page as a hole. Kept as
    tokens rather than literals so a second theme is a block of values rather than a rewrite.  */

:root {
    --ci-bg:        #ffffff;
    --ci-bg-2:      #f5f7fa;
    --ci-line:      #dbe1e8;
    --ci-ink:       #10141a;
    --ci-ink-dim:   #5b6675;

    --ci-blue:      #1668e3;
    --ci-on-blue:   #ffffff;
    --ci-orange:    #c2560a;
    --ci-orange-bg: #fff4ea;

    --ci-bubble:    #eef1f5;
    --ci-shadow:    0 16px 48px rgba(10, 16, 26, .18);
}

.ci-assistant {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: inherit;
}

/* ── the launcher ─────────────────────────────────────────────────────────────────────── */

.ci-launch {
    position: relative;
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: var(--ci-blue);
    color: var(--ci-on-blue);
    font-size: 26px;
    cursor: pointer;
    box-shadow: var(--ci-shadow);
    transition: transform .15s ease;
}

.ci-launch:hover { transform: translateY(-2px) scale(1.04); }

/*  Getting noticed, without becoming the page.

    A blue circle in a corner is easy to read past, and a visitor who never notices it never
    finds out the site can read their CV. So it arrives with one bounce, then sends a ring
    outward every few seconds - movement at the edge of vision rather than in the middle of it.

    Both stop for good once the panel has been opened: the animation exists to be discovered,
    and after that it is just something moving on a page somebody is trying to read.          */
/*  Bounces every few seconds, not once.

    It used to run a single time, 1.2 seconds after the component was created - which in
    WebAssembly is while the app is still booting. It fired correctly and was finished before
    anybody had looked at the page, so waiting a minute showed nothing: there was nothing left
    to show.

    One timeline, mostly still. The movement lives in the first second of a seven-second cycle
    and the remaining six are flat, so it reads as an occasional nudge rather than something
    jittering in the corner of a page being read.                                             */
.ci-calling { animation: ci-arrive 7s cubic-bezier(.3, 1.4, .5, 1) 1500ms infinite both; }

.ci-calling::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--ci-blue);
    animation: ci-ring 2800ms ease-out 2200ms infinite;

    /* The ring is decoration over a button; it must never eat the click. */
    pointer-events: none;
}

@keyframes ci-arrive {
      0% { transform: translateY(0)     scale(1);    }
      4% { transform: translateY(-14px) scale(1.06); }
      8% { transform: translateY(0)     scale(.97);  }
     11% { transform: translateY(-6px)  scale(1.02); }
     15% { transform: translateY(0)     scale(1);    }
    100% { transform: translateY(0)     scale(1);    }
}

@keyframes ci-ring {
      0% { transform: scale(1);    opacity: .55; }
     70% { transform: scale(1.75); opacity: 0;   }
    100% { transform: scale(1.75); opacity: 0;   }
}

/*  What it is FOR, which an icon cannot say.

    Appears a few seconds in, sits long enough to be read, then leaves on its own. Driven by
    one keyframe timeline rather than a timer, so there is nothing to dispose and nothing that
    can keep firing after the component is gone.                                             */
.ci-teaser {
    position: relative;
    max-width: 230px;
    margin-bottom: 2px;
    padding: 11px 13px;
    border: 1px solid var(--ci-line);
    border-radius: 14px 14px 4px 14px;
    background: var(--ci-bg);
    color: var(--ci-ink);
    box-shadow: var(--ci-shadow);
    font: inherit;
    font-size: 12.5px;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    opacity: 0;
    animation: ci-teaser-life 16s ease 3400ms 1 both;
}

.ci-teaser:hover { border-color: var(--ci-blue); }
.ci-teaser b { display: block; margin-bottom: 2px; }

@keyframes ci-teaser-life {
      0% { opacity: 0; transform: translateY(8px) scale(.96); }
      4% { opacity: 1; transform: translateY(0)   scale(1);   }
     88% { opacity: 1; transform: translateY(0)   scale(1);   }
    100% { opacity: 0; transform: translateY(4px) scale(.98); }
}

/* Orange: the assistant reporting something, rather than an action to take. */
.ci-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--ci-orange);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    font-weight: 700;
}

/* ── the panel ────────────────────────────────────────────────────────────────────────── */

.ci-panel {
    display: flex;
    flex-direction: column;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--ci-bg);
    color: var(--ci-ink);
    border: 1px solid var(--ci-line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--ci-shadow);
}

/* Full width on a phone. A 380px panel on a 360px screen is a panel with the page poking out
   around it, and a careers site is read on phones more than anywhere else. */
@media (max-width: 480px) {
    .ci-assistant { right: 12px; bottom: 12px; left: 12px; }
    .ci-panel { width: auto; height: calc(100vh - 100px); }
}

.ci-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--ci-bg-2);
    border-bottom: 1px solid var(--ci-line);
}

.ci-avatar {
    width: 32px; height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: var(--ci-blue);
    color: var(--ci-on-blue);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}

.ci-who { min-width: 0; flex: 1; line-height: 1.25; }
.ci-who b { display: block; font-size: 14px; }
.ci-who small { display: block; font-size: 11px; color: var(--ci-ink-dim); }

.ci-icon, .ci-ghost {
    border: 1px solid transparent;
    background: none;
    color: var(--ci-ink-dim);
    cursor: pointer;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1;
}

.ci-icon:hover, .ci-ghost:hover { background: var(--ci-bubble); color: var(--ci-ink); }
.ci-ghost { border-color: var(--ci-line); font-size: 11px; }

/* ── the conversation ─────────────────────────────────────────────────────────────────── */

/*  Block layout, not flex.

    As a flex column the children would not shrink below their content width, and a percentage
    max-width on them resolves against a container whose own width depends on that content — a
    cycle the browser breaks by ignoring the max-width. The answer then sized itself to its
    longest unbroken line and spilled across the page behind the panel.                      */
.ci-scroll {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    background: var(--ci-bg);
}

.ci-block + .ci-block { margin-top: 10px; }

.ci-block {
    display: block;
    max-width: 100%;
}

.ci-bubble {
    display: block;
    width: fit-content;
    max-width: 85%;
    margin: 0;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;

    /* anywhere rather than break-word: a URL with no break opportunity at all is the one thing
       that can still push the panel open. */
    overflow-wrap: anywhere;
}

.ci-mine   { margin-left: auto; background: var(--ci-blue); color: var(--ci-on-blue); border-bottom-right-radius: 4px; }
.ci-theirs { margin-right: auto; background: var(--ci-bubble); color: var(--ci-ink); border-bottom-left-radius: 4px; }
.ci-human  { margin-right: auto; background: var(--ci-orange-bg); border: 1px solid var(--ci-orange); }
.ci-from   { display: block; font-size: 11px; font-weight: 600; color: var(--ci-orange); margin-bottom: 2px; }

.ci-note  { margin: 0; text-align: center; font-size: 11.5px; color: var(--ci-ink-dim); }
.ci-error { margin: 0; font-size: 12px; color: var(--ci-orange); }
.ci-dim   { color: var(--ci-ink-dim); font-size: 12.5px; margin: 0; }

.ci-card, .ci-sources, .ci-chips, .ci-note { max-width: 100%; }

.ci-card {
    border: 1px solid var(--ci-line);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 13px;
    background: var(--ci-bg);
}

.ci-card p { margin: 0 0 8px; }
.ci-card b { display: block; font-size: 13px; }
.ci-card small { color: var(--ci-ink-dim); font-size: 11.5px; }

/* The queue is the assistant reporting a state, so it wears orange. */
.ci-queue { background: var(--ci-orange-bg); border-color: var(--ci-orange); }

.ci-row { display: flex; gap: 6px; flex-wrap: wrap; }

.ci-primary {
    border: 0; border-radius: 8px; padding: 6px 12px;
    background: var(--ci-blue); color: var(--ci-on-blue); font-size: 12.5px; cursor: pointer;
}

.ci-score {
    width: 34px; height: 34px;
    border: 1px solid var(--ci-line); border-radius: 8px;
    background: var(--ci-bg); color: var(--ci-ink); cursor: pointer; font-size: 13px;
}

.ci-score:hover { border-color: var(--ci-blue); color: var(--ci-blue); }

/* ── open roles, as cards ─────────────────────────────────────────────────────────────── */

.ci-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }

.ci-role {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid var(--ci-line);
    border-left: 3px solid var(--ci-orange);
    border-radius: 10px;
    padding: 9px 11px;
    background: var(--ci-bg);
    color: var(--ci-ink);
    cursor: pointer;
    font: inherit;
    transition: border-color .12s ease, background .12s ease;
}

.ci-role:hover { border-color: var(--ci-blue); background: var(--ci-bg-2); }
.ci-role b { display: block; font-size: 13px; margin-bottom: 2px; }
.ci-role-meta { display: block; font-size: 11.5px; color: var(--ci-ink-dim); }
.ci-role-pay  { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ci-orange); font-weight: 600; }

/* ── CV matches ───────────────────────────────────────────────────────────────────────── */

.ci-matches { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 9px; }
.ci-match-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.ci-bar { height: 5px; border-radius: 3px; background: var(--ci-bubble); overflow: hidden; margin-top: 3px; }
.ci-bar i { display: block; height: 100%; background: var(--ci-blue); }
.ci-good { color: var(--ci-blue); font-weight: 600; }
.ci-mid  { color: var(--ci-orange); font-weight: 600; }
.ci-low  { color: var(--ci-ink-dim); }

/* ── sources, follow-ups, feedback ────────────────────────────────────────────────────── */

.ci-sources { margin-top: 6px; font-size: 11.5px; color: var(--ci-ink-dim); }
.ci-sources summary { cursor: pointer; }
.ci-sources ul { margin: 6px 0 0; padding-left: 16px; }
.ci-sources a { color: var(--ci-blue); }

.ci-chips { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.ci-starters { margin-top: 10px; }

.ci-chip {
    border: 1px solid var(--ci-line); border-radius: 14px;
    padding: 4px 10px; background: var(--ci-bg);
    font-size: 12px; cursor: pointer; color: var(--ci-ink);
}

.ci-chip:hover { border-color: var(--ci-blue); color: var(--ci-blue); }

.ci-helpful { margin-top: 6px; font-size: 11.5px; color: var(--ci-ink-dim); display: flex; align-items: center; gap: 6px; }

.ci-helpful button {
    border: 1px solid var(--ci-line); border-radius: 6px;
    background: var(--ci-bg); color: var(--ci-ink);
    cursor: pointer; font-size: 11.5px; padding: 2px 8px;
}

/* ── composing ────────────────────────────────────────────────────────────────────────── */

.ci-compose {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid var(--ci-line);
    background: var(--ci-bg-2);
}

.ci-compose textarea {
    flex: 1;
    resize: none;
    max-height: 100px;
    border: 1px solid var(--ci-line);
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    background: var(--ci-bg);
    color: var(--ci-ink);
}

.ci-compose textarea:focus { outline: 2px solid var(--ci-blue); outline-offset: -1px; }

.ci-send {
    width: 34px; height: 34px;
    border: 0; border-radius: 50%;
    background: var(--ci-blue); color: var(--ci-on-blue);
    cursor: pointer; font-size: 14px;
}

.ci-send:disabled { background: var(--ci-line); cursor: default; }

/*  The paperclip is a button; the input is hidden and clicked for it by script.

    Nothing here is load-bearing any more. Earlier versions put the input behind a label or
    stretched it invisibly over the icon, which made opening a file dialog depend on where a
    click happened to land. It is a button now, and the forwarding lives in JavaScript.    */
.ci-attach {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    flex: 0 0 auto;
    font-size: 15px;
}

.ci-file { display: none; }
.ci-live { color: var(--ci-orange); }

/* ── rendered markdown inside an answer ───────────────────────────────────────────────── */

.ci-theirs p { margin: 0 0 6px; }
.ci-theirs p:last-child { margin-bottom: 0; }
.ci-theirs ul { margin: 4px 0; padding-left: 18px; }
.ci-theirs li { margin: 2px 0; }
.ci-theirs strong { font-weight: 600; }
.ci-theirs code { background: var(--ci-bg-2); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

/* ── the assistant composing ──────────────────────────────────────────────────────────── */

.ci-thinking { display: inline-flex; gap: 3px; align-items: center; height: 14px; }

.ci-thinking i {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--ci-ink-dim);
    animation: ci-pulse 1.2s infinite ease-in-out;
}

.ci-thinking i:nth-child(2) { animation-delay: .15s; }
.ci-thinking i:nth-child(3) { animation-delay: .30s; }

@keyframes ci-pulse {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40%           { opacity: 1;  transform: translateY(-2px); }
}

.ci-stage { margin-left: 8px; font-size: 11.5px; color: var(--ci-ink-dim); }

.ci-caret {
    display: inline-block;
    width: 2px; height: 13px;
    background: var(--ci-ink);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: ci-blink 1s steps(2) infinite;
}

@keyframes ci-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* Respect a system setting that exists because motion makes some people ill. */
/*  Nothing here moves for somebody who asked that nothing move. The teaser still appears -
    it carries the words - it simply does not slide or fade to get there.                     */
@media (prefers-reduced-motion: reduce) {
    .ci-thinking i,
    .ci-caret,
    .ci-launch,
    .ci-role,
    .ci-calling,
    .ci-calling::after { animation: none; transition: none; }

    .ci-teaser { animation: none; opacity: 1; }
}

/* ── the guidance card ────────────────────────────────────────────────────────────────── */

.ci-guide { border-left: 3px solid var(--ci-blue); }
.ci-guide-list { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 7px; }
.ci-guide-list:last-of-type { margin-bottom: 6px; }

.ci-ready-h, .ci-gap-h {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 2px;
}

.ci-ready-h { color: var(--ci-blue); }
.ci-gap-h   { color: var(--ci-orange); }

.ci-role-ready { border-left-color: var(--ci-blue); }

.ci-gap {
    border: 1px solid var(--ci-line);
    border-left: 3px solid var(--ci-orange);
    border-radius: 10px;
    padding: 9px 11px;
}

.ci-gap b { display: block; font-size: 13px; margin-bottom: 2px; }

/* The one word the card exists to say. */
.ci-missing { font-style: normal; font-weight: 600; color: var(--ci-orange); }

.ci-gap-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

.ci-footnote {
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--ci-line);
    font-size: 11px;
    line-height: 1.45;
    color: var(--ci-ink-dim);
}

/* ── waiting for a person ─────────────────────────────────────────────────────────────── */

.ci-queue-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

/* Tabular figures so a ticking clock does not shuffle the text beside it. */
.ci-waited {
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: var(--ci-orange);
    font-weight: 600;
}

.ci-queue-late { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--ci-orange); }
.ci-queue-late p { margin: 0 0 8px; font-size: 12.5px; }

.ci-email {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--ci-line);
    border-radius: 8px;
    padding: 6px 9px;
    font: inherit;
    font-size: 12.5px;
    background: var(--ci-bg);
    color: var(--ci-ink);
}

.ci-email:focus { outline: 2px solid var(--ci-blue); outline-offset: -1px; }
