/*
 * What a phone needs and the pages of the tips: the bar at the bottom of the screen (the main menu on a phone, with the pencil of a new wish in the
 * middle), the menu of the account with words, the heart with the number of the saved tips, the block that leads to them, the button "Načíst další"
 * and the filter of the tips. Loaded after discover.css; the dark theme of these parts is at the end.
 */

/* ---- the heart with the number of the saved tips: beside the link to the tips, no red bubble ---- */
.fav-badge {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    margin-left: .35rem;
    color: var(--heart);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1;
}

.fav-badge[hidden] {
    display: none;
}

.fav-badge.is-bumped,
.favorites-block.is-bumped,
.favorites-link.is-bumped {
    animation: fav-bump .45s ease;
}

@keyframes fav-bump {
    40% { transform: scale(1.12); }
}

/* the way to the saved tips, a small button at the top of the page of the tips */
.favorites-link {
    margin: .25rem 0 .75rem;
}

.favorites-link[hidden] {
    display: none;
}

.favorites-link .bi {
    color: var(--heart);
}

.favorites-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1rem;
    margin: .5rem 0 1rem;
    padding: .8rem 1rem;
    border: 1px solid #f3b6c6;
    border-radius: 12px;
    background: #fdecef;
}

.favorites-block[hidden] {
    display: none;
}

.favorites-block > .bi {
    color: var(--heart);
    font-size: 1.6rem;
}

.favorites-block-text {
    flex: 1 1 14rem;
    margin: 0;
}

/* ---- the button "Načíst další" and the tile that ends a row of tips ---- */
[data-load-more].is-loading {
    opacity: .6;
    cursor: progress;
}

.tip-mini-more {
    flex: 0 0 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 9rem;
    border: 2px dashed rgba(0, 0, 0, .2);
    border-radius: 8px;
    color: var(--brand);
    font-weight: 700;
    font-size: .9rem;
    text-align: center;
    scroll-snap-align: start;
}

.tip-mini-more .bi {
    font-size: 1.8rem;
}

.tip-mini-more:hover {
    background: rgba(255, 255, 255, .6);
    color: var(--brand-dark);
    text-decoration: none;
}

/* the way to the whole page of the tips under a row of the home page: always in sight, the row scrolls on its own */
.showcase-all {
    margin: .7rem 0 0;
}

.showcase-all .showcase-more {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .15);
    color: var(--brand);
    font-weight: 700;
}

.showcase-all .showcase-more:hover {
    background: var(--yellow-light);
    border-color: var(--yellow-hover);
    color: var(--brand-dark);
}

/* a label that is a few words long stays in one line (the price of a tip, a chip of a page); the name of a category may break, a long one must not stretch the card */
.tip-chips .tip-chip-price,
.showcase-chip {
    white-space: nowrap;
}

.tip-chips li {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* ---- the path to a page: close to the heading below it, and not far from the menu above ---- */
.crumbs {
    margin: .1rem 0 .9rem;
}

/* ---- the filter of the tips: always open, the conditions first, the words and the button last ---- */
.tip-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tip-filter-search {
    margin-top: .75rem;
}

.age-stepper {
    display: flex;
    align-items: stretch;
}

.age-stepper .form-control {
    min-width: 0;
    border-radius: 0;
    text-align: center;
    -moz-appearance: textfield;
}

.age-stepper .form-control::-webkit-outer-spin-button,
.age-stepper .form-control::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.age-stepper .btn {
    padding: 0 .65rem;
}

.age-stepper .btn:first-child {
    border-radius: .25rem 0 0 .25rem;
}

.age-stepper .btn:last-child {
    border-radius: 0 .25rem .25rem 0;
}

@media (min-width: 768px) {
    .tip-filter-grid {
        grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    }
}

/* ---- the menu of the account on a phone: one button with words instead of a row of icons ---- */
.account-menu {
    position: relative;
}

.account-menu > summary {
    list-style: none;
}

.account-menu > summary::-webkit-details-marker {
    display: none;
}

.account-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .7rem;
    border: 1px solid #c9d3dc;
    border-radius: 999px;
    background: #fff;
    color: #2d3b48;
    font-weight: 700;
    cursor: pointer;
}

.account-menu-toggle .bi {
    font-size: 1.2rem;
}

.account-menu-panel {
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    z-index: 1040;
    min-width: 16rem;
    padding: .35rem;
    border: 1px solid #c9d3dc;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(6, 22, 58, .2);
}

.account-menu-panel form {
    margin: 0;
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .65rem .7rem;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #2d3b48;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
}

.account-menu-item:hover,
.account-menu-item:focus {
    background: #eef3f7;
    color: var(--brand);
    text-decoration: none;
}

.account-menu-item .bi {
    width: 1.3rem;
    font-size: 1.15rem;
    text-align: center;
}

.account-menu-item-danger {
    color: #c0392b;
}

.account-menu-note {
    margin-left: auto;
    color: var(--heart);
    font-size: .8rem;
    font-weight: 700;
}

.account-menu-note[hidden] {
    display: none;
}


/* ---- the bar at the bottom of a phone ---- */
.tabbar {
    display: none;
}

@media (max-width: 767.98px) {
    /* the menu under the logo is replaced by the bar below */
    .main-nav {
        display: none;
    }

    body {
        padding-bottom: calc(62px + env(safe-area-inset-bottom));
    }

    .tabbar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        height: calc(62px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        border-top: 1px solid #d6dde3;
        background: #fff;
        box-shadow: 0 -6px 20px rgba(6, 22, 58, .12);
    }

    .tabbar__link {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* from the top, not the middle: a name on one line and a name on two lines would otherwise put their icons at different heights */
        justify-content: flex-start;
        gap: 2px;
        min-width: 0;
        padding: 9px 2px 0;
        color: #5b6b7a;
        font-size: .68rem;
        font-weight: 700;
        line-height: 1.1;
        text-align: center;
        -webkit-tap-highlight-color: transparent;
    }

    .tabbar__link:hover,
    .tabbar__link:focus {
        color: var(--brand);
        text-decoration: none;
    }

    .tabbar__link > .bi {
        font-size: 1.35rem;
        line-height: 1;
    }

    .tabbar__link > span:not(.fav-badge) {
        max-width: 100%;
        overflow: hidden;
        overflow-wrap: anywhere;
    }

    /* where I am: the icon is filled and sits in a yellow pill, the name is darker */
    .tabbar__link.is-active {
        color: var(--brand);
    }

    .tabbar__link.is-active > .bi {
        padding: .1rem 1rem;
        border-radius: 999px;
        background: var(--yellow-light);
    }

    .tabbar__link.is-active > span:not(.fav-badge) {
        color: var(--brand-dark);
        font-weight: 800;
    }

    /* the heart with the number sits at the corner of the icon of the tips */
    .tabbar__link .fav-badge {
        position: absolute;
        top: 7px;
        left: calc(50% + .75rem);
        margin: 0;
        font-size: .68rem;
    }

    /* the pencil: a round yellow button that rises above the bar */
    .tabbar__link--write > .bi {
        display: grid;
        place-items: center;
        width: 50px;
        height: 50px;
        margin-top: -26px;
        /* so its name is on the same line as the names of the others */
        margin-bottom: 4px;
        border: 3px solid #fff;
        border-radius: 50%;
        background: var(--yellow);
        color: #3a2b00;
        font-size: 1.3rem;
        box-shadow: 0 4px 0 rgba(0, 0, 0, .12), 0 8px 18px rgba(255, 213, 79, .45);
    }

    /* (the pencil rises above the bar by its negative margin, so it starts higher than the others) */
    .tabbar__link--write {
        padding-top: 3px;
        color: #2d3b48;
    }

    /* the round button of the feedback is not on a phone: it covered what the pages keep at the bottom (the bar of a tip, the buttons of a list); the feedback is
       an item of the menu there (the layout), and the button stays on a bigger screen */
    .feedback {
        display: none;
    }

    /* the button for the whole sign-in invitation is as wide as the buttons above it */
    .signin-invite .btn {
        display: block;
        width: 100%;
    }

    /* a row of tips shows a bit of the next tip, so one sees that it goes on; the labels of the price do not break */
    .tip-mini-more {
        flex-basis: 7rem;
    }
}

/* ---- the dark theme of these parts ---- */
html[data-theme="dark"] .tabbar {
    border-top-color: var(--dark-border);
    background: var(--dark-surface);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .tabbar__link {
    color: var(--dark-muted);
}

html[data-theme="dark"] .tabbar__link.is-active,
html[data-theme="dark"] .tabbar__link:hover {
    color: var(--dark-link);
}

html[data-theme="dark"] .tabbar__link--write {
    color: var(--dark-text);
}

html[data-theme="dark"] .tabbar__link--write > .bi {
    border-color: var(--dark-surface);
    color: #3a2b00;
}

html[data-theme="dark"] .fav-badge,
html[data-theme="dark"] .account-menu-note {
    color: #ff7aa2;
}

html[data-theme="dark"] .favorites-block {
    border-color: #6b3446;
    background: #2b1b22;
}

html[data-theme="dark"] .account-menu-toggle,
html[data-theme="dark"] .account-menu-panel {
    border-color: var(--dark-border);
    background: var(--dark-surface-2);
    color: var(--dark-text);
}

html[data-theme="dark"] .account-menu-item {
    color: var(--dark-text);
}

html[data-theme="dark"] .account-menu-item:hover,
html[data-theme="dark"] .account-menu-item:focus {
    background: var(--dark-surface-3);
    color: var(--dark-link);
}

html[data-theme="dark"] .account-menu-item-danger {
    color: #ff8a7e;
}

html[data-theme="dark"] .tip-mini-more {
    border-color: var(--dark-border);
    color: var(--dark-link);
}

html[data-theme="dark"] .tip-mini-more:hover {
    background: var(--dark-surface-2);
}

html[data-theme="dark"] .showcase-all .showcase-more {
    border-color: var(--dark-border);
    background: var(--dark-surface-2);
    color: var(--dark-link);
}

@media (prefers-reduced-motion: reduce) {
    .fav-badge.is-bumped,
    .favorites-block.is-bumped {
        animation: none;
    }
}

/* ---- nothing found in the tips: a loud message with a broken gift, the tips offered instead are set apart ---- */
.tips-empty {
    margin: 1.5rem 0 2rem;
    padding: 1.5rem 1rem;
    border: 2px dashed #e6b7a8;
    border-radius: 14px;
    background: #fff5f0;
    text-align: center;
}

.tips-empty .error-art {
    width: min(11rem, 55%);
    height: auto;
    margin-bottom: .5rem;
}

.tips-empty-title {
    margin: 0 0 .4rem;
    color: #b3261e;
    font-size: 1.5rem;
    font-weight: 800;
}

.tips-empty-text {
    max-width: 30rem;
    margin: 0 auto 1rem;
    font-size: 1.05rem;
}

.tips-suggested {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, .1);
}

html[data-theme="dark"] .tips-empty {
    border-color: #6b4036;
    background: #2a1d1a;
}

html[data-theme="dark"] .tips-empty-title {
    color: #ff9a8f;
}

/* ---- the slideshow of sample wishes made of real tips: the photo of the tip fills the picture ---- */
.sample-photo-real {
    overflow: hidden;
    background: #fff;
}

.sample-photo-real img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* the button under a row of the home page sits at the left edge (the older rule of the button in the head of a section shifted it on a phone) */
.showcase-all .showcase-more {
    margin-left: 0;
}

/* ---- the pencil of the administrator under the heart: a round button over the corner of the photo (it does not stretch the labels of the card) ---- */
.tip-edit {
    position: absolute;
    top: 3.05rem;
    right: .45rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    color: var(--brand);
}

.tip-edit:hover,
.tip-edit:focus-visible {
    background: #fff;
    color: var(--brand-dark);
    text-decoration: none;
}

/* on the page of the tip it is a small button among the others */
.tip-edit.tip-edit-inline {
    position: static;
    margin-left: .35rem;
    border: 1px solid rgba(0, 0, 0, .15);
    background: #fff;
    box-shadow: none;
    vertical-align: middle;
}

/* where there is a pointer the pencil shows when it is over the card (or the keyboard is there), on a screen without one it is always there */
@media (hover: hover) {
    .tip-card .tip-edit,
    .tip-top .tip-edit {
        opacity: 0;
    }

    .tip-card:hover .tip-edit,
    .tip-top:hover .tip-edit,
    .tip-card .tip-edit:focus-visible,
    .tip-top .tip-edit:focus-visible {
        opacity: 1;
    }
}

html[data-theme="dark"] .tip-edit,
html[data-theme="dark"] .tip-edit.tip-edit-inline {
    border-color: var(--dark-border);
    background: var(--dark-surface-2);
    color: var(--dark-link);
}

/* the button under a row never breaks into two lines (the arrow alone on the second one): a long name is cut with dots */
.showcase-all .showcase-more {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- the header: the logo at the very top, the theme switch and the menu of the account on its row ---- */
#banner #logged-as {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0;
}

/* a visitor's theme switch is no longer laid over the logo row by hand: it is an item of the row now */
#logged-as.is-visitor {
    position: static;
    height: auto;
    padding: 0;
    align-items: center;
}

#logged-as.is-visitor .icon-action {
    margin-top: 0;
}

/* ---- the button of a new wish (only in the section Přání): the first thing in the content, on the right, as wide as its text ---- */
.add-wish-bar {
    margin: 0 0 1rem;
    text-align: right;
}

@media (max-width: 575.98px) {
    .add-wish-bar .btn {
        padding: .45rem 1rem;
        font-size: 1rem;
    }

    /* the two buttons under the promise of the home page are of one width */
    .visitor-hero-actions {
        display: flex;
        flex-direction: column;
        gap: .6rem;
    }

    .visitor-hero-actions .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: .45rem;
        width: 100%;
        margin: 0;
    }
}

/* ---- the filter of the wishes on a phone: the person on the first row, the icons (state, order, mode) together on the second ---- */
@media (max-width: 575.98px) {
    .filter-bar {
        gap: .5rem;
    }

    .filter-person {
        flex: 1 1 100%;
        max-width: none;
    }

    .filter-icons {
        flex: 1 1 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: .3rem;
        margin-left: 0;
    }

    .filter-menu-name {
        display: none;
    }
}

/* a narrow phone (360 px): the four icon boxes do not fit in the width of the select with the usual padding, so the row of the icons would be wider than the select above it */
@media (max-width: 399.98px) {
    .filter-group a.icon-action {
        padding: 0 8px;
    }

    .filter-menu > summary {
        padding: 0 8px;
    }
}

/* ---- a phone: the buttons that lead on are as wide as the page (the button under a row of tips, the ones of the page Jak to funguje and of the closing invitation) ---- */
@media (max-width: 575.98px) {
    .showcase-all .showcase-more {
        display: block;
        width: 100%;
        /* the font has more room under the letters than above them: the words sit in the middle with a little more padding on top */
        padding: .55rem .75rem .4rem;
        line-height: 1.2;
        text-align: center;
    }

    .info-actions {
        display: flex;
        flex-direction: column;
        gap: .6rem;
    }

    .info-actions .btn,
    .info-cta .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: .45rem;
        width: 100%;
        margin: 0;
    }

    .tips-empty .btn {
        display: block;
        width: 100%;
    }
}

/* a phone: the icon of a big button is as big as its words (the text of the button may go to two lines, a small icon looked lost) */
@media (max-width: 575.98px) {
    .visitor-hero-actions .btn .bi,
    .info-actions .btn .bi {
        font-size: 1.5rem;
        line-height: 1;
    }
}

/* ---- the tabs of the dashboard on a phone: a light grid (three in a row), not a heap of pills of different widths ---- */
@media (max-width: 575.98px) {
    .dash-menu {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .4rem;
    }

    .dash-menu .nav-item {
        min-width: 0;
    }

    .dash-menu .nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .1rem;
        height: 100%;
        padding: .45rem .25rem;
        border: 1px solid #cdd6e2;
        font-size: .85rem;
        text-align: center;
    }

    .dash-menu .nav-link .bi {
        font-size: 1.1rem;
    }
}

/* ---- the system page of the dashboard on a phone: the name above its value (two columns made the page wider than the screen) ---- */
@media (max-width: 575.98px) {
    .dash-system {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .dash-system dt {
        margin-top: .6rem;
    }

    .dash-system dt:first-child {
        margin-top: 0;
    }

    .dash-system dd {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* the Rubíny in the menu are blue like the number on the gem, not the pink of the hearts (after the dark rule of the note, so that it wins) */
.account-menu-note.account-menu-note-ruby {
    color: #1f6feb;
}

html[data-theme="dark"] .account-menu-note.account-menu-note-ruby {
    color: #6aa5ff;
}
