/*
 * Recipe detail view (EXT:rezepte, Templates/Recipe/Detail.html).
 * Loaded through the AssetCollector by the detail template only. Colours follow the site theme of the
 * bootstrap package: the orange accent for surfaces and lines, the darker red for text, which keeps the
 * contrast of text above 4.5:1 where the orange alone reaches about 2.7:1.
 */
.rezept-detail {
    --rezept-accent: var(--bs-primary, #ef7b4f);
    --rezept-accent-text: var(--bs-secondary, #bf3f27);
    --rezept-accent-soft: #fdeee7;
    --rezept-sand: #d3c4b5;
    --rezept-sand-soft: #f7f2ed;
    --rezept-muted: #6c6c6c;
    --rezept-border: #e6ded6;
    --rezept-radius: 0.5rem;
    --rezept-photo-width: 320px;
    margin-bottom: 2rem;
}

/* Doubled class: the theme colours links with a selector of its own that a single class does not outweigh. */
.rezept-detail.rezept-detail a {
    color: var(--rezept-accent-text);
}

.rezept-detail a:focus-visible,
.rezept-detail button:focus-visible {
    outline: 2px solid var(--rezept-accent-text);
    outline-offset: 2px;
}

/* Head: title, meta, teaser and key data beside the first photo */
.rezept-detail__head {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .rezept-detail__head--with-image {
        grid-template-columns: minmax(0, 1fr) var(--rezept-photo-width);
        align-items: start;
    }
}

.rezept-detail__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--rezept-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.rezept-detail__title {
    font-weight: 300;
    margin: 0;
}

.rezept-detail__print {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--rezept-border);
    border-radius: 50%;
    background: #fff;
    color: var(--rezept-muted);
    cursor: pointer;
}

.rezept-detail__print:hover {
    color: var(--rezept-accent-text);
    border-color: var(--rezept-accent);
}

.rezept-detail__icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
}

.rezept-detail__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0;
    color: var(--rezept-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.rezept-detail__meta > * + * {
    border-left: 1px solid var(--rezept-border);
    margin-left: 0.6rem;
    padding-left: 0.6rem;
}

.rezept-detail__meta a {
    text-decoration: none;
}

.rezept-detail__meta a:hover {
    text-decoration: underline;
}

.rezept-detail__teaser {
    font-size: 1.15rem;
    color: #444;
    margin-bottom: 1.25rem;
}

.rezept-detail__photo {
    margin: 0;
    max-width: var(--rezept-photo-width);
}

.rezept-detail__photo img,
.rezept-detail__step-photo img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--rezept-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.rezept-detail__photo figcaption {
    color: var(--rezept-muted);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

/* Key data as chips */
.rezept-detail__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
}

.rezept-detail__fact {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.5rem;
    align-items: center;
    background: var(--rezept-sand-soft);
    border: 1px solid var(--rezept-border);
    border-radius: var(--rezept-radius);
    padding: 0.5rem 0.8rem;
}

.rezept-detail__fact .rezept-detail__icon {
    grid-row: 1 / span 3;
    align-self: center;
    color: var(--rezept-accent);
    width: 1.5rem;
    height: 1.5rem;
}

.rezept-detail__fact dt {
    grid-column: 2;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--rezept-muted);
}

.rezept-detail__fact dd {
    grid-column: 2;
    margin: 0;
    font-weight: 600;
}

.rezept-detail__fact dd.rezept-detail__oven-alternative {
    grid-column: 2;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--rezept-muted);
}

.rezept-detail__fact small {
    font-weight: 400;
    color: var(--rezept-muted);
}

/* Body: ingredients beside the preparation */
.rezept-detail__body {
    display: grid;
    gap: 2rem;
}

@media (min-width: 992px) {
    .rezept-detail__body {
        grid-template-columns: minmax(16rem, 1fr) minmax(0, 2fr);
        align-items: start;
    }

    /* Below the sticky header of the site theme, which stays at the top while scrolling. */
    .rezept-detail__ingredients {
        position: sticky;
        top: var(--rezept-sticky-offset, 6rem);
    }
}

.rezept-detail__section-title {
    font-weight: 300;
    font-size: 1.6rem;
    margin: 0 0 1rem;
}

.rezept-detail__ingredients {
    background: var(--rezept-sand-soft);
    border-top: 4px solid var(--rezept-sand);
    border-radius: var(--rezept-radius);
    padding: 1.25rem 1.25rem 1rem;
}

.rezept-detail__ingredients-for {
    color: var(--rezept-muted);
    margin: -0.5rem 0 0.75rem;
}

.rezept-detail__ingredient-list {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}

/* One grid for the whole list, so the amount column takes the width of its longest entry in every row. */
.rezept-detail__ingredient {
    display: contents;
}

.rezept-detail__ingredient > span {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--rezept-border);
}

.rezept-detail__ingredient:last-child > span {
    border-bottom: 0;
}

.rezept-detail__ingredient .rezept-detail__name {
    padding-left: 0.75rem;
}

.rezept-detail__amount {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.rezept-detail__note {
    display: block;
    color: var(--rezept-muted);
    font-size: 0.85rem;
}

.rezept-detail__ingredient-heading {
    grid-column: 1 / -1;
}

.rezept-detail__ingredient-heading,
.rezept-detail__optional-title {
    color: var(--rezept-accent-text);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.9rem 0 0.2rem;
    margin: 0;
}

.rezept-detail__ingredient-heading:first-child {
    padding-top: 0;
}

.rezept-detail__optional-title {
    border-top: 1px dashed var(--rezept-sand);
    margin-top: 0.75rem;
}

/* Preparation: numbered steps */
.rezept-detail__steps {
    list-style: none;
    counter-reset: rezept-step;
    margin: 0;
    padding: 0;
}

.rezept-detail__step {
    counter-increment: rezept-step;
    position: relative;
    padding: 0 0 1.25rem 3.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--rezept-border);
}

.rezept-detail__step:last-child {
    border-bottom: 0;
}

.rezept-detail__step::before {
    content: counter(rezept-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--rezept-accent-soft);
    border: 2px solid var(--rezept-accent);
    color: var(--rezept-accent-text);
    font-weight: 700;
}

.rezept-detail__step > :last-child {
    margin-bottom: 0;
}

.rezept-detail__step-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.35rem 0 0.5rem;
}

.rezept-detail__step--oven {
    background: var(--rezept-accent-soft);
    border-radius: var(--rezept-radius);
    border-bottom: 0;
    padding: 1rem 1rem 1rem 4.25rem;
}

.rezept-detail__step--oven::before {
    left: 1rem;
    top: 1rem;
    background: #fff;
}

.rezept-detail__oven-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-top: 0.35rem;
}

.rezept-detail__step--oven .rezept-detail__icon {
    color: var(--rezept-accent-text);
}

.rezept-detail__step--oven .rezept-detail__oven-alternative {
    margin: 0.25rem 0 0 1.75rem;
}

.rezept-detail__oven-alternative {
    color: var(--rezept-muted);
}

.rezept-detail__step-photo {
    margin: 0.75rem 0 0;
    max-width: var(--rezept-photo-width);
}

.rezept-detail__notes {
    border-left: 4px solid var(--rezept-accent);
    background: var(--rezept-sand-soft);
    border-radius: 0 var(--rezept-radius) var(--rezept-radius) 0;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.rezept-detail__notes > :last-child {
    margin-bottom: 0;
}

/* Photos: the first one large, the others as thumbnails below; each opens the lightbox of the site theme */
.rezept-detail__photos {
    max-width: var(--rezept-photo-width);
}

.rezept-detail__zoom {
    display: block;
    position: relative;
    cursor: zoom-in;
}

.rezept-detail__zoom img {
    transition: opacity 0.15s ease-in-out;
}

.rezept-detail__zoom:hover img {
    opacity: 0.9;
}

.rezept-detail__thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
}

.rezept-detail__thumbs img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: calc(var(--rezept-radius) / 2);
}

/* Related recipes and back link */
.rezept-detail__related {
    border: 1px solid var(--rezept-border);
    border-radius: var(--rezept-radius);
    padding: 1rem 1.25rem;
    margin-top: 2rem;
}

.rezept-detail__related .rezept-detail__section-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.rezept-detail__related ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    margin: 0;
    padding-left: 1.1rem;
}

.rezept-detail__back {
    margin-top: 1.5rem;
}

.rezept-detail__back a {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    border: 1px solid var(--rezept-border);
    border-radius: 2rem;
    padding: 0.35rem 1rem;
    text-decoration: none;
}

.rezept-detail__back a:hover {
    border-color: var(--rezept-accent);
}

/* Print: the recipe alone, ingredients above the steps */
@media print {
    header.navbar, .navbar, .breadcrumb-section, .breadcrumb, footer, .footer-section,
    .cookie-consent, .cc-window, .cc-revoke,
    .rezept-detail__print, .rezept-detail__related, .rezept-detail__back, .rezept-detail__thumbs {
        display: none !important;
    }

    .rezept-detail__head--with-image {
        grid-template-columns: minmax(0, 1fr) 160px;
    }

    .rezept-detail__body {
        display: block;
    }

    .rezept-detail__ingredients {
        position: static;
        margin-bottom: 1.5rem;
        break-inside: avoid;
    }

    .rezept-detail__step {
        break-inside: avoid;
    }

    .rezept-detail__photo img,
    .rezept-detail__step-photo img {
        box-shadow: none;
    }

    .rezept-detail a {
        color: inherit;
        text-decoration: none;
    }
}
