/* =========================================================
   CIBERRA HOMEPAGE
   Styles used only by index.html
   ========================================================= */


/* =========================================================
   1. HERO AND CIBERRA SYSTEM VIEW
   ========================================================= */

.hero-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 0.82fr) minmax(0, 1.18fr);

    gap: clamp(1.5rem, 2.5vw, 2.5rem);
    align-items: center;
}

.hero-grid>* {
    min-width: 0;
}

.platform-card {
    width: 100%;
    min-width: 0;
}


/* =========================================================
   2. CIBERRA INTELLIGENCE PREVIEW
   ========================================================= */

.intelligence-preview {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.intelligence-preview .dashboard-top {
    margin-bottom: 0;
}

.intelligence-preview .intelligence-claim {
    max-width: 15ch;
    margin: 0.15rem 0 0;

    color: #17211f;

    font-size: clamp(1.65rem, 2.35vw, 2.35rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.045em;
}

.intelligence-preview .intelligence-claim span {
    color: #66716b;
    font-weight: 600;
}


/* Intelligence lens cards */

.lens-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.lens-card {
    --lens-accent: #3c6557;

    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 175px;
    padding: 1.25rem 1.15rem 1.1rem;

    overflow: hidden;

    border: 1px solid rgba(31, 47, 43, 0.14);
    border-radius: 1.25rem;

    background: rgba(255, 255, 255, 0.82);
}

.lens-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;

    height: 0.36rem;

    background: var(--lens-accent);

    content: "";
}

.lens-number {
    color: var(--lens-accent);

    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.lens-card h3 {
    margin: 1rem 0 0;

    color: #17211f;

    font-size: 1.05rem;
    line-height: 1.1;
}

.intelligence-preview .lens-card p {
    margin: auto 0 0;

    color: #59645f;

    font-size: 0.82rem;
    font-style: normal;
    font-weight: 600;
    line-height: 1.38;
}


/* Intelligence card colors */

.lens-regulation {
    --lens-accent: #3d6758;
}

.lens-markets {
    --lens-accent: #995f46;
}

.lens-true-cost {
    --lens-accent: #a08838;
}


/* =========================================================
   3. DASHBOARD SIGNAL CARDS
   ========================================================= */

.signal-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem;

    width: 100%;
}

.signal-card {
    min-width: 0;
    padding: 0.95rem 0.55rem;

    border: 1px solid var(--line);
    border-radius: var(--radius-md);

    background: rgba(255, 255, 255, 0.72);
}

.signal-card small {
    display: block;

    font-size: clamp(0.52rem, 0.65vw, 0.64rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-transform: uppercase;

    white-space: nowrap;
}

.signal-card strong {
    display: block;

    margin: 0.55rem 0 0.35rem;

    font-size: clamp(1.4rem, 2vw, 2rem);
    line-height: 1;
}

.signal-card em {
    display: block;

    min-height: 2.6em;

    color: var(--ink-soft);

    font-size: clamp(0.58rem, 0.65vw, 0.68rem);
    font-style: normal;
    line-height: 1.3;
}


/* =========================================================
   4. DASHBOARD FOOD-SYSTEM BUTTONS
   ========================================================= */

.flow-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem;

    width: 100%;
}

.flow-step {
    min-width: 0;
    padding: 0.75rem 0.25rem;

    text-align: center;
    font-size: clamp(0.58rem, 0.7vw, 0.7rem);
    line-height: 1.2;

    white-space: nowrap;
}

.flow-step span {
    display: block;

    margin-bottom: 0.3rem;

    font-size: 0.58rem;
}

.flow-step.packaging {
    background: #75624e;
    color: white;
}


/* =========================================================
   5. RESEARCH AND SERVICES MODULES
   ========================================================= */

.modules {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;

    width: 100%;
    margin-top: clamp(2rem, 3vw, 3rem);
}

.module {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    min-width: 0;
    min-height: 270px;
    padding: 1.3rem 1rem;

    border: 1px solid var(--line);
    border-radius: var(--radius-lg);

    background: rgba(255, 255, 255, 0.64);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.module:hover {
    transform: translateY(-6px);
    border-color: rgba(31, 87, 71, 0.28);
    box-shadow: var(--shadow);
}

.module-number {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;
    margin-bottom: 20px;

    border-radius: 50%;

    background: var(--surface-muted);
    color: var(--primary-dark);

    font-weight: 800;
}

.module h3 {
    margin: 0 0 12px;

    font-size: 1.05rem;
    line-height: 1.25;
    letter-spacing: -0.04em;
}

.module p {
    margin: 0;

    color: var(--ink-soft);

    font-size: 0.86rem;
    line-height: 1.55;
}

.module-line {
    width: 100%;
    height: 4px;
    margin-top: 28px;

    border-radius: 999px;

    background: var(--primary);
}


/* =========================================================
   6. FLEXIBLE BY DESIGN CLOSING SECTION
   ========================================================= */

.services-closing {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;

    gap: clamp(1.5rem, 4vw, 4rem);

    width: 100%;

    /*
       Creates comfortable space between the six cards
       and the Flexible by Design section.
    */
    margin-top: clamp(4rem, 6vw, 5.5rem);
    margin-inline: auto;

    /*
       Creates space between the divider and the text.
    */
    padding-top: clamp(2rem, 3vw, 3rem);

    border-top: 1px solid var(--line);
}

.services-closing-copy {
    width: 100%;
    max-width: 780px;
}

.services-closing .section-kicker {
    display: block;
}

.services-closing h3 {
    margin: 0.55rem 0 0.75rem;

    color: var(--ink);

    font-size: clamp(1.55rem, 2.4vw, 2.25rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.services-closing p {
    max-width: 760px;
    margin: 0;

    color: var(--ink-soft);

    font-size: 0.95rem;
    line-height: 1.65;
}


/* Closing section button */

.services-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;
    padding: 0.8rem 1.4rem;

    border: 1px solid transparent;
    border-radius: 999px;

    background: var(--primary-dark);
    color: white;

    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;

    white-space: nowrap;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.services-button:hover {
    transform: translateY(-2px);

    background: var(--primary);
    color: white;

    box-shadow: var(--shadow);
}

.services-button:focus-visible {
    outline: 3px solid rgba(31, 87, 71, 0.28);
    outline-offset: 4px;
}


/* Keeps anchor links below the fixed navigation */

#system,
#intelligence,
#data,
#contact {
    scroll-margin-top: 7rem;
}


/* =========================================================
   7. GENERAL OVERFLOW PROTECTION
   ========================================================= */

.hero-grid>*,
.modules>*,
.signal-grid>*,
.signals-grid>*,
.flow-strip>*,
.lens-grid>* {
    min-width: 0;
}

img,
svg,
canvas,
video {
    max-width: 100%;
    height: auto;
}


/* =========================================================
   8. LARGE TABLETS AND SMALL DESKTOPS
   ========================================================= */

@media (max-width: 1200px) {

    .modules {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* =========================================================
   9. TABLETS
   ========================================================= */

@media (max-width: 1024px) {

    .hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 48px;
    }

    .modules {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-preview,
    .dashboard-preview,
    .system-view,
    .platform-card {
        width: 100%;
        max-width: 720px;
        margin-inline: auto;
    }
}


/* =========================================================
   10. SMALL TABLETS
   ========================================================= */

@media (max-width: 800px) {

    .modules {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   11. MOBILE
   ========================================================= */

@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden;
    }

    .container {
        width: min(100% - 32px, var(--container));
    }

    section {
        padding-block: 64px;
    }


    /* Hero */

    .hero-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
    }

    .hero-copy,
    .hero-content,
    .hero-preview {
        width: 100%;
        max-width: none;
    }

    .hero h1 {
        max-width: 100%;

        font-size: clamp(3rem, 15vw, 5rem);
        line-height: 0.9;

        overflow-wrap: normal;
        word-break: normal;
    }

    .hero p,
    .hero-copy p,
    .hero-description {
        max-width: 100%;

        font-size: 1.1rem;
        line-height: 1.65;

        overflow-wrap: normal;
        word-break: normal;
    }

    .hero-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .hero-actions a,
    .hero-actions .button,
    .hero-actions .btn {
        width: 100%;

        justify-content: center;

        text-align: center;
    }


    /* Intelligence preview */

    .intelligence-preview .intelligence-claim {
        max-width: 18ch;
    }

    .lens-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .lens-card {
        min-height: 140px;
    }


    /* Dashboard preview */

    .dashboard-preview,
    .system-view,
    .hero-preview,
    .platform-card {
        width: 100%;
        max-width: 100%;
        padding: 24px;

        overflow: hidden;
    }


    /* Dashboard signals */

    .signal-grid,
    .signals-grid,
    .dashboard-signals {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }


    /* Food-system stages */

    .flow-strip,
    .system-flow,
    .stage-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }


    /* Research modules */

    .modules {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;

        margin-top: 2rem;
    }

    .module {
        width: 100%;
        min-width: 0;
        min-height: auto;
        padding: 24px;
    }

    .module h3,
    .module p {
        overflow-wrap: normal;
        word-break: normal;
    }


    /* Flexible by design */

    .services-closing {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;

        gap: 1.5rem;

        margin-top: 3.5rem;
        padding-top: 2rem;
    }

    .services-closing-copy {
        max-width: none;
    }

    .services-button {
        width: 100%;
    }
}


/* =========================================================
   12. SMALL PHONES
   ========================================================= */

@media (max-width: 560px) {

    .modules {
        grid-template-columns: minmax(0, 1fr);
    }

    .module {
        min-height: 240px;
    }
}


/* =========================================================
   13. VERY SMALL PHONES
   ========================================================= */

@media (max-width: 480px) {

    .container {
        width: min(100% - 24px, var(--container));
    }

    section {
        padding-block: 52px;
    }

    .hero {
        padding-top: 48px;
    }

    .hero h1 {
        font-size: clamp(2.8rem, 16vw, 4.2rem);
    }

    .dashboard-preview,
    .system-view,
    .hero-preview,
    .platform-card {
        padding: 18px;
        border-radius: 28px;
    }

    .flow-strip,
    .system-flow,
    .stage-strip {
        grid-template-columns: minmax(0, 1fr);
    }

    .module {
        min-height: auto;
        padding: 22px;

        border-radius: 24px;
    }

    .services-closing {
        margin-top: 3rem;
        padding-top: 1.75rem;
    }

    .services-closing h3 {
        font-size: clamp(1.45rem, 8vw, 1.9rem);
    }
}

/* =========================================================
   MATCH FLEXIBLE SECTION SPACING TO HEADER SPACING
   ========================================================= */

.modules+.services-closing {
    margin-top: 1.5rem;
    padding-top: 0;
    border-top: none;
}