.farm-page {
    max-width: var(--content-max);
    padding-bottom: 2.5rem;
}

.farm-hero {
    width: 100%;
    min-height: clamp(17rem, 42vw, 26rem);
    border-radius: 1.25rem;
    background-size: cover;
    background-position: center;
    background-color: #5b402f;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.farm-hero__content {
    width: 100%;
    padding: clamp(1.25rem, 3.8vw, 2.5rem);
    color: #fffaf3;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.farm-hero__logo {
    width: clamp(3.2rem, 8vw, 4.8rem);
    height: clamp(3.2rem, 8vw, 4.8rem);
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.14);
}

.farm-hero__title {
    margin: 0;
    font-size: clamp(1.9rem, 5.8vw, 3.25rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
}

.farm-hero__subtitle {
    margin: 0;
    font-size: clamp(0.95rem, 2.2vw, 1.2rem);
    color: rgba(255, 250, 243, 0.92);
}

.farm-detail {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.farm-detail__sidebar {
    order: -1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.farm-detail__main {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.farm-detail__section {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-2);
    padding: 1.1rem 1.15rem;
}

.farm-detail__section h2,
.farm-profile h2,
.farm-contact-card h2 {
    margin: 0 0 0.55rem;
    font-size: 1.08rem;
    letter-spacing: 0;
}

.farm-detail__section p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.farm-detail__about-kpis {
    display: none;
}

@media (min-width: 980px) {
    .farm-detail__about-kpis {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.65rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px dashed rgba(65, 44, 29, 0.12);
    }
}

.farm-detail__about-kpi {
    border: 0;
    border-radius: var(--radius);
    background: var(--bg2);
    padding: 0.85rem 0.55rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    min-width: 0;
}

.farm-detail__about-kpi-icon {
    font-size: 1.4rem;
    color: var(--cta);
    line-height: 1;
}

.farm-detail__about-kpi-value {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    max-width: 100%;
    min-width: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--cta);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.farm-detail__about-kpi-num {
    font-variant-numeric: tabular-nums;
}

.farm-detail__about-kpi-unit {
    font-size: 0.52em;
    font-weight: 700;
    margin-left: 0.04em;
    letter-spacing: 0;
    vertical-align: 0.08em;
}

.farm-detail__about-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.25;
    max-width: 100%;
}

.farm-detail__about-links {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(65, 44, 29, 0.12);
}

.farm-detail__about-links-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem 0.65rem;
    max-width: 100%;
}

.farm-detail__about-links-item {
    margin: 0;
}

.farm-detail__about-link,
.farm-contact-card__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.35rem;
    padding: 0.4rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(111, 78, 55, 0.42);
    background: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cta);
    text-decoration: none;
    line-height: 1.2;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.farm-detail__about-link:hover,
.farm-contact-card__link:hover {
    background: rgba(111, 78, 55, 0.08);
    border-color: rgba(111, 78, 55, 0.58);
    color: var(--cta);
}

.farm-detail__about-link:focus-visible,
.farm-contact-card__link:focus-visible {
    outline: 2px solid rgba(111, 78, 55, 0.45);
    outline-offset: 2px;
}

.farm-detail__about-link .ph,
.farm-contact-card__link .ph {
    font-size: 1.02rem;
    line-height: 1;
    flex-shrink: 0;
}

.farm-detail__richtext {
    color: var(--muted);
    line-height: 1.6;
}

.farm-detail__richtext p,
.farm-detail__richtext ul,
.farm-detail__richtext ol,
.farm-detail__richtext blockquote,
.farm-detail__richtext h3,
.farm-detail__richtext h4 {
    margin: 0 0 0.75rem;
}

.farm-detail__richtext > :last-child {
    margin-bottom: 0;
}

.farm-detail__richtext ul,
.farm-detail__richtext ol {
    padding-left: 1.2rem;
}

.farm-detail__richtext a {
    color: var(--cta);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.farm-detail__section .btn {
    margin-top: 0.85rem;
}

.farm-detail__section--coffee .farm-detail__coffee-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px dashed rgba(65, 44, 29, 0.12);
}

.farm-detail__section--export-logistics .farm-detail__coffee-block--production-checks {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
}

.farm-detail__production-checkgrid.farm-detail__production-checkgrid--export-logistics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.farm-detail__coffee-subh {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0;
}

.farm-detail__coffee-block--production-checks {
    margin-top: 0.15rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-top: 1px dashed rgba(65, 44, 29, 0.12);
    border-bottom: 1px dashed rgba(65, 44, 29, 0.12);
}

.farm-detail__production-checkgrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 1.15rem;
    align-items: start;
}

@media (max-width: 920px) {
    .farm-detail__production-checkgrid {
        grid-template-columns: 1fr;
    }
}

.farm-detail__production-checkcol .farm-detail__coffee-subh {
    margin-bottom: 0.45rem;
}

.farm-detail__production-optionlist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.farm-detail__production-option-label {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    cursor: default;
    font-size: 0.8rem;
    line-height: 1.38;
    color: var(--text);
}

.farm-detail__production-option--off .farm-detail__production-option-label {
    color: var(--muted);
}

/*
 * Nur-Anzeige-Checkboxen: kein disabled (sonst grau statt accent-color).
 * Wie App-Filter (.check input): brauner Akzent via accent-color: var(--cta).
 */
.farm-detail__coffee-block--production-checks .farm-detail__production-option-label,
.farm-detail__coffee-block--production-checks .farm-detail__production-option-input {
    pointer-events: none;
}

.farm-detail__production-option-input {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin: 0.12rem 0 0;
    accent-color: var(--cta);
    cursor: default;
}

.farm-detail__coffee-body {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.farm-detail__harvest-months {
    display: flex;
    width: 100%;
    margin-top: 0.5rem;
    min-height: clamp(1.45rem, 3.2vw, 1.75rem);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.farm-detail__harvest-month {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.12rem 0.04rem;
    border: 0;
    border-radius: 0;
    text-align: center;
}

.farm-detail__harvest-month--active {
    background: var(--bg2);
    border-bottom: 2px solid var(--cta);
}

.farm-detail__harvest-month--active .farm-detail__harvest-month-abbr {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cta);
    line-height: 1.3;
    letter-spacing: 0;
}

.farm-detail__harvest-month--inactive {
    background: transparent;
    opacity: 0.25;
}

.farm-detail__harvest-month--inactive .farm-detail__harvest-month-abbr {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.3;
}

.farm-detail__harvest-month-abbr {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Mobil: 4×3-Raster statt einer Zeile mit 12 Zellen */
@media (max-width: 900px) {
    .farm-detail__harvest-months {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.22rem;
        min-height: 0;
        padding: 0.35rem;
        overflow: visible;
    }

    .farm-detail__harvest-month {
        flex: none;
        min-width: 0;
        min-height: 2.35rem;
        padding: 0.2rem 0.12rem;
        border-radius: 0.3rem;
    }

    .farm-detail__harvest-month--active {
        border-bottom: 0;
        box-shadow: inset 0 -2px 0 0 var(--cta);
    }
}

.farm-gallery {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-2);
    padding: 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.farm-gallery__head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
}

.farm-gallery__head h2 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: 0;
}

.farm-gallery__body {
    position: relative;
}

.farm-gallery__clip {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.68s ease;
}

.farm-gallery--expanded .farm-gallery__clip,
.farm-gallery--no-expand .farm-gallery__clip {
    max-height: none;
    overflow: visible;
    transition: none;
}

.farm-gallery__reveal {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 8.75rem;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0.85rem 0.7rem;
    pointer-events: none;
    box-sizing: border-box;
}

.farm-gallery__reveal:not([hidden]) {
    display: flex;
}

.farm-gallery--no-expand .farm-gallery__reveal {
    display: none !important;
}

.farm-gallery__reveal-fade {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 253, 249, 0) 0%,
        rgba(255, 253, 249, 0.38) 38%,
        rgba(255, 253, 249, 0.82) 78%,
        rgba(255, 253, 249, 0.97) 100%
    );
    pointer-events: none;
}

.farm-gallery__reveal-btn {
    pointer-events: auto;
    position: relative;
    z-index: 1;
    margin: 0;
    border: 1px solid rgba(111, 78, 55, 0.3);
    border-radius: 999px;
    padding: 0.55rem 1.2rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    color: #fff;
    background: var(--cta);
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(61, 40, 24, 0.16);
}

.farm-gallery__reveal-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.28), 0 6px 22px rgba(61, 40, 24, 0.16);
}

.farm-gallery__reveal-btn:hover {
    filter: brightness(1.06);
}

@media (prefers-reduced-motion: reduce) {
    .farm-gallery__clip {
        transition: none;
    }
}

.farm-gallery__masonry {
    columns: 3;
    column-gap: 0.7rem;
}

.farm-gallery__item {
    display: block;
    break-inside: avoid;
    margin-bottom: 0.7rem;
    border-radius: 0.9rem;
    overflow: hidden;
    background: rgba(65, 44, 29, 0.05);
    border: 1px solid rgba(65, 44, 29, 0.1);
    text-decoration: none;
    aspect-ratio: var(--tile-ratio, 4 / 3);
}

.farm-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.farm-gallery__item:hover img {
    transform: scale(1.02);
}

.farm-profile {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-2);
    padding: 1.1rem 1.15rem;
}

.farm-contact-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-2);
    padding: 1.1rem 1.15rem;
}

.farm-contact-card__person {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.farm-contact-card__photo {
    width: 4.4rem;
    height: 4.4rem;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid rgba(65, 44, 29, 0.16);
    background: var(--bg2);
    flex-shrink: 0;
}

.farm-contact-card__photo--initials {
    display: grid;
    place-items: center;
    color: var(--cta);
    font-weight: 800;
    letter-spacing: 0.04em;
}

.farm-contact-card__identity {
    min-width: 0;
}

.farm-contact-card__name {
    margin: 0;
    color: var(--text);
    font-weight: 800;
    line-height: 1.2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.farm-contact-card__role,
.farm-contact-card__note {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.farm-contact-card__languages {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem;
}

.farm-contact-card__language {
    display: inline-block;
    font-size: 2rem;
    line-height: 1;
    vertical-align: middle;
}

.farm-contact-card__note {
    margin-top: 0.75rem;
}

.farm-contact-card__actions {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.9rem;
}

@media (max-width: 460px) {
    .farm-gallery__masonry {
        columns: 1;
    }
}

.farm-profile__list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.farm-profile__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem 0.75rem;
    align-items: baseline;
    border-top: 1px dashed rgba(65, 44, 29, 0.12);
    padding-top: 0.55rem;
}

.farm-profile__item:not(.farm-profile__item--address):not(.farm-profile__item--features-wide) > dt {
    min-width: 0;
}

.farm-profile__item:not(.farm-profile__item--address):not(.farm-profile__item--features-wide) > dd {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
}

.farm-profile__item--address {
    grid-template-columns: max-content minmax(0, 1fr);
}

.farm-profile__item--address > dd {
    justify-self: stretch;
    text-align: right;
}

.farm-profile__item--features-wide {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
}

.farm-profile__item--features-wide > dd {
    grid-column: 1 / -1;
    justify-self: stretch;
    text-align: start;
    white-space: normal;
}

.farm-profile__visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.farm-profile__features-dd {
    margin: 0;
}

.farm-profile__features-dd .farm-profile__badges {
    margin: 0;
}

.farm-profile__item > .farm-profile__map,
.farm-profile__item > .farm-profile__map-placeholder,
.farm-profile__item--location .farm-profile__map,
.farm-profile__item--location .farm-profile__map-placeholder {
    grid-column: 1 / -1;
}

.farm-profile__item dt {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    display: inline-flex;
    align-items: flex-start;
    gap: 0.35rem;
}

.farm-profile__item dt .ph {
    font-size: 0.95rem;
    color: var(--cta);
    flex-shrink: 0;
}

.farm-profile__info {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.farm-profile__info-btn {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--cta);
    cursor: help;
}

.farm-profile__info-btn:focus-visible {
    outline: 2px solid rgba(111, 78, 55, 0.32);
    outline-offset: 2px;
}

/* Farm-Profil-Tooltip: siehe beanivo-design.css (.farm-profile__info-tooltip) */

.farm-profile__item dd {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
}

.farm-profile__address {
    display: block;
    text-align: right;
    text-wrap: pretty;
}

.farm-profile__address-street {
    display: inline;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.farm-profile__address-sep {
    white-space: nowrap;
}

.farm-profile__address-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 0.125rem;
    vertical-align: baseline;
}

.farm-profile__address-flag {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.farm-profile__address-region-country {
    min-width: 0;
}

.farm-profile__item dd > span:not(.farm-profile__badges) {
    display: block;
}

.farm-profile__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
}

.farm-profile__badges--inline {
    display: inline-flex;
    vertical-align: middle;
}

.farm-profile__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    padding: 0.18rem 0.55rem;
    border-radius: var(--radius-sm);
    background: var(--bg2);
    border: 0;
    color: var(--cta);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.farm-profile__badge .ph {
    font-size: 0.82rem;
    line-height: 1;
}

.farm-profile__map,
.farm-profile__map-placeholder {
    width: 100%;
    min-height: 11.5rem;
    border-radius: 0.8rem;
    overflow: hidden;
}

.farm-profile__map {
    border: 1px solid rgba(65, 44, 29, 0.18);
    background: rgba(65, 44, 29, 0.05);
}

.farm-profile__map .maplibregl-control-container {
    font-family: inherit;
}

.farm-profile__map-marker {
    position: relative;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    background: var(--cta);
    border: 2px solid #fffaf3;
    box-shadow: 0 0.3rem 0.8rem rgba(65, 44, 29, 0.28);
}

.farm-profile__map-marker::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.42rem;
    width: 0;
    height: 0;
    border-left: 0.28rem solid transparent;
    border-right: 0.28rem solid transparent;
    border-top: 0.48rem solid var(--cta);
    transform: translateX(-50%);
}

.farm-profile__map-placeholder {
    border: 1px dashed rgba(65, 44, 29, 0.25);
    background:
        radial-gradient(circle at 32% 42%, rgba(111, 78, 55, 0.14) 0 10%, transparent 11%),
        radial-gradient(circle at 66% 58%, rgba(111, 78, 55, 0.11) 0 9%, transparent 10%),
        linear-gradient(160deg, rgba(111, 78, 55, 0.06), rgba(75, 47, 35, 0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cta);
}

.farm-profile__map-placeholder .ph {
    font-size: 1.35rem;
}

@media (max-width: 760px) {
    .farm-gallery__masonry {
        columns: 2;
    }

    /* Adresse/Karte: weiter untereinander. KPI-Zeilen: eine Zeile wo möglich (Label | Wert) */
    .farm-profile__item--address,
    .farm-profile__item--features-wide {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .farm-profile__item:not(.farm-profile__item--address):not(.farm-profile__item--features-wide) {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.35rem 0.65rem;
        align-items: start;
    }
}

/* Schmal: Kurzsteckbrief direkt unter dem Hero, dann Hauptinhalt, Ansprechpartner ganz unten */
@media (max-width: 979px) {
    .farm-detail {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .farm-detail__sidebar {
        display: contents;
    }

    .farm-profile {
        order: -1;
    }

    .farm-detail__main {
        order: 0;
    }

    .farm-contact-card {
        order: 1;
    }
}

@media (min-width: 980px) {
    .farm-profile,
    .farm-contact-card,
    .farm-detail__main {
        order: unset;
    }

    .farm-detail {
        grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
        gap: 1.15rem;
    }

    .farm-detail__sidebar {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        order: 0;
        position: sticky;
        top: clamp(0.75rem, 2vw, 1.25rem);
        align-self: start;
        width: 100%;
        min-width: 0;
        max-height: calc(100vh - clamp(1.5rem, 4vw, 2.5rem));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}
