* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-sidebar: #263645;
    --text-light: #ffffff;
    --text-dark: #1a1a1a;
    --text-muted: #666666;
    --bg-light: #f9f9f9;
    --bg-cream: #f0ede7;
    --bg-quote: #eae6e1;
    --accent-light: #cfc3ae;
    --accent-dark: #8f7e64;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Inter', sans-serif;

    --gold: rgba(255, 255, 255, 0.55);

    --bg-deep: linear-gradient(180deg, #263645 0%, #1f2d3a 100%);

    --shadow-soft: 0 1px 2px rgba(20, 30, 40, 0.04),
                   0 8px 24px rgba(20, 30, 40, 0.06),
                   0 24px 60px rgba(20, 30, 40, 0.06);
}

html {
    scroll-behavior: smooth;
}

::selection {
    background: var(--bg-sidebar);
    color: #fff;
}

body {
    font-family: var(--font-sans);
    color: var(--text-dark);
    background-color: #fff;
    line-height: 1.6;
    overflow-x: hidden;
}

.section,
.step,
.gallery-main,
.gallery-sub img,
.footer-card,
blockquote {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.section.visible,
.step.visible,
.gallery-main.visible,
.gallery-sub img.visible,
.footer-card.visible,
blockquote.visible {
    opacity: 1;
    transform: translateY(0);
}

.step:nth-child(1) { transition-delay: 0s; }
.step:nth-child(2) { transition-delay: 0.15s; }
.step:nth-child(3) { transition-delay: 0.3s; }
.step:nth-child(4) { transition-delay: 0.45s; }

.site-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    background: var(--bg-deep);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 40px 30px;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(10, 18, 26, 0.10);
}

.main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-cream);
}

.logo-container {
    margin-bottom: 40px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: flex-start;
}

.logo {
    text-decoration: none;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.brand-name {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    letter-spacing: 1px;
    white-space: nowrap;
}

.brand-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    display: block;
    opacity: 0.55;
    white-space: nowrap;
    border-block-start: 1px solid rgba(255, 255, 255, 0.25);
    padding-block-start: 14px;
}

.nav-menu ul {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 20px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    transition: color 0.4s ease;
}

.nav-link::before {
    content: '';
    width: 0;
    height: 1px;
    background: #fff;
    margin-right: 0;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                margin-right 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-link:hover {
    color: var(--accent-light);
}

.nav-link.active {
    color: #fff;
    font-weight: 500;
}

.nav-link.active::before {
    width: 22px;
    margin-right: 12px;
}

.nav-toggle {
    display: none;
}

.hero {
    height: 100vh;
    height: 100svh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

.section {
    padding: 90px 8%;
    background-color: transparent;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 2.8fr;
    gap: 80px;
}

.grid-2-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 30px;
}

h2 {
    font-family: var(--font-serif);
    font-size: 2.0rem;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 30px;
}

.lead-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.step {
    display: grid;
    grid-template-rows: 170px auto auto 1fr;
    align-items: start;
    border-top: 1px solid #d9d4ca;
    padding-top: 30px;
}

.step img {
    width: 100%;
    height: 130px;
    object-fit: contain;
    object-position: center center;
    align-self: center;
    margin-bottom: 30px;
}

.step-number {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 14px;
}

.step h3 {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    line-height: 1.3;
    margin-bottom: 24px;
}

.step p {
    font-size: 0.7rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.architect-section {
    padding-top: 0;
}

.grid-architect {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 90px;
    align-items: center;
}

.architect-photo {
    aspect-ratio: 4 / 5;
    background-color: var(--bg-quote);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.architect-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.section-eyebrow {
    display: block;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.architect-bio h2 {
    margin-bottom: 22px;
}

.architect-bio .lead-text {
    margin-bottom: 22px;
}

.architect-bio p:not(.lead-text) {
    font-size: 0.9rem;
    line-height: 1.85;
    color: var(--text-muted);
    margin-bottom: 34px;
}

.banner-section {
    height: 60vh;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

.banner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    padding: 0 10%;
}

.banner-content h2 {
    color: #fff;
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.btn-link {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 2px;
    border-bottom: 1px solid #fff;
    padding-bottom: 5px;
    transition: color 0.35s ease, border-color 0.35s ease;
}

.btn-link:hover {
    color: var(--accent-light);
    border-color: var(--accent-light);
}

.projects-section-link {
    grid-column: 1 / -1;
    margin-top: 10px;
    display: flex;
    justify-content: flex-start;
}

.projects-link {
    color: var(--text-dark);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--text-dark);
    padding-bottom: 5px;
    transition: color 0.35s ease, border-color 0.35s ease;
}

.projects-link:hover {
    color: var(--accent-dark);
    border-color: var(--accent-dark);
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 15px;
    background-color: var(--bg-sidebar);
    background: var(--bg-deep);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    align-items: stretch;
    width: 100%;
    max-width: 680px;
    aspect-ratio: 4 / 3;
    margin-left: auto;
}

.gallery-main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-sub {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    height: 100%;
    min-height: 0;
}

.gallery-sub img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   Pagina progetti — Carosello a schermo intero
   ========================================================================== */

.projects-page {
    position: relative;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: #fbfaf6;
    cursor: none;
}

.project-hud {
    cursor: auto;
}

.breadcrumbs {
    position: absolute;
    top: 32px;
    left: 6%;
    z-index: 8;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    cursor: auto;
}

.breadcrumbs a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.35s ease;
}

.breadcrumbs a:hover {
    color: var(--accent-dark);
}

.breadcrumbs [aria-current] {
    color: var(--text-dark);
}

.crumb-sep {
    opacity: 0.5;
}

.breadcrumbs.on-image {
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.breadcrumbs.on-image a:hover {
    color: var(--accent-light);
}

.breadcrumbs.on-image [aria-current] {
    color: #fff;
}

.projects-stage {
    position: relative;
    height: 100%;
    overflow: hidden;
}

.projects-track {
    height: 100%;
    will-change: transform;
    transition: transform 1.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-panel {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh calc(4% + 280px) 4vh 6%;
}

.project-media {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    user-select: none;
    -webkit-user-drag: none;
}

.project-frame {
    --frame-h: min(82vh, 820px);
    --ar: 1.3333;                /* aggiornato dal JS in base al media attivo */
    position: relative;
    height: auto;
    aspect-ratio: var(--ar);
    width: min(100%, calc(var(--frame-h) * var(--ar)));
    overflow: hidden;
    background: transparent;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-slides {
    position: absolute;
    inset: 0;
    display: flex;
    transition: transform 1.15s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.project-slide {
    flex: 0 0 100%;
    height: 100%;
    margin: 0;
    position: relative;
    background-color: transparent;
}

.project-slide img,
.project-slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* il frame ha già il rapporto del media: niente barre, niente ritagli */
    object-position: center;
    display: block;
    background: transparent;
}

.project-hud {
    position: absolute;
    right: 4%;
    bottom: 8%;
    width: 250px;
    text-align: left;
    z-index: 6;
}

.hud-paging {
    margin-bottom: 14px;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hud-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.25;
    margin-bottom: 8px;
}

.hud-place {
    font-size: 0.8rem;
    color: var(--text-dark);
}

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

.hud-region::before {
    content: ', ';
}

.hud-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.project-cursor {
    position: fixed;
    top: 0;
    left: 0;
    margin: -8px 0 0 -8px;
    pointer-events: none;
    z-index: 20;
}

.project-cursor span {
    display: block;
    width: 14px;
    height: 14px;
    border-top: 1px solid #9a958c;
    border-right: 1px solid #9a958c;
    font-size: 0;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.25s ease;
    transform: rotate(45deg);
}

.project-cursor.is-visible span {
    opacity: 1;
}

.project-cursor[data-dir="prev"] span { transform: rotate(-135deg); }
.project-cursor[data-dir="next"] span { transform: rotate(45deg); }
.project-cursor[data-dir="up"] span   { transform: rotate(-45deg); }
.project-cursor[data-dir="down"] span { transform: rotate(135deg); }

@media (hover: none), (pointer: coarse) {
    .project-cursor { display: none; }
    .projects-page { cursor: auto; }
    .project-media { cursor: pointer; }
}

.detail-carousel {
    position: relative;
    padding: 0;
}

.detail-frame {
    position: relative;
    height: min(72vh, 760px);
    overflow: hidden;
    background-color: #eceae5;
}

.detail-slides {
    position: absolute;
    inset: 0;
    display: flex;
    transition: transform 1.15s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.detail-slide {
    flex: 0 0 100%;
    height: 100%;
    margin: 0;
}

.detail-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.detail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 3;
}

.detail-nav span {
    display: block;
    width: 15px;
    height: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.85);
    border-right: 1px solid rgba(255, 255, 255, 0.85);
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.35));
    transition: border-color 0.4s ease, transform 0.4s ease;
}

.detail-nav:hover span {
    border-color: #fff;
}

.detail-nav.prev { left: 22px; }
.detail-nav.prev span { transform: rotate(-135deg); }
.detail-nav.next { right: 22px; }
.detail-nav.next span { transform: rotate(45deg); }

.detail-count {
    position: absolute;
    right: 26px;
    bottom: 20px;
    z-index: 3;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.project-content { padding: 80px 8%; }
.project-header { max-width: 900px; margin: 0 auto 60px; }
.project-meta { display: flex; gap: 24px; margin-bottom: 30px; }
.project-category, .project-year { text-transform: uppercase; letter-spacing: 2px; font-size: 0.75rem; color: var(--text-muted); }
.project-header h1 { margin-bottom: 24px; font-size: 2.8rem; }
.project-description { font-size: 1.1rem; color: var(--text-muted); line-height: 1.6; max-width: 700px; }
.project-body { max-width: 900px; margin: 0 auto 60px; }
.project-body p { font-size: 1rem; line-height: 1.8; color: var(--text-dark); }
.project-navigation { max-width: 900px; margin: 0 auto; padding-top: 40px; border-top: 1px solid #eee; }
.back-link { color: var(--text-dark); text-decoration: none; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 2px; border-bottom: 1px solid var(--text-dark); padding-bottom: 5px; transition: color 0.35s ease, border-color 0.35s ease; }
.back-link:hover { color: var(--accent-dark); border-color: var(--accent-dark); }

.bim-banner { min-height: 70vh; }
.bim-banner-overlay { background: rgba(20, 18, 15, 0.5); justify-content: flex-start; }
.bim-banner-content { max-width: 620px; }
.bim-banner-content h2 { font-size: 2.4rem; }
.bim-eyebrow { color: rgba(255, 255, 255, 0.75); }
.bim-banner-text { color: rgba(255, 255, 255, 0.92); font-size: 1rem; line-height: 1.8; margin-bottom: 28px; }

.quote-section {
    background-color: var(--bg-quote);
    background-image: linear-gradient(rgba(234, 230, 225, 0.88), rgba(234, 230, 225, 0.88)), url('../img/progetti/3msll_Concept.jpg');
    background-size: cover;
    background-position: center;
    padding: 48px 10%;
}

.quote-content-wrapper { display: flex; align-items: center; justify-content: center; max-width: 1200px; }
.quote-text-wrapper { display: grid; grid-template-columns: auto 1fr; column-gap: 28px; align-items: start; max-width: 680px; text-align: left; }
.quote-icon-top { grid-column: 1; font-style: normal; line-height: 0.9; }
.quote-icon-top::before { content: '\201C'; font-family: Georgia, serif; font-size: 6rem; color: #c5bdb1; }
.quote-text { grid-column: 2; font-family: var(--font-serif); font-size: 2.2rem; line-height: 1.35; margin: 0; }
.signature-image { max-width: 150px; height: auto; margin-top: 18px; }

.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); min-height: 50vh; }
.footer-card { background-size: cover; background-position: center; position: relative; color: #fff; display: flex; align-items: flex-end; padding: 40px; }
.footer-card::before { content: ''; position: absolute; top:0; left:0; right:0; bottom:0; background: rgba(0, 0, 0, 0.4); z-index: 1; transition: opacity 0.8s ease; }
.footer-card:hover::before { opacity: 0.55; }
.card-content { position: relative; z-index: 2; }
.card-content p { font-family: var(--font-serif); font-size: 1.5rem; line-height: 1.4; margin-bottom: 20px; font-weight: 400; }
.signature { font-family: var(--font-serif); font-style: italic; opacity: 0.8; }

.contact-section { padding: 70px 8% 76px; }
.contact-grid { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
.contact-intro h1 { font-size: 2.4rem; margin-bottom: 14px; }
.contact-intro .lead-text { font-size: 1rem; font-style: normal; line-height: 1.7; color: var(--text-dark); margin-bottom: 26px; }
.contact-mail { display: inline-block; font-family: var(--font-sans); font-size: 1.05rem; letter-spacing: 0.5px; color: var(--text-dark); text-decoration: none; border-bottom: 1px solid var(--text-dark); padding-bottom: 6px; transition: color 0.35s ease, border-color 0.35s ease; }
.contact-mail:hover { color: var(--accent-dark); border-color: var(--accent-dark); }
.contact-cols { display: grid; grid-template-columns: 1fr; gap: 28px; }
.contact-item { border-top: 1px solid #d9d4ca; padding-top: 22px; }
.contact-item h3 { font-family: var(--font-sans); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; line-height: 1.3; margin-bottom: 10px; }
.contact-item p { font-size: 0.9rem; line-height: 1.8; color: var(--text-muted); }
.contact-item a { color: inherit; text-decoration: none; transition: color 0.35s ease; }
.contact-item a:hover { color: var(--accent-dark); }

.site-footer { background: #17232f; color: var(--text-light); padding: 60px 8% 28px; }
.footer-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; padding-bottom: 40px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.footer-name { display: block; font-family: var(--font-serif); font-size: 1.6rem; letter-spacing: 1px; }
.footer-role { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 3px; color: var(--gold); margin-top: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: rgba(255, 255, 255, 0.75); text-decoration: none; font-size: 0.85rem; transition: color 0.35s ease; }
.footer-links a:hover { color: var(--accent-light); }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px; padding-top: 25px; font-size: 0.7rem; letter-spacing: 1px; color: rgba(255, 255, 255, 0.4); }

@media (max-width: 1024px) {
    .site-wrapper { flex-direction: column; }
    .sidebar { position: relative; width: 100%; height: auto; flex-direction: row; justify-content: space-between; align-items: center; padding: 20px; }
    .logo-container { writing-mode: horizontal-tb; transform: none; margin-bottom: 0; }
    .logo { gap: 6px; }
    .brand-name { font-size: 1.3rem; }
    .brand-sub { border-block-start: none; border-top: 1px solid rgba(255, 255, 255, 0.25); padding-block-start: 0; padding-top: 6px; }
    .main-content { margin-left: 0; width: 100%; }
    .nav-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-sidebar); padding: 20px; }
    .nav-menu.open { display: block; }
    .nav-toggle { display: flex; flex-direction: column; justify-content: space-between; width: 30px; height: 21px; background: transparent; border: none; cursor: pointer; }
    .nav-toggle span { width: 100%; height: 3px; background: #fff; transition: 0.3s; }
    .grid-2, .grid-2-equal, .steps-grid, .footer-grid, .grid-architect { grid-template-columns: 1fr; }
    .grid-architect { gap: 40px; }
    .architect-photo { max-width: 380px; }
    .contact-section { padding: 70px 8%; }
    .contact-cols { gap: 32px; margin-top: 12px; }
    .contact-intro h1 { font-size: 2rem; }
    .footer-row { flex-direction: column; gap: 28px; }
    .footer-bottom { flex-direction: column; gap: 6px; }
    .banner-section { background-attachment: scroll; }
    .gallery-grid { margin-left: 0; padding: 30px; }
    .projects-section-link { margin-top: 0; }
    .quote-section { padding: 48px 8%; }
    .quote-text { font-size: 1.7rem; }
    .projects-page { height: auto; overflow: visible; }
    .projects-stage { height: auto; overflow: visible; }
    .projects-track { transform: none !important; transition: none; }
    .project-panel { height: auto; min-height: 100svh; padding: 90px 6% 200px; scroll-snap-align: start; }
    .project-frame { --frame-h: min(58vh, 520px); }
    .project-hud { position: fixed; right: 6%; left: 6%; bottom: 26px; width: auto; text-align: left; padding-top: 16px; border-top: 1px solid #e2e2e2; background-color: rgba(255, 255, 255, 0.94); backdrop-filter: blur(6px); }
    .hud-paging { justify-content: flex-start; margin-bottom: 10px; }
    .hud-title { font-size: 1.35rem; margin-bottom: 4px; }
    .hud-place, .hud-region, .hud-date { display: inline; margin-top: 0; }
    .hud-region::before { content: ' · '; }
    .hud-date::before { content: ' — '; }
    .projects-index { display: none; }
}

@media (max-width: 700px) {
    .contact-mail { font-size: 0.95rem; }
    .project-panel { padding: 70px 6% 190px; }
    .hud-title { font-size: 1.2rem; }
}