/* Pilot Portal interactive tour — widget styles.
   Everything is scoped under .pilot-tour / .pt-* so host-page CSS (Webflow) can't leak in.
   Fonts are expected from the host page (pilot.com loads Euclid Circular B and Space Mono). */

.pilot-tour,
.pt-modal-root {
    --pt-purple: #5f2ee5;
    --pt-purple-dark: #3c2d89;
    --pt-purple-deep: #281350;
    --pt-purple-100: #f2edff;
    --pt-purple-200: #e3dafd;
    --pt-green: #47bfa4;
    --pt-green-dark: #3da291;
    --pt-black: #3f3c3d;
    --pt-gray: #656363;
    --pt-gray-300: #e0e0e0;
    --pt-gray-100: #f3f5fa;
    --pt-white: #fff;
    --pt-font: "Euclid Circular B", Euclid, "Helvetica Neue", Arial, sans-serif;
    --pt-mono: "Space Mono", ui-monospace, Menlo, monospace;
    --pt-dim: rgba(40, 19, 80, 0.55);
    --pt-shadow: 0 12px 40px rgba(40, 19, 80, 0.25);
    --pt-max-h: calc(100vh - 32px);
    font-family: var(--pt-font);
    color: var(--pt-black);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

.pilot-tour *,
.pilot-tour *::before,
.pilot-tour *::after {
    box-sizing: inherit;
}

.pilot-tour button,
.pilot-tour input {
    font: inherit;
}

.pilot-tour :focus-visible {
    outline: 3px solid rgba(95, 46, 229, 0.45);
    outline-offset: 2px;
}

/* ---------- Stage (16:10 product screen) ---------- */

.pt-stage {
    position: relative;
    width: min(100%, calc(var(--pt-max-h) * 1.6));
    aspect-ratio: 1440 / 900;
    margin: 0 auto;
    overflow: hidden;
    background: var(--pt-gray-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(40, 19, 80, 0.12);
    user-select: none;
    container-type: inline-size;
}

/* The portal page itself: a 1440×900 iframe scaled to the stage width by the script. */
.pt-frame-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--pt-white);
}

.pt-frame-wrap[hidden] {
    display: none;
}

.pt-frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 1440px;
    height: 900px;
    border: 0;
    transform-origin: 0 0;
    background: var(--pt-white);
}

.pt-screens,
.pt-screen {
    position: absolute;
    inset: 0;
}

.pt-screens[hidden] {
    display: none;
}

.pt-screen {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pt-screen[hidden] {
    display: none;
}

/* Spotlight: the anchored element stays bright, everything else dims. */
.pt-spot {
    position: absolute;
    z-index: 2;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px var(--pt-dim), 0 0 0 3px rgba(95, 46, 229, 0.9);
    pointer-events: none;
    transition: left 0.35s ease, top 0.35s ease, width 0.35s ease, height 0.35s ease;
}

.pt-spot[hidden] {
    display: none;
}

.pt-anchor-btn {
    position: absolute;
    z-index: 3;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    border-radius: 10px;
}

.pt-anchor-btn[hidden] {
    display: none;
}

/* Clickable hotspots inside the spotlight */
.pt-hotspot {
    position: absolute;
    z-index: 4;
    background: rgba(95, 46, 229, 0.08);
    border: 2px solid rgba(95, 46, 229, 0.7);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s;
}

.pt-hotspot:hover {
    background: rgba(95, 46, 229, 0.18);
}

.pt-hotspot::after {
    content: "";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--pt-purple);
    box-shadow: 0 0 0 0 rgba(95, 46, 229, 0.6);
    animation: pt-pulse 1.6s ease-out infinite;
}

@keyframes pt-pulse {
    0% { box-shadow: 0 0 0 0 rgba(95, 46, 229, 0.6); }
    100% { box-shadow: 0 0 0 14px rgba(95, 46, 229, 0); }
}

.pt-hotspot[hidden] {
    display: none;
}

/* Toast for clicks the demo can't honour, and the bar shown while a visitor explores. */
.pt-toast {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    max-width: calc(100% - 40px);
    background: var(--pt-purple-deep);
    color: var(--pt-white);
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 999px;
    box-shadow: var(--pt-shadow);
    animation: pt-fade 0.2s ease;
}

.pt-toast[hidden] {
    display: none;
}

.pt-resume {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100% - 40px);
    background: var(--pt-white);
    border-radius: 999px;
    padding: 10px 12px 10px 20px;
    box-shadow: var(--pt-shadow);
    font-size: 14px;
    color: var(--pt-gray);
    animation: pt-fade 0.2s ease;
}

.pt-resume[hidden] {
    display: none;
}

.pt-resume strong {
    color: var(--pt-purple-deep);
    font-weight: 600;
}

.pt-resume .pt-btn,
.pt-resume .pt-link {
    padding: 8px 18px;
    font-size: 14px;
    white-space: nowrap;
}

/* ---------- Backdrop + centered modals (gate, intro, closer) ---------- */

.pt-backdrop {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--pt-dim);
    backdrop-filter: blur(2px);
}

.pt-backdrop[hidden],
.pt-modal[hidden],
.pt-tooltip[hidden],
.pt-ai[hidden] {
    display: none;
}

.pt-modal {
    position: absolute;
    z-index: 6;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(520px, 92%);
    max-height: 92%;
    overflow: auto;
    background: var(--pt-white);
    border-radius: 16px;
    padding: 36px 36px 32px;
    text-align: center;
    box-shadow: var(--pt-shadow);
}

.pt-modal .pt-logo {
    height: 28px;
    margin: 0 auto 20px;
    display: block;
}

.pt-modal h2 {
    margin: 0 0 12px;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 600;
    color: var(--pt-purple-deep);
}

.pt-modal p {
    margin: 0 0 20px;
    font-size: 16px;
    color: var(--pt-gray);
}

.pt-modal .pt-close {
    position: absolute;
    top: 10px;
    right: 10px;
}

.pt-fineprint {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--pt-gray);
}

.pt-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.pt-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pt-black);
}

.pt-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--pt-gray-300);
    border-radius: 8px;
    font-size: 16px;
    color: var(--pt-black);
    background: var(--pt-white);
}

.pt-input:focus {
    border-color: var(--pt-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(95, 46, 229, 0.2);
}

.pt-input[aria-invalid="true"] {
    border-color: #c0392b;
}

.pt-note {
    margin: 0;
    font-size: 13px;
    color: var(--pt-gray);
}

.pt-note[hidden] {
    display: none;
}

.pt-note.is-error {
    color: #c0392b;
}

.pt-modal .pt-form .pt-btn {
    margin-top: 6px;
}

.pt-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.pt-link {
    background: none;
    border: 0;
    padding: 4px;
    color: var(--pt-purple);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.pt-link:hover {
    text-decoration: underline;
}

.pt-link.is-quiet {
    color: var(--pt-gray);
    font-weight: 400;
    font-size: 14px;
}

/* ---------- Buttons (pilot.com .button.purple recipe) ---------- */

.pt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 28px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.pt-btn-primary {
    background: var(--pt-purple);
    color: var(--pt-white);
}

.pt-btn-primary:hover {
    background: var(--pt-purple-dark);
}

.pt-btn-ghost {
    background: transparent;
    border-color: var(--pt-gray-300);
    color: var(--pt-black);
}

.pt-btn-ghost:hover {
    border-color: var(--pt-purple);
    color: var(--pt-purple);
}

.pt-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.pt-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--pt-gray);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pt-close:hover {
    background: var(--pt-gray-100);
    color: var(--pt-black);
}

/* ---------- Anchored tooltip ---------- */

.pt-tooltip {
    position: absolute;
    z-index: 7;
    width: clamp(240px, 32cqw, 340px);
    max-width: calc(100% - 24px);
    background: var(--pt-white);
    border-radius: 12px;
    box-shadow: var(--pt-shadow);
    padding: 20px 20px 16px;
    text-align: left;
}

.pt-tooltip::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--pt-white);
    transform: rotate(45deg);
}

.pt-place-bottom::before { top: -7px; left: var(--pt-arrow-x, 50%); margin-left: -7px; }
.pt-place-top::before    { bottom: -7px; left: var(--pt-arrow-x, 50%); margin-left: -7px; }
.pt-place-right::before  { left: -7px; top: var(--pt-arrow-y, 50%); margin-top: -7px; }
.pt-place-left::before   { right: -7px; top: var(--pt-arrow-y, 50%); margin-top: -7px; }

.pt-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--pt-purple-200);
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.pt-progress > span {
    display: block;
    height: 100%;
    background: var(--pt-purple);
    transition: width 0.3s ease;
}

.pt-tooltip .pt-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    font-size: 18px;
}

.pt-tooltip h3 {
    margin: 4px 28px 8px 0;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--pt-purple-deep);
}

.pt-tooltip p {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--pt-gray);
}

.pt-tooltip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pt-tooltip-footer .pt-btn {
    padding: 8px 18px;
    font-size: 14px;
}

.pt-step-label {
    font-family: var(--pt-mono);
    font-size: 12px;
    color: var(--pt-gray);
    letter-spacing: 0.02em;
}

/* ---------- Interactive Pilot AI step ---------- */

.pt-ai {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.pt-ai > * {
    pointer-events: auto;
}

/* Drawn as the portal's own right-hand Pilot AI drawer. */
.pt-ai-panel {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 0.8cqw;
    padding: 1.2cqw 1.4cqw;
    background: var(--pt-white);
    border-left: 1px solid var(--pt-gray-300);
    box-shadow: -12px 0 32px rgba(40, 19, 80, 0.12);
    animation: pt-slide-in 0.3s ease;
}

@keyframes pt-slide-in {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.pt-ai-header {
    display: flex;
    align-items: center;
    gap: 0.5cqw;
    font-size: 1.3cqw;
    font-weight: 600;
    color: var(--pt-purple-deep);
    padding-bottom: 0.6cqw;
    border-bottom: 1px solid var(--pt-gray-300);
}

.pt-ai-spark {
    color: var(--pt-purple);
}

.pt-chip-hotspot {
    border-radius: 10px;
}

.pt-ai-prompts {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 0.6cqw;
}

.pt-ai-prompts .pt-eyebrow {
    font-family: var(--pt-mono);
    font-size: 0.8cqw;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pt-gray);
    margin: 0 0 0.2cqw;
}

.pt-chip {
    text-align: left;
    background: var(--pt-purple-100);
    border: 1px solid var(--pt-purple-200);
    border-radius: 0.7cqw;
    padding: 0.7cqw 0.9cqw;
    font-size: 0.95cqw;
    line-height: 1.4;
    color: var(--pt-purple-deep);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.pt-chip:hover,
.pt-chip.is-active {
    background: var(--pt-white);
    border-color: var(--pt-purple);
}

.pt-chip.is-active {
    box-shadow: 0 0 0 2px rgba(95, 46, 229, 0.25);
}

.pt-ai-answer {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background: var(--pt-white);
    border: 1px solid var(--pt-gray-300);
    border-radius: 0.8cqw;
    padding: 1cqw 1.1cqw;
    font-size: 0.95cqw;
    line-height: 1.5;
    color: var(--pt-black);
}

.pt-ai-answer .pt-placeholder-text {
    color: var(--pt-gray);
    margin: 0;
}

.pt-ai-answer p,
.pt-ai-answer ul,
.pt-ai-answer table {
    margin: 0 0 0.8cqw;
}

.pt-ai-answer ul {
    padding-left: 1.3cqw;
}

.pt-ai-answer table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9cqw;
}

.pt-ai-answer th,
.pt-ai-answer td {
    text-align: left;
    padding: 0.4cqw 0.6cqw;
    border-bottom: 1px solid var(--pt-gray-300);
}

.pt-ai-answer th {
    font-weight: 600;
    color: var(--pt-gray);
    font-size: 0.8cqw;
}

.pt-in {
    animation: pt-fade 0.25s ease;
}

@keyframes pt-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

.pt-thinking {
    display: inline-flex;
    gap: 0.35cqw;
    padding: 0.3cqw 0;
}

.pt-thinking span {
    width: 0.5cqw;
    height: 0.5cqw;
    border-radius: 50%;
    background: var(--pt-purple);
    animation: pt-bounce 1s infinite ease-in-out;
}

.pt-thinking span:nth-child(2) { animation-delay: 0.15s; }
.pt-thinking span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pt-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---------- Full-screen modal host (PilotTour.open) ---------- */

.pt-modal-root {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(40, 19, 80, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: pt-fade 0.2s ease;
}

.pt-modal-frame {
    width: 100%;
    max-width: 1440px;
    max-height: 100%;
    overflow: auto;
}

.pt-modal-frame .pilot-tour {
    --pt-max-h: calc(100vh - 32px);
}

.pt-modal-close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 100000;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--pt-purple-deep);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.pt-modal-close:hover {
    background: var(--pt-white);
}

body.pt-no-scroll {
    overflow: hidden;
}

/* ---------- Stacked mode (mobile) ---------- */

.pt-stacked {
    padding: 16px;
    background: var(--pt-white);
}

.pt-stacked .pt-gate-card {
    background: var(--pt-white);
    border: 1px solid var(--pt-gray-300);
    border-radius: 14px;
    padding: 22px 18px;
    text-align: center;
}

.pt-stacked .pt-gate-card .pt-logo {
    height: 24px;
    margin: 0 auto 14px;
    display: block;
}

.pt-stacked h2 {
    margin: 0 0 10px;
    font-size: 24px;
    line-height: 1.15;
    font-weight: 600;
    color: var(--pt-purple-deep);
}

.pt-stacked p {
    margin: 0 0 14px;
    font-size: 15px;
    color: var(--pt-gray);
}

.pt-stack {
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    display: grid;
    gap: 28px;
}

.pt-stack[hidden] {
    display: none;
}

.pt-stack-intro {
    text-align: center;
    padding: 8px 0 0;
}

.pt-stack-shot {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--pt-gray-300);
    background: var(--pt-gray-100);
    margin: 0 0 12px;
}

.pt-stack-shot img {
    display: block;
    width: 100%;
    height: auto;
}

.pt-spot-static {
    position: absolute;
    border-radius: 6px;
    box-shadow: 0 0 0 9999px rgba(40, 19, 80, 0.38), 0 0 0 2px var(--pt-purple);
    pointer-events: none;
}

.pt-stack-step h3 {
    margin: 0 0 6px;
    font-size: 19px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--pt-purple-deep);
}

.pt-stack-step .pt-step-label {
    display: block;
    margin-bottom: 6px;
}

.pt-stack .pt-ai-panel {
    position: static;
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
    animation: none;
}

.pt-stack .pt-ai-header {
    font-size: 16px;
    gap: 6px;
    padding-bottom: 8px;
    margin-top: 10px;
}

.pt-stack .pt-ai-prompts,
.pt-stack .pt-ai-answer {
    margin-top: 10px;
}

.pt-stack .pt-ai-prompts { gap: 8px; }
.pt-stack .pt-ai-prompts .pt-eyebrow { font-size: 11px; }
.pt-stack .pt-chip { font-size: 14px; padding: 10px 12px; border-radius: 10px; }
.pt-stack .pt-ai-answer { font-size: 14px; padding: 12px 14px; border-radius: 10px; max-height: 60vh; }
.pt-stack .pt-ai-answer p, .pt-stack .pt-ai-answer ul, .pt-stack .pt-ai-answer table { margin-bottom: 10px; }
.pt-stack .pt-ai-answer ul { padding-left: 18px; }
.pt-stack .pt-ai-answer table { font-size: 13px; }
.pt-stack .pt-ai-answer th, .pt-stack .pt-ai-answer td { padding: 6px 8px; }
.pt-stack .pt-ai-answer th { font-size: 11px; }
.pt-stack .pt-thinking { gap: 5px; }
.pt-stack .pt-thinking span { width: 7px; height: 7px; }

.pt-stack-closer {
    text-align: center;
    background: var(--pt-purple-100);
    border-radius: 14px;
    padding: 24px 18px;
}

.pt-stack-closer .pt-actions .pt-btn {
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .pt-spot,
    .pt-progress > span,
    .pt-in,
    .pt-modal-root {
        transition: none;
        animation: none;
    }

    .pt-hotspot::after,
    .pt-thinking span {
        animation: none;
    }
}
