/* Companion Plant Guide
 *
 * Every value here is lifted from the design's inline styles. Fonts are the
 * self-hosted subsets extracted from the design bundle; Manrope ships as a
 * variable face, so one file per subset covers weights 300-700.
 */

/* ---------------------------------------------------------------- Fonts */

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Forum';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/forum-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/manrope-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/manrope-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/manrope-greek.woff2') format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/manrope-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/manrope-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('fonts/manrope-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* ----------------------------------------------------------------- Base */

/* No global border-box reset: the design set box-sizing only on the shell, the
 * stage and the pairings panel, and relies on content-box elsewhere. The search
 * pill in particular renders 632px wide (600px max-width + padding + border),
 * so a blanket reset would visibly narrow it. */

html,
body {
    margin: 0;
    min-height: 100%;
    background: #16241F;
    font-family: 'Manrope', system-ui, sans-serif;
}

a {
    color: #B9CCB4;
    text-decoration: none;
}

a:hover {
    color: #F2EDDF;
}

input {
    font-family: 'Manrope', sans-serif;
}

input:focus {
    outline: none;
}

::placeholder {
    color: #8FA394;
    opacity: 1;
}

/* ---------------------------------------------------------------- Shell */

#cpg-shell {
    min-height: 100vh;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(380px, 34vw, 520px);
    background: #16241F;
}

.cpg-stage {
    box-sizing: border-box;
    padding: 32px clamp(24px, 4vw, 52px) 36px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* --------------------------------------------------------------- Topbar */

.cpg-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    color: #B9CCB4;
    font-size: 12.5px;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.cpg-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Forum', serif;
    font-size: clamp(26px, 2.4vw, 34px);
    letter-spacing: .08em;
    color: #F2EDDF;
    text-transform: none;
}

.cpg-brand:hover {
    color: #F2EDDF;
}

#cpg-nav {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------- Copy */

.cpg-copy {
    padding-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.cpg-intro {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cpg-eyebrow {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #9DB398;
    font-size: 11.5px;
    letter-spacing: .3em;
    text-transform: uppercase;
}

.cpg-eyebrow-rule {
    width: 44px;
    height: 1px;
    background: #4A5C52;
}

.cpg-headline {
    margin: 0;
    font-family: 'Forum', serif;
    font-size: clamp(28px, 3.2vw, 48px);
    line-height: 1.1;
    color: #F2EDDF;
    font-weight: 400;
    letter-spacing: -.01em;
    white-space: nowrap;
}

.cpg-lede {
    margin: 0;
    color: #B9CCB4;
    font-size: clamp(13px, 1.15vw, 15px);
    line-height: 1.45;
    font-weight: 300;
    white-space: nowrap;
}

/* --------------------------------------------------------------- Search */

.cpg-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 16px;
    border: 1px solid #4A5C52;
    border-radius: 999px;
    max-width: 380px;
    background: #1B2E27;
}

/* The design removes the input outline; keyboard users get the pill instead. */
.cpg-search:focus-within {
    border-color: #8FA394;
}

.cpg-search-icon {
    color: #8FA394;
    font-size: 15px;
}

#cpg-query {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: #F2EDDF;
    font-size: 14px;
    padding: 8px 0;
}

.cpg-search-button {
    border: none;
    cursor: pointer;
    background: #F2EDDF;
    color: #16241F;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 9px 16px;
    border-radius: 999px;
    white-space: nowrap;
}

.cpg-search-button:hover {
    background: #FFFFFF;
}

.cpg-search-button:focus-visible {
    outline: 2px solid #B9CCB4;
    outline-offset: 3px;
}

/* ---------------------------------------------------------------- Tiles */

/* 40% of leftover column height sits empty; the picker takes the other 60%. */
.cpg-hero-gap {
    min-height: 0;
}

.cpg-picker {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.cpg-picker-stage {
    position: relative;
    display: flex;
    min-height: 0;
    flex: 1;
}

/* Six tiles as three straight columns by two rows. They fill the remaining
 * 60% of the hero so leftover viewport space sits in .cpg-hero-gap instead. */
.cpg-tiles {
    display: grid;
    grid-template-rows: 1fr 1fr;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 40px) / 3);
    gap: 16px 20px;
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 8px 6px 4px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.cpg-tiles::-webkit-scrollbar {
    display: none;
}

/* Sit on the photo stack only: tiles padding on top, crop names on the bottom. */
.cpg-arrow {
    position: absolute;
    top: 8px;
    bottom: 30px;
    z-index: 6;
    width: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    border-radius: 0;
    background: rgba(242, 237, 223, 0.3);
    color: #16241F;
}

.cpg-arrow-prev {
    left: 0;
}

.cpg-arrow-next {
    right: 0;
}

.cpg-arrow svg {
    width: 20px;
    height: 20px;
}

.cpg-arrow:hover:not(:disabled) {
    background: rgba(242, 237, 223, 0.45);
    color: #16241F;
}

.cpg-arrow:focus-visible {
    outline: 2px solid #B9CCB4;
    outline-offset: -2px;
}

.cpg-arrow:disabled {
    cursor: default;
    opacity: .35;
}

.cpg-tile {
    position: relative;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    height: 100%;
    scroll-snap-align: start;
    cursor: pointer;
    padding: 0;
    background: transparent;
    border: none;
    overflow: visible;
    text-align: left;
    display: flex;
    flex-direction: column;
    font: inherit;
    z-index: 1;
}

.cpg-tile:focus-visible {
    outline: none;
}

.cpg-tile-image {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: clamp(140px, 18vh, 200px);
    overflow: hidden;
    background: #1B2E27;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.cpg-tile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Thin cream frame drawn inside the photo on hover / keyboard focus. */
.cpg-tile-image::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid #F2EDDF;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.cpg-tile:hover .cpg-tile-image::after,
.cpg-tile:focus-visible .cpg-tile-image::after {
    opacity: 1;
}

.cpg-tile-name {
    position: relative;
    z-index: 1;
    padding: 8px 4px 2px;
    font-family: 'Forum', serif;
    font-size: 16px;
    color: #C9D8C2;
}

.cpg-tile.is-selected .cpg-tile-name,
.cpg-tile:hover .cpg-tile-name,
.cpg-tile:focus-visible .cpg-tile-name {
    color: #F2EDDF;
}

@media (prefers-reduced-motion: reduce) {
    .cpg-tile-image::after {
        transition: none;
    }
}

/* ------------------------------------------------------- Pairings panel */

.cpg-panel {
    background: #F2EDDF;
    box-sizing: border-box;
    padding: 36px clamp(24px, 3vw, 44px);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.cpg-kicker {
    color: #6B7A66;
    font-size: 11.5px;
    letter-spacing: .24em;
    text-transform: uppercase;
}

.cpg-kicker-good {
    color: #2C5A3B;
    letter-spacing: .2em;
}

.cpg-kicker-bad {
    color: #A8552C;
    letter-spacing: .2em;
}

.cpg-crop-name {
    margin: 8px 0 0;
    font-family: 'Forum', serif;
    font-size: clamp(36px, 3.2vw, 44px);
    line-height: 1.05;
    color: #16241F;
    font-weight: 400;
}

.cpg-crop-latin {
    font-style: italic;
    color: #7A8874;
    font-size: 15px;
    margin-top: 2px;
}

.cpg-meta {
    display: flex;
    gap: 24px;
    padding: 14px 0;
    border-top: 1px solid #CFC7AF;
    border-bottom: 1px solid #CFC7AF;
    color: #4A5C52;
    font-size: 13px;
}

.cpg-meta-label {
    color: #8A9583;
    font-size: 10.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.cpg-meta-value {
    margin-top: 4px;
}

.cpg-pairs {
    margin-top: 10px;
}

.cpg-pair {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dashed #D5CDB5;
}

.cpg-pair-name {
    font-family: 'Forum', serif;
    font-size: 23px;
    color: #16241F;
}

.cpg-pairs-bad .cpg-pair-name {
    color: #8F4726;
}

.cpg-pair-why {
    color: #6E7C69;
    font-size: 13px;
    font-weight: 300;
    text-align: right;
}

/* Crops with no recorded antagonists would otherwise leave an empty heading. */
.cpg-hidden {
    display: none;
}

/* ----------------------------------------------------------- Responsive */

@media (min-width: 901px) {
    html,
    body {
        height: 100%;
        overflow: hidden;
    }

    #cpg-shell {
        height: 100vh;
        overflow: hidden;
    }

    .cpg-stage {
        height: 100vh;
        overflow: hidden;
        min-height: 0;
        display: grid;
        grid-template-rows: auto auto minmax(0, 2fr) minmax(0, 8fr);
        gap: 0;
    }

    .cpg-hero-gap {
        min-height: 0;
    }

    .cpg-picker {
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .cpg-picker-stage {
        flex: 1 1 0%;
        min-height: 0;
        height: 100%;
    }

    .cpg-tiles {
        min-height: 0;
        height: 100%;
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }

    .cpg-panel {
        height: 100vh;
        overflow: auto;
    }
}

@media (max-width: 900px) {
    #cpg-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    #cpg-nav {
        display: none;
    }

    .cpg-copy {
        gap: 16px;
        padding-top: 28px;
    }

    .cpg-headline,
    .cpg-lede {
        white-space: normal;
    }

    .cpg-hero-gap {
        display: none;
    }

    .cpg-picker {
        flex: none;
    }

    .cpg-tiles {
        grid-template-rows: auto auto;
        padding: 8px 0;
        flex: none;
    }

    .cpg-tile-image {
        flex: none;
        height: 120px;
        min-height: 0;
    }
}
