/* kaigenrei.com - Seapunk Insurrection */
/* Colors: #5c1a2a #8b2e4a #c4687e #f2e8d9 #2a2024 #3dd6c8 #1a6b63 #7dfff2 */
/* Fonts: Jost, Libre Baskerville, IBM Plex Mono */

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

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

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    color: #f2e8d9;
    background: #2a2024;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* SVG Defs */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Distortion Overlay */
.distortion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    filter: url(#water-distortion);
    background: transparent;
}

/* Bubble Container */
#bubble-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
}

.bubble-bg {
    animation: bubbleRise var(--duration) var(--delay) linear infinite;
    opacity: var(--opacity);
    width: var(--size);
    height: var(--size);
    background: radial-gradient(circle at 35% 30%, rgba(125,255,242,0.03), rgba(61,214,200,0.06) 70%, rgba(61,214,200,0.12));
    box-shadow: inset 4px -4px 8px rgba(125,255,242,0.04), 0 0 6px rgba(61,214,200,0.05);
    filter: blur(0.5px);
}

.bubble-mid {
    animation: bubbleRise var(--duration) var(--delay) linear infinite;
    opacity: var(--opacity);
    width: var(--size);
    height: var(--size);
    background: radial-gradient(circle at 35% 30%, rgba(125,255,242,0.05), rgba(61,214,200,0.1) 70%, rgba(61,214,200,0.18));
    box-shadow: inset 3px -3px 6px rgba(125,255,242,0.06), 0 0 4px rgba(61,214,200,0.08);
    filter: blur(0.5px);
    border: 0.5px solid rgba(61,214,200,0.1);
}

.bubble-fg {
    animation: bubbleRise var(--duration) var(--delay) linear infinite;
    opacity: var(--opacity);
    width: var(--size);
    height: var(--size);
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.08), rgba(61,214,200,0.15) 70%, rgba(61,214,200,0.25));
    box-shadow: inset 2px -2px 4px rgba(125,255,242,0.1), 0 0 3px rgba(61,214,200,0.12);
    filter: blur(0.5px);
    border: 0.5px solid rgba(61,214,200,0.15);
}

.bubble-falling {
    animation-name: bubbleFall !important;
}

@keyframes bubbleRise {
    0% {
        transform: translate(0, 100vh) translateX(0);
    }
    25% {
        transform: translate(0, 75vh) translateX(15px);
    }
    50% {
        transform: translate(0, 50vh) translateX(0);
    }
    75% {
        transform: translate(0, 25vh) translateX(-15px);
    }
    100% {
        transform: translate(0, -10vh) translateX(0);
    }
}

@keyframes bubbleFall {
    0% {
        transform: translate(0, -10vh) translateX(0);
    }
    25% {
        transform: translate(0, 25vh) translateX(15px);
    }
    50% {
        transform: translate(0, 50vh) translateX(0);
    }
    75% {
        transform: translate(0, 75vh) translateX(-15px);
    }
    100% {
        transform: translate(0, 110vh) translateX(0);
    }
}

/* Edicts - Full viewport sections */
.edict {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    overflow: hidden;
}

/* Edict 1 - The Surface (Hero) */
.edict-1 {
    background: radial-gradient(ellipse at 50% 60%, #2a2024 0%, #5c1a2a 45%, #8b2e4a 100%);
    clip-path: circle(150% at 50% 50%);
}

.edict-content {
    text-align: center;
    position: relative;
    z-index: 20;
}

.edict-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: #f2e8d9;
    text-shadow: 0 0 40px rgba(61,214,200,0.15);
    transition: text-shadow 0.3s ease;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.edict-title:hover {
    text-shadow: 0 0 60px rgba(61,214,200,0.35);
}

.edict-title-inverted {
    color: #5c1a2a;
    text-shadow: 0 0 40px rgba(92,26,42,0.15);
}

.edict-title-inverted:hover {
    text-shadow: 0 0 60px rgba(61,214,200,0.25);
}

.edict-subtitle {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #c4687e;
    line-height: 1.75;
    max-width: 38ch;
    margin: 0 auto;
}

.edict-subtitle-inverted {
    color: #8b2e4a;
}

/* Labels */
.label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3dd6c8;
    display: block;
    margin-bottom: 2rem;
}

.label-inverted {
    color: #1a6b63;
    margin-top: 2rem;
    margin-bottom: 0;
}

/* Seals */
.seal {
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
}

.seal-svg {
    animation: sealSpin 60s linear infinite;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.seal-hero .seal-svg {
    width: 100px;
    height: 100px;
}

.seal-depths .seal-svg {
    width: 80px;
    height: 80px;
}

.seal-decree .seal-svg {
    width: 110px;
    height: 110px;
}

.seal-svg:hover {
    transform: scale(1.08);
}

.seal-svg:hover circle {
    stroke: #3dd6c8;
    transition: stroke 0.3s ease;
}

@keyframes sealSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Edict 2 - The Descent */
.edict-2 {
    background: radial-gradient(ellipse at 30% 50%, #2a2024 0%, #5c1a2a 70%, #8b2e4a 100%);
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 1.2s ease-out;
}

.edict-2.revealed {
    clip-path: circle(150% at 50% 50%);
}

.edict-2-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    width: 90%;
    max-width: 1200px;
    padding: 4rem 2rem;
}

.edict-2-text {
    max-width: 38ch;
    padding-top: 2rem;
}

.body-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    line-height: 1.75;
    color: #f2e8d9;
    margin-bottom: 3rem;
}

.edict-2-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
}

.illustration-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.kelp-frond {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: kelpGrow 8s ease-out forwards;
}

.kelp-2 { animation-delay: 0.5s; }
.kelp-3 { animation-delay: 1s; }
.kelp-4 { animation-delay: 1.5s; }

@keyframes kelpGrow {
    to { stroke-dashoffset: 0; }
}

/* Edict 3 - The Depths */
.edict-3 {
    background: radial-gradient(ellipse at 50% 40%, #2a2024 0%, #5c1a2a 60%, #8b2e4a 100%);
    min-height: 100vh;
    padding: 6rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 1.2s ease-out;
}

.edict-3.revealed {
    clip-path: circle(150% at 50% 50%);
}

.edict-3-label {
    text-align: center;
    margin-bottom: 3rem;
}

.edict-3-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 1000px;
    width: 100%;
    position: relative;
}

/* Glass Cards */
.glass-card {
    background: rgba(242, 232, 217, 0.12);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(92, 26, 42, 0.15);
    border-radius: 2px;
    padding: 2.5rem 2rem;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.card-1 {
    transform: rotate(-0.5deg) translate(3px, -5px);
}

.card-2 {
    transform: rotate(0.8deg) translate(-4px, 6px);
}

.card-3 {
    transform: rotate(0.3deg) translate(6px, 2px);
}

.card-4 {
    transform: rotate(-1deg) translate(-2px, -4px);
}

.glass-card:hover {
    transform: scale(1.05) rotate(0deg) !important;
    box-shadow: 0 8px 40px rgba(61, 214, 200, 0.1), 0 0 20px rgba(125, 255, 242, 0.05);
}

.card-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3dd6c8;
    display: block;
    margin-bottom: 1rem;
}

.card-title {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: -0.02em;
    color: #f2e8d9;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(61,214,200,0.1);
    transition: text-shadow 0.3s ease;
}

.glass-card:hover .card-title {
    text-shadow: 0 0 50px rgba(61,214,200,0.3);
}

.card-body {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.75;
    color: rgba(242, 232, 217, 0.8);
}

.seal-depths {
    position: absolute;
    bottom: -40px;
    right: -40px;
    margin: 0;
}

/* Edict 4 - The Decree (Inverted) */
.edict-4 {
    background: radial-gradient(ellipse at 50% 50%, #f2e8d9 0%, #f2e8d9 60%, rgba(196, 104, 126, 0.2) 100%);
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 1.2s ease-out;
}

.edict-4.revealed {
    clip-path: circle(150% at 50% 50%);
}

/* Kelp Dividers */
.kelp-divider {
    width: 100%;
    height: 60px;
    position: relative;
    z-index: 10;
    display: block;
}

.kelp-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: kelpDividerFlow 6s ease-out forwards;
}

@keyframes kelpDividerFlow {
    to { stroke-dashoffset: 0; }
}

/* Scroll Indicator */
.scroll-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

#scroll-indicator svg {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .edict-2-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .edict-2-text {
        max-width: 100%;
        order: 1;
    }

    .edict-2-illustration {
        order: 2;
    }

    .edict-3-grid {
        grid-template-columns: 1fr;
    }

    .glass-card {
        transform: rotate(0deg) translate(0, 0) !important;
    }

    .edict-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
}
