/* A note to Daniel: the Give Feedback window (F1, decisions.md 2026-10-06).
   Loaded by sidebar.html only under web_nav_three_places (born dark). Every
   rule is scoped to #feedbackNote. Design source:
   ~/lifenote/org/mockups/feedback-modal-options-2026-10-06.html option F1,
   without the "What were you doing?" field and without a picture of Daniel. */

/* ---- tokens: the --wrb-* set (all four themes) plus the paper ------------ */
#feedbackNote {
    --fbn-paper: #FBF6EC;
    --fbn-paper-ink: #3A3124;
    --fbn-paper-line: #E6DCC6;
    --fbn-err: var(--ln-danger);
    --fbn-err-bg: var(--ln-danger-soft);
    --fbn-scrim: rgba(17, 12, 28, 0.42);
    --fbn-raise: var(--wrb-raise, #FFFFFF);
    --fbn-text: var(--wrb-text, #333333);
    --fbn-title: var(--wrb-title, #111111);
    --fbn-muted: var(--wrb-muted, #6b6b76);
    --fbn-faint: var(--wrb-faint, #7a7883);
    --fbn-line: var(--wrb-line, #dcdae2);
    --fbn-hover: var(--wrb-hover, rgba(17, 17, 17, 0.05));
    --fbn-accent: var(--wrb-accent, #7C3AED);
    --fbn-ring: var(--wrb-ring, #8B5CF6);
    --fbn-shadow: 0 24px 60px -12px rgba(30, 20, 60, 0.35), 0 2px 6px rgba(30, 20, 60, 0.08);
}
body.dark #feedbackNote {
    --fbn-paper: #2B2433;
    --fbn-paper-ink: #E9E2D6;
    --fbn-paper-line: #4a3f57;
    --fbn-err: var(--ln-danger);
    --fbn-err-bg: var(--ln-danger-soft);
    --fbn-scrim: rgba(0, 0, 0, 0.55);
    --fbn-accent: #8B5CF6;
    --fbn-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
}

#feedbackNote[hidden] { display: none !important; }
#feedbackNote {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: Inter, "Avenir Next", -apple-system, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
    color: var(--fbn-text);
    text-align: left;
}
#feedbackNote *, #feedbackNote *::before, #feedbackNote *::after { box-sizing: border-box; }
#feedbackNote [hidden] { display: none !important; }
#feedbackNote .fbn-scrim {
    position: absolute;
    inset: 0;
    background: var(--fbn-scrim);
}
#feedbackNote .fbn-dialog {
    position: relative;
    width: 480px;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: var(--fbn-raise);
    color: var(--fbn-text);
    border: 1px solid var(--fbn-line);
    border-radius: 18px;
    box-shadow: var(--fbn-shadow);
}
#feedbackNote .fbn-dialog:focus { outline: none; }
#feedbackNote button { font: inherit; cursor: pointer; }
#feedbackNote :focus-visible { outline: 2px solid var(--fbn-ring); outline-offset: 2px; }

#feedbackNote .fbn-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--fbn-muted);
    z-index: 1;
}
#feedbackNote .fbn-x:hover { background: var(--fbn-hover); color: var(--fbn-title); }
#feedbackNote .fbn-x svg { width: 18px; height: 18px; }

#feedbackNote .fbn-compose { padding: 26px 28px 22px; margin: 0; }
#feedbackNote .fbn-title {
    margin: 0 40px 0 0;
    font-family: Palatino, "Palatino Linotype", "Book Antiqua", "Noto Serif TC", "Songti TC", Georgia, serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--fbn-title);
}
#feedbackNote .fbn-sub {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--fbn-muted);
}

/* the paper: "Dear Daniel," sits on it, above the words */
#feedbackNote .fbn-paper {
    margin-top: 16px;
    padding: 12px 14px 4px;
    border: 1px solid var(--fbn-paper-line);
    border-radius: 12px;
    background: var(--fbn-paper);
    color: var(--fbn-paper-ink);
    font-family: Palatino, "Palatino Linotype", "Book Antiqua", "Noto Serif TC", "Songti TC", Georgia, serif;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#feedbackNote .fbn-paper:focus-within {
    border-color: var(--fbn-ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fbn-ring) 22%, transparent);
}
#feedbackNote .fbn-salute {
    display: block;
    font-size: 16px;
    line-height: 1.6;
}
#feedbackNote .fbn-text {
    display: block;
    width: 100%;
    min-height: 132px;
    max-height: 46vh;
    margin: 6px 0 0;
    padding: 0 0 8px;
    resize: vertical;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--fbn-paper-ink);
    font: 16px/1.6 Palatino, "Palatino Linotype", "Book Antiqua", "Noto Serif TC", "Songti TC", Georgia, serif;
    box-shadow: none;
}
#feedbackNote .fbn-text:focus { outline: none; box-shadow: none; }
#feedbackNote .fbn-text[aria-invalid="true"] { color: var(--fbn-paper-ink); }
#feedbackNote .fbn-paper:has(.fbn-text[aria-invalid="true"]) { border-color: var(--fbn-err); }

#feedbackNote .fbn-count {
    margin: 6px 0 0;
    text-align: right;
    font-size: 12.5px;
    color: var(--fbn-faint);
    font-variant-numeric: tabular-nums;
}
#feedbackNote .fbn-count.is-over { color: var(--fbn-err); font-weight: 600; }

#feedbackNote .fbn-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#feedbackNote .fbn-thumbs:empty { display: none; }
#feedbackNote .fbn-thumb {
    position: relative;
    width: 64px;
    height: 48px;
    border: 1px solid var(--fbn-line);
    border-radius: 8px;
    overflow: visible;
}
#feedbackNote .fbn-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; display: block; }
#feedbackNote .fbn-thumb.is-uploading img { opacity: 0.45; }
#feedbackNote .fbn-thumb.is-uploading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--fbn-line);
    border-top-color: var(--fbn-accent);
    border-radius: 50%;
    animation: fbn-spin 0.8s linear infinite;
}
#feedbackNote .fbn-thumb-rm {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.68);
    color: #FFFFFF;
    font-size: 14px;
    line-height: 22px;
}
#feedbackNote .fbn-thumb-rm:disabled { opacity: 0.4; cursor: default; }

#feedbackNote .fbn-banner {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--fbn-err-bg);
    color: var(--fbn-err);
    font-size: 13.5px;
    line-height: 1.45;
}

#feedbackNote .fbn-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}
#feedbackNote .fbn-attach {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--fbn-line);
    border-radius: 10px;
    background: transparent;
    color: var(--fbn-text);
    font-size: 13.5px;
    text-align: left;
}
#feedbackNote .fbn-attach:hover { background: var(--fbn-hover); }
#feedbackNote .fbn-attach:disabled { opacity: 0.5; cursor: default; }
#feedbackNote .fbn-attach svg { flex: 0 0 16px; width: 16px; height: 16px; color: var(--fbn-muted); }
#feedbackNote .fbn-attach-count { color: var(--fbn-faint); font-size: 12.5px; }
#feedbackNote .fbn-attach-count:empty { display: none; }

#feedbackNote .fbn-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: var(--fbn-accent);
    color: #FFFFFF;
    font-size: 14.5px;
    font-weight: 600;
}
#feedbackNote .fbn-send:hover:not(:disabled) { filter: brightness(1.06); }
#feedbackNote .fbn-send:disabled { opacity: 0.45; cursor: default; }
#feedbackNote .fbn-send.is-busy:disabled { opacity: 0.85; cursor: progress; }
#feedbackNote .fbn-spin {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: fbn-spin 0.8s linear infinite;
}
#feedbackNote .fbn-send.is-busy .fbn-spin { display: inline-block; }
@keyframes fbn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    #feedbackNote .fbn-spin,
    #feedbackNote .fbn-thumb.is-uploading::after { animation-duration: 2.4s; }
}

#feedbackNote .fbn-from {
    margin: 12px 0 0;
    font-size: 12.5px;
    color: var(--fbn-faint);
    overflow-wrap: anywhere;
}

/* the honest thank-you: only after the server saved the note */
#feedbackNote .fbn-done { padding: 38px 30px 28px; text-align: center; }
#feedbackNote .fbn-done .fbn-title { margin: 0 0 8px; font-size: 23px; }
#feedbackNote .fbn-done .fbn-title:focus { outline: none; }
#feedbackNote .fbn-done .fbn-sub { max-width: 340px; margin: 0 auto 20px; font-size: 14.5px; line-height: 1.55; }
#feedbackNote .fbn-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--fbn-accent) 12%, transparent);
    color: var(--fbn-accent);
}
#feedbackNote .fbn-mark svg { width: 26px; height: 26px; }

#feedbackNote .fbn-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

body.fbn-open { overflow: hidden; }

/* ---- a phone: a bottom sheet, Send stays reachable ----------------------- */
@media (max-width: 640px) {
    #feedbackNote { align-items: flex-end; padding: 0; }
    #feedbackNote .fbn-dialog {
        width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        border-bottom: 0;
        border-radius: 20px 20px 0 0;
    }
    #feedbackNote .fbn-dialog::before {
        content: "";
        display: block;
        width: 36px;
        height: 4px;
        margin: 8px auto 0;
        border-radius: 2px;
        background: var(--fbn-line);
    }
    #feedbackNote .fbn-compose { padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px)); }
    #feedbackNote .fbn-done { padding: 26px 22px calc(32px + env(safe-area-inset-bottom, 0px)); }
    #feedbackNote .fbn-title { font-size: 22px; }
    #feedbackNote .fbn-text { min-height: 120px; max-height: 38vh; }
}
