:root {
    color-scheme: light;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --bg: #f3f8fc;
    --surface: #ffffff;
    --surface-soft: #e8f1f8;
    --text: #172033;
    --muted: #536574;
    --primary: #1f5f8a;
    --primary-dark: #153f66;
    --accent: #2f7fb0;
    --gold: #4f9bc8;
    --border: #d3e1ec;
    --shadow: 0 18px 48px rgba(23, 32, 51, 0.11);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

.container {
    width: min(1140px, calc(100% - 36px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.header-inner {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.08rem;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: #ffffff;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 900;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--text);
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
    background: var(--surface-soft);
    color: var(--primary);
}

.site-nav a.active {
    box-shadow: inset 0 0 0 1px rgba(31, 95, 138, 0.18);
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    padding: 9px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 5px auto;
    background: var(--text);
}

.hero {
    padding: 92px 0 76px;
    background:
        linear-gradient(135deg, rgba(21, 63, 102, 0.94), rgba(47, 127, 176, 0.82)),
        linear-gradient(45deg, #153f66, #2f7fb0);
    color: #fff;
}

.hero-grid,
.two-columns,
.contact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 42px;
}

.hero-grid {
    align-items: center;
}

.align-center {
    align-items: center;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero .eyebrow,
.contact-band .eyebrow {
    color: #cfeeff;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

.hero h1 {
    margin: 0;
    max-width: 780px;
    font-size: clamp(2.45rem, 5vw, 5rem);
    line-height: 1;
    letter-spacing: 0;
}

.hero-text {
    max-width: 760px;
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1.08rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 12px 18px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 850;
}

.button.primary {
    background: var(--gold);
    border-color: var(--gold);
}

.button.primary:hover {
    background: #2d82ae;
    color: #fff;
}

.button.secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--primary);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.34);
}

.button.ghost:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.hero-visual,
.work-card,
.skill-block,
.cv-card,
.contact-form {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hero-visual {
    position: relative;
    overflow: hidden;
    padding: 18px;
    color: var(--text);
}

.hero-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    object-fit: cover;
}

.hero-profile {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: center;
    margin: -56px 16px 0;
    padding: 18px;
    border: 1px solid rgba(217, 225, 234, 0.92);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 32px rgba(23, 32, 51, 0.14);
}

.hero-profile img {
    width: 92px;
    height: 92px;
    border: 5px solid var(--surface-soft);
    border-radius: 50%;
    object-fit: contain;
}

.hero-profile h2 {
    margin: 0 0 8px;
    font-size: 1.45rem;
    line-height: 1.15;
}

.hero-profile p,
.prose p,
.work-card p,
.work-card li,
.skill-block p,
.cv-card p,
.timeline p,
.contact-band p,
.interest-grid p {
    color: var(--muted);
}

.quick-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 16px 0;
}

.quick-facts div {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.quick-facts dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.quick-facts dd {
    margin: 2px 0 0;
    font-weight: 900;
}

.image-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.image-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.interests-image-card {
    height: 100%;
}

.interests-image-card img {
    height: 100%;
    min-height: 520px;
    aspect-ratio: auto;
}

.section {
    padding: 78px 0;
}

.section.white {
    background: #fff;
}

.section h2,
.cv-header h2 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.35rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.section-title {
    max-width: 780px;
    margin: 0 auto 34px;
    text-align: center;
}

.interest-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.interest-grid div {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.interest-grid h3 {
    margin: 0 0 8px;
    line-height: 1.2;
}

.interest-grid p {
    margin: 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.work-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.work-card.featured {
    border-color: rgba(79, 155, 200, 0.46);
    background: #f0f7fc;
}

.work-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.work-card > :not(.work-image) {
    margin-left: 28px;
    margin-right: 28px;
}

.work-card .card-icon {
    margin-top: -22px;
    box-shadow: 0 10px 22px rgba(23, 32, 51, 0.18);
}

.work-card h3,
.skill-block h3,
.cv-card h3 {
    margin: 18px 0 10px;
    line-height: 1.22;
}

.work-card ul {
    margin: 18px 0 22px;
    padding: 0;
    list-style: none;
}

.work-card li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
}

.work-card li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.68em;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
}

.text-link {
    display: inline-flex;
    padding-bottom: 28px;
    margin-top: auto;
}

.visual-band {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 30px;
    align-items: center;
    margin-top: 34px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow);
}

.visual-band img {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    object-fit: cover;
}

.visual-band .sites-image {
    align-self: center;
    height: auto;
    min-height: 0;
    max-height: 460px;
    aspect-ratio: 1 / 1;
}

.visual-band h3 {
    margin: 0 0 12px;
    font-size: clamp(1.45rem, 2vw, 2.15rem);
    line-height: 1.15;
}

.visual-band p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.pretty-list {
    display: grid;
    gap: 12px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.pretty-list li {
    position: relative;
    display: grid;
    gap: 3px;
    padding: 14px 16px 14px 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.72);
}

.pretty-list li::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(47, 127, 176, 0.13);
}

.pretty-list a {
    color: var(--text);
    width: fit-content;
    font-weight: 900;
}

.pretty-list a:hover {
    color: var(--accent);
}

.pretty-list span {
    color: var(--muted);
}

.personal-band {
    background: #f7fbfe;
}

.skills-layout {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.skill-block {
    padding: 24px;
}

.skill-block h3 {
    margin-top: 0;
}

.cv-section {
    background: linear-gradient(180deg, #eef5f8, #f9fbfd);
}

.cv-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.cv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.cv-card {
    padding: 28px;
}

.cv-card h3 {
    margin-top: 0;
}

.cv-card.wide {
    grid-column: 1 / -1;
}

.timeline {
    display: grid;
    gap: 16px;
}

.timeline div {
    padding: 18px 20px;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.timeline span {
    color: var(--primary);
    font-weight: 900;
}

.timeline p {
    margin: 8px 0 0;
}

.contact-band {
    background: #153f66;
    color: #fff;
}

.contact-band h2 {
    margin: 0 0 18px;
}

.contact-band p {
    color: rgba(255, 255, 255, 0.8);
}

.contact-list {
    display: grid;
    gap: 12px;
    margin-top: 26px;
}

.contact-list a,
.contact-list span {
    display: block;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    font-weight: 800;
}

.contact-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding: 30px;
    color: var(--text);
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field.full,
.form-actions.full {
    grid-column: 1 / -1;
}

.contact-form label {
    font-weight: 850;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 14px;
    font: inherit;
    background: #f7fbfe;
    color: var(--text);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: rgba(47, 127, 176, 0.68);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(47, 127, 176, 0.13);
}

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

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.form-actions p {
    max-width: 310px;
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.legal {
    padding-top: 36px;
    padding-bottom: 36px;
}

details {
    border-top: 1px solid var(--border);
    padding: 18px 0;
}

details:last-child {
    border-bottom: 1px solid var(--border);
}

summary {
    cursor: pointer;
    font-weight: 900;
}

.site-footer {
    padding: 30px 0;
    background: #101a2b;
    color: #fff;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.footer-inner p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}

@media (max-width: 980px) {
    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 12px 18px 18px;
        background: #fff;
        border-bottom: 1px solid var(--border);
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 12px;
    }

    .menu-toggle {
        display: block;
    }

    .header-inner {
        position: relative;
    }

    .hero-grid,
    .two-columns,
    .contact-grid,
    .cards-grid,
    .interest-grid,
    .skills-layout,
    .cv-grid,
    .visual-band {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 76px 0 62px;
    }

    .interests-image-card img {
        min-height: 340px;
    }

    .visual-band .sites-image {
        max-height: none;
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100%, calc(100% - 28px));
    }

    .section {
        padding: 56px 0;
    }

    .hero h1 {
        font-size: clamp(2.35rem, 15vw, 3.2rem);
    }

    .hero-visual,
    .work-card,
    .skill-block,
    .cv-card,
    .contact-form {
        padding: 22px;
    }

    .work-card {
        padding: 0;
    }

    .work-card > :not(.work-image) {
        margin-left: 22px;
        margin-right: 22px;
    }

    .hero-profile {
        grid-template-columns: 1fr;
        margin: -36px 10px 0;
        text-align: center;
    }

    .hero-profile img {
        margin: 0 auto;
    }

    .quick-facts {
        grid-template-columns: 1fr;
        margin-left: 10px;
        margin-right: 10px;
    }

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

    .cv-header {
        display: grid;
        align-items: start;
    }

    .contact-form {
        grid-template-columns: 1fr;
    }

    .form-actions {
        align-items: stretch;
    }

    .form-actions .button {
        width: 100%;
    }
}

@media print {
    .site-header,
    .hero-actions,
    #contatti,
    .legal,
    .site-footer {
        display: none !important;
    }

    body {
        background: #fff;
        color: #111;
        font-size: 10.5pt;
    }

    .hero,
    .section,
    .section.white,
    .cv-section {
        padding: 0 0 8mm;
        background: #fff;
        color: #111;
    }

    .container {
        width: 100%;
    }

    .hero-grid,
    .two-columns,
    .cards-grid,
    .skills-layout,
    .cv-grid {
        grid-template-columns: 1fr;
        gap: 5mm;
    }

    .hero-visual,
    .work-card,
    .skill-block,
    .cv-card {
        box-shadow: none;
        break-inside: avoid;
    }
}
