/* ========================================
   desca.dev - Blobitecture Organic Design
   ======================================== */

/* CSS Custom Property for conic gradient angle */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ---- Palette Variables ---- */
:root {
    --petal-white: #f7f3ee;
    --soma-blush: #e8b4b8;
    --chloro-sage: #8fae8b;
    --nucleus-plum: #6b4c6e;
    --membrane-teal: #5a9e9e;
    --deep-charcoal: #2d2a32;
    --intersection-amber: #d4a660;
    --light-lavender: #c9b5cc;
    --deep-wine: #8e5a60;
    --code-bg: #f0ece4;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #f7f3ee;
    color: #2d2a32;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    overflow-x: hidden;
}

/* ---- Typography ---- */
.site-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 8vw, 7rem);
    letter-spacing: -0.03em;
    color: #6b4c6e;
    line-height: 1.1;
}

.blob-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    letter-spacing: -0.02em;
    color: #6b4c6e;
    margin-bottom: 0.8rem;
}

.blob-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    color: #2d2a32;
}

.blob-text-sm {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.6;
    color: #2d2a32;
}

code {
    font-family: 'DM Mono', monospace;
    font-weight: 400;
    font-size: 15px;
    background-color: #f0ece4;
    padding: 2px 8px;
    border-radius: 6px;
}

.nuc-label {
    display: block;
    margin-bottom: 0.5rem;
}

.nuc-label code {
    font-size: 17px;
    color: #6b4c6e;
}

a {
    color: #d4a660;
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #d4a660;
    transition: width 200ms ease;
}

a:hover::after {
    width: 100%;
}

/* ---- Zones (each min 100vh) ---- */
.zone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* ========================================
   Zone 1: The Membrane
   ======================================== */
#membrane {
    padding: 4rem 2rem;
}

.membrane-blob {
    width: 80vw;
    max-width: 1000px;
    height: 70vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: membrane-pulse 6s ease-in-out infinite;
}

.membrane-border-ring {
    position: absolute;
    inset: 0;
    border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%;
    border: 2px solid transparent;
    background: conic-gradient(from var(--border-angle), #e8b4b8, #5a9e9e, #d4a660, #e8b4b8) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: spin-border 8s linear infinite, breathe-membrane 10s ease-in-out infinite;
    will-change: border-radius;
}

.membrane-content {
    text-align: center;
    padding: 3rem;
    max-width: 600px;
    z-index: 1;
}

.site-purpose {
    margin-top: 1.5rem;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #2d2a32;
    opacity: 0.8;
}

@keyframes membrane-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes spin-border {
    to { --border-angle: 360deg; }
}

@keyframes breathe-membrane {
    0%, 100% {
        border-radius: 40% 60% 55% 45% / 55% 40% 60% 45%;
    }
    50% {
        border-radius: 55% 45% 40% 60% / 45% 60% 40% 55%;
    }
}

/* ========================================
   Zone 2-3: The Cytoplasm
   ======================================== */
#cytoplasm {
    min-height: 200vh;
    padding: 8rem 2rem;
    align-items: flex-start;
    padding-top: 15vh;
}

.cytoplasm-cluster {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    min-height: 160vh;
}

.cyto-blob {
    position: absolute;
    background-color: rgba(232, 180, 184, 0.6);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    mix-blend-mode: multiply;
    will-change: border-radius;
}

.cyto-blob-1 {
    width: clamp(280px, 40vw, 500px);
    height: clamp(280px, 35vw, 420px);
    top: 0;
    left: 5%;
    border-radius: 35% 65% 50% 50% / 55% 40% 60% 45%;
    animation: breathe-1 9s ease-in-out infinite;
    background-color: rgba(232, 180, 184, 0.6);
}

.cyto-blob-2 {
    width: clamp(260px, 38vw, 470px);
    height: clamp(260px, 32vw, 400px);
    top: 5%;
    right: 5%;
    border-radius: 50% 40% 60% 50% / 45% 55% 35% 65%;
    animation: breathe-2 11s ease-in-out infinite;
    background-color: rgba(143, 174, 139, 0.6);
}

.cyto-blob-3 {
    width: clamp(300px, 42vw, 520px);
    height: clamp(280px, 34vw, 430px);
    top: 45%;
    left: 15%;
    border-radius: 45% 55% 40% 60% / 60% 35% 55% 45%;
    animation: breathe-3 10s ease-in-out infinite;
    background-color: rgba(143, 174, 139, 0.6);
}

.cyto-blob-4 {
    width: clamp(260px, 36vw, 460px);
    height: clamp(260px, 30vw, 380px);
    top: 55%;
    right: 8%;
    border-radius: 55% 45% 50% 50% / 40% 60% 45% 55%;
    animation: breathe-4 12s ease-in-out infinite;
    background-color: rgba(232, 180, 184, 0.6);
}

/* Breathing animations for cytoplasm blobs */
@keyframes breathe-1 {
    0%, 100% { border-radius: 35% 65% 50% 50% / 55% 40% 60% 45%; }
    50% { border-radius: 55% 45% 60% 40% / 40% 60% 45% 55%; }
}

@keyframes breathe-2 {
    0%, 100% { border-radius: 50% 40% 60% 50% / 45% 55% 35% 65%; }
    50% { border-radius: 40% 60% 45% 55% / 60% 40% 55% 45%; }
}

@keyframes breathe-3 {
    0%, 100% { border-radius: 45% 55% 40% 60% / 60% 35% 55% 45%; }
    50% { border-radius: 60% 40% 55% 45% / 35% 55% 40% 60%; }
}

@keyframes breathe-4 {
    0%, 100% { border-radius: 55% 45% 50% 50% / 40% 60% 45% 55%; }
    50% { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; }
}

/* ========================================
   Zone 4: The Nucleus
   ======================================== */
#nucleus {
    padding: 8rem 2rem;
    min-height: 120vh;
}

.nucleus-grid {
    position: relative;
    width: 90vw;
    max-width: 900px;
    height: 80vh;
    min-height: 600px;
}

.nuc-blob {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    will-change: border-radius;
}

.nuc-blob-core {
    width: clamp(240px, 30vw, 360px);
    height: clamp(240px, 30vw, 360px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(107, 76, 110, 0.15);
    border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%;
    animation: breathe-core 8s ease-in-out infinite;
    text-align: center;
    z-index: 2;
    padding: 3rem;
}

.nuc-blob-orbit-1 {
    width: clamp(150px, 20vw, 220px);
    height: clamp(150px, 18vw, 200px);
    top: 5%;
    left: 5%;
    background-color: rgba(90, 158, 158, 0.25);
    border-radius: 50% 40% 55% 45% / 45% 55% 40% 60%;
    animation: breathe-orbit-1 9s ease-in-out infinite;
}

.nuc-blob-orbit-2 {
    width: clamp(140px, 18vw, 200px);
    height: clamp(140px, 16vw, 180px);
    top: 2%;
    right: 10%;
    background-color: rgba(232, 180, 184, 0.35);
    border-radius: 40% 60% 45% 55% / 55% 40% 60% 45%;
    animation: breathe-orbit-2 10s ease-in-out infinite;
}

.nuc-blob-orbit-3 {
    width: clamp(130px, 17vw, 190px);
    height: clamp(130px, 15vw, 170px);
    bottom: 8%;
    left: 2%;
    background-color: rgba(143, 174, 139, 0.3);
    border-radius: 55% 45% 50% 50% / 40% 55% 45% 60%;
    animation: breathe-orbit-3 11s ease-in-out infinite;
}

.nuc-blob-orbit-4 {
    width: clamp(140px, 19vw, 210px);
    height: clamp(140px, 17vw, 190px);
    bottom: 5%;
    right: 5%;
    background-color: rgba(90, 158, 158, 0.2);
    border-radius: 45% 55% 40% 60% / 60% 40% 55% 45%;
    animation: breathe-orbit-4 12s ease-in-out infinite;
}

.nuc-blob-orbit-5 {
    width: clamp(120px, 16vw, 180px);
    height: clamp(120px, 14vw, 160px);
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background-color: rgba(212, 166, 96, 0.2);
    border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%;
    animation: breathe-orbit-5 10s ease-in-out infinite;
}

/* Nucleus breathing animations */
@keyframes breathe-core {
    0%, 100% { border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%; }
    50% { border-radius: 50% 50% 55% 45% / 45% 55% 50% 50%; }
}

@keyframes breathe-orbit-1 {
    0%, 100% { border-radius: 50% 40% 55% 45% / 45% 55% 40% 60%; }
    50% { border-radius: 40% 55% 45% 50% / 55% 40% 60% 45%; }
}

@keyframes breathe-orbit-2 {
    0%, 100% { border-radius: 40% 60% 45% 55% / 55% 40% 60% 45%; }
    50% { border-radius: 55% 45% 60% 40% / 40% 60% 45% 55%; }
}

@keyframes breathe-orbit-3 {
    0%, 100% { border-radius: 55% 45% 50% 50% / 40% 55% 45% 60%; }
    50% { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; }
}

@keyframes breathe-orbit-4 {
    0%, 100% { border-radius: 45% 55% 40% 60% / 60% 40% 55% 45%; }
    50% { border-radius: 60% 40% 55% 45% / 40% 60% 45% 55%; }
}

@keyframes breathe-orbit-5 {
    0%, 100% { border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%; }
    50% { border-radius: 45% 55% 55% 45% / 50% 50% 45% 55%; }
}

/* ========================================
   Zone 5: The Deep
   ======================================== */
#deep {
    min-height: 100vh;
    position: relative;
    background: linear-gradient(to bottom, #f7f3ee 0%, #2d2a32 50%);
    flex-direction: column;
}

.deep-gradient {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.deep-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60vh;
    margin-top: 30vh;
}

.deep-blob {
    width: clamp(220px, 30vw, 380px);
    padding: 3rem;
    /* Wine #8e5a60 at 0.3 opacity */
    background-color: rgba(142, 90, 96, 0.3);
    border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%;
    text-align: center;
    animation: breathe-deep 10s ease-in-out infinite;
    will-change: border-radius;
}

.deep-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.8;
    color: #c9b5cc;
}

.deep-link {
    display: inline-block;
    margin-top: 1.5rem;
    color: #d4a660;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

@keyframes breathe-deep {
    0%, 100% { border-radius: 45% 55% 50% 50% / 50% 45% 55% 50%; }
    50% { border-radius: 55% 45% 45% 55% / 45% 55% 50% 50%; }
}

/* ========================================
   Spore Particles
   ======================================== */
#spore-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.spore {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #5a9e9e;
    opacity: 0.15;
    animation: float-up linear infinite;
}

@keyframes float-up {
    0% {
        transform: translateY(110vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.15;
    }
    100% {
        transform: translateY(-10vh) translateX(20px);
        opacity: 0;
    }
}

/* ========================================
   Scroll Indicator & Radial Nav
   ======================================== */
#scroll-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid #6b4c6e;
    background-color: transparent;
    cursor: pointer;
    z-index: 100;
    overflow: hidden;
    transition: transform 300ms ease;
}

#scroll-indicator:hover {
    transform: scale(1.3);
}

#scroll-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background-color: #6b4c6e;
    border-radius: 50%;
    transition: height 100ms ease;
}

#radial-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99;
    pointer-events: none;
}

#radial-nav.visible {
    pointer-events: auto;
}

#radial-nav.hidden .radial-item {
    opacity: 0;
    transform: translate(0, 0) scale(0.5);
}

.radial-item {
    position: absolute;
    width: auto;
    padding: 6px 14px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 13px;
    color: #f7f3ee;
    background-color: #6b4c6e;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 300ms ease, transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radial-item:nth-child(1) {
    transition-delay: 0ms;
}
.radial-item:nth-child(2) {
    transition-delay: 50ms;
}
.radial-item:nth-child(3) {
    transition-delay: 100ms;
}
.radial-item:nth-child(4) {
    transition-delay: 150ms;
}

#radial-nav.visible .radial-item {
    opacity: 1;
}

#radial-nav.visible .radial-item:nth-child(1) {
    transform: translate(-60px, -70px);
}
#radial-nav.visible .radial-item:nth-child(2) {
    transform: translate(-95px, -35px);
}
#radial-nav.visible .radial-item:nth-child(3) {
    transform: translate(-95px, 5px);
}
#radial-nav.visible .radial-item:nth-child(4) {
    transform: translate(-60px, 40px);
}

/* ========================================
   Scroll-Based Fade-In for Blobs
   ======================================== */
.cyto-blob,
.nuc-blob {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.cyto-blob.visible,
.nuc-blob.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Restore mix-blend-mode for cytoplasm when visible */
.cyto-blob.visible {
    mix-blend-mode: multiply;
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    .membrane-blob {
        width: 92vw;
        height: 60vh;
    }

    .cytoplasm-cluster {
        width: 95vw;
        min-height: 220vh;
    }

    .cyto-blob {
        position: relative;
        width: 85vw !important;
        height: auto !important;
        min-height: 200px;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 2rem auto;
    }

    .nucleus-grid {
        height: auto;
        min-height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .nuc-blob {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 80vw !important;
        height: auto !important;
        min-height: 120px;
    }

    .deep-blob {
        width: 80vw;
    }

    #radial-nav.visible .radial-item:nth-child(1) {
        transform: translate(-55px, -65px);
    }
    #radial-nav.visible .radial-item:nth-child(2) {
        transform: translate(-85px, -30px);
    }
    #radial-nav.visible .radial-item:nth-child(3) {
        transform: translate(-85px, 10px);
    }
    #radial-nav.visible .radial-item:nth-child(4) {
        transform: translate(-55px, 45px);
    }
}
