:root {
    --navy: #0e2d3d;
    --navy-deep: #092434;
    --cream: #f1e7d9;
    --paper: #fbf7ef;
    --terracotta: #c86f4b;
    --terracotta-dark: #a9583b;
    --gold: #c6a15c;
    --ink: #403a35;
    --muted: #766c63;
    --white: #fffaf2;
    --line: rgba(94, 77, 59, 0.17);
    --shadow: 0 18px 45px rgba(34, 25, 18, 0.16);
    --serif: "Playfair Display", Georgia, serif;
    --sans: "Poppins", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(129, 102, 71, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, rgba(129, 102, 71, 0.028) 1px, transparent 1px),
        var(--paper);
    background-size: 34px 34px;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    font: inherit;
}

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

.btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 28px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 220ms ease, background 220ms ease, color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-3px);
}

.btn-primary {
    color: var(--white);
    background: var(--terracotta);
    box-shadow: 0 10px 22px rgba(160, 82, 52, 0.26);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--terracotta-dark);
}

.btn-outline {
    color: var(--terracotta);
    background: rgba(255, 250, 242, 0.72);
    border-color: rgba(201, 111, 75, 0.44);
}

.btn-outline:hover,
.btn-outline:focus-visible {
    color: var(--white);
    background: var(--terracotta);
    border-color: var(--terracotta);
}

.section-kicker {
    margin: 0 0 12px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    line-height: 1;
    text-transform: uppercase;
}

.site-header {
    position: absolute;
    inset: 0 0 auto;
    z-index: 10;
    height: 94px;
    color: var(--white);
}

.nav-shell {
    width: min(1500px, calc(100% - 70px));
    height: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 245px 1fr 150px;
    align-items: center;
    gap: 24px;
    opacity: 0;
    animation: navDrop 680ms ease forwards;
}

.brand {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    color: var(--gold);
}

.brand-logo-img {
    width: 268px;
    max-width: 100%;
    height: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 29px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-menu li,
.header-cta {
    opacity: 0;
    animation: navItemRise 520ms ease forwards;
}

.nav-menu li:nth-child(1) { animation-delay: 90ms; }
.nav-menu li:nth-child(2) { animation-delay: 145ms; }
.nav-menu li:nth-child(3) { animation-delay: 200ms; }
.nav-menu li:nth-child(4) { animation-delay: 255ms; }
.nav-menu li:nth-child(5) { animation-delay: 310ms; }
.header-cta { animation-delay: 365ms; }

.nav-menu a {
    position: relative;
    display: inline-flex;
    color: rgba(255, 250, 242, 0.9);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-menu a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -13px;
    height: 2px;
    opacity: 0;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity 180ms ease, transform 230ms ease;
}

.nav-menu a:hover::after,
.nav-menu a:focus-visible::after {
    opacity: 1;
    transform: scaleX(1);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-direction: column;
    border: 1px solid rgba(198, 161, 92, 0.44);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(9, 36, 52, 0.78);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
    transform: translateY(-1px);
    border-color: var(--gold);
    background: rgba(9, 36, 52, 0.94);
}

.nav-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.legal-hero {
    position: relative;
    min-height: 420px;
    display: flex;
    align-items: flex-end;
    color: var(--white);
    overflow: hidden;
    background-image:
        linear-gradient(90deg, rgba(8, 13, 17, 0.82) 0%, rgba(8, 13, 17, 0.68) 39%, rgba(8, 13, 17, 0.18) 100%),
        linear-gradient(180deg, rgba(7, 10, 12, 0.42) 0%, rgba(7, 10, 12, 0.1) 45%, rgba(7, 10, 12, 0.74) 100%),
        url("../images/sfondo.jpg");
    background-position: center 48%;
    background-size: cover;
    animation: heroDrift 16s ease-in-out infinite alternate;
}

.legal-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 120px;
    background: linear-gradient(180deg, transparent, rgba(10, 15, 18, 0.72));
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 720px;
    padding: 148px 0 76px;
}

.hero-inner h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(46px, 6vw, 72px);
    font-weight: 500;
    line-height: 0.98;
}

.hero-inner p:last-child {
    max-width: 650px;
    margin: 24px 0 0;
    color: rgba(255, 250, 242, 0.86);
    font-size: 16px;
    font-weight: 500;
}

.legal-section {
    padding: 78px 0 90px;
}

.legal-layout {
    display: grid;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.legal-aside {
    position: sticky;
    top: 28px;
    display: grid;
    gap: 18px;
}

.aside-card,
.toc-card,
.legal-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 250, 242, 0.86);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.aside-card {
    padding: 28px;
}

.aside-label {
    display: block;
    margin-bottom: 12px;
    color: var(--terracotta);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.aside-card h2 {
    margin: 0;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 31px;
    font-weight: 500;
    line-height: 1.08;
}

.aside-card p {
    margin: 18px 0 24px;
    color: var(--muted);
}

.toc-card {
    display: grid;
    padding: 10px;
    box-shadow: 0 12px 30px rgba(34, 25, 18, 0.09);
}

.toc-card a {
    display: flex;
    align-items: center;
    min-height: 45px;
    padding: 0 16px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.toc-card a:hover,
.toc-card a:focus-visible {
    color: var(--navy);
    background: rgba(198, 161, 92, 0.16);
    transform: translateX(3px);
}

.legal-card {
    padding: clamp(28px, 5vw, 56px);
}

.legal-note {
    display: inline-flex;
    margin-bottom: 22px;
    padding: 10px 14px;
    border: 1px solid rgba(198, 161, 92, 0.38);
    border-radius: 999px;
    color: var(--navy);
    background: rgba(198, 161, 92, 0.14);
    font-size: 13px;
}

.legal-card section {
    scroll-margin-top: 26px;
}

.legal-card section + section {
    margin-top: 36px;
    padding-top: 30px;
    border-top: 1px solid rgba(94, 77, 59, 0.13);
}

.legal-card h2 {
    margin: 0 0 16px;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(28px, 3vw, 39px);
    font-weight: 500;
    line-height: 1.08;
}

.legal-card h3 {
    margin: 22px 0 8px;
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
}

.legal-card p,
.legal-card li {
    color: var(--muted);
}

.legal-card p {
    margin: 0 0 15px;
}

.legal-card ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.legal-card li {
    position: relative;
    padding-left: 26px;
}

.legal-card li::before {
    content: "";
    position: absolute;
    top: 0.72em;
    left: 3px;
    width: 8px;
    height: 8px;
    border: 2px solid var(--gold);
    border-radius: 999px;
    background: rgba(198, 161, 92, 0.14);
}

.legal-card strong {
    color: var(--ink);
}

.legal-card a {
    color: var(--terracotta);
    font-weight: 700;
}

.legal-card a:hover,
.legal-card a:focus-visible {
    color: var(--terracotta-dark);
}

.legal-card code {
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--navy);
    background: rgba(198, 161, 92, 0.15);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
}

.legal-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 18px;
    border: 1px solid rgba(94, 77, 59, 0.14);
    border-radius: 8px;
    background: rgba(255, 250, 242, 0.7);
}

.legal-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    color: var(--muted);
}

.legal-table th,
.legal-table td {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(94, 77, 59, 0.12);
    text-align: left;
    vertical-align: top;
}

.legal-table th {
    color: var(--navy);
    background: rgba(198, 161, 92, 0.12);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.legal-table tr:last-child td {
    border-bottom: 0;
}

.legal-contact-box {
    padding: 26px;
    border: 1px solid rgba(198, 161, 92, 0.32);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(14, 45, 61, 0.96), rgba(9, 36, 52, 0.96)),
        var(--navy);
}

.legal-card .legal-contact-box h2,
.legal-card .legal-contact-box p,
.legal-card .legal-contact-box a {
    color: var(--white);
}

.legal-card .legal-contact-box a {
    display: inline-flex;
    margin: 4px 18px 0 0;
    color: var(--gold-soft, #dac28d);
}

.site-footer {
    padding: 29px 0 21px;
    background: var(--paper);
    border-top: 1px solid rgba(89, 70, 48, 0.12);
}

.footer-row {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    color: rgba(64, 58, 53, 0.62);
    font-size: 12px;
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-links a {
    transition: color 180ms ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--terracotta);
}

.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 680ms ease, transform 680ms ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal[data-reveal="left"] {
    transform: translateX(-24px);
}

.reveal[data-reveal="right"] {
    transform: translateX(24px);
}

.reveal.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

@keyframes heroDrift {
    from { background-position: center 48%; }
    to { background-position: center 54%; }
}

@keyframes navDrop {
    from { opacity: 0; transform: translateY(-18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes navItemRise {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 1050px) {
    .nav-shell {
        width: calc(100% - 38px);
        grid-template-columns: 210px 1fr 130px;
        gap: 18px;
    }

    .brand-logo-img {
        width: 220px;
    }

    .nav-menu {
        gap: 18px;
    }

    .legal-layout {
        grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-aside {
        position: static;
    }

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

@media (max-width: 760px) {
    .site-header {
        height: auto;
        padding: 18px 0;
    }

    .nav-shell {
        position: relative;
        width: calc(100% - 32px);
        min-height: 58px;
        display: flex;
        justify-content: space-between;
        gap: 14px;
        padding: 0;
    }

    .brand-logo-img {
        width: 176px;
    }

    .nav-toggle {
        display: inline-flex;
        flex: 0 0 44px;
    }

    .nav-menu {
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        display: grid;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        border: 1px solid transparent;
        border-radius: 8px;
        background: rgba(9, 36, 52, 0.96);
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
        opacity: 0;
        transform: translateY(-8px);
        transition: max-height 260ms ease, padding 260ms ease, opacity 220ms ease, transform 220ms ease, border-color 220ms ease;
    }

    .nav-menu.is-open {
        max-height: 360px;
        padding: 10px;
        border-color: rgba(198, 161, 92, 0.3);
        opacity: 1;
        transform: translateY(0);
    }

    .nav-menu li {
        opacity: 1;
        animation: none;
    }

    .nav-menu a {
        display: flex;
        min-height: 43px;
        align-items: center;
        padding: 0 14px;
        border-radius: 6px;
    }

    .nav-menu a::after {
        display: none;
    }

    .nav-menu a:hover,
    .nav-menu a:focus-visible {
        background: rgba(255, 250, 242, 0.1);
    }

    .header-cta {
        display: none;
    }

    .legal-hero {
        min-height: 0;
    }

    .hero-inner {
        padding: 138px 0 48px;
    }

    .legal-section {
        padding: 46px 0 62px;
    }

    .container {
        width: min(100% - 32px, 1110px);
    }

    .toc-card {
        grid-template-columns: 1fr;
    }

    .legal-card {
        padding: 24px 20px;
    }

    .legal-contact-box a {
        display: flex;
        margin-right: 0;
    }

    .footer-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 460px) {
    .brand-logo-img {
        width: 150px;
    }

    .hero-inner h1 {
        font-size: 42px;
    }

    .aside-card {
        padding: 23px;
    }

    .footer-links {
        gap: 15px;
    }
}
