/* Feedback widget.
   From 768px up, the launch control is a horizontal 128x44 pill, inset from the
   bottom-right corner. The label stays upright. The pill is position:fixed, so it
   overlays that corner and does not move the header, the timelines, the ads, the
   calendar, or the footer.
   Below 768px, every page hides the pill the same way the phone planner already
   did: the footer Feedback button is the entry, so the control cannot cover
   content. --fb-pad / --fb-toast are clearance for that pill; with the pill off
   the page they collapse, and nothing is reserved for a control that is not on
   screen. */
.fb-launch {
    position: fixed; z-index: 25;
    right: max(20px, calc(env(safe-area-inset-right) + 12px));
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 16px 0 14px; border-radius: 999px;
    background: var(--card); color: var(--text);
    border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
    box-shadow: 0 6px 20px var(--black-28);
    font: var(--btn-weight) var(--btn-size)/1 Outfit, system-ui, sans-serif;
}
html.light .fb-launch { box-shadow: 0 6px 18px var(--slate-900-14); }
.fb-launch svg { width: 18px; height: 18px; flex: none; }
.fb-launch:hover { border-color: color-mix(in srgb, var(--text) 35%, transparent); }
.fb-launch:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
/* Reserved from first paint: only pages that load feedback.js link this file, and the script always
   adds the tab, so the clearance is in the initial CSS instead of arriving with .has-fb (no layout shift). */
body {
    --fb-pad: max(6.75rem, calc(env(safe-area-inset-bottom) + 6rem));
    --fb-toast: max(76px, calc(env(safe-area-inset-bottom) + 68px));
    padding-bottom: var(--fb-pad);
}
body.has-fb .toast:not(.anchored) { bottom: var(--fb-toast); }

/* From 768px up the pill stays the horizontal corner control above. The label is not rotated.
   The bottom clearance stays the amount this sheet already reserved, so the footer, the
   leaderboard and the calendar do not move to make room. */
@media (min-width: 768px) {
    body {
        --fb-pad: max(12.5rem, calc(env(safe-area-inset-bottom) + 12rem));
        --fb-toast: max(11.5rem, calc(env(safe-area-inset-bottom) + 11rem));
    }
}

/* Below 768px the tab is off the page on every page, the same way the phone
   planner already hid it. Footer Feedback opens the same dialog.
   No bottom padding for a control that is not on screen. */
@media (max-width: 767px) {
    body {
        --fb-pad: 0px;
        --fb-toast: max(12px, env(safe-area-inset-bottom));
    }
    body.has-fb .fb-launch { display: none; }
}

/* Footer control: same dialog, same quiet weight as the other footer items. */
.site-footer .fb-footer {
    background: none; border: 0; margin: 0;
    display: inline-flex; align-items: center; min-block-size: 44px; padding-block: 0; padding-inline: 8px;
    color: var(--text); font: var(--btn-weight) var(--btn-size)/1.4 Outfit, system-ui, sans-serif;
    text-decoration: none;
}
.site-footer .fb-footer:hover { text-decoration: underline; }
.site-footer .fb-footer:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; border-radius: 3px; }

.fb-dialog {
    position: fixed; inset: auto max(20px, calc(env(safe-area-inset-right) + 12px)) max(20px, calc(env(safe-area-inset-bottom) + 12px)) auto;
    margin: 0; width: min(380px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow: auto;
    padding: 18px 18px 16px; border-radius: 16px;
    background: var(--card); color: var(--text); border: 1px solid var(--line);
    box-shadow: 0 18px 48px var(--black-40);
    font-family: Outfit, system-ui, sans-serif;
}
html.light .fb-dialog { box-shadow: 0 18px 44px var(--slate-900-20); }
.fb-dialog::backdrop { background: var(--ink-35); }
html.light .fb-dialog::backdrop { background: var(--slate-900-18); }
@media (prefers-reduced-motion: no-preference) {
    .fb-dialog[open] { animation: fb-in 0.16s ease-out; }
    @keyframes fb-in { from { opacity: 0; transform: translateY(8px); } }
}
@media (prefers-reduced-motion: reduce) {
    .fb-dialog[open] { animation: none; }
}
.fb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.fb-head h2 { font-size: 1.05rem; line-height: 1.3; font-weight: 700; margin: 0; }
.fb-x {
    flex: none; width: 36px; height: 36px; margin: -6px -6px 0 0; border-radius: 10px;
    display: grid; place-items: center; background: transparent; color: var(--muted); border: 1px solid transparent;
}
.fb-x:hover { color: var(--text); border-color: var(--line); }
.fb-x:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.fb-x svg { width: 18px; height: 18px; }
.fb-form { display: grid; gap: 12px; }
.fb-field { display: grid; gap: 6px; }
.fb-field label { font-size: 0.88rem; font-weight: 600; }
.fb-field .fb-opt { color: var(--muted); font-weight: 400; }
.fb-form textarea, .fb-form input[type="email"] {
    width: 100%; font: inherit; font-size: 0.95rem; color: var(--text); background: var(--bg);
    border: 1px solid color-mix(in srgb, var(--text) 22%, transparent); border-radius: 10px; padding: 10px 12px;
}
.fb-form textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.fb-form textarea:focus-visible, .fb-form input[type="email"]:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.fb-form :is(textarea, input):user-invalid { border-color: var(--red-500); }
html.light .fb-form :is(textarea, input):user-invalid { border-color: var(--red-700); }
.fb-err { display: none; color: var(--red-300); font-size: 0.8rem; }
html.light .fb-err { color: var(--night-text, var(--red-800)); }
.fb-form :is(textarea, input):user-invalid ~ .fb-err { display: block; }
.fb-form [aria-invalid="true"] { border-color: var(--red-500); }
html.light .fb-form [aria-invalid="true"] { border-color: var(--red-700); }
.fb-form [aria-invalid="true"] ~ .fb-err { display: block; }
.fb-count { color: var(--muted); font-size: 0.8rem; justify-self: end; font-variant-numeric: tabular-nums; }
.fb-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fb-note { color: var(--muted); font-size: 0.8rem; line-height: 1.4; margin: 0; }
.fb-note a, .fb-status a { color: inherit; text-underline-offset: 3px; }
.fb-send {
    justify-self: stretch; min-height: 44px; border-radius: 12px; border: 1px solid transparent;
    background: var(--text); color: var(--card); font: 700 var(--btn-size)/1 Outfit, system-ui, sans-serif;
}
.fb-send:hover { opacity: 0.92; }
.fb-send:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.fb-send[disabled] { opacity: 0.6; cursor: progress; }
.fb-status { font-size: 0.88rem; line-height: 1.45; margin: 0; }
.fb-status:empty { display: none; }
.fb-status.fb-bad { color: var(--red-300); }
html.light .fb-status.fb-bad { color: var(--night-text, var(--red-800)); }
.fb-done { display: grid; gap: 14px; }
.fb-done p { margin: 0; line-height: 1.5; }
.fb-done[hidden], .fb-form[hidden] { display: none; }

@media (max-width: 600px) {
    .fb-dialog {
        inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px; width: auto; max-width: none;
        max-height: calc(100dvh - 16px); border-radius: 18px;
    }
}
