/* ============================================
   simulai.net - Glitch-Encoded Manuscript
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    font-size: 1rem;
    line-height: 1.8;
    font-weight: 400;
    color: #4A6A8A;
    background-color: #E8F0F8;
    overflow-x: hidden;
}

/* --- Paper-Aged Treatment --- */
.paper-aged {
    background-image: radial-gradient(ellipse at 60% 40%, rgba(200,190,170,0.15), transparent);
    filter: contrast(1.02) brightness(0.98);
}

/* --- Floating Bubbles --- */
.bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

@keyframes bubbleFloat {
    0% { transform: translateY(100vh) scale(1); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-20px) scale(1.05); opacity: 0; }
}

.bubble {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: #A8D4E6;
    opacity: 0.15;
    left: var(--left);
    bottom: -120px;
    animation: bubbleFloat var(--duration) ease-in-out var(--delay) infinite;
}

.bubble-cluster {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
}

.bubble-static {
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: #A8D4E6;
    opacity: var(--opacity);
    flex-shrink: 0;
}

/* --- Main Manuscript --- */
.manuscript {
    position: relative;
    z-index: 1;
}

/* --- Sections --- */
.section {
    position: relative;
    padding: 4rem 2rem;
}

/* --- Hero --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(4rem, 9vw, 7rem);
    font-weight: 700;
    color: #1A2A3A;
    letter-spacing: 0.01em;
    line-height: 1.05;
    position: relative;
}

/* Glitch effect layers */
.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: #E8A0B0;
    z-index: -1;
}

.glitch-text::after {
    color: #A8D4E6;
    z-index: -1;
}

@keyframes glitchBurst {
    0%, 100% { opacity: 0; transform: translate(0, 0); }
    50% { opacity: 0.8; }
}

.glitch-text.glitching::before {
    animation: glitchBurst 60ms steps(2) forwards;
    transform: translate(-2px, 1px);
    opacity: 0.8;
}

.glitch-text.glitching::after {
    animation: glitchBurst 60ms steps(2) forwards;
    transform: translate(2px, -1px);
    opacity: 0.8;
}

.hero-subtitle {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    color: #7A8ABE;
    margin-top: 1rem;
    font-style: italic;
}

/* --- Glitch Bands --- */
.glitch-band {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #E8A0B0, transparent 30%, #A8D4E6 60%, transparent);
    position: relative;
    z-index: 2;
}

/* --- Z-Pattern Sections --- */
.z-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.z-left {
    margin-left: 8vw;
    max-width: 600px;
    justify-content: flex-start;
}

.z-right {
    margin-left: auto;
    margin-right: 8vw;
    max-width: 600px;
    justify-content: flex-end;
}

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

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

/* --- Flip Cards --- */
.flip-card {
    perspective: 1000px;
    width: 100%;
    max-width: 500px;
    min-height: 280px;
}

.flip-card-small {
    max-width: 400px;
    min-height: 200px;
    margin: 0 auto;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: inherit;
    backface-visibility: hidden;
    padding: 2.5rem;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flip-card-front {
    background: #F0F5FA;
    box-shadow: inset 0 0 40px rgba(160,140,110,0.1), 0 4px 20px rgba(26,42,58,0.08);
}

.flip-card-back {
    background: #1A2A3A;
    transform: rotateY(180deg);
}

/* --- Card Typography --- */
.card-heading {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 700;
    color: #1A2A3A;
    letter-spacing: 0.01em;
    margin-bottom: 1rem;
    line-height: 1.15;
}

.card-text {
    font-family: 'Lora', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #4A6A8A;
}

.card-heading-digital {
    font-family: monospace;
    font-size: 1.4rem;
    color: #A8D4E6;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.card-text-digital {
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #7A8ABE;
}

/* --- Closing Section --- */
.closing-section {
    min-height: 60vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.closing-title {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    color: #1A2A3A;
    margin-bottom: 0.5rem;
}

.closing-text {
    font-family: 'Lora', serif;
    font-size: 1rem;
    color: #7A8ABE;
    font-style: italic;
}

.closing-title-digital {
    font-family: monospace;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #A8D4E6;
    margin-bottom: 0.5rem;
}

.closing-text-digital {
    font-family: monospace;
    font-size: 0.85rem;
    color: #E8A0B0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .z-left,
    .z-right {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
        max-width: 100%;
    }

    .section {
        padding: 3rem 1.5rem;
    }

    .bubble-cluster {
        display: none;
    }
}
