/* The feedback tab, on every reader's page.
 *
 * Hand-written, like _cookies.css. Jack, 22 October 2026, just after the launch: "some kind of pop up or bar or
 * tooltip or something that can be on the site on every page where they can give their feedback or report issues,
 * something super easy", and "be good to say on it we have just launched". The component is
 * resources/js/components/site-feedback.tsx; every class here is sfb- prefixed, for the reason _cookies.css gives
 * (a word the system owns brings its rules with it).
 *
 * The cookie card's materials: the cask ground, Shell words, the house button, square corners. In the bottom LEFT
 * corner, because the right is the cookie card's and the Desk's bell's. On a phone the cookie card spans the foot, so
 * the tab stands above it until it is put away.
 */

.sfb-tab {
    position: fixed;
    left: clamp(16px, 3vw, 32px);
    bottom: clamp(16px, 3vw, 32px);
    z-index: 69;                     /* under the cookie card (70), over the page */

    /* ONE LINE ON SHELL (22 October 2026): two lines of cask on a cask-dark band disappeared and covered the band's
       words; Shell with a cask edge reads on the dark bands, on photographs and on paper, and is 36px tall. */
    display: flex;
    gap: 8px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 14px;
    align-items: center;

    background: var(--shell, #F1EDE8);
    color: var(--cask, #392916);
    border: 1px solid var(--cask, #392916);
    border-radius: 0;
    box-shadow: 0 8px 20px rgba(65, 64, 66, .22);
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    animation: sfb-in .45s var(--ease, cubic-bezier(.22, .8, .24, 1)) 1.2s both;
}

.sfb-tab-new,
.sfb-new {
    font-family: var(--sans);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sfb-tab-new {
    color: rgba(57, 41, 22, .62);
}

.sfb-new {
    color: var(--on-forest-55, rgba(241, 237, 232, .72));
}

.sfb-tab-ask {
    font-family: var(--serif);
    font-size: 14.5px;
    line-height: 1;
}

.sfb-tab:hover .sfb-tab-ask {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* the box, opened */
.sfb {
    position: fixed;
    left: clamp(16px, 3vw, 32px);
    bottom: clamp(16px, 3vw, 32px);
    z-index: 71;                     /* over the cookie card while it is open */
    width: min(360px, calc(100vw - 32px));
    padding: 18px 18px 18px;

    background: var(--cask, #392916);
    color: var(--on-forest, #F1EDE8);
    border: 1px solid rgba(241, 237, 232, .2);
    border-radius: 0;
    box-shadow: 0 14px 32px rgba(65, 64, 66, .3);
}

.sfb form,
.sfb-done {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
}

.sfb-x {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    color: var(--on-forest-55, rgba(241, 237, 232, .72));
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.sfb-x:hover {
    color: var(--on-forest, #F1EDE8);
}

.sfb-new {
    margin: 0 0 6px;
}

.sfb-h {
    margin: 0 32px 8px 0;
    font-family: var(--serif);
    font-size: 20px;
    line-height: 1.2;
    color: var(--on-forest, #F1EDE8);
    text-wrap: balance;
}

.sfb-line {
    margin: 0 0 14px;
    font-family: var(--serif);
    font-size: 14px;
    line-height: 1.45;
    color: var(--on-forest, #F1EDE8);
    text-wrap: pretty;
}

.sfb-label {
    display: block;
    margin: 0 0 6px;
    font-family: var(--sans);
    font-size: 12px;
    color: var(--on-forest-55, rgba(241, 237, 232, .72));
}

.sfb-said,
.sfb-email {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 12px;
    padding: 9px 10px;
    background: rgba(241, 237, 232, .08);
    color: var(--on-forest, #F1EDE8);
    border: 1px solid rgba(241, 237, 232, .32);
    border-radius: 0;
    font-family: var(--sans);
    font-size: 15px;                 /* 16 on a phone below, so iOS does not zoom in */
    line-height: 1.4;
}

.sfb-said {
    min-height: 92px;
    resize: vertical;
}

.sfb-said::placeholder {
    color: rgba(241, 237, 232, .5);
}

.sfb-said:focus,
.sfb-email:focus {
    outline: none;
    border-color: var(--on-forest, #F1EDE8);
}

.sfb-error {
    margin: -4px 0 12px;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--august, #A0BAD4);
}

/* the house button on a dark ground, stated as the cookie card states it */
.sfb .btn.sfb-send {
    align-self: flex-start;
    height: 38px;
    min-width: 88px;
    padding: 0 18px;
    font-size: 13px;
    background: transparent;
    border-color: var(--on-forest, #F1EDE8);
    color: var(--on-forest, #F1EDE8);
    --hover-bg: var(--on-forest, #F1EDE8);
    --hover-color: var(--cask, #392916);
}

.sfb .btn.sfb-send:disabled {
    opacity: .6;
    cursor: default;
}

.sfb-again {
    align-self: flex-start;
    padding: 0;
    background: none;
    border: 0;
    color: var(--on-forest-55, rgba(241, 237, 232, .72));
    font-family: var(--sans);
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.sfb :focus-visible,
.sfb-tab:focus-visible {
    outline: 2px solid var(--august, #A0BAD4);
    outline-offset: 3px;
}

@keyframes sfb-in {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sfb-tab {
        animation: none;
    }
}

/* A moment from /live slides into the same corner for twelve seconds now and then (components/design/live-moment.tsx,
   .mm-card.on, 77px tall at 24px from the foot): the tab steps up above it and back down after. Measured 22 Oct 2026. */
.sfb-tab {
    transition: bottom .4s var(--ease, cubic-bezier(.22, .8, .24, 1));
}

body:has(.mm-card.on) .sfb-tab {
    bottom: calc(24px + 77px + 10px);
}

/* A phone: smaller, and above the cookie card while that spans the foot. */
@media (max-width: 720px) {
    .sfb-tab {
        left: 16px;
        bottom: 16px;
        height: 34px;
        padding: 0 12px;
    }

    .sfb-tab-ask {
        font-size: 14px;
    }

    body:has(.ck) .sfb-tab {
        bottom: calc(16px + 72px + 10px);   /* the cookie card is 72px on a phone (measured at 375, 22 Oct 2026) */
    }

    body:has(.mm-card.on) .sfb-tab {
        bottom: calc(12px + 77px + 10px);   /* the moment spans the foot here, 12px up */
    }

    .sfb {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
    }

    .sfb-said,
    .sfb-email {
        font-size: 16px;
    }
}
