/* POC Feedback tab + coach-mark + form (app-v0.3.0; mobile toast/icon tab app-v0.4.2; attachments app-v0.6.1). One shared component on every /pocs/{slug} page.
   Palettes are AA (4.5:1+) for the tab text: contractor 5.2, crew 11.8, landscape 7.1, handyman 7.4,
   equipment 8.3, craft 5.8, grooming 11.6, fixit 14.2, default 17.9. Focus ring is a white + ink double ring, visible on light and dark pages.
   Placement: fixed to the right edge at mid-height, clear of sticky headers, Log out, bottom sticky CTA bars,
   and below the required disclaimer modal (z 5000) and the Parker lightbox (z 1200). */
.pfb {
    --pfb-bg: #0f172a; --pfb-fg: #ffffff; --pfb-edge: #0f172a; --pfb-accent: #1d4ed8; --pfb-radius: 14px;
    --pfb-font: inherit;
}
.pfb-tone-contractor { --pfb-bg: #c2410c; --pfb-fg: #ffffff; --pfb-edge: #7c2d12; --pfb-accent: #c2410c; }
.pfb-tone-crew       { --pfb-bg: #a3e635; --pfb-fg: #18181b; --pfb-edge: #18181b; --pfb-accent: #3f6212; }
.pfb-tone-landscape  { --pfb-bg: #166534; --pfb-fg: #ffffff; --pfb-edge: #fdf6e3; --pfb-accent: #166534; }
/* Superior: 2px cream outline (on top of the cream edge) so the forest tab stands off forest-green bands. */
.pfb-tone-landscape .pfb-tab { outline: 2px solid #fdf6e3; outline-offset: 0; box-shadow: 0 0 0 4px #14532d, -4px 6px 18px rgba(2, 6, 23, 0.35); }
.pfb-tone-landscape .pfb-coach { border-color: #14532d; }
.pfb-tone-landscape .pfb-coach-go, .pfb-tone-landscape .pfb-primary { border-color: #14532d; }
.pfb-tone-handyman   { --pfb-bg: #7c4a1e; --pfb-fg: #ffffff; --pfb-edge: #431407; --pfb-accent: #7c4a1e; }
.pfb-tone-appliance  { --pfb-bg: #0B5F6E; --pfb-fg: #ffffff; --pfb-edge: #0A3D47; --pfb-accent: #0B5F6E; }
.pfb-tone-bakery     { --pfb-bg: #9B2C5A; --pfb-fg: #ffffff; --pfb-edge: #5C1734; --pfb-accent: #9B2C5A; }
.pfb-tone-fixit      { --pfb-bg: #161616; --pfb-fg: #e5eb6a; --pfb-edge: #e5eb6a; --pfb-accent: #161616; }
.pfb-tone-grooming   { --pfb-bg: #1B3A6B; --pfb-fg: #ffffff; --pfb-edge: #F7F4EE; --pfb-accent: #1B3A6B; }
.pfb-tone-equipment  { --pfb-bg: #f59e0b; --pfb-fg: #0f172a; --pfb-edge: #0f2744; --pfb-accent: #0f2744; }
.pfb-tone-craft      { --pfb-bg: #ff5aae; --pfb-fg: #22183a; --pfb-edge: #22183a; --pfb-accent: #6d28d9; --pfb-radius: 26px;
                       --pfb-font: 'Baloo 2', 'Nunito', 'Trebuchet MS', system-ui, sans-serif; }

/* ---------- Tab ---------- */
.pfb-tab {
    position: fixed; right: 0; top: 58%; z-index: 1100; box-sizing: border-box;
    transform: translateY(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    min-width: 44px; min-height: 120px; padding: 14px 10px;
    background: var(--pfb-bg); color: var(--pfb-fg);
    border: 2px solid var(--pfb-edge); border-right: 0;
    border-radius: var(--pfb-radius) 0 0 var(--pfb-radius);
    box-shadow: -4px 6px 18px rgba(2, 6, 23, 0.35);
    font: 800 0.95rem/1 var(--pfb-font, inherit); font-family: var(--pfb-font); letter-spacing: 0.04em;
    cursor: pointer;
}
.pfb-tab-text { writing-mode: vertical-rl; transform: rotate(180deg); }
.pfb-tab-icon { width: 22px; height: 22px; flex: none; }
.pfb-tab:hover { filter: brightness(1.06); box-shadow: -6px 8px 22px rgba(2, 6, 23, 0.45); }
.pfb-tab:focus { outline: none; }
.pfb-tab:focus-visible,
.pfb button:focus-visible, .pfb input:focus-visible, .pfb textarea:focus-visible, .pfb .pfb-star-input:focus-visible + .pfb-star {
    outline: 3px solid #ffffff; outline-offset: 0; box-shadow: 0 0 0 6px #111827;
}
.pfb-tone-craft .pfb-tab { box-shadow: -4px 6px 0 #ffd43b, -4px 6px 18px rgba(34, 24, 58, 0.3); }

/* Pulse ring while the coach-mark is showing (6 beats, then still). */
.pfb-pulse::after {
    content: ""; position: absolute; inset: -4px 0 -4px -4px; border-radius: inherit;
    border: 3px solid var(--pfb-bg); opacity: 0;
    animation: pfb-pulse 1.8s ease-out 6;
    pointer-events: none;
}
@keyframes pfb-pulse {
    0% { opacity: 0.85; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.25); }
}

/* ---------- Coach-mark ---------- */
.pfb-coach {
    position: fixed; right: 60px; top: 58%; z-index: 1101;
    transform: translateY(-50%);
    width: min(280px, calc(100vw - 84px));
    background: #ffffff; color: #0f172a;
    border: 3px solid var(--pfb-edge); border-radius: var(--pfb-radius);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.35);
    padding: 14px 16px 12px;
    font-family: var(--pfb-font);
    animation: pfb-pop 0.35s ease-out both;
}
.pfb-coach-title { margin: 0 0 4px; font-weight: 900; font-size: 1.08rem; color: #0f172a; }
.pfb-coach-body { margin: 0 0 10px; font-size: 0.92rem; line-height: 1.45; color: #334155; }
.pfb-coach-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pfb-coach-go, .pfb-coach-x {
    border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 0.9rem; cursor: pointer; min-height: 36px;
}
.pfb-coach-go { background: var(--pfb-bg); color: var(--pfb-fg); border: 2px solid var(--pfb-edge); }
.pfb-coach-x { background: #ffffff; color: #0f172a; border: 2px solid #475569; }
.pfb-coach-arrow {
    position: absolute; right: -12px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
    background: #ffffff; border-top: 3px solid var(--pfb-edge); border-right: 3px solid var(--pfb-edge);
    transform: rotate(45deg);
}
/* app-v0.9.1: desktop tip steps aside (no layout jump) whenever page content would sit under it. */
.pfb-coach.pfb-coach-yield { visibility: hidden; pointer-events: none; }
@keyframes pfb-pop {
    from { opacity: 0; transform: translateY(-50%) translateX(10px) scale(0.96); }
    to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
}

/* ---------- Dialog ---------- */
.pfb-layer { position: fixed; inset: 0; z-index: 4000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pfb-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.7); }
.pfb-dialog {
    position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
    background: #ffffff; color: #0f172a; border-radius: 16px;
    border-top: 8px solid var(--pfb-bg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    padding: 20px 22px 18px;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.pfb-tone-craft .pfb-dialog { border-radius: 26px; border-top-width: 10px; }
.pfb-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pfb-dialog h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; color: #0f172a; font-family: var(--pfb-font, inherit); }
.pfb-close { background: #f1f5f9; color: #0f172a; border: 2px solid #475569; border-radius: 999px; width: 40px; height: 40px; font-size: 1.05rem; font-weight: 800; cursor: pointer; }
.pfb-sub { margin: 6px 0 14px; color: #334155; font-size: 0.97rem; line-height: 1.45; }
.pfb-label { display: block; font-weight: 800; font-size: 0.92rem; margin: 10px 0 4px; color: #0f172a; padding: 0; }
.pfb-req { font-weight: 700; color: #b91c1c; }
.pfb-opt { font-weight: 600; color: #475569; }
.pfb-input {
    width: 100%; box-sizing: border-box; border: 2px solid #64748b; border-radius: 10px; padding: 10px 12px;
    font: inherit; font-size: 1rem; color: #0f172a; background: #ffffff;
}
.pfb-input[aria-invalid="true"] { border-color: #b91c1c; }
.pfb-textarea { resize: vertical; min-height: 110px; }
.pfb-row-between { display: flex; justify-content: space-between; gap: 8px; min-height: 1.2em; }
.pfb-count { font-size: 0.82rem; color: #475569; white-space: nowrap; }
.pfb-error { font-size: 0.85rem; color: #b91c1c; font-weight: 700; }
.pfb-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pfb-stars { border: 0; margin: 4px 0 0; padding: 0; min-width: 0; }
.pfb-stars-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pfb-star-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pfb-star { font-size: 1.9rem; line-height: 1; color: #64748b; cursor: pointer; padding: 2px 3px; border-radius: 8px; }
.pfb-star.is-on { color: #b45309; }
.pfb-tone-craft .pfb-star.is-on { color: #c2185b; }
.pfb-link { background: none; border: 0; color: #1d4ed8; text-decoration: underline; font-weight: 700; cursor: pointer; padding: 6px; font-size: 0.9rem; }
.pfb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pfb-hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }
.pfb-note { margin: 12px 0 0; font-size: 0.82rem; color: #475569; line-height: 1.4; }
.pfb-form-error { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: #991b1b; border: 2px solid #b91c1c; font-weight: 700; }
.pfb-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pfb-primary, .pfb-secondary { border-radius: 999px; padding: 11px 20px; font-weight: 800; font-size: 1rem; cursor: pointer; min-height: 44px; }
.pfb-primary { background: var(--pfb-bg); color: var(--pfb-fg); border: 2px solid var(--pfb-edge); }
.pfb-primary[disabled] { opacity: 0.7; cursor: progress; }
.pfb-secondary { background: #ffffff; color: #0f172a; border: 2px solid #475569; }
.pfb-thanks { text-align: center; padding: 8px 4px; }
.pfb-thanks-mark { font-size: 2.6rem; }
.pfb-thanks p { color: #334155; font-size: 1rem; line-height: 1.5; }
.pfb-thanks .pfb-actions { justify-content: center; }

/* ---------- Mobile (<= 640px): icon-only speech-bubble tab docked bottom-right, tip as a bottom toast ----------
   --pfb-bottom-offset is set by poc-feedback.js to the height of any sticky/fixed bottom CTA bar, so the tab and
   toast always sit above it. The toast hides itself (pfb-coach-yield) whenever it would cover a CTA. */
/* ---------- Attachments (app-v0.6.1) ---------- */
.pfb-files { margin: 14px 0 4px; }
.pfb-drop { position: relative; display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 12px 14px;
            border: 2px dashed #94a3b8; border-radius: 12px; background: #f8fafc; color: #334155; cursor: pointer;
            transition: border-color .15s, background-color .15s; }
.pfb-drop:hover, .pfb-dialog.pfb-dragging .pfb-drop { border-color: var(--pfb-accent); background: #eef2ff; }
.pfb-dialog.pfb-dragging .pfb-drop { border-style: solid; }
.pfb-drop:focus-within { outline: 3px solid var(--pfb-accent); outline-offset: 2px; }
.pfb-drop.is-full { cursor: default; opacity: .75; }
.pfb-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.pfb-drop.is-full .pfb-file-input { pointer-events: none; }
.pfb-drop-icon { flex: 0 0 auto; color: var(--pfb-accent); }
.pfb-drop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pfb-drop-main { font-weight: 600; font-size: .95rem; color: #0f172a; }
.pfb-drop-mob { display: none; }
.pfb-drop-link { color: var(--pfb-accent); text-decoration: underline; text-underline-offset: 2px; }
.pfb-drop-hint { font-size: .8125rem; line-height: 1.35; color: #475569; }
.pfb-file-errors { margin: 8px 0 0; padding: 8px 12px 8px 28px; border-radius: 10px; background: #fef2f2; color: #991b1b;
                   border: 1px solid #fecaca; font-size: .85rem; line-height: 1.35; }
.pfb-file-errors li + li { margin-top: 3px; }
.pfb-file-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pfb-thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: #e2e8f0;
             border: 1px solid #cbd5e1; flex: 0 0 auto; }
.pfb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pfb-chip { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; min-width: 0; padding: 6px 6px 6px 8px;
            border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; font-size: .88rem; color: #0f172a; }
.pfb-chip-ext { flex: 0 0 auto; min-width: 40px; padding: 3px 6px; border-radius: 6px; background: #e0e7ff; color: #3730a3;
                font-size: .7rem; font-weight: 700; text-align: center; letter-spacing: .02em; }
.pfb-chip-ext.pfb-chip-image { background: #dcfce7; color: #166534; }
.pfb-chip-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfb-chip-size { flex: 0 0 auto; color: #64748b; font-size: .8rem; }
.pfb-file-x { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
              border: 0; border-radius: 999px; background: rgba(15, 23, 42, .78); color: #fff; font-size: .8rem; line-height: 1;
              cursor: pointer; flex: 0 0 auto; }
.pfb-thumb .pfb-file-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; }
.pfb-chip .pfb-file-x { background: #e2e8f0; color: #0f172a; }
.pfb-file-x:hover { background: #b91c1c; color: #fff; }
.pfb-file-x:focus-visible { outline: 3px solid var(--pfb-accent); outline-offset: 1px; }
.pfb-file-x:disabled { opacity: .5; cursor: default; }
.pfb-tone-craft .pfb-drop { border-radius: 18px; }

@media (max-width: 640px) {
    /* Attachments on phones: tap target, no drag wording, compact thumbnails. */
    .pfb-drop { padding: 12px; gap: 10px; min-height: 56px; }
    .pfb-drop-desk { display: none; }
    .pfb-drop-mob { display: inline; }
    .pfb-drop-hint { font-size: .8125rem; } /* 13px (Sightline) */
    .pfb-thumb { width: 64px; height: 64px; }
    .pfb-file-x, .pfb-thumb .pfb-file-x { width: 28px; height: 28px; }
    .pfb-tab {
        top: auto !important; right: 12px !important;
        bottom: calc(var(--pfb-bottom-offset, 0px) + 12px + env(safe-area-inset-bottom, 0px));
        transform: none;
        min-width: 52px; min-height: 52px; width: 52px; height: 52px; padding: 0;
        justify-content: center; gap: 0;
        border: 2px solid var(--pfb-edge);
        border-radius: 50% 50% 50% 10px;
        box-shadow: 0 6px 18px rgba(2, 6, 23, 0.35);
    }
    .pfb-tab-text { display: none; }
    .pfb-tab-icon { width: 26px; height: 26px; }
    .pfb-tone-landscape .pfb-tab { box-shadow: 0 0 0 4px #14532d, 0 6px 18px rgba(2, 6, 23, 0.35); }
    .pfb-tone-craft .pfb-tab { box-shadow: 3px 4px 0 #ffd43b, 0 6px 18px rgba(34, 24, 58, 0.3); }
    .pfb-pulse::after { inset: -5px; }

    .pfb-coach {
        top: auto; left: 12px; right: 12px; width: auto; max-width: 420px; margin-left: auto;
        bottom: calc(var(--pfb-bottom-offset, 0px) + 12px + 52px + 12px + env(safe-area-inset-bottom, 0px));
        transform: none;
        padding: 12px 14px;
        animation: pfb-toast 0.3s ease-out both;
    }
    .pfb-coach-title { font-size: 1rem; margin-bottom: 2px; }
    .pfb-coach-body { display: block; font-size: 0.9rem; margin-bottom: 8px; }
    .pfb-coach-go, .pfb-coach-x { padding: 8px 14px; font-size: 0.9rem; min-height: 40px; }
    .pfb-coach-arrow { right: 22px; top: auto; bottom: -12px; margin-top: 0; transform: rotate(135deg); }
    .pfb-coach-yield { visibility: hidden; pointer-events: none; }
    /* v0.7.5: phones never show the tip (bubble only); this guards a desktop window narrowed while it is open. */
    .pfb-coach { display: none !important; }
    .pfb-tab { transition: transform 0.2s ease, opacity 0.2s ease; }
    /* Tucked: slides off the right edge (a 12px peek stays) whenever text, a CTA or a field is under it. */
    /* Upload fix (2026-10-08): the peek stays tappable (it was pointer-events:none, so on pages where the bubble is always
   tucked - Matt's at phone width - the feedback form could not be opened at all). 18px peek = 12px edge gap + 6px. */
/* app-v0.20.52 (Hubprobe): on phones the bubble no longer slides off the right edge (it started at x=372 of 390 on
   FwMrfixit and the older POCs). Every POC gets Vega's inset: whole, 12px from the edge, above any sticky bar. */
.pfb-tab.pfb-tab-tuck { transform: none !important; opacity: 1; pointer-events: auto; right: max(12px, env(safe-area-inset-right, 0px)) !important; left: auto !important; }
    .pfb-tab.pfb-tab-tuck::after { animation: none; opacity: 0; }
    /* Keep the last lines and footers clear of the bubble (Sightline item 4). */
    .zk-foot { padding-bottom: calc(1.6rem + 72px); }

    .pfb-two { grid-template-columns: 1fr; }
    .pfb-layer { align-items: flex-end !important; padding: 0; }
    .pfb-dialog { width: 100% !important; border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes pfb-toast {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .pfb-pulse::after { animation: none; opacity: 0; }
    .pfb-coach { animation: none !important; }
}

@media print { .pfb { display: none !important; } }

/* app-v0.10.11: the Feedback side tab uses the same blue keyboard focus ring as the rest of the site (was white on a dark ring). */
.pfb .pfb-tab:focus-visible, button.pfb-tab:focus-visible { outline: 3px solid #3b82f6; outline-offset: 2px; box-shadow: -4px 6px 18px rgba(2, 6, 23, 0.35); }
