
/* ==========================================
   TERRAIFA - COFFEE RESEARCH
   ========================================== */


.section-research.coffee-research {
    position: relative;
    padding: clamp(65px, 7vw, 100px) 0
             clamp(100px, 10vw, 140px);
    background:
        radial-gradient(
            circle at 78% 20%,
            rgba(71, 191, 154, .11),
            transparent 40%
        ),
        #f4f9f7;
    color: #173047;
}


/* ==========================================
   INTRODUCTION
   ========================================== */

.coffee-research__intro {
    max-width: 1120px;
    margin: 0 auto 28px;
    text-align: center;
}

.coffee-research__intro .section-eyebrow {
    justify-content: center;
    margin-bottom: 17px;
}

.coffee-research__title {
    margin: 0 auto;
    color: #173047;
    font-size: clamp(38px, 4.5vw, 66px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.048em;
}

.coffee-research__title em {
    display: block;
    max-width: 950px;
    margin: 7px auto 0;
    background: linear-gradient(
        95deg,
        #43b982,
        #168da5
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    font-style: normal;
    font-size: .66em;
    line-height: 1.24;
    letter-spacing: -.035em;
}

.coffee-research__lead {
    max-width: 760px;
    margin: 18px auto 0;
    color: #526b78;
    font-size: 16px;
    line-height: 1.7;
}

/* ==========================================
   STATISTICS AND COFFEE SYMBOL
   ========================================== */

.coffee-dashboard {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(250px, 1.2fr)
        minmax(0, 1fr);
    grid-template-areas:
        "revenue art loss"
        "farmers art share";
    align-items: center;
    gap: 18px 26px;
    max-width: 1160px;
    margin: 0 auto;
    padding: 8px 0 25px;
}

.coffee-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 151px;
    padding: 21px 23px;
    border: 1px solid #d7e8e2;
    border-radius: 19px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 12px 28px rgba(31, 89, 76, .055);
    transition:
        transform .25s ease,
        box-shadow .25s ease;
}

.coffee-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 35px rgba(31, 89, 76, .10);
}

.coffee-stat--revenue {
    grid-area: revenue;
}

.coffee-stat--loss {
    grid-area: loss;
}

.coffee-stat--farmers {
    grid-area: farmers;
}

.coffee-stat--share {
    grid-area: share;
}


.coffee-stat__value {
    display: block;
    margin-bottom: 5px;
    color: #159b89;
    font-size: clamp(32px, 3.3vw, 49px);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.05em;
    font-variant-numeric: tabular-nums;
}

.coffee-stat--loss .coffee-stat__value {
    color: #b9683c;
}

.coffee-stat--share .coffee-stat__value {
    color: #168fa7;
}

.coffee-stat strong {
    color: #203e51;
    font-size: 13px;
    line-height: 1.45;
}

.coffee-stat__context {
    margin-top: 5px;
    color: #71868b;
    font-size: 10px;
    line-height: 1.5;
}

.coffee-stat a {
    display: inline-block;
    margin-top: 11px;
    color: #168e86;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-decoration: none;
}

.coffee-stat a:hover {
    text-decoration: underline;
}

.coffee-stat a:focus-visible {
    outline: 2px solid #168e86;
    outline-offset: 4px;
}

/* ==========================================
   ORIGINAL COFFEE LOGO
   ========================================== */

.coffee-art {
    grid-area: art;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 352px;
    isolation: isolate;
}

.coffee-art__halo {
    position: absolute;
    z-index: -1;
    top: 49%;
    left: 50%;
    width: min(340px, 100%);
    aspect-ratio: 1;
    border: 1px solid rgba(55, 176, 157, .20);
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(89, 211, 165, .12),
        transparent 70%
    );
    box-shadow: 0 0 55px rgba(61, 177, 158, .08);
    transform: translate(-50%, -50%);
}

.coffee-art__halo::before {
    content: "";
    position: absolute;
    inset: 22px;
    border: 1px dashed rgba(62, 169, 155, .20);
    border-radius: 50%;
}

.coffee-art__image {
    position: relative;
    width: min(330px, 100%);
    aspect-ratio: 1;
}

.coffee-art__full,
.coffee-art__layer {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.coffee-art__full {
    z-index: 1;
    opacity: 1;
}

.coffee-art__layer {
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

.coffee-art__caption {
    position: relative;
    z-index: 3;
    margin-top: -3px;
    color: #268e86;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .2em;
}

/* ==========================================
   COFFEE LOGO BUILD ANIMATION
   ========================================== */


/* The complete artwork remains as a fallback. */

.coffee-research.is-enhanced .coffee-art__full {
    opacity: 0;
}

/* Heart and coffee beans remain fully visible. */

.coffee-research.is-enhanced
.coffee-art__layer--base {
    opacity: 1;
}

/* Animate only the two small strokes and the leaf. */

.coffee-research.is-revealed
.coffee-art__layer--line-left {
    animation: coffee-line-left .7s
        cubic-bezier(.18, .8, .2, 1)
        .25s both;
}

.coffee-research.is-revealed
.coffee-art__layer--line-right {
    animation: coffee-line-right .7s
        cubic-bezier(.18, .8, .2, 1)
        .25s both;
}

.coffee-research.is-revealed
.coffee-art__layer--leaf {
    animation: coffee-leaf-build .95s
        cubic-bezier(.19, 1, .22, 1)
        .85s both;
}

.coffee-research.is-revealed
.coffee-art__halo {
    animation: coffee-halo-pulse 1.1s ease
        1.55s both;
}

@keyframes coffee-line-left {
    from {
        opacity: 0;
        transform: translate(-14px, -9px);
    }

    to {
        opacity: 1;
        transform: translate(0, 0);
    }
}

@keyframes coffee-line-right {
    from {
        opacity: 0;
        transform: translate(14px, -9px);
    }

    to {
        opacity: 1;
        transform: translate(0, 0);
    }
}

@keyframes coffee-leaf-build {
    from {
        opacity: 0;
        clip-path: inset(100% 0 0 0);
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
        transform: translateY(0);
    }
}


@keyframes coffee-halo-pulse {
    0% {
        opacity: .5;
        transform: translate(-50%, -50%) scale(.93);
    }
    55% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.06);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ==========================================
   POST-HARVEST CHALLENGES
   ========================================== */


.coffee-challenges {
    display: grid;
    grid-template-columns:
        minmax(0, .85fr)
        minmax(0, 1.65fr);
    gap: clamp(22px, 4vw, 55px);
    align-items: center;
    margin-top: 22px;
    padding: 32px 0;
    border-top: 1px solid #d5e7e0;
    border-bottom: 1px solid #d5e7e0;
}

.coffee-challenges__eyebrow {
    color: #178f86;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.coffee-challenges__heading h3 {
    margin: 12px 0 0;
    color: #1c3548;
    font-size: clamp(25px, 2.4vw, 34px);
    line-height: 1.25;
    letter-spacing: -.03em;
}


.coffee-challenges__heading h3 em {
    color: #189e8e;
    font-style: normal;
}

.coffee-challenges__items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
}


.coffee-challenge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 8px 17px;
}

.coffee-challenge + .coffee-challenge {
    border-left: 1px solid #d7e8e2;
}

.coffee-challenge__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: #e0f3ea;
    color: #159e8a;
    font-size: 27px;
}

.coffee-challenge strong {
    color: #244255;
    font-size: 15px;
    line-height: 1.45;
}

.coffee-challenge p {
    margin: 7px 0 0;
    color: #637e85;
    font-size: 13px;
    line-height: 1.65;
}



/* ==========================================
   ORGANIC TRANSITION TO OUR APPROACH
   ========================================== */

.coffee-research__wave {
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: -1px;
    left: 0;
    height: clamp(75px, 8vw, 115px);
    pointer-events: none;
}

.coffee-research__wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

.coffee-research__source-note {
    margin: 14px 0 0;
    color: #74868b;
    font-size: 10px;
    line-height: 1.7;
    text-align: center;
}

.coffee-research__source-note a {
    color: #247d81;
    text-underline-offset: 2px;
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */

@media (max-width: 950px) {

    .coffee-dashboard {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(220px, 1fr)
            minmax(0, 1fr);
        gap: 12px;
    }

    .coffee-stat {
        min-height: 145px;
        padding: 15px;
    }

    .coffee-stat__value {
        font-size: 32px;
    }

    .coffee-art__image {
        width: min(270px, 100%);
    }

    .coffee-art {
        min-height: 300px;
    }

    .coffee-challenges {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */

@media (max-width: 700px) {

    .section-research.coffee-research {
        padding: 65px 0 105px;
    }

    .coffee-research__title {
        font-size: clamp(34px, 8vw, 49px);
    }

    .coffee-research__title em {
        font-size: .76em;
    }

    .coffee-research__lead {
        font-size: 14px;
    }

    .coffee-dashboard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "art art"
            "revenue loss"
            "farmers share";
        gap: 12px;
        padding-bottom: 15px;
    }

    .coffee-art {
        min-height: 285px;
    }

    .coffee-art__image {
        width: min(280px, 78vw);
    }

    .coffee-stat {
        min-height: 143px;
        padding: 15px;
    }

    .coffee-stat__value {
        font-size: clamp(27px, 7vw, 38px);
    }

    .coffee-stat strong {
        font-size: 12px;
    }

    .coffee-stat__context {
        font-size: 9px;
    }

    .coffee-challenges {
        margin-top: 22px;
    }

    .coffee-challenges__items {
        grid-template-columns: 1fr;
    }

    .coffee-challenge {
        flex-direction: row;
        padding: 12px 0;
    }

    .coffee-challenge + .coffee-challenge {
        border-left: 0;
        border-top: 1px solid #d7e8e2;
    }

}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {

    .coffee-research.is-enhanced
    .coffee-art__full {
        opacity: 1;
    }

    .coffee-art__layer {
        display: none;
    }

    .coffee-research.is-revealed
    .coffee-art__halo {
        animation: none;
    }

    .coffee-stat {
        transition: none;
    }

    .coffee-stat:hover {
        transform: none;
    }
}
