/* ==========================================================================
   JJUGGL.com — Styles
   Muted-vintage, avant-garde, watercolor & glitch aesthetic
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --bg: #f5f0e8;
    --sidebar-bg: #e8e0d0;
    --text-primary: #3a3632;
    --text-secondary: #7a7168;
    --accent-red: #b85c4e;
    --accent-teal: #5a8a7a;
    --accent-mustard: #c4a34e;
    --accent-violet: #8b7aab;
    --shadow-sepia: #d4c8b4;
    --sidebar-width: 200px;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-accent: 'Caveat', cursive;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg);
    line-height: 1.65;
    overflow-x: hidden;
    position: relative;
}

/* ---------- Noise Overlay ---------- */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---------- Intro Screen ---------- */
#intro-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg);
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1),
                visibility 0.8s;
}

#intro-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro-watercolor-wash {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    background:
        radial-gradient(ellipse 60% 50% at 30% 40%, rgba(90,138,122,0.18) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 70% 60%, rgba(184,92,78,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(196,163,78,0.10) 0%, transparent 70%);
    filter: blur(60px);
}

#intro-screen.wash-visible .intro-watercolor-wash {
    opacity: 1;
}

#intro-title {
    display: flex;
    gap: 0.05em;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: -0.03em;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.intro-letter {
    display: inline-block;
    opacity: 0;
    transform: translate(var(--from-x), var(--from-y)) rotate(var(--from-rot));
    animation: letterArrive 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    animation-delay: calc(var(--delay) * 0.15s + 0.3s);
    position: relative;
}

@keyframes letterArrive {
    0% {
        opacity: 0;
        transform: translate(var(--from-x), var(--from-y)) rotate(var(--from-rot));
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Glitch after letters land */
.intro-letter.glitch-flash {
    animation: introGlitch 0.2s steps(2) forwards;
}

@keyframes introGlitch {
    0% { text-shadow: 2px 0 #b85c4e, -2px 0 #5a8a7a; transform: translateX(2px); }
    25% { text-shadow: -3px 0 #8b7aab, 3px 0 #c4a34e; transform: translateX(-3px); }
    50% { text-shadow: 1px 0 #5a8a7a, -1px 0 #b85c4e; transform: translateX(1px); }
    75% { text-shadow: -2px 0 #c4a34e, 2px 0 #8b7aab; transform: translateX(-2px); }
    100% { text-shadow: none; transform: translateX(0); }
}

.intro-tagline {
    font-family: var(--font-accent);
    font-size: 1.4rem;
    color: var(--text-secondary);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 0.3s, transform 0.8s ease 0.3s;
    position: relative;
    z-index: 1;
    margin-top: 1rem;
}

#intro-screen.tagline-visible .intro-tagline {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Sidebar ---------- */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--sidebar-bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.2rem;
    transform: translateX(-100%);
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    border-right: 1px solid var(--shadow-sepia);
    overflow: hidden;
}

#sidebar.visible {
    transform: translateX(0);
}

.sidebar-logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 3rem;
}

.sidebar-nav-items {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
}

.sidebar-link {
    font-family: var(--font-accent);
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.2rem;
    position: relative;
    transition: color 0.3s ease, transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: inline-block;
}

.sidebar-link:hover {
    color: var(--text-primary);
    transform: translateX(4px) translateY(-2px);
}

.sidebar-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-red);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 50% 30% 40% 60% / 60% 50% 50% 40%;
}

.sidebar-link:hover::after,
.sidebar-link.active::after {
    transform: scaleX(1);
}

.sidebar-link.active {
    color: var(--text-primary);
}

.sidebar-active-indicator {
    position: absolute;
    left: 0.2rem;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    transition: top 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.sidebar-active-indicator.visible {
    opacity: 1;
}

.sidebar-decoration {
    margin-top: auto;
    opacity: 0.6;
}

.sidebar-orbit-svg {
    width: 60px;
    height: 200px;
}

/* ---------- Hamburger (mobile) ---------- */
#hamburger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    width: 36px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

#hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: absolute;
    left: 0;
}

#hamburger span:nth-child(1) { top: 4px; }
#hamburger span:nth-child(2) { top: 13px; }
#hamburger span:nth-child(3) { top: 22px; }

#hamburger.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
#hamburger.open span:nth-child(2) {
    opacity: 0;
}
#hamburger.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ---------- Mobile Overlay ---------- */
#mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
}

#mobile-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-overlay-wash {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 30% 30%, rgba(90,138,122,0.15) 0%, transparent 70%),
        radial-gradient(ellipse 50% 70% at 70% 70%, rgba(184,92,78,0.10) 0%, transparent 70%);
    filter: blur(80px);
}

.mobile-nav-items {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.mobile-link {
    font-family: var(--font-accent);
    font-size: 2rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* ---------- Main Content ---------- */
#main-content {
    margin-left: var(--sidebar-width);
    padding: 4rem 3rem 2rem;
    position: relative;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#main-content.visible {
    opacity: 1;
}

/* ---------- Watercolor Washes (structural) ---------- */
.watercolor-wash {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
    opacity: 0.5;
}

.wash-1 {
    top: 5%;
    left: -5%;
    width: 60%;
    height: 40%;
    background: radial-gradient(ellipse at center, rgba(90,138,122,0.2) 0%, transparent 70%);
    animation: washDrift1 30s ease-in-out infinite alternate;
}

.wash-2 {
    top: 40%;
    right: -10%;
    width: 50%;
    height: 35%;
    background: radial-gradient(ellipse at center, rgba(184,92,78,0.15) 0%, transparent 70%);
    animation: washDrift2 25s ease-in-out infinite alternate;
}

.wash-3 {
    top: 70%;
    left: 10%;
    width: 55%;
    height: 30%;
    background: radial-gradient(ellipse at center, rgba(196,163,78,0.12) 0%, transparent 70%);
    animation: washDrift3 35s ease-in-out infinite alternate;
}

@keyframes washDrift1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -20px) scale(1.05); }
}

@keyframes washDrift2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-25px, 15px) scale(1.08); }
}

@keyframes washDrift3 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(20px, -30px) scale(1.03); }
}

/* ---------- Content Sections ---------- */
.content-section {
    position: relative;
    padding: 3rem 0;
    z-index: 1;
}

/* ---------- Section Panels (Organic Blob Shapes) ---------- */
.section-panel {
    background: rgba(232,224,208,0.4);
    padding: 2.5rem 2.5rem;
    position: relative;
    max-width: 700px;
    box-shadow: 0 4px 20px rgba(58,54,50,0.05);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.4s ease;
}

.section-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(58,54,50,0.08);
}

/* Organic blob border-radius variations */
.blob-shape-1 { border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%; }
.blob-shape-2 { border-radius: 55% 45% 40% 60% / 45% 55% 60% 40%; }
.blob-shape-3 { border-radius: 45% 55% 60% 40% / 55% 45% 40% 60%; }
.blob-shape-4 { border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%; }
.blob-shape-5 { border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%; }
.blob-shape-6 { border-radius: 42% 58% 52% 48% / 55% 45% 48% 52%; }
.blob-shape-7 { border-radius: 58% 42% 48% 52% / 45% 55% 52% 48%; }
.blob-shape-8 { border-radius: 38% 62% 50% 50% / 62% 38% 50% 50%; }
.blob-shape-9 { border-radius: 52% 48% 58% 42% / 42% 58% 48% 52%; }
.blob-shape-10 { border-radius: 48% 52% 42% 58% / 58% 42% 52% 48%; }
.blob-shape-11 { border-radius: 55% 45% 50% 50% / 50% 50% 45% 55%; }
.blob-shape-12 { border-radius: 44% 56% 52% 48% / 56% 44% 48% 52%; }

.offset-panel {
    margin-left: 60px;
    margin-top: -20px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

h1 { font-size: 3.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 2.25rem; margin-bottom: 1.2rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.8rem; }
h4 { font-size: 1.125rem; margin-bottom: 0.6rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 400;
}

.lead-text {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ---------- Glitch Effect ---------- */
[data-glitch] {
    position: relative;
    display: inline-block;
}

[data-glitch]::before,
[data-glitch]::after {
    content: attr(data-glitch-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

[data-glitch]::before {
    color: var(--accent-red);
    z-index: -1;
}

[data-glitch]::after {
    color: var(--accent-teal);
    z-index: -1;
}

[data-glitch].glitching::before {
    opacity: 0.8;
    animation: glitchBefore 0.2s steps(3) forwards;
}

[data-glitch].glitching::after {
    opacity: 0.8;
    animation: glitchAfter 0.2s steps(3) forwards;
}

@keyframes glitchBefore {
    0% { clip-path: inset(20% 0 60% 0); transform: translateX(-3px); }
    33% { clip-path: inset(50% 0 20% 0); transform: translateX(2px); }
    66% { clip-path: inset(10% 0 70% 0); transform: translateX(-4px); }
    100% { clip-path: inset(40% 0 30% 0); transform: translateX(0); opacity: 0; }
}

@keyframes glitchAfter {
    0% { clip-path: inset(60% 0 10% 0); transform: translateX(3px); }
    33% { clip-path: inset(30% 0 40% 0); transform: translateX(-2px); }
    66% { clip-path: inset(70% 0 5% 0); transform: translateX(4px); }
    100% { clip-path: inset(20% 0 50% 0); transform: translateX(0); opacity: 0; }
}

/* ---------- Pull Quote ---------- */
.pull-quote {
    font-family: var(--font-accent);
    font-size: 1.6rem;
    color: var(--accent-teal);
    padding: 1.5rem 1rem;
    margin: 1.5rem 0;
    position: relative;
    text-align: center;
    line-height: 1.4;
}

.quote-mark {
    font-size: 2.5rem;
    color: var(--shadow-sepia);
    vertical-align: text-top;
    line-height: 0.5;
}

/* ---------- Principles List ---------- */
.principles-list {
    list-style: none;
    padding: 0;
}

.principles-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.6rem 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.principle-marker {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: var(--accent-mustard);
    margin-top: 0.45rem;
}

/* ---------- Works Grid ---------- */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    position: relative;
    z-index: 1;
}

.work-card {
    background: rgba(232,224,208,0.5);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.4s ease;
}

.work-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(58,54,50,0.08);
}

.work-watercolor {
    width: 100%;
    height: 120px;
    margin-bottom: 1.2rem;
    border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%;
    opacity: 0.7;
}

.work-wc-1 {
    background:
        radial-gradient(ellipse at 30% 50%, rgba(90,138,122,0.4) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 50%, rgba(196,163,78,0.3) 0%, transparent 60%);
}

.work-wc-2 {
    background:
        radial-gradient(ellipse at 40% 40%, rgba(184,92,78,0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 65% 65%, rgba(139,122,171,0.3) 0%, transparent 60%);
}

.work-wc-3 {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(196,163,78,0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 35% 70%, rgba(90,138,122,0.3) 0%, transparent 60%);
}

.work-tag {
    display: inline-block;
    font-family: var(--font-accent);
    font-size: 0.9rem;
    color: var(--accent-teal);
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--shadow-sepia);
    border-radius: 30% 70% 50% 50% / 60% 40% 60% 40%;
    margin-top: 0.5rem;
}

/* ---------- Process Steps ---------- */
.process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.process-step {
    background: rgba(232,224,208,0.4);
    padding: 2rem;
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.4s ease;
}

.process-step:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(58,54,50,0.08);
}

.step-number {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--shadow-sepia);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

/* ---------- Contact ---------- */
.contact-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.contact-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.contact-label {
    font-family: var(--font-accent);
    font-size: 1rem;
    color: var(--text-secondary);
}

.contact-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ---------- Orbit Decorations ---------- */
.orbit-decoration {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

.orbit-1 {
    top: -30px;
    right: -60px;
    width: 300px;
    height: 300px;
}

.orbit-2 {
    bottom: -40px;
    left: -80px;
    width: 400px;
    height: 250px;
}

.orbit-3 {
    top: 20px;
    right: -40px;
    width: 250px;
    height: 250px;
}

/* ---------- Dot Scatter ---------- */
.dot-scatter {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.dot {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-teal);
    position: absolute;
    transform: translate(var(--dx), var(--dy));
    opacity: 0.6;
}

.scatter-1 { top: 20%; right: 10%; }
.scatter-2 { bottom: 15%; left: 5%; }
.scatter-3 { top: 10%; right: 20%; }

/* ---------- Wave Dividers ---------- */
.wave-divider {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
    z-index: 1;
}

.wave-svg {
    width: 100%;
    height: 100%;
}

/* ---------- Reveal Animations ---------- */
.reveal-element {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

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

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

.reveal-element[data-reveal="up"] {
    transform: translateY(30px);
}

.reveal-element.revealed {
    opacity: 1;
    transform: translate(0, 0);
}

/* ---------- Footer ---------- */
.site-footer {
    position: relative;
    z-index: 1;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--shadow-sepia);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.footer-copy {
    font-family: var(--font-accent);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    #sidebar {
        display: none;
    }

    #hamburger {
        display: block;
    }

    #mobile-overlay {
        display: flex;
    }

    #main-content {
        margin-left: 0;
        padding: 3rem 1.5rem 2rem;
    }

    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.75rem; }

    .offset-panel {
        margin-left: 0;
        margin-top: 1.5rem;
    }

    .works-grid {
        grid-template-columns: 1fr;
    }

    .process-steps {
        grid-template-columns: 1fr;
    }

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

    .orbit-decoration {
        display: none;
    }

    .section-panel {
        max-width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    #main-content {
        padding: 3rem 2rem 2rem;
    }

    .section-panel {
        max-width: 600px;
    }
}
