:root {
    --g900: #16401f;
    --g700: #256c34;
    --g500: #3d9a4f;
    --g100: #e3f1e0;
    --bg: #f4f9f1;
    --surface: #ffffff;
    --text: #1b2a1e;
    --muted: #566a5a;
    --line: #c9dcc6;
    --gold: #e8a92b;
    --on-g: #ffffff;
    --danger: #b3261e;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --g900: #0f2c16;
        --g700: #4fb063;
        --g500: #6cc47e;
        --g100: #1c3322;
        --bg: #0f1a12;
        --surface: #16241a;
        --text: #e6f0e4;
        --muted: #9bb2a0;
        --line: #2d4733;
        --on-g: #0b1a0f;
        --danger: #ff8a80;
    }
}

html {
    scroll-padding-top: env(safe-area-inset-top, 0px);
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 1.0625rem/1.6 "Source Sans 3", system-ui, sans-serif;
}

h1, h2 {
    font-family: Fraunces, Georgia, serif;
    line-height: 1.12;
    margin: 0;
}

/* Intestazione */
.hero {
    background: var(--g900);
    color: #fff;
    padding: 2.5rem 1.25rem 5.5rem;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    left: -5%;
    right: -5%;
    bottom: -1px;
    height: 70px;
    background: var(--bg);
    border-radius: 50% 50% 0 0/100% 100% 0 0;
}

.hero-in {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: center;
}

.logo {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: #fff;
    padding: 6px;
    box-shadow: 0 0 0 4px var(--gold);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

h1 {
    font-size: clamp(2rem, 5.4vw, 3.4rem);
    font-weight: 800;
    max-width: 15ch;
}

.hero p {
    margin: .9rem 0 0;
    max-width: 46ch;
    color: #d4e8d0;
    font-size: 1.15rem;
}

/* Form */
main {
    max-width: 720px;
    margin: -3rem auto 3rem;
    padding: 0 1.25rem;
    position: relative;
    z-index: 1;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    border-top: 6px solid var(--g500);
}

fieldset {
    border: 0;
    margin: 0 0 2rem;
    padding: 0;
}

legend {
    font: 800 1.45rem Fraunces, Georgia, serif;
    color: var(--g700);
    padding: 0;
    margin-bottom: .25rem;
}

.hint {
    color: var(--muted);
    margin: 0 0 1rem;
    font-size: .97rem;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label.f {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
}

label.f.spaced {
    margin-top: 1.4rem;
}

label.f small {
    font-weight: 400;
    color: var(--muted);
}

input[type=text], textarea {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .75rem .9rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1.5px solid var(--line);
    border-radius: 10px;
}

textarea {
    min-height: 170px;
    resize: vertical;
}

input:focus-visible, textarea:focus-visible, .send:focus-visible, .chip input:focus-visible + span {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

/* Temi */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip span {
    display: inline-block;
    padding: .5rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    background: var(--bg);
    font-weight: 600;
}

.chip input:checked + span {
    background: var(--g700);
    border-color: var(--g700);
    color: var(--on-g);
}

/* Pulsante */
.send {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    font: 800 1.15rem Fraunces, Georgia, serif;
    text-align: center;
    text-decoration: none;
    background: var(--g700);
    color: var(--on-g);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

.send:hover {
    background: var(--g900);
    color: #fff;
}

/* Messaggi */
.alert {
    background: var(--g100);
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: .7rem 1rem;
    border-radius: 8px;
    margin: 0 0 1.5rem;
    font-weight: 600;
}

.thanks {
    text-align: center;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

.thanks h2 {
    color: var(--g700);
    font-size: 2rem;
    margin-bottom: .6rem;
}

.thanks .send {
    max-width: 320px;
    margin: 1.5rem auto 0;
}

/* Campo trappola anti-bot: invisibile alle persone */
.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

footer {
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
    padding: 0 1.25rem 2.5rem;
}

@media (max-width: 620px) {
    .hero-in {
        grid-template-columns: 1fr;
        justify-items: start;
        gap: 1.2rem;
    }

    .logo {
        width: 130px;
        height: 130px;
    }

    .row {
        grid-template-columns: 1fr;
    }
}
