/* ============================================
   SIMONE PAOLETTI ARCHITETTURA
   3D Ring Portfolio — CLOU-inspired
   ============================================ */

:root {
    --bg: #080808;
    --bg-elevated: #111111;
    --text: #e8e4df;
    --text-dim: #6b6660;
    --accent: #0057FF;
    --accent-glow: rgba(0, 87, 255, 0.15);
    --font-main: 'Instrument Sans', -apple-system, sans-serif;
    --font-mono: 'DM Mono', 'SF Mono', monospace;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    cursor: default;
    min-height: 100vh;
    min-height: 100dvh;
}

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

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

button {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

/* ============================================
   LOADER
   ============================================ */

#loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-brand {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--text);
}

.loader-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.5em;
    color: var(--text-dim);
    font-weight: 300;
}

.loader-bar {
    width: 180px;
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin-top: 32px;
    overflow: hidden;
    border-radius: 1px;
}

.loader-fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.3s var(--ease-out);
}

.loader-pct {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 0.15em;
    font-weight: 300;
}

/* ============================================
   HEADER
   ============================================ */

#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 40px;
    pointer-events: none;
    opacity: 0;
}

#header > * {
    pointer-events: auto;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: opacity 0.3s;
}

.logo:hover { opacity: 0.7; }

.logo-name {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.28em;
}

.logo-tag {
    font-family: var(--font-mono);
    font-size: 0.52rem;
    letter-spacing: 0.4em;
    color: var(--text-dim);
    font-weight: 300;
}

.nav-main {
    display: flex;
    gap: 36px;
}

.nav-link {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.3s;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.4s var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Burger */
.nav-burger {
    display: none;
    flex-direction: column;
    gap: 6px;
    width: 28px;
    padding: 4px 0;
}

.nav-burger span {
    display: block;
    width: 100%;
    height: 1px;
    background: var(--text);
    transition: transform 0.4s var(--ease-out), opacity 0.3s;
}

.nav-burger.open span:first-child {
    transform: translateY(3.5px) rotate(45deg);
}

.nav-burger.open span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
}

/* Mobile Nav */
.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(8, 8, 8, 0.96);
    backdrop-filter: blur(40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s var(--ease-out);
}

.mobile-nav.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-link {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.3s;
}

.mobile-link:hover {
    color: var(--text);
}

/* ============================================
   VIEWS
   ============================================ */

.view {
    position: fixed;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s var(--ease-out);
}

.view.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   RING VIEW
   ============================================ */

#ring-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#ring-filters {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 100px;
    backdrop-filter: blur(20px);
    z-index: 10;
}

.filter-btn {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 8px 16px;
    border-radius: 100px;
    color: var(--text-dim);
    transition: all 0.35s var(--ease-out);
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--text);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff;
}

#hover-label {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#hover-label.visible {
    opacity: 1;
}

.hover-category {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
    font-weight: 400;
}

.hover-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}

#ring-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s;
    font-weight: 300;
}

#ring-hint.visible {
    opacity: 1;
}

#ring-hint svg {
    animation: hintSlide 2s var(--ease-in-out) infinite;
}

@keyframes hintSlide {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
}

#project-count {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 10;
    opacity: 0;
}

.count-num {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.count-label {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 300;
}

/* ============================================
   DETAIL VIEW
   ============================================ */

#detail-view {
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
}

.detail-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 40px;
    background: linear-gradient(to bottom, var(--bg) 60%, transparent);
    pointer-events: none;
}

.detail-header > * {
    pointer-events: auto;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.3s;
}

.back-btn:hover {
    color: var(--text);
}

.back-btn svg {
    transition: transform 0.3s var(--ease-out);
}

.back-btn:hover svg {
    transform: translateX(-4px);
}

.detail-meta {
    display: flex;
    gap: 20px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 300;
}

.detail-hero {
    min-height: 50vh;
    display: flex;
    align-items: flex-end;
    padding: 0 40px 60px;
}

.detail-title {
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
    max-width: 800px;
}

.detail-gallery {
    padding: 0 40px 120px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-gallery img {
    width: 100%;
    display: block;
    border-radius: 2px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.detail-gallery img.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   STUDIO VIEW
   ============================================ */

#studio-view {
    overflow-y: auto;
    background: var(--bg);
}

.studio-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 40px 80px;
}

.studio-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 80px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.studio-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.studio-number {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.4em;
    color: var(--accent);
    margin-top: 16px;
    font-weight: 400;
}

.studio-text {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-dim);
    margin-bottom: 24px;
    max-width: 560px;
}

.studio-stats {
    display: flex;
    gap: 48px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 6px;
    font-weight: 300;
}

/* ============================================
   CONTATTI VIEW
   ============================================ */

#contatti-view {
    overflow-y: auto;
    background: var(--bg);
}

.contatti-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 40px 80px;
}

.contatti-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 80px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.contatti-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.contatti-block {
    margin-bottom: 40px;
}

.contatti-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: 400;
}

.contatti-value {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-dim);
}

.contatti-link {
    display: inline-block;
    transition: color 0.3s;
    position: relative;
}

.contatti-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.4s var(--ease-out);
}

.contatti-link:hover {
    color: var(--text);
}

.contatti-link:hover::after {
    width: 100%;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    #header {
        padding: 20px 24px;
    }

    .nav-main {
        display: none;
    }

    .nav-burger {
        display: flex;
    }

    #ring-filters {
        bottom: 24px;
        gap: 2px;
        padding: 3px;
        max-width: calc(100vw - 32px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #ring-filters::-webkit-scrollbar { display: none; }

    .filter-btn {
        font-size: 0.5rem;
        padding: 6px 12px;
    }

    #hover-label {
        bottom: 80px;
    }

    .hover-title {
        font-size: 0.9rem;
    }

    #project-count {
        display: none;
    }


    #ring-hint {
        bottom: 80px;
    }

    .detail-header {
        padding: 20px 24px;
    }

    .detail-hero {
        padding: 0 24px 40px;
        min-height: 35vh;
    }

    .detail-gallery {
        padding: 0 24px 80px;
    }

    .studio-content,
    .contatti-content {
        padding: 100px 24px 60px;
    }

    .studio-grid,
    .contatti-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .studio-stats {
        gap: 32px;
    }
}

/* ============================================
   CUSTOM CURSOR (desktop)
   ============================================ */

@media (hover: hover) {
    body.on-ring {
        cursor: none;
    }

    #custom-cursor {
        position: fixed;
        top: 0;
        left: 0;
        width: 16px;
        height: 16px;
        border: 1px solid rgba(255,255,255,0.5);
        border-radius: 50%;
        pointer-events: none;
        z-index: 9998;
        transition: width 0.35s var(--ease-out),
                    height 0.35s var(--ease-out),
                    border-color 0.3s,
                    background 0.3s;
        transform: translate(-50%, -50%);
        mix-blend-mode: difference;
    }

    #custom-cursor.hover {
        width: 48px;
        height: 48px;
        border-color: var(--accent);
        background: var(--accent-glow);
    }
}

/* Noise grain overlay — disabled: caused white patina on images */
