/* ==========================================================================
   RRIPPL.com — Styles
   Memphis-meets-Palazzo | Opulent Grand | Magazine Spread Layout
   ========================================================================== */

/* ---------- CSS Variables ---------- */
:root {
    --deep: #0F052C;
    --amethyst: #2D1B69;
    --gold: #E8C547;
    --pink: #FF6B9D;
    --teal: #00D4AA;
    --violet: #7B2FBE;
    --text-light: #F0E6FF;
    --text-warm: #FFF5D6;
    --font-display: 'Bungee', cursive;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Playfair Display', serif;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--deep);
    color: var(--text-warm);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ---------- Dotted Grid Watermark ---------- */
.dotted-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #F0E6FF 1.5px, transparent 1.5px);
    background-size: 40px 40px;
    opacity: 0.03;
}

/* ---------- Magazine Spine ---------- */
.magazine-spine {
    position: fixed;
    top: 0;
    left: 8.33%;
    width: 2px;
    height: 100vh;
    background: var(--gold);
    z-index: 10;
    opacity: 0.5;
    pointer-events: none;
}

/* ---------- Floating Nav ---------- */
#main-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 40px);
    max-width: 1200px;
    height: 60px;
    background: rgba(15, 5, 44, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px;
    border: 1px solid rgba(232, 197, 71, 0.15);
    transition: height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
}

#main-nav.nav-compact {
    height: 48px;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 32px;
}

.nav-wordmark {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow:
        1px 0 #FF6B9D,
        -1px 0 #00D4AA;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.2s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width 0.3s ease;
}

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

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

/* Hamburger */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 20px;
    position: relative;
    z-index: 1010;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--gold);
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 9px; }
.hamburger span:nth-child(3) { top: 18px; }

.hamburger.active span:nth-child(1) {
    top: 9px;
    transform: rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    top: 9px;
    transform: rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: linear-gradient(135deg, #0F052C 0%, #2D1B69 25%, #7B2FBE 50%, #00D4AA 75%, #E8C547 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.mobile-menu.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-link {
    font-family: var(--font-body);
    font-size: 1.5rem;
    color: var(--deep);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* ---------- Spreads (Sections) ---------- */
.spread {
    position: relative;
    width: 100%;
    min-height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 80px 60px;
}

/* ---------- SPREAD: Hero ---------- */
.spread-hero {
    background: linear-gradient(135deg, #0F052C 0%, #2D1B69 30%, #7B2FBE 55%, #00D4AA 80%, #E8C547 100%);
    flex-direction: column;
}

.hero-content {
    position: relative;
    z-index: 5;
    text-align: center;
}

.hero-wordmark {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 8rem);
    color: var(--text-light);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    position: relative;
}

.hero-wordmark .letter {
    display: inline-block;
    opacity: 0;
    transform: translateX(6px);
    animation: none;
}

.hero-wordmark .letter.animate-in {
    animation: letterShakeIn 0.4s ease-out forwards;
}

.hero-wordmark.glitch-active .letter {
    text-shadow:
        2px 1px #FF6B9D,
        -2px -1px #00D4AA,
        1px -1px #E8C547;
    animation: glitchPulse 4s ease-in-out infinite;
}

.hero-subtitle {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    color: var(--text-warm);
    margin-top: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 1s, transform 0.8s ease 1s;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Aurora Ribbons ---------- */
.aurora-ribbon {
    position: absolute;
    width: 120%;
    height: 60%;
    left: -10%;
    z-index: 1;
    pointer-events: none;
}

.aurora-ribbon-1 {
    top: 10%;
    animation: auroraFloat1 25s linear infinite;
}

.aurora-ribbon-2 {
    top: 30%;
    animation: auroraFloat2 30s linear infinite;
}

.aurora-ribbon-3 {
    top: 50%;
    animation: auroraFloat3 28s linear infinite;
}

.aurora-ribbon-4 {
    top: 20%;
    animation: auroraFloat1 22s linear infinite;
}

@keyframes auroraFloat1 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5%); }
}

@keyframes auroraFloat2 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-4%); }
}

@keyframes auroraFloat3 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(3%); }
}

/* ---------- Totems ---------- */
.totem {
    position: relative;
    z-index: 3;
}

.totem-svg {
    width: 100%;
    height: auto;
    filter:
        drop-shadow(2px 0 0 rgba(255, 107, 157, 0.3))
        drop-shadow(-2px 0 0 rgba(0, 212, 170, 0.3));
}

.totem-left,
.totem-right {
    position: absolute;
    width: clamp(60px, 8vw, 120px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
}

.totem-left {
    left: 10%;
    animation: totemOscillate 8s ease-in-out infinite;
}

.totem-right {
    right: 10%;
    animation: totemOscillate 8s ease-in-out infinite 2s;
}

.totem-inline {
    max-width: 160px;
    margin: 24px auto;
    animation: totemOscillate 8s ease-in-out infinite;
}

.totem-large {
    max-width: 200px;
}

@keyframes totemOscillate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}

/* ---------- Zigzag Dividers ---------- */
.zigzag-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 8;
    pointer-events: none;
}

.zigzag-line {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.zigzag-line.drawn {
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 8px #E8C547);
}

/* ---------- Spread Backgrounds ---------- */
.spread-manifesto {
    background: var(--deep);
}

.spread-vision {
    background: var(--amethyst);
}

.spread-craft {
    background: var(--deep);
}

.spread-signal {
    background: var(--amethyst);
}

.spread-coda {
    background: linear-gradient(135deg, #0F052C 0%, #2D1B69 30%, #7B2FBE 55%, #00D4AA 80%, #E8C547 100%);
    flex-direction: column;
}

/* ---------- Spread Grid Layout ---------- */
.spread-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 48px;
    width: 100%;
    max-width: 1200px;
    align-items: center;
    position: relative;
    z-index: 5;
}

.spread-grid-reverse {
    grid-template-columns: 5fr 7fr;
}

/* ---------- Folio Numbers ---------- */
.folio-number {
    font-family: var(--font-accent);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(3rem, 6vw, 6rem);
    color: var(--gold);
    opacity: 0.15;
    line-height: 1;
    display: block;
    margin-bottom: -20px;
}

/* ---------- Section Titles ---------- */
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 3rem);
    color: var(--text-light);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 24px;
    text-shadow:
        1px 0 #FF6B9D,
        -1px 0 #00D4AA;
}

/* ---------- Body Text ---------- */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-warm);
    margin-bottom: 16px;
    letter-spacing: 0.01em;
}

.body-text em {
    font-style: italic;
    color: var(--gold);
}

.caption-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-light);
    opacity: 0.8;
}

/* ---------- Terrazzo Panel ---------- */
.terrazzo-panel {
    position: relative;
    padding: 28px 32px;
    border: 2px solid var(--gold);
    border-radius: 0;
    background:
        radial-gradient(circle 3px at 15% 25%, rgba(232, 197, 71, 0.08) 100%, transparent 100%),
        radial-gradient(circle 5px at 45% 60%, rgba(255, 107, 157, 0.06) 100%, transparent 100%),
        radial-gradient(circle 4px at 75% 30%, rgba(0, 212, 170, 0.07) 100%, transparent 100%),
        radial-gradient(circle 6px at 85% 75%, rgba(123, 47, 190, 0.06) 100%, transparent 100%),
        radial-gradient(circle 3px at 30% 80%, rgba(232, 197, 71, 0.05) 100%, transparent 100%),
        radial-gradient(circle 4px at 60% 15%, rgba(255, 107, 157, 0.07) 100%, transparent 100%),
        radial-gradient(circle 5px at 10% 55%, rgba(0, 212, 170, 0.06) 100%, transparent 100%),
        radial-gradient(circle 3px at 90% 45%, rgba(123, 47, 190, 0.08) 100%, transparent 100%),
        rgba(15, 5, 44, 0.4);
    backdrop-filter: blur(1px);
}

/* ---------- Pull Quotes ---------- */
.pull-quote {
    font-family: var(--font-accent);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--text-light);
    line-height: 1.4;
    text-align: center;
    padding: 20px 0;
    position: relative;
}

.quote-mark {
    color: var(--gold);
    font-size: 1.5em;
}

/* ---------- Geometric Accents ---------- */
.geometric-accent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.geo-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--pink);
    opacity: 0.5;
    animation: geoFloat 6s ease-in-out infinite;
}

.geo-triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 80px solid var(--teal);
    opacity: 0.5;
    animation: geoFloat 6s ease-in-out infinite 1s;
}

.geo-zigzag-block {
    width: 100px;
    height: 40px;
    background: repeating-linear-gradient(
        45deg,
        #FF6B9D 0px,
        #FF6B9D 4px,
        transparent 4px,
        transparent 12px
    );
    opacity: 0.4;
    animation: geoFloat 6s ease-in-out infinite 2s;
}

@keyframes geoFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}

/* ---------- Craft Cards ---------- */
.craft-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
}

.craft-card {
    background: rgba(45, 27, 105, 0.5);
    border: 1px solid rgba(232, 197, 71, 0.2);
    border-radius: 0;
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.3s ease, transform 0.2s ease;
}

.craft-card:hover {
    border-color: var(--gold);
}

.craft-card-accent {
    width: 100%;
    height: 6px;
    margin-bottom: 16px;
}

.memphis-stripe {
    background: repeating-linear-gradient(
        45deg,
        #FF6B9D 0px,
        #FF6B9D 4px,
        transparent 4px,
        transparent 12px
    );
}

.memphis-dots {
    background: radial-gradient(circle 3px, #00D4AA 100%, transparent 100%);
    background-size: 12px 6px;
}

.memphis-zigzag {
    background: linear-gradient(135deg, #E8C547 25%, transparent 25%) -5px 0,
                linear-gradient(225deg, #E8C547 25%, transparent 25%) -5px 0,
                linear-gradient(315deg, #E8C547 25%, transparent 25%),
                linear-gradient(45deg, #E8C547 25%, transparent 25%);
    background-size: 10px 6px;
    background-color: transparent;
}

.craft-card-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.craft-card-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ---------- Coda / Footer Spread ---------- */
.coda-content {
    position: relative;
    z-index: 5;
    text-align: center;
}

.coda-wordmark-wrapper {
    margin-bottom: 16px;
}

.coda-wordmark {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 8rem);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
}

.glitch-text {
    text-shadow:
        2px 1px #FF6B9D,
        -2px -1px #00D4AA,
        1px -1px #E8C547;
    animation: glitchPulse 4s ease-in-out infinite;
}

.coda-tagline {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-warm);
    margin-bottom: 40px;
}

.coda-totems {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 40px;
}

.coda-totems .totem-inline {
    max-width: 80px;
}

.coda-copyright {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--text-light);
    opacity: 0.6;
    letter-spacing: 0.04em;
}

/* ---------- Reveal Animations ---------- */
.reveal-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Shake-Error Interaction ---------- */
.shake-hover {
    cursor: pointer;
    transition: transform 0.1s ease;
}

.shake-hover:hover {
    animation: shakeError 0.4s ease-in-out;
}

.shake-hover:hover .craft-card-title,
.shake-hover:hover .nav-link {
    text-shadow:
        2px 0 #FF6B9D,
        -2px 0 #00D4AA;
}

/* ---------- Keyframe Animations ---------- */
@keyframes letterShakeIn {
    0% {
        opacity: 0;
        transform: translateX(6px);
    }
    15% { transform: translateX(-5px); opacity: 1; }
    30% { transform: translateX(4px); }
    45% { transform: translateX(-3px); }
    60% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes glitchPulse {
    0%, 100% {
        text-shadow:
            2px 1px #FF6B9D,
            -2px -1px #00D4AA,
            1px -1px #E8C547;
    }
    25% {
        text-shadow:
            -1px 2px #FF6B9D,
            1px -2px #00D4AA,
            -2px 1px #E8C547;
    }
    50% {
        text-shadow:
            2px -1px #FF6B9D,
            -2px 1px #00D4AA,
            1px 2px #E8C547;
    }
    75% {
        text-shadow:
            -2px -1px #FF6B9D,
            2px 1px #00D4AA,
            -1px -2px #E8C547;
    }
}

@keyframes shakeError {
    0% { transform: translateX(0); }
    12.5% { transform: translateX(-4px); }
    25% { transform: translateX(4px); }
    37.5% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    62.5% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

@keyframes zigzagGlow {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(232, 197, 71, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(232, 197, 71, 0.7));
    }
}

/* ---------- Responsive: Tablet ---------- */
@media (max-width: 1024px) {
    .spread {
        padding: 100px 40px 60px;
    }

    .spread-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .spread-grid-reverse {
        grid-template-columns: 1fr;
    }

    .spread-grid-reverse .spread-col-minor {
        order: 2;
    }

    .spread-grid-reverse .spread-col-major {
        order: 1;
    }

    .craft-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .totem-left, .totem-right {
        width: clamp(40px, 6vw, 80px);
    }
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 768px) {
    .spread {
        padding: 90px 20px 50px;
        min-height: 100vh;
    }

    html {
        scroll-snap-type: y proximity;
    }

    .nav-links {
        display: none;
    }

    .hamburger {
        display: block;
    }

    .magazine-spine {
        opacity: 0.2;
    }

    .spread-grid {
        gap: 24px;
    }

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

    .totem-left {
        left: 5%;
        width: 50px;
    }

    .totem-right {
        right: 5%;
        width: 50px;
    }

    .totem-inline {
        max-width: 100px;
    }

    .coda-totems {
        gap: 24px;
    }

    .coda-totems .totem-inline {
        max-width: 50px;
    }

    .hero-wordmark {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .folio-number {
        font-size: clamp(2rem, 8vw, 4rem);
    }

    .nav-inner {
        padding: 0 20px;
    }

    .geometric-accent {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .geo-circle {
        width: 50px;
        height: 50px;
    }

    .geo-triangle {
        border-left-width: 30px;
        border-right-width: 30px;
        border-bottom-width: 50px;
    }

    .geo-zigzag-block {
        width: 60px;
        height: 25px;
    }
}

/* ---------- Reduce motion for accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-snap-type: none;
    }
}
