/* ============================================
   SIMONE PAOLETTI — CLOU-INSPIRED ELLIPTICAL RING
   ============================================ */

:root {
    --bg: #f5f3f0;
    --bg-white: #ffffff;
    --text: #1a1a1a;
    --text-dim: #888888;
    --accent: #1a1a1a;
    --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(0,0,0,0.1);
    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;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 32px 0 0 40px;
    pointer-events: none;
    opacity: 0;
}

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

/* Logo wrap — single glass bubble that expands */
.logo-wrap {
    position: relative;
    border-radius: 24px;
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.04) 40%,
            rgba(255, 255, 255, 0.08) 100%
        );
    backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    -webkit-backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 -1px 0 rgba(255, 255, 255, 0.06) inset,
        0 0 0 0.5px rgba(255, 255, 255, 0.1);
    transition: border-radius 0.4s var(--ease-out), border-color 0.3s;
}

.logo-wrap:hover {
    border-color: rgba(255, 255, 255, 0.35);
}

.logo-wrap.open {
    border-radius: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    padding: 10px 20px 10px 24px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

.logo::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.14) 100%
        );
    transform: translateX(-100%);
    transition: transform 0.45s var(--ease-out);
    z-index: 0;
}

.logo:hover::before {
    transform: translateX(0);
}

.logo > * {
    position: relative;
    z-index: 1;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-name {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    color: #ffffff;
    mix-blend-mode: difference;
}

.logo-tag {
    font-family: var(--font-mono);
    font-size: 0.52rem;
    letter-spacing: 0.4em;
    color: #ffffff;
    mix-blend-mode: difference;
    font-weight: 300;
}

.logo-chevron {
    width: 16px;
    height: 16px;
    color: #ffffff;
    mix-blend-mode: difference;
    transition: transform 0.4s var(--ease-out);
    flex-shrink: 0;
}

.logo-wrap.open .logo-chevron {
    transform: rotate(180deg);
}

/* Dropdown — inside the same glass bubble */
.logo-dropdown {
    display: flex;
    flex-direction: column;
    padding: 0 8px 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s var(--ease-out), opacity 0.35s var(--ease-out), padding 0.35s var(--ease-out);
}

.logo-wrap.open .logo-dropdown {
    max-height: 200px;
    opacity: 1;
    padding: 4px 8px 8px;
}

/* Separator line between logo and dropdown */
.logo-dropdown::before {
    content: '';
    display: block;
    height: 1px;
    margin: 0 12px 6px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    flex-shrink: 0;
}

.dropdown-link {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: #ffffff;
    mix-blend-mode: difference;
    padding: 10px 20px;
    border-radius: 14px;
    transition: background 0.3s var(--ease-out);
    white-space: nowrap;
}

.dropdown-link:hover {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.06) 50%,
            rgba(255, 255, 255, 0.12) 100%
        );
}

.dropdown-link.active {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.22) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.14) 100%
        );
}

/* ── Light-background override for studio/contatti ── */
.on-light .logo-wrap {
    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.06) 0%,
            rgba(0, 0, 0, 0.02) 40%,
            rgba(0, 0, 0, 0.04) 100%
        );
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.06),
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 0 0 0.5px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(48px) saturate(1.2);
    -webkit-backdrop-filter: blur(48px) saturate(1.2);
}

.on-light .logo-wrap:hover {
    border-color: rgba(0, 0, 0, 0.18);
}

.on-light .logo-name,
.on-light .logo-tag,
.on-light .logo-chevron,
.on-light .dropdown-link {
    color: var(--text);
    mix-blend-mode: normal;
}

.on-light .logo-tag {
    color: var(--text-dim);
}

.on-light .logo::before {
    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.04) 0%,
            rgba(0, 0, 0, 0.02) 50%,
            rgba(0, 0, 0, 0.03) 100%
        );
}

.on-light .dropdown-link:hover {
    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.05) 0%,
            rgba(0, 0, 0, 0.02) 50%,
            rgba(0, 0, 0, 0.04) 100%
        );
}

.on-light .dropdown-link.active {
    background:
        linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.07) 0%,
            rgba(0, 0, 0, 0.03) 50%,
            rgba(0, 0, 0, 0.05) 100%
        );
}

.on-light .logo-dropdown::before {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

/* Burger — hidden, replaced by dropdown */
.nav-burger { display: none; }

/* Mobile Nav */
.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(245, 243, 240, 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 — Elliptical 3D ring
   ============================================ */

#ring-view {
    z-index: 5;
}

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

/* Fullscreen background preview image */
#bg-preview {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
}

#bg-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1), transform 2s cubic-bezier(0.4, 0, 0.2, 1);
}

#bg-preview img.active {
    opacity: 1;
    transform: scale(1);
}

/* Dark overlay so ring + text remain readable */
#bg-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.25) 50%,
        rgba(0, 0, 0, 0.45) 100%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s var(--ease-out);
}

#bg-overlay.active {
    opacity: 1;
}

/* Category tag — small glass pill */
#hover-category-bubble {
    position: fixed;
    bottom: 130px;
    left: 40px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    padding: 7px 18px;
    border-radius: 50px;
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.04) 40%,
            rgba(255, 255, 255, 0.08) 100%
        );
    backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    -webkit-backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.14),
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 -1px 0 rgba(255, 255, 255, 0.06) inset,
        0 0 0 0.5px rgba(255, 255, 255, 0.1);
}

#ring-view.active #hover-category-bubble { opacity: 1; }

.hover-category {
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Project name — glass card */
#hover-label {
    position: fixed;
    bottom: 40px;
    left: 40px;
    text-align: left;
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.5s;
    display: flex;
    align-items: center;
    padding: 14px 28px;
    border-radius: 50px;
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.04) 40%,
            rgba(255, 255, 255, 0.08) 100%
        );
    backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    -webkit-backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 -1px 0 rgba(255, 255, 255, 0.06) inset,
        0 0 0 0.5px rgba(255, 255, 255, 0.1);
}

#ring-view.active #hover-label { opacity: 1; }

.hover-title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    mix-blend-mode: difference;
    line-height: 1.1;
}

/* Category labels — hidden in this layout */
#category-labels {
    display: none;
}

/* Filter bar — liquid glass */
#ring-filters {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0;
    z-index: 10;
    padding: 6px;
    border-radius: 50px;
    /* Heavy blur for true adaptive glass */
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.04) 40%,
            rgba(255, 255, 255, 0.08) 100%
        );
    backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    -webkit-backdrop-filter: blur(48px) saturate(1.8) brightness(1.1);
    /* Subtle refractive border */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.2) inset,
        0 -1px 0 rgba(255, 255, 255, 0.06) inset,
        0 0 0 0.5px rgba(255, 255, 255, 0.1);
}

.filter-btn {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #ffffff;
    mix-blend-mode: difference;
    transition: all 0.4s var(--ease-out);
    padding: 10px 20px;
    position: relative;
    border-radius: 44px;
    z-index: 1;
}

.filter-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 44px;
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.06) 50%,
            rgba(255, 255, 255, 0.12) 100%
        );
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        0 2px 16px rgba(0, 0, 0, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.18) inset;
    backdrop-filter: blur(12px) brightness(1.15);
    -webkit-backdrop-filter: blur(12px) brightness(1.15);
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
    z-index: -1;
}

.filter-btn:hover { opacity: 0.85; }
.filter-btn:hover::after { opacity: 0.5; }
.filter-btn.active { opacity: 1; }
.filter-btn.active::after { opacity: 1; }

/* ============================================
   PREVIEW VIEW — Zoomed category with project info
   ============================================ */

#preview-view {
    display: flex;
    background: var(--bg);
}

.preview-left {
    width: 45%;
    padding: 140px 60px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.preview-category {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.preview-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 32px;
    color: var(--text);
}

.preview-image-wrap {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 3/2;
    overflow: hidden;
    border-radius: 2px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-cta {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    position: relative;
    display: inline-block;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--text);
    transition: opacity 0.3s;
    align-self: flex-start;
}

.preview-cta:hover { opacity: 0.6; }

.preview-right {
    width: 55%;
    position: relative;
    overflow: hidden;
}

.preview-right canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.preview-cat-label {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ============================================
   DETAIL VIEW — Full project page
   ============================================ */

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

.detail-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 140px 60px 80px;
}

.detail-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    margin-bottom: 60px;
    align-items: start;
}

.detail-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text);
}

.detail-back {
    display: inline-block;
    margin-top: 32px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--text);
    padding-bottom: 4px;
    transition: opacity 0.3s;
}

.detail-back:hover { opacity: 0.5; }

.detail-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-dim);
    max-width: 520px;
    padding-top: 20px;
}

.detail-hero {
    width: 100%;
    margin-bottom: 40px;
}

.detail-hero-img {
    width: 100%;
    display: block;
    border-radius: 2px;
}

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

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

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

.detail-meta {
    display: flex;
    gap: 80px;
    padding-top: 40px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.meta-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

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

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

.studio-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 60px 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(--text-dim);
    margin-top: 16px;
}

.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(0,0,0,0.08);
}

.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;
}

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

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

.contatti-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 60px 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(--text-dim);
    margin-bottom: 10px;
}

.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(--text);
    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; }

    #ring-filters {
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        gap: 0;
        flex-wrap: nowrap;
        padding: 4px;
        width: calc(100% - 32px);
        max-width: 480px;
        justify-content: center;
    }

    .filter-btn { font-size: 0.58rem; padding: 8px 12px; }

    #preview-view { flex-direction: column; }
    .preview-left { width: 100%; padding: 100px 24px 40px; }
    .preview-right { width: 100%; height: 50vh; }

    .detail-content { padding: 100px 24px 60px; }
    .detail-top { grid-template-columns: 1fr; gap: 32px; }
    .detail-gallery { grid-template-columns: 1fr; }
    .detail-meta { flex-direction: column; gap: 24px; }

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

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