/* Azienda agricola Gianella - TYPO3 13 / fluid_styled_content */

:root {
    --verde: #94c02b;
    --verde-scuro: #1f9a4f;
    --verde-chiaro: #c3dc85;
    --verde-pallido: #e8f0d2;
    --grigio-scuro: #2e2e2e;
    --testo: #4a4a4a;
    --sfondo: #ffffff;
    --larghezza: 1140px;
    --font: 'Bitter', Georgia, 'Times New Roman', serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.6;
    color: var(--testo);
    background: var(--sfondo);
}

img { max-width: 100%; height: auto; }

a { color: var(--verde); }
a:hover { color: var(--verde-scuro); }

h1, h2, h3, h4 {
    font-family: var(--font);
    font-weight: 700;
    line-height: 1.2;
    color: var(--grigio-scuro);
    margin: 0 0 .6em;
}
h1 { font-size: clamp(30px, 5vw, 54px); text-transform: uppercase; }
h2 { font-size: clamp(24px, 3vw, 32px); color: var(--verde); font-weight: 400; }
h3 { font-size: 22px; }

p { margin: 0 0 1em; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
    position: absolute; left: 10px; top: -60px; z-index: 100;
    background: var(--grigio-scuro); color: #fff; padding: 8px 14px;
}
.skip-link:focus { top: 10px; }

.btn,
.ce-bodytext a.btn {
    display: inline-block;
    padding: 12px 26px;
    background: var(--verde);
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 700;
    transition: background .2s;
}
.btn:hover,
.ce-bodytext a.btn:hover { background: var(--verde-scuro); color: #fff; }

/* ---------- Header ---------- */

.site-header {
    position: relative; z-index: 50;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
.site-header .wrap {
    max-width: var(--larghezza);
    margin: 0 auto;
    padding: 10px 20px 0;
    text-align: center;
}
.logo img { display: block; margin: 0 auto; width: 200px; }

.mainnav ul {
    list-style: none; margin: 0; padding: 6px 0 10px;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 0 26px;
}
.mainnav a {
    display: block; padding: 6px 0;
    color: var(--grigio-scuro);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 17px;
}
.mainnav a:hover,
.mainnav a.active { color: var(--verde); }

.nav-toggle { display: none; }

/* ---------- Titolo pagina (pagine interne) ---------- */

.page-title {
    background: var(--verde);
    padding: clamp(50px, 10vw, 110px) 20px;
    text-align: center;
}
.page-title h1 { color: #fff; margin: 0; }

/* ---------- Contenuti: ogni elemento e' a tutta larghezza, il testo resta centrato ---------- */

.content-main {
    display: flex;
    flex-wrap: wrap;
}
.content-main > .frame {
    flex: 0 0 100%;
    padding: 50px max(20px, calc((100% - var(--larghezza)) / 2));
}
.content-main > .frame + .frame { padding-top: 10px; }
.content-main > .frame[class*="frame-verde"],
.content-main > .frame-galleria,
.content-main > .frame-visita,
.content-main > .frame-cards,
.content-main > .frame + .frame[class*="frame-verde"],
.content-main > .frame + .frame-galleria,
.content-main > .frame + .frame-visita { padding-top: 50px; }
.content-main > .frame.frame-cards,
.content-main > .frame.frame-visita,
.content-main > .frame + .frame.frame-cards,
.content-main > .frame + .frame.frame-visita { padding: 0; }

/* fascia verde */
.frame-verde { background: var(--verde); text-align: center; }
.frame-verde, .frame-verde h1, .frame-verde h2, .frame-verde a { color: #fff; }
.frame-verde .ce-bodytext { max-width: 820px; margin: 0 auto; font-size: clamp(18px, 2vw, 24px); }

/* fascia verde scuro */
.frame-verde-scuro { background: var(--verde-scuro); text-align: center; text-transform: uppercase; }
.frame-verde-scuro, .frame-verde-scuro h2, .frame-verde-scuro a { color: #fff; }
.frame-verde-scuro p { margin: 0 0 .4em; }

/* due elementi affiancati (es. contatti + modulo) */
.content-main > .frame-colonna { flex: 1 1 50%; }
.content-main > .frame-colonna:has(+ .frame-colonna) { padding-right: 30px; }
.content-main > .frame-colonna + .frame-colonna { padding-left: 30px; padding-top: 50px; }

/* ---------- Testo e immagini (fluid_styled_content) ---------- */

.ce-gallery figure { margin: 0; }
.ce-gallery img { display: block; width: 100%; height: auto; }
.ce-gallery figcaption { font-size: 14px; padding-top: 6px; }
.ce-row { display: flex; gap: 10px; margin-bottom: 10px; }
.ce-column { flex: 1 1 0; min-width: 0; }

.ce-textpic.ce-intext.ce-nowrap { display: flex; gap: 50px; align-items: flex-start; }
.ce-textpic.ce-intext.ce-nowrap .ce-gallery { flex: 0 0 42%; }
.ce-textpic.ce-intext.ce-nowrap .ce-bodytext { flex: 1 1 auto; min-width: 0; }
.ce-textpic.ce-intext.ce-right.ce-nowrap .ce-gallery { order: 2; }
.ce-textpic.ce-above .ce-gallery { margin-bottom: 25px; }
.ce-textpic.ce-below .ce-gallery { margin-top: 25px; }
.ce-textpic.ce-intext.ce-right:not(.ce-nowrap) .ce-gallery { float: right; width: 42%; margin: 0 0 20px 40px; }
.ce-textpic.ce-intext.ce-left:not(.ce-nowrap) .ce-gallery { float: left; width: 42%; margin: 0 40px 20px 0; }
.ce-textpic::after { content: ''; display: table; clear: both; }

/* ---------- Home: slider ---------- */

.hero { position: relative; }
.hero .frame { margin: 0; padding: 0; }
.hero .ce-textpic {
    position: relative;
    min-height: clamp(420px, 75vh, 760px);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: var(--grigio-scuro);
}
.hero .ce-gallery,
.hero .ce-gallery .ce-outer,
.hero .ce-gallery .ce-inner {
    position: absolute; inset: 0; margin: 0 !important; width: auto !important;
}
.hero .ce-row, .hero .ce-column { display: contents; }
.hero .ce-gallery figure {
    position: absolute; inset: 0;
    opacity: 0; transition: opacity 1.2s ease;
}
.hero .ce-gallery figure.is-active,
.hero .ce-gallery .ce-row:first-child .ce-column:first-child figure { opacity: 1; }
.hero .ce-gallery.is-slider figure { opacity: 0; }
.hero .ce-gallery.is-slider figure.is-active { opacity: 1; }
.hero .ce-gallery img { width: 100%; height: 100%; object-fit: cover; }
.hero .ce-gallery::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(rgba(0, 0, 0, .15), rgba(0, 0, 0, .45));
}
.hero header,
.hero .ce-bodytext {
    position: relative; z-index: 2;
    max-width: 900px; padding: 0 20px;
    color: #fff; text-align: center;
}
.hero .ce-textpic { flex-direction: column; }
.hero header h1, .hero header h2, .hero header h3,
.hero .ce-bodytext h1, .hero .ce-bodytext h2, .hero .ce-bodytext h3 {
    color: #fff; text-transform: uppercase; font-weight: 700;
    font-size: clamp(28px, 4.6vw, 56px);
    text-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}
.hero .ce-bodytext { font-size: clamp(17px, 1.8vw, 21px); text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }

/* ---------- Home: 3 riquadri con link ---------- */

.frame-cards .ce-row { gap: 0; margin: 0; }
.frame-cards .ce-gallery figure { position: relative; }
.frame-cards .ce-gallery img { aspect-ratio: 4 / 3; object-fit: cover; }
.frame-cards .ce-gallery figure a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.frame-cards .ce-gallery figcaption {
    padding: 22px 10px; text-align: center;
    font-size: 21px; color: #fff; background: var(--verde);
}
.frame-cards .ce-column:nth-child(2) figcaption { background: var(--verde-scuro); }
.frame-cards .ce-column:nth-child(3) figcaption { background: var(--grigio-scuro); }
.frame-cards figure:hover img { filter: brightness(1.08); }

/* ---------- Riquadro su foto di sfondo ("Vieni a trovarci") ---------- */

.frame-visita { position: relative; background: var(--verde-pallido); }
.frame-visita .ce-textpic {
    position: relative; min-height: 540px; padding: 50px 20px;
    display: flex; align-items: center; justify-content: center;
}
.frame-visita .ce-gallery,
.frame-visita .ce-gallery .ce-outer,
.frame-visita .ce-gallery .ce-inner { position: absolute; inset: 0; margin: 0 !important; width: auto !important; }
.frame-visita .ce-row, .frame-visita .ce-column, .frame-visita figure { height: 100%; }
.frame-visita .ce-gallery img { width: 100%; height: 100%; object-fit: cover; }
.frame-visita header,
.frame-visita .ce-bodytext {
    position: relative; z-index: 1;
    background: var(--verde-pallido);
    max-width: 520px; width: 100%;
    padding: 30px 40px; text-align: center;
}
.frame-visita .ce-textpic { flex-direction: column; }
.frame-visita header { padding-bottom: 0; }
.frame-visita .ce-bodytext h2 { color: var(--verde); }

/* ---------- Galleria foto ---------- */

.frame-galleria { background: var(--verde-chiaro); }
.frame-galleria h2 { color: #fff; }
.frame-galleria .ce-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.frame-galleria .ce-outer, .frame-galleria .ce-inner,
.frame-galleria .ce-row, .frame-galleria .ce-column { display: contents; }
.frame-galleria .ce-gallery figure { overflow: hidden; }
.frame-galleria .ce-gallery img { aspect-ratio: 1 / 1; object-fit: cover; transition: transform .4s; }
.frame-galleria .ce-gallery figure:hover img { transform: scale(1.05); }
.frame-galleria figure.is-hidden { display: none; }
.gallery-more { display: block; margin: 25px auto 0; border: 0; cursor: pointer; font: inherit; }

/* ---------- Lightbox ---------- */

.lb {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0, 0, 0, .9);
    display: flex; align-items: center; justify-content: center;
}
.lb[hidden] { display: none; }
.lb img { max-width: 92vw; max-height: 88vh; width: auto; height: auto; box-shadow: 0 0 30px #000; }
.lb button {
    position: absolute; border: 0; background: none; color: #fff;
    font-size: 44px; line-height: 1; cursor: pointer; padding: 10px 16px;
}
.lb-close { top: 10px; right: 10px; }
.lb-prev { left: 5px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 5px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #ccc; font-size: 14px; }

/* ---------- Modulo contatti (EXT:form) ---------- */

.frame-type-form_formframework form { max-width: 640px; }
.frame-type-form_formframework .form-group { margin-bottom: 16px; }
.frame-type-form_formframework label { display: block; font-weight: 700; margin-bottom: 4px; color: var(--grigio-scuro); }
.frame-type-form_formframework input[type="text"],
.frame-type-form_formframework input[type="email"],
.frame-type-form_formframework input[type="tel"],
.frame-type-form_formframework textarea {
    width: 100%; padding: 10px 12px;
    font: inherit; color: inherit;
    border: 1px solid #c9c9c9; border-radius: 4px; background: #fff;
}
.frame-type-form_formframework input:focus,
.frame-type-form_formframework textarea:focus { outline: 2px solid var(--verde); border-color: var(--verde); }
.frame-type-form_formframework .form-check label { display: inline; font-weight: 400; }
.frame-type-form_formframework .required { color: #c0392b; }
.frame-type-form_formframework .error .form-control,
.frame-type-form_formframework .has-error .form-control { border-color: #c0392b; }
.frame-type-form_formframework .help-block,
.frame-type-form_formframework .invalid-feedback { color: #c0392b; font-size: 14px; }
.frame-type-form_formframework button[type="submit"],
.frame-type-form_formframework .btn-primary {
    padding: 12px 34px; border: 0; border-radius: 30px; cursor: pointer;
    background: var(--verde); color: #fff; font: inherit; font-weight: 700;
}
.frame-type-form_formframework button[type="submit"]:hover { background: var(--verde-scuro); }

/* ---------- Footer ---------- */

.site-footer {
    background: #fff;
    border-top: 4px solid var(--verde-chiaro);
    padding: 50px 20px 90px;
    text-align: center;
    font-size: 15px;
}
.site-footer .wrap { max-width: var(--larghezza); margin: 0 auto; }
.footer-title {
    font-size: 26px; text-transform: uppercase; color: var(--verde);
    border-bottom: 1px solid #ddd; padding-bottom: 20px; margin-bottom: 30px;
}
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.footer-col .icon { width: 34px; height: 34px; fill: var(--verde); }
.footer-col a { color: var(--testo); text-decoration: none; }
.footer-col a:hover { color: var(--verde); }
.footer-social a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.footer-social .icon { width: 22px; height: 22px; fill: currentColor; }
.footer-links { list-style: none; padding: 0; margin: 20px 0 0; display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; }

/* ---------- Pulsanti fissi ---------- */

.fab {
    position: fixed; bottom: 16px; z-index: 40;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 20px;
    background: var(--verde); color: #fff;
    border-radius: 30px; text-decoration: none; font-size: 15px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .25);
}
.fab:hover { background: var(--verde-scuro); color: #fff; }
.fab .icon { width: 18px; height: 18px; fill: currentColor; }
.fab-left { left: 16px; }
.fab-right { right: 16px; }

.to-top {
    position: fixed; right: 22px; bottom: 76px; z-index: 40;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--verde-scuro);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .3s;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; }
.to-top .icon { width: 26px; height: 26px; fill: #fff; }

/* ---------- Mobile ---------- */

@media (max-width: 900px) {
    .site-header { position: sticky; top: 0; }
    .site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; text-align: left; }
    .logo img { width: 130px; margin: 0; }
    .nav-toggle {
        display: block; width: 46px; height: 46px; border: 0; background: none; cursor: pointer; position: relative;
    }
    .nav-toggle-bar,
    .nav-toggle-bar::before,
    .nav-toggle-bar::after {
        position: absolute; left: 10px; right: 10px; height: 3px; background: var(--verde); border-radius: 2px; content: '';
        transition: transform .25s;
    }
    .nav-toggle-bar { top: 50%; margin-top: -1.5px; }
    .nav-toggle-bar::before { left: 0; right: 0; top: -8px; }
    .nav-toggle-bar::after { left: 0; right: 0; top: 8px; }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(8px) rotate(45deg); }
    .nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-8px) rotate(-45deg); }

    .mainnav {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        background: #fff; box-shadow: 0 10px 20px rgba(0, 0, 0, .1);
    }
    .mainnav.is-open { display: block; }
    .mainnav ul { flex-direction: column; gap: 0; padding: 10px 0; text-align: center; }
    .mainnav a { padding: 12px 20px; font-size: 19px; }

    .ce-textpic.ce-intext.ce-nowrap { flex-direction: column; gap: 25px; }
    .ce-textpic.ce-intext.ce-nowrap .ce-gallery { flex-basis: auto; width: 100%; }
    .ce-textpic.ce-intext.ce-right.ce-nowrap .ce-gallery { order: 0; }
    .ce-textpic.ce-intext:not(.ce-nowrap) .ce-gallery { float: none !important; width: 100% !important; margin: 0 0 20px !important; }

    .frame-cards .ce-row { flex-direction: column; }

    .content-main > .frame-colonna { flex-basis: 100%; }
    .content-main > .frame-colonna:has(+ .frame-colonna) { padding-right: 20px; }
    .content-main > .frame-colonna + .frame-colonna { padding-left: 20px; padding-top: 10px; }

    .frame-visita header, .frame-visita .ce-bodytext { padding: 24px 20px; }
    .frame-galleria .ce-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

    .footer-cols { grid-template-columns: 1fr; }
    .fab span { display: none; }
    .fab { padding: 14px; }
    .to-top { bottom: 80px; }
}
