/* ============================================
   Layout — Grid, Sections, Hero
   ============================================ */

/* ---------- Section ---------- */
.section {
    padding: var(--space-5xl) 0;
    position: relative;
}

.section--sm {
    padding: var(--space-4xl) 0;
}

.section--surface {
    background: var(--bg-surface);
}

.section--border-top {
    border-top: 1px solid var(--border-subtle);
}

.section__header {
    margin-bottom: var(--space-3xl);
    max-width: 760px;
}

.section__label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent-light);
    margin-bottom: var(--space-md);
}

.section__title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-md);
}

.section__subtitle {
    font-size: var(--text-lg);
    color: var(--fg2);
    max-width: 640px;
    line-height: 1.6;
}

.section--contrast {
    background: var(--bg-contrast);
    color: var(--fg1-light);
}
.section--contrast p {
    color: var(--fg2-light);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: calc(var(--header-height) + var(--space-5xl)) 0 var(--space-5xl);
    overflow: hidden;
}

.hero--home {
    padding-bottom: var(--space-4xl);
    min-height: 85vh;
    display: flex;
    align-items: center;
}

.hero__content {
    position: relative;
    z-index: 2;
    max-width: 720px;
}

.hero__label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--accent-light);
    margin-bottom: var(--space-lg);
}

.hero__title {
    font-size: var(--text-5xl);
    font-weight: var(--font-extrabold);
    line-height: 1.08;
    letter-spacing: -0.025em;
    margin-bottom: var(--space-xl);
}

.hero__subtitle {
    font-size: var(--text-xl);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-2xl);
    max-width: 580px;
}

.hero__actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* Hero code decoration */
.hero__code {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 420px;
    z-index: 1;
    opacity: 0.4;
}

.hero__code pre {
    background: transparent;
    border: none;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.hero__code .code-keyword {
    color: var(--accent-light);
}

.hero__code .code-string {
    color: var(--accent-blue-light);
}

.hero__code .code-comment {
    color: var(--text-muted);
    font-style: italic;
}

/* ---------- Grids ---------- */
.grid {
    display: grid;
    gap: var(--space-xl);
}

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

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

.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid--5 {
    grid-template-columns: repeat(5, 1fr);
}

/* ---------- Content layouts ---------- */
.content-block {
    max-width: var(--max-width-narrow);
}

.content-block--wide {
    max-width: none;
}

.content-block h2 {
    margin-bottom: var(--space-lg);
}

.content-block > .section__title:not(:first-child) {
    margin-top: var(--space-4xl);
}

.content-block > .reveal + .reveal {
    margin-top: var(--space-2xl);
}

.content-block h3 {
    margin-top: var(--space-2xl);
    margin-bottom: var(--space-md);
}

.content-block p {
    margin-bottom: var(--space-md);
}

.content-block ul {
    padding-left: var(--space-xl);
    margin-bottom: var(--space-md);
}

.content-block li {
    position: relative;
    padding-left: var(--space-sm);
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.content-block li::before {
    content: "—";
    position: absolute;
    left: calc(-1 * var(--space-lg));
    color: var(--accent);
}

/* ---------- Two-column layout ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4xl);
    align-items: start;
}

.two-col--reverse {
    direction: rtl;
}

.two-col--reverse > * {
    direction: ltr;
}

/* ---------- CTA Section ---------- */
.cta-section {
    text-align: center;
    padding: var(--space-5xl) 0;
}

.cta-section__title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-md);
}

.cta-section__text {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.cta-section__actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.breadcrumb__sep {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--accent-light);
}

/* ---------- Hero — Azienda variant (always dark, same pattern as .hero--bg) ---------- */
.hero--azienda {
    background-color: #0a0e1a;
    background-image:
        linear-gradient(180deg, rgba(10, 14, 26, 0.88) 0%, rgba(10, 14, 26, 0.97) 100%),
        url('../images/home/hero_azienda.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #f0f0f5;
}

.hero--azienda .hero__subtitle {
    color: #8a8fa8;
}

.hero--azienda .breadcrumb,
.hero--azienda .breadcrumb a,
.hero--azienda .breadcrumb span {
    color: rgba(255, 255, 255, 0.7);
}

.hero--azienda .breadcrumb a:hover {
    color: #fff;
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
    padding-left: var(--space-3xl);
}

.timeline::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-medium);
}

.timeline__item {
    position: relative;
    padding-bottom: var(--space-3xl);
}

.timeline__item:last-child {
    padding-bottom: 0;
}

.timeline__dot {
    position: absolute;
    left: calc(-1 * var(--space-3xl) - 5px);
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
}

.timeline__step {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-xs);
}

html[data-theme="light"] .timeline__step {
    display: inline-block;
    color: #0a0e1a;
    background: var(--accent);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
}

.timeline__title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-sm);
}

.timeline__text {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

@media (max-width: 768px) {
    h1, .hero__title {
        font-size: var(--text-4xl);
    }

    h2, .section__title {
        font-size: var(--text-3xl);
    }

    .grid--2,
    .grid--3,
    .grid--4,
    .grid--5 {
        grid-template-columns: 1fr;
    }

    .two-col {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
    }

    .hero__code {
        display: none;
    }

    .nav-desktop {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
    }

    .footer__bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .hero--home {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--space-4xl));
    }

    .section {
        padding: var(--space-4xl) 0;
    }

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