/* The page of a tip (Tips/detail.latte): one grid of five areas. On a screen the side (the photo) is on the left and stays while the text is read, the heading, the box
   with the buttons, the text and the chart of the price on the right; on a phone it is the heading, the photo, the box with the buttons, the text and the chart, so the
   shop button is on the first screen. The bar at the bottom of a phone (tip_sticky_bar.latte) takes over when the box has gone. */

.tip-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "head"
        "side"
        "buy"
        "body"
        "chart";
    gap: 1rem;
}

.tip-detail-head { grid-area: head; }
.tip-detail-side { grid-area: side; }
.tip-detail .tip-buy { grid-area: buy; }
.tip-detail-body { grid-area: body; }
.tip-detail-chart { grid-area: chart; }

.tip-detail-head .tip-detail-lead {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .tip-detail {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        grid-template-areas:
            "side head"
            "side buy"
            "side body"
            "side chart";
        grid-template-rows: auto auto auto 1fr;
        column-gap: 1.75rem;
    }

    /* the side sticks under the header of the site (the script puts its height into --tip-sticky-top) */
    .tip-detail-side {
        position: sticky;
        top: var(--tip-sticky-top, 1rem);
        align-self: start;
    }
}

/* ---- the photo: a soft frame, the lens that looks closely at it, the way to open it big ---- */
.tip-detail-media {
    position: relative;
    margin: 0;
    box-shadow: 0 6px 22px rgba(30, 40, 60, .1);
}

.tip-detail-media[data-tip-zoom] {
    cursor: zoom-in;
}

/* a phone: the photo is lower, so the box with the buttons fits on the first screen */
@media (max-width: 767.98px) {
    .tip-detail-media .tip-image {
        aspect-ratio: 16 / 10;
        object-fit: contain;
    }
}

/* the heart of the favorites sits in the corner of the photo, a little bigger than on a card */
.tip-detail-media .tip-heart-form,
.tip-detail-media a.tip-heart {
    top: .7rem;
    right: .7rem;
}

.tip-detail-media .tip-heart {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.3rem;
    cursor: pointer;
}

/* the heart is above the lens (which has z-index 2), so the lens never covers it */
.tip-detail-media .tip-heart-form,
.tip-detail-media a.tip-heart {
    z-index: 3;
}

.tip-zoom-hint {
    position: absolute;
    right: .6rem;
    bottom: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 5px rgba(0, 0, 0, .25);
    color: #1f3b63;
    pointer-events: none;
}

/* the lens (js/tip-zoom.js): a circle that follows the mouse and shows the photo bigger; only where there is a mouse */
.tip-zoom-lens {
    position: absolute;
    z-index: 2;
    width: 11rem;
    height: 11rem;
    border: 3px solid #fff;
    border-radius: 50%;
    background-color: #fff;
    background-repeat: no-repeat;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
    pointer-events: none;
}

.tip-zoom-lens[hidden] {
    display: none;
}

/* ---- the box with the buttons: the shop is the biggest and the only green thing in it ---- */
.tip-buy {
    padding: 1rem 1.1rem;
    border: 1px solid #cfe8d6;
    border-radius: 14px;
    background: linear-gradient(180deg, #f6fbf7 0%, #eef8f1 100%);
    box-shadow: 0 2px 10px rgba(47, 158, 68, .08);
}

.tip-buy-offer {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .15rem 1rem;
    margin-bottom: .7rem;
}

.tip-buy-offer p {
    margin: 0;
}

.tip-buy-price strong {
    color: #1f6b34;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -.01em;
}

.tip-buy-price-note {
    margin-left: .4rem;
    color: #5f6b7a;
    font-size: .82rem;
}

.tip-buy-rating {
    color: #4a5565;
    font-size: .9rem;
}

.tip-buy-rating .bi-star-fill {
    color: #f2a900;
}

.tip-buy-rating span {
    color: #7b8696;
}

.tip-buy .btn-shop.tip-buy-shop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .8rem 1rem;
    font-size: 1.2rem;
}

/* one line under the button: where it leads on the left, the notice that the link is a paid one on the right, both in the same size and on the same line */
.tip-buy-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .2rem .8rem;
    margin-top: .5rem;
}

.tip-buy-meta > *,
.tip-buy-meta .affiliate-note {
    margin: 0 !important;
    font-size: .8rem;
    line-height: 1.4;
}

.tip-buy-meta .affiliate-note {
    display: flex;
    align-items: center;
    gap: .3rem;
}

/* the two quiet buttons (the wish, sharing): one height, one size of the words, each its own colour (grey, soft blue) */
.tip-buy .tip-detail-actions {
    flex-wrap: nowrap;
    gap: .5rem;
    margin: .8rem 0 .4rem;
}

.tip-buy .tip-detail-actions .btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    height: 2.6rem;
    padding: 0 1rem;
    border: 2px solid;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}

.tip-buy .btn-secondary {
    border-color: #6c757d;
}

/* ---- sending the tip: a button and the small menu under it ---- */
.tip-share {
    position: relative;
    display: inline-block;
}

.tip-buy .tip-share-toggle {
    border-color: #b6cde4;
    background: #e3edf7;
    color: #24507c;
}

.tip-buy .tip-share-toggle:hover,
.tip-buy .tip-share-toggle:focus {
    border-color: #8fb1d3;
    background: #d3e3f3;
    color: #1b3f63;
}

/* a phone: the buttons share one row, equally wide, with shorter words and a bit smaller */
@media (max-width: 575.98px) {
    .tip-buy .tip-detail-actions {
        gap: .4rem;
    }

    .tip-buy .tip-detail-actions .btn {
        width: 100%;
        height: 2.5rem;
        padding: 0 .3rem;
        gap: .3rem;
        font-size: .875rem;
    }

    .tip-buy .tip-detail-actions > .btn,
    .tip-buy .tip-detail-actions .tip-share {
        display: flex;
        flex: 1 1 0;
        min-width: 0;
    }
}

.tip-share-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + .35rem);
    right: 0;
    min-width: 13rem;
    padding: .35rem;
    border: 1px solid #dedcd6;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.tip-share-menu[hidden] {
    display: none;
}

.tip-share-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .6rem .75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #212529;
    font-size: 1rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.tip-share-item[hidden] {
    display: none;
}

.tip-share-item:hover,
.tip-share-item:focus-visible {
    background: #eef3f8;
    color: #212529;
    text-decoration: none;
}

.tip-share-item .bi {
    font-size: 1.2rem;
}

.tip-share-item .bi-whatsapp {
    color: #1ea952;
}

/* after the long text (a screen only: on a phone the bar at the bottom is there for it) */
.tip-text-end {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, .1);
}

.tip-text-end-title {
    margin: 0 0 .5rem;
    font-weight: 700;
}

.tip-text-end .tip-detail-actions {
    margin: 0;
}

@media (max-width: 767.98px) {
    .tip-text-end {
        display: none;
    }
}

/* ---- the chart of the price ---- */
.tip-chart {
    padding: 1rem 1.1rem;
    overflow: hidden;
    border: 1px solid #dedcd6;
    border-radius: 14px;
    background: #fff;
}

.tip-chart-frame {
    display: block;
    width: 100%;
    height: 340px;
    margin-top: .75rem;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

/* a phone: the widget of Heureka does not shrink under 320 px, so the chart goes to the edges of the card (and the card has less padding) */
@media (max-width: 575.98px) {
    .tip-chart {
        padding: .9rem 0 .5rem;
    }

    .tip-chart > h2,
    .tip-chart > p {
        padding: 0 .9rem;
    }

    .tip-chart-frame {
        width: 100%;
        height: 360px;
        margin-top: .5rem;
        border-radius: 0;
    }
}

/* ---- the bar of a phone: only there, and only while the script says that the shop button of the box is out of the screen; it sits right on the tab bar (mobile.css).
   The lower padding is room for the raised middle button of the tab bar, which reaches into the bar a little. ---- */
.tip-sticky-bar {
    display: none;
}

@media (max-width: 767.98px) {
    .tip-sticky-bar {
        --bar-button: 2.75rem;
        position: fixed;
        right: 0;
        bottom: calc(62px + env(safe-area-inset-bottom));
        left: 0;
        z-index: 1020;
        align-items: flex-start;
        gap: .5rem;
        padding: .5rem .75rem 1.3rem;
        border-top: 1px solid rgba(0, 0, 0, .12);
        background: #fff;
        box-shadow: 0 -4px 14px rgba(0, 0, 0, .1);
    }

    .tip-sticky-bar.is-visible {
        display: flex;
    }

    /* the shop takes what the two small buttons leave; the heart and the wish are squares of the same size as its height */
    .tip-sticky-bar .btn-shop {
        display: flex;
        flex: 1 1 auto;
        align-items: center;
        justify-content: center;
        gap: .4rem;
        height: var(--bar-button);
        padding: 0 .75rem;
    }

    .tip-sticky-bar .tip-heart-form {
        display: flex;
        flex: 0 0 auto;
    }

    .tip-sticky-bar .tip-heart.tip-heart-compact,
    .tip-sticky-bar a.tip-heart.tip-heart-compact,
    .tip-sticky-bar .btn.tip-bar-icon {
        position: static;
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        width: var(--bar-button);
        height: var(--bar-button);
        padding: 0;
        border: 2px solid;
        border-radius: .3rem;
        box-shadow: none;
        line-height: 1;
    }

    .tip-sticky-bar .tip-heart-compact {
        border-color: var(--heart);
        background: #fff;
    }

    .tip-sticky-bar .tip-heart-compact:hover,
    .tip-sticky-bar .tip-heart-compact.is-on {
        background: var(--heart);
        color: #fff;
        transform: none;
    }

    .tip-sticky-bar .btn.tip-bar-icon {
        border-color: #6c757d;
    }

    .tip-sticky-bar .tip-heart-compact .bi,
    .tip-sticky-bar .tip-bar-icon .bi {
        font-size: 1.25rem;
        line-height: 1;
    }

    /* the bar must not cover the end of the page */
    .tip-sticky-spacer {
        height: 4.5rem;
    }
}
