/*
 * Public product page (admin/views/home.php). Builds on app.css tokens.
 * One loud thing: the trace in the hero - the answer's source tied back to
 * the passage it came from. Everything else stays quiet.
 * The customer's own help page is set in a serif so it reads as *their*
 * content, not ours; the sample customer's widget uses its own navy.
 */
.home {
    --page: 1180px;
    --gutter: 1.25rem;
    --customer: #27466b;
    --customer-soft: #eaf0f7;
    --paper-ink: #2a2f38;
    --amber: #f2b84b;
    --trace: var(--accent);
    background: var(--mist);
    font-size: 16px;
}
.home .skip:focus { position: fixed; left: 1rem; top: 1rem; width: auto; height: auto; clip: auto; z-index: 10; background: var(--surface); padding: .5rem .75rem; border-radius: var(--r-control); }

.hm-top, .hm-hero, .hm-steps, .hm-more, .hm-end, .hm-foot, .hm-unsure {
    width: min(100% - 2 * var(--gutter), var(--page));
    margin-inline: auto;
}

/* Top bar */
.hm-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; }
.hm-top .brand span { font-size: 1.05rem; }
.hm-nav { display: flex; align-items: center; gap: .5rem; }
.hm-link { color: var(--ink); font-weight: 600; text-decoration: none; padding: .45rem .7rem; border-radius: var(--r-control); }
.hm-link:hover { background: var(--surface); }

/* Hero */
.hm-hero { display: grid; gap: 2.5rem; padding: 2rem 0 3.5rem; }
.hm-copy h1 {
    font-size: clamp(2.4rem, 1.5rem + 4vw, 4.4rem);
    line-height: 1.02;
    letter-spacing: -.038em;
    font-weight: 780;
    max-width: 12ch;
    margin: 0 0 1.25rem;
    text-wrap: balance;
}
.hm-lede { font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); line-height: 1.55; color: var(--graphite); max-width: 34em; margin: 0 0 1.75rem; }
.hm-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.hm-actions .btn { min-height: 46px; padding-inline: 1.2rem; font-size: 1rem; }
.hm-note { margin: .85rem 0 0; font-size: var(--step--1); color: var(--graphite); }

/* The scene: their page, our answer, and the line between */
.hm-scene { position: relative; margin: 0; }
.hm-doc {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(29, 35, 48, .04), 0 24px 48px -32px rgba(29, 35, 48, .35);
    width: 100%;
    overflow: hidden;
}
.hm-doc-bar { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-bottom: 1px solid var(--hairline); background: #f7f9f8; }
.hm-doc-bar .dots { display: flex; gap: 5px; }
.hm-doc-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--hairline-strong); }
.hm-doc-url { font-size: 12.5px; color: var(--graphite); background: var(--surface); border: 1px solid var(--hairline); border-radius: 999px; padding: .15rem .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hm-doc-body { padding: 1.5rem 1.4rem 5.5rem; font-family: Georgia, 'Times New Roman', serif; color: var(--paper-ink); font-size: 1rem; line-height: 1.7; }
.hm-doc-crumb { font-family: var(--font); font-size: 12.5px; color: var(--customer); font-weight: 600; margin: 0 0 .4rem; }
.hm-doc-body h2 { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; font-size: 1.75rem; letter-spacing: -.01em; margin: 0 0 .9rem; color: #1f2530; }
.hm-doc-body p { margin: 0 0 .9rem; max-width: 38em; }
.hm-doc-dim { color: #8b919b; }
.hm-doc mark {
    color: inherit;
    background: linear-gradient(var(--accent-tint), var(--accent-tint)) no-repeat 0 0 / 100% 100%;
    border-radius: 3px;
    padding: .06em .15em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.hm-chat {
    position: relative;
    z-index: 2;
    width: min(360px, 90%);
    margin: -4.5rem 0 0 auto;
    background: var(--surface);
    border: 1px solid #e6e9ee;
    border-radius: 18px;
    box-shadow: 0 30px 60px -28px rgba(29, 35, 48, .45);
    overflow: hidden;
    font-size: 14.5px;
    line-height: 1.45;
}
.hm-chat-head { display: flex; align-items: center; gap: .65rem; padding: .7rem .9rem; border-bottom: 1px solid #e6e9ee; }
.hm-chat-head .av { width: 34px; height: 34px; border-radius: 50%; background: var(--customer); color: #fff; display: grid; place-items: center; flex: none; }
.hm-chat-head .av svg { width: 18px; height: 18px; }
.hm-chat-head strong { display: block; font-size: 15px; }
.hm-chat-head small { display: block; font-size: 12px; color: #5b6573; }
.hm-chat-log { background: #f6f7f9; padding: .9rem .8rem 1rem; display: flex; flex-direction: column; gap: .55rem; }
.hm-chat .m { margin: 0; max-width: 88%; padding: .55rem .8rem; border-radius: 16px; }
.hm-chat .m p { margin: 0; }
.hm-chat .user { align-self: flex-end; background: var(--customer); color: #fff; border-bottom-right-radius: 6px; }
.hm-chat .bot { align-self: flex-start; background: #fff; border: 1px solid #e6e9ee; border-bottom-left-radius: 6px; }
.hm-chat .hm-srcs { margin-top: .6rem; padding: 1px 0 1px .6rem; border-left: 3px solid var(--customer); display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: #5b6573; }
.hm-chat .hm-srcs > span:first-child { font-weight: 600; color: #3d4653; }
.hm-chat .hm-src b { display: block; color: var(--customer); font-weight: 600; }
.hm-chat .hm-src small { display: block; color: #8a94a3; font-size: 11.5px; }

.hm-trace { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; overflow: visible; }
.hm-trace path { fill: none; stroke: var(--trace); stroke-width: 2; stroke-linecap: round; }
.hm-trace circle { fill: var(--surface); stroke: var(--trace); stroke-width: 2; }

/* One orchestrated moment on load: the answer arrives, its passage lights up, the line draws */
@media (prefers-reduced-motion: no-preference) {
    .play [data-answer] { animation: hm-arrive .45s .35s cubic-bezier(.2, .7, .2, 1) both; }
    .play .hm-doc mark { animation: hm-sweep .7s 1s cubic-bezier(.5, 0, .2, 1) both; }
    .play .hm-trace path { stroke-dasharray: var(--len); animation: hm-draw .8s 1.55s cubic-bezier(.6, 0, .2, 1) both; }
    .play .hm-trace circle { animation: hm-pop .25s 1.5s both; }
    .play .hm-trace circle + circle { animation-delay: 2.3s; }
}
@keyframes hm-arrive { from { opacity: 0; transform: translateY(8px); } }
@keyframes hm-sweep { from { background-size: 0% 100%; } }
@keyframes hm-draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes hm-pop { from { opacity: 0; } }

/* Steps: a real sequence, so it is numbered */
.hm-steps { padding: 3.5rem 0; border-top: 1px solid var(--hairline); }
.hm-steps > h2, .hm-more > h2 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem); letter-spacing: -.028em; margin: 0 0 2rem; max-width: 20ch; }
.hm-steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2.5rem; counter-reset: step; }
.hm-steps li { counter-increment: step; display: grid; gap: 1rem; align-content: start; }
.hm-step-text::before {
    content: counter(step);
    display: grid; place-items: center;
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700; font-size: .95rem;
    margin-bottom: .9rem;
}
.hm-step-text h3 { font-size: var(--step-2); letter-spacing: -.015em; margin: 0 0 .4rem; }
.hm-step-text p { color: var(--graphite); margin: 0; max-width: 32em; }

.hm-frag { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: .75rem; font-size: 13.5px; display: flex; flex-direction: column; gap: .5rem; }
.fr-src { display: flex; align-items: center; gap: .65rem; padding: .35rem .25rem; }
.fr-src + .fr-src { border-top: 1px solid var(--hairline); padding-top: .75rem; }
.fr-src > span:nth-child(2) { flex: 1; min-width: 0; }
.fr-src b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-src small { display: block; color: var(--graphite); }
.fr-src .ic { width: 30px; height: 34px; border-radius: 6px; flex: none; display: grid; place-items: center; font-size: 9px; font-weight: 800; color: var(--accent-deep); background: var(--accent-soft); }
.fr-src .ic.site { border-radius: 50%; width: 32px; height: 32px; background: var(--accent-soft) radial-gradient(circle at 50% 50%, transparent 7px, var(--accent) 7px, var(--accent) 8.5px, transparent 8.5px); }
.fr-src .ok { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.fr-q { margin: 0; align-self: flex-end; background: var(--accent); color: #fff; padding: .4rem .7rem; border-radius: 12px 12px 4px 12px; max-width: 90%; }
.fr-a { margin: 0; background: var(--mist); padding: .45rem .7rem; border-radius: 12px 12px 12px 4px; max-width: 92%; }
.fr-used { margin: 0; color: var(--graphite); font-size: 12.5px; padding-left: .6rem; border-left: 3px solid var(--accent); }
.fr-used b { color: var(--ink); font-weight: 600; }
.fr-code { background: var(--ink); border-color: var(--ink); color: #dfe7e6; padding: .9rem 1rem; }
.fr-code code { font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }

/* When it isn't sure: amber, the admin's colour for handoffs and gaps */
.hm-unsure {
    display: grid; gap: 2.5rem; align-items: center;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-sheet);
    padding: 2rem 1.25rem;
}
.hm-unsure h2 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem); letter-spacing: -.028em; margin: 0 0 .75rem; max-width: 18ch; }
.hm-unsure .hm-lede { margin-bottom: 1.5rem; }
.hm-unsure dl { margin: 0; display: grid; gap: 1.1rem; }
.hm-unsure dl div { padding-left: 1.1rem; border-left: 3px solid var(--amber); }
.hm-unsure dt { font-weight: 700; }
.hm-unsure dd { margin: .15rem 0 0; color: var(--graphite); max-width: 36em; }
.hm-chat-flat { margin: 0 auto; box-shadow: none; width: min(380px, 100%); }
.hm-chat-flat .hm-chat-log { background: var(--mist); }
.hm-chat .offer { display: inline-block; margin-top: .55rem; border: 1px solid var(--customer); color: var(--customer); border-radius: 999px; padding: .2rem .7rem; font-size: 13px; font-weight: 600; }
.hm-chat .m.form { align-self: stretch; max-width: none; background: #fff; border: 1px solid #e6e9ee; border-top: 3px solid var(--amber); border-radius: 14px; display: flex; flex-direction: column; gap: .45rem; font-size: 13.5px; }
.hm-chat .in { border: 1px solid #d5dbe3; border-radius: 8px; padding: .35rem .55rem; color: #3d4653; }
.hm-chat .in.tall { min-height: 3.2rem; }
.hm-chat .send { align-self: flex-start; background: var(--customer); color: #fff; border-radius: 8px; padding: .35rem .8rem; font-weight: 600; }

/* Also included */
.hm-more { padding: 4rem 0 3rem; }
.hm-more dl { margin: 0; display: grid; gap: 1.5rem 2.5rem; }
.hm-more dt { font-weight: 700; font-size: var(--step-1); }
.hm-more dd { margin: .25rem 0 0; color: var(--graphite); max-width: 30em; }

/* End */
.hm-end { padding: 3rem 0 4rem; border-top: 1px solid var(--hairline); }
.hm-end h2 { font-size: clamp(1.875rem, 1.4rem + 2vw, 3rem); letter-spacing: -.034em; line-height: 1.08; margin: 0 0 .75rem; max-width: 16ch; }
.hm-end p { color: var(--graphite); font-size: 1.0625rem; max-width: 34em; margin: 0 0 1.5rem; }
.hm-end .btn { min-height: 46px; padding-inline: 1.2rem; font-size: 1rem; }

.hm-foot { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 0 2rem; border-top: 1px solid var(--hairline); font-size: var(--step--1); color: var(--graphite); }
.hm-foot a { color: var(--graphite); }

@media (min-width: 640px) {
    .home { --gutter: 2rem; }
    .hm-more dl { grid-template-columns: 1fr 1fr; }
    .hm-unsure { padding: 2.5rem; }
    .hm-doc-body { padding: 2rem 2rem 6rem; }
}
@media (min-width: 900px) {
    .hm-steps ol { grid-template-columns: repeat(3, 1fr); gap: 2rem; position: relative; }
    /* the rail between the numbers says "in this order" */
    .hm-steps ol::before { content: ''; position: absolute; left: 1rem; right: calc(33.33% - 1rem); top: 1rem; height: 2px; background: var(--accent-tint); z-index: 0; }
    .hm-step-text::before { position: relative; z-index: 1; box-shadow: 0 0 0 6px var(--mist); }
    .hm-steps li { grid-template-rows: auto 1fr; }
    .hm-frag { align-self: end; }
    .hm-unsure { grid-template-columns: 1.1fr 1fr; padding: 3.5rem; gap: 3.5rem; }
    .hm-more dl { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1040px) {
    .hm-hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; gap: 4rem; padding: 3.5rem 0 5rem; }
    .hm-chat { margin-top: -6rem; margin-right: -1.5rem; }
}
