
/* ========================================
   1. VARIABLES
======================================== */

:root {
    --color-dark: #292929;
    --color-background: #ffffff;
    --color-background-alt: #efefef;

    --color-text: #292929;
    --color-text-muted: #666666;
    --color-text-light: #ffffff;
    --color-border: #d5d5d5;

    --italian-green: #009246;
    --italian-white: #ffffff;
    --italian-red: #ce2b37;

    --font-primary: "Manrope", sans-serif;

    --container-width: 1200px;
    --container-padding: 20px;

    --section-padding: 56px;
    --grid-gap: 24px;

    --radius: 4px;
}


/* ========================================
   2. RESET
======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-primary);
    font-size: 16px;
    color: var(--color-text);
    background-color: var(--color-background);
    font-weight: 400;
    line-height: 1.8;
}

h1,
h2,
h3,
p,
figure,
dl,
dd {
    margin: 0;
}

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

a {
    color: inherit;
    text-underline-offset: 4px;
}

a:focus-visible {
    outline: 2px solid var(--italian-green);
    outline-offset: 5px;
}

address {
    font-style: normal;
}


/* ========================================
   3. TYPOGRAPHY
======================================== */

h1, h2 {
    font-weight: 700;
    letter-spacing: -0.03em;
}

h1,
h2,
h3 {
    line-height: 1.25;
    overflow-wrap: break-word;
}

h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 24px;
}

h3 {
    font-size: 1.125rem;
    margin-bottom: 12px;
    font-weight: 600;
}

p + p {
    margin-top: 16px;
}


/* ========================================
   4. SHARED LAYOUT
======================================== */

.container {
    width: 100%;
    max-width: calc(
            var(--container-width) +
            var(--container-padding) * 2
    );

    margin-inline: auto;
    padding-inline: var(--container-padding);
}

.section {
    padding-block: var(--section-padding);
}

.section-heading {
    max-width: 800px;
    margin: 0 auto 36px;
    text-align: center;
}

.section-label {
    display: block;
    margin-bottom: 12px;

    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;

    color: var(--color-text-muted);
}


/* ========================================
   5. HEADER
======================================== */

.site-header {
    background-color: var(--color-dark);
    color: var(--color-text-light);

    padding-block: 40px;
    text-align: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: min(100%, 360px);
    margin-bottom: 12px;
}

.header-subtitle {
    color: #cccccc;
    font-size: 1rem;
}


/* Italian flag divider */

.italian-stripe {
    height: 4px;

    background: linear-gradient(
            to right,
            var(--italian-green) 0%,
            var(--italian-green) 33.333%,
            var(--italian-white) 33.333%,
            var(--italian-white) 66.666%,
            var(--italian-red) 66.666%,
            var(--italian-red) 100%
    );
}


/* ========================================
   6. ABOUT
======================================== */

.about {
    background-color: var(--color-background-alt);
}

.about-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.about-content h3 {
    margin-bottom: 20px;
}

.about-image img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: var(--radius);
}


/* ========================================
   7. SERVICES
======================================== */

.services {
    background-color: var(--color-background);
}

.services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--grid-gap);
}

.service-card {
    padding: 28px;

    background-color: var(--color-background-alt);
    border-top: 3px solid var(--color-dark);
    border-radius: var(--radius);
}

.service-card h3 {
    margin-bottom: 16px;
}

.service-card p {
    color: var(--color-text-muted);
}


/* ========================================
   8. PROJECTS
======================================== */

.projects {
    background-color: var(--color-background-alt);
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--grid-gap);
}

.project-card {
    padding: 24px 0;
    border-top: 1px solid var(--color-border);
}

.project-date {
    display: block;
    margin-bottom: 12px;

    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}


/* ========================================
   9. GALLERY
======================================== */

.gallery-section {
    background-color: var(--color-background);
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

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


/* ========================================
   10. CONTACT
======================================== */

.contact {
    background-color: var(--color-background-alt);
}

.contact-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 24px;

    margin-top: 32px;
}

.contact-item {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.contact-item h3 {
    margin-bottom: 8px;
}

.contact-item a {
    display: block;
    width: fit-content;
    overflow-wrap: anywhere;
}

.contact-item p + a {
    margin-top: 12px;
}

.contact-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-image img {
    width: min(100%, 320px);
}


/* ========================================
   11. FOOTER
======================================== */

.site-footer {
    padding-top: 48px;

    color: #dddddd;
    background-color: var(--color-dark);

    font-size: 0.875rem;
}

.footer-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.site-footer h3 {
    color: var(--color-text-light);
}

.footer-details dl {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 16px;
}

.footer-details dd {
    overflow-wrap: anywhere;
}

.footer-details dt {
    font-weight: 700;
}

.footer-brand img {
    width: 200px;
}

.footer-bottom {
    margin-top: 32px;
    padding-block: 24px;

    border-top: 1px solid #555555;

    color: #bbbbbb;
    font-size: 0.75rem;
}


/* ========================================
   12. TABLET
======================================== */

@media (min-width: 768px) {

    :root {
        --container-padding: 32px;
        --section-padding: 72px;
        --grid-gap: 28px;
    }

    .header-logo {
        width: 400px;
    }

    .services-grid,
    .projects-grid,
    .gallery-grid,
    .footer-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .about-image img {
        max-height: 600px;
    }

    .contact-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
    }

}


/* ========================================
   13. DESKTOP
======================================== */

@media (min-width: 1024px) {

    :root {
        --section-padding: 96px;
        --grid-gap: 32px;
    }

    .site-header {
        padding-block: 56px;
    }

    .header-logo {
        width: 460px;
    }

    .about-layout {
        grid-template-columns: 1.2fr 0.8fr;
        align-items: center;
        gap: 64px;
    }

    .about-image img {
        aspect-ratio: 4 / 5;
        max-height: none;
    }

    .services-grid,
    .gallery-grid,
    .footer-layout {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .projects-grid {
        column-gap: 64px;
    }

    .contact-layout {
        gap: 80px;
    }

    .contact-image img {
        width: min(100%, 400px);
    }

    .footer-brand {
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

}
/* Developer credit */

.footer-bottom {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}

.developer-credit {
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 11px;
    color: #aaaaaa;
    text-decoration: none;

    opacity: 0.65;
    transition: opacity 0.25s ease;
}

.developer-credit img {
    width: 32px;
    height: auto;
}

.developer-credit[href]:hover,
.developer-credit[href]:focus-visible {
    opacity: 1;
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}


/* ========================================
   14. ACCESSIBILITY
======================================== */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

}


/* Scroll reveal */

.reveal {
    opacity: 0;
    transform: translateY(25px);

    transition:
            opacity 0.7s ease,
            transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}


/* Gallery lightbox */

.gallery-button {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    overflow: hidden;
}

.gallery-button img {
    transition: transform 0.35s ease;
}

.gallery-button:hover img {
    transform: scale(1.035);
}

.lightbox {
    padding: 0;
    border: none;
    background: transparent;
    max-width: 90vw;
    max-height: 90dvh;
    overflow: visible;
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.92);
}

.lightbox img {
    width: auto;
    max-width: 100%;
    max-height: 85dvh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;

    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 30px;
    cursor: pointer;
}

body:has(.lightbox[open]) {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-button img {
        transition: none;
    }
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;

    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    background-color: #292929;
    color: #ffffff;

    border: 1px solid #666666;
    border-radius: 50%;

    font-size: 24px;
    text-decoration: none;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);

    transition: all 0.3s ease;
}

.back-to-top.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #ffffff;
    color: #292929;
    transform: translateY(-4px);
}
