/* The store: product grid, product page, cart and downloads. Builds on blog.css */

/* The cart in the header: a round button like the social links, with room for its count before them */
.site-nav .site-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 8px;
    padding: 0;
    border-radius: 50%;
    font-size: .95rem;
    text-decoration: none;
    transition: background-color .2s ease;
}

.site-nav .site-cart:hover,
.site-nav .site-cart:focus-visible {
    background: var(--x-yellow);
    color: #1d2340;
    text-decoration: none;
}

/* Charcoal, so it shows over the home page's yellow hero as well as on white */
.site-cart-count {
    position: absolute;
    top: -5px;
    right: -7px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #1d2340;
    color: var(--x-yellow);
    font-size: .65rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    letter-spacing: 0;
}

/* Between tablet and wide screens the menu is tight: while something's in the cart, the social links step aside for it */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .site-nav-end:has(.site-cart) .site-social {
        display: none;
    }
}

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card-media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--x-radius);
    background: var(--x-grey-light);
    margin-bottom: 18px;
}

.product-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.product-card:hover .product-card-media img {
    transform: scale(1.03);
}

.product-card-media .post-card-placeholder span {
    font-size: 2.6rem;
}

.product-price-tag {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--x-charcoal);
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
}

.product-card-meta {
    margin: auto 0 0;
    font-size: .8rem;
}

/* A featured product: a wide card above the grid on the store's main page, stacked on phones */
/* "Start free": the free guides above everything else on the store's main page */
.free-strip {
    margin-bottom: 48px;
}

.free-strip-title {
    margin: 0 0 18px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.free-strip-card {
    display: flex;
    gap: 18px;
    align-items: center;
    height: 100%;
    padding: 16px;
    border: 1px solid var(--x-line);
    border-radius: var(--x-radius);
    background: var(--r-card);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.free-strip-card:hover {
    border-color: var(--x-yellow);
    box-shadow: 0 8px 20px rgba(29, 35, 64, .08);
}

.free-strip-card img {
    flex: none;
    width: 120px;
    height: auto;
    border-radius: 6px;
}

.free-strip-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .88rem;
}

.free-strip-text strong {
    font-size: 1rem;
}

.free-strip-summary {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.free-strip-cta {
    margin-top: 4px;
    font-weight: 600;
    color: var(--x-charcoal);
}

.free-strip-card:hover .free-strip-cta {
    text-decoration: underline;
}

@media (max-width: 575.98px) {
    .free-strip-card img {
        width: 88px;
    }
}

.product-feature {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 48px;
    padding: 20px;
    border: 1px solid var(--x-line);
    border-left: 6px solid var(--x-yellow);
    border-radius: var(--x-radius);
    background: var(--x-yellow-soft);
}

@media (min-width: 992px) {
    .product-feature {
        grid-template-columns: 1.1fr 1fr;
        gap: 40px;
        align-items: center;
        padding: 28px;
    }
}

.product-feature .product-feature-media {
    margin-bottom: 0;
}

.product-feature:hover .product-card-media img {
    transform: scale(1.03);
}

.product-feature-body {
    display: flex;
    flex-direction: column;
}

.product-feature-title {
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    margin-bottom: 12px;
}

.product-feature-title a {
    color: inherit;
    text-decoration: none;
}

.product-feature-summary {
    margin-bottom: 18px;
}

.product-feature-buy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.product-feature-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--x-charcoal);
}

.product-feature .product-card-meta {
    margin: 0;
}

.product-image {
    width: 100%;
    height: auto;
    border-radius: var(--x-radius);
}

.buy-box,
.checkout-box {
    padding: 28px;
    border: 1px solid var(--x-line);
    border-radius: var(--x-radius);
    background: var(--r-card);
    box-shadow: var(--x-shadow);
}

@media (min-width: 992px) {
    .buy-box {
        position: sticky;
        top: 24px;
    }
}

.buy-box-price {
    margin-bottom: 18px;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--x-charcoal);
}

.buy-box-price span,
.cart-total span {
    font-size: .8rem;
    font-weight: 500;
    color: var(--x-grey);
}

.buy-box-points {
    list-style: none;
    padding: 0;
    margin: 22px 0 0;
    font-size: .88rem;
}

.buy-box-points li + li {
    margin-top: 8px;
}

.buy-box-points .fas,
.buy-box-points .fab {
    width: 20px;
    color: var(--x-yellow-strong);
}

.buy-box-heading {
    margin: 26px 0 12px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--x-grey);
}

.buy-box-files {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: .88rem;
}

.buy-box-files li {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 8px 0;
    border-top: 1px solid var(--x-line);
}

.buy-box-size {
    margin-left: auto;
    flex: none;
    font-size: .78rem;
}

.buy-box-bundle {
    margin-top: 24px;
    padding: 18px;
    border-radius: var(--x-radius);
    background: var(--x-yellow-soft);
    font-size: .9rem;
}

.buy-box-bundle p {
    margin-bottom: 12px;
}

.cart-items {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--x-line);
}

.cart-item img,
.cart-item-placeholder {
    flex: none;
    width: 96px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--x-yellow);
    color: var(--x-charcoal);
}

.cart-item-title {
    font-weight: 600;
    color: var(--x-charcoal);
    text-decoration: none;
}

.cart-item-title:hover {
    text-decoration: underline;
    text-decoration-color: var(--x-yellow-strong);
}

.cart-item-meta {
    font-size: .8rem;
}

.cart-item-price {
    font-weight: 600;
    color: var(--x-charcoal);
}

.cart-discount {
    margin-top: 24px;
}

.cart-totals {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
    margin: 0;
    font-size: .92rem;
}

.cart-totals dt {
    font-weight: 400;
}

.cart-totals dd {
    margin: 0;
    text-align: right;
}

.cart-totals .cart-total {
    padding-top: 10px;
    border-top: 1px solid var(--x-line);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--x-charcoal);
}

.checkout-note {
    margin: 12px 0 0;
    font-size: .78rem;
}

.order-thanks {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 36px;
    padding: 24px 26px;
    border-radius: var(--x-radius);
    background: var(--x-yellow-soft);
    color: var(--x-charcoal);
}

.order-thanks .fas {
    font-size: 2rem;
    color: #1e8a49;
}

.download-group {
    margin-bottom: 28px;
    padding: 22px 24px;
    border: 1px solid var(--x-line);
    border-radius: var(--x-radius);
}

.download-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.download-meta {
    margin: 2px 0 12px;
    font-size: .8rem;
}

.download-files {
    list-style: none;
    padding: 0;
    margin: 0;
}

.download-files li {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--x-line);
}

.download-name {
    display: block;
    font-weight: 500;
    color: var(--x-charcoal);
}

.download-size {
    font-size: .78rem;
}

.order-receipt {
    margin-top: 40px;
}

.min-w-0 {
    min-width: 0;
}

/* Order page: bought while logged out - suggest an account (StoreController::order) */
.order-account {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin: 0 0 32px;
    padding: 20px 24px;
    border-radius: var(--x-radius);
    background: var(--x-yellow-soft);
    font-size: .92rem;
}

.order-account > i {
    font-size: 1.8rem;
    color: var(--x-yellow-strong);
}

/* Ratings (store/partials/stars): grey stars with yellow ones over them, cut to the rating */
.stars {
    position: relative;
    display: inline-block;
    color: #d6d6d6;
    letter-spacing: 1px;
    line-height: 1;
    white-space: nowrap;
}

.stars-on {
    position: absolute;
    inset: 0 auto 0 0;
    overflow: hidden;
    color: var(--x-yellow-strong);
}

.product-card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -4px 0 10px;
    font-size: .8rem;
}

.buy-box-rating {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: -8px 0 18px;
    font-size: .85rem;
    color: var(--x-grey);
    text-decoration: none;
}

.buy-box-rating .stars {
    font-size: 1.05rem;
}

/* Reviews (store/partials/reviews) */
.reviews {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--x-line);
    scroll-margin-top: 90px;
}

.reviews-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 20px;
    margin-bottom: 20px;
}

.reviews-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
}

.reviews-summary .stars {
    font-size: 1.15rem;
}

.reviews-summary strong {
    color: var(--x-charcoal);
}

.review-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.review {
    padding: 22px 0;
    scroll-margin-top: 90px;
}

.review + .review {
    border-top: 1px solid var(--x-line);
}

.review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-bottom: 8px;
}

.review-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.review-body {
    overflow-wrap: anywhere;
}

.review-meta {
    margin: 10px 0 0;
    font-size: .8rem;
}

.review-verified {
    color: #2f7d4b;
}

.reviews-empty {
    margin: 0;
}

.review-form,
#reviews .comment-login,
#reviews .comments-closed {
    margin-top: 28px;
    scroll-margin-top: 90px;
}

.review-form {
    padding: 24px 26px;
    border-radius: var(--x-radius);
    background: var(--x-grey-light);
}

.review-form-heading {
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 700;
}

.review-form-status {
    font-size: .88rem;
}

/* Choosing stars: the radios are listed 5 to 1 and shown the other way round, so the chosen
   star and every one before it can be lit with the ~ selector */
.star-input {
    border: 0;
    margin: 0;
    padding: 0;
}

/* A legend, not a label: Bootstrap makes legends heading-sized */
.star-input legend {
    font-size: inherit;
    line-height: inherit;
}

.star-input-stars {
    display: inline-flex;
    flex-direction: row-reverse;
}

.star-input-stars label {
    padding: 0 3px;
    font-size: 1.9rem;
    line-height: 1;
    color: #cfcfcf;
    cursor: pointer;
    transition: color .1s, transform .1s;
}

.star-input-stars input:checked ~ label,
.star-input-stars label:hover,
.star-input-stars label:hover ~ label {
    color: var(--x-yellow-strong);
}

.star-input-stars label:hover {
    transform: scale(1.12);
}

.star-input-stars input:focus-visible + label {
    outline: 3px solid var(--x-yellow-strong);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .star-input-stars label {
        transition: none;
    }
}
