/* ========================================
   mujun.day - Styles
   Hand-drawn journal aesthetic with gold-black luxury
   ======================================== */

/* Custom Properties */
:root {
    --bg-light: #F8F2E8;
    --bg-dark: #1A1A1A;
    --gold-primary: #D4AF37;
    --gold-muted: #B8962E;
    --text-primary: #2C2C2C;
    --text-on-dark: #C8B89A;
    --annotation: #8B7355;
    --bubble-surface: #E8DCC8;
    --sepia-wash: #3A3020;
    --gold-highlight: #F0D060;

    --bg-color: var(--bg-light);
    --text-color: var(--text-primary);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    font-weight: 400;
    line-height: 1.9;
    font-size: clamp(1rem, 1.7vw, 1.15rem);
    color: var(--text-primary);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* ========================================
   Typography
   ======================================== */

h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: clamp(2.6rem, 7.5vw, 5.5rem);
}

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.02em;
    font-size: clamp(1.5rem, 3.5vw, 2.6rem);
}

h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    letter-spacing: 0.02em;
    margin-bottom: 0.5em;
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    color: #8B7355;
    opacity: 0.8;
}

/* Gold text effect */
.gold-text {
    background: linear-gradient(135deg, #D4AF37 0%, #F0D060 30%, #D4AF37 50%, #B8962E 70%, #D4AF37 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: goldShimmer 6s ease-in-out infinite;
}

@keyframes goldShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ========================================
   Sections - General
   ======================================== */

.section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: background-color 0.8s ease;
}

/* ========================================
   Section I: The Morning Page
   ======================================== */

.section-morning {
    background-color: var(--bg-light);
    /* Parchment texture via gradient */
    background-image:
        linear-gradient(90deg, rgba(139,115,85,0.03) 1px, transparent 1px),
        linear-gradient(rgba(139,115,85,0.03) 1px, transparent 1px),
        radial-gradient(ellipse at 30% 40%, rgba(212,175,55,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(184,150,46,0.03) 0%, transparent 50%);
    background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

/* Clock watermark */
.clock-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(70vw, 500px);
    height: min(70vw, 500px);
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

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

.clock-face {
    fill: none;
    stroke: #2C2C2C;
    stroke-width: 2.5;
    stroke-dasharray: 3 0;
}

.clock-face-inner {
    fill: none;
    stroke: #2C2C2C;
    stroke-width: 1;
    opacity: 0.5;
}

.clock-tick {
    stroke: #2C2C2C;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.clock-hand {
    stroke: #D4AF37;
    stroke-width: 3;
    stroke-linecap: round;
    transform-origin: 200px 200px;
}

.clock-hand-hour {
    animation: rotateHour 3600s linear infinite;
}

.clock-hand-minute {
    animation: rotateMinute 60s linear infinite;
    stroke-width: 2;
}

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

@keyframes rotateMinute {
    from { transform: rotate(180deg); }
    to { transform: rotate(540deg); }
}

.clock-center {
    fill: #D4AF37;
}

.ink-splatter {
    fill: #2C2C2C;
    opacity: 0.6;
}

.ink-splatter-dark {
    fill: #8B7355;
    opacity: 0.4;
}

/* Morning content */
.morning-content {
    position: relative;
    z-index: 2;
}

.morning-content h1 {
    margin-bottom: 0.15em;
    line-height: 1.1;
}

.morning-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #2C2C2C;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

.hand-drawn-divider {
    width: min(280px, 70vw);
    margin: 0.8rem auto;
}

.hand-drawn-divider svg {
    width: 100%;
    height: 20px;
}

.divider-line {
    fill: none;
    stroke: #B8962E;
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.6;
}

.morning-tagline {
    font-size: clamp(1rem, 2vw, 1.3rem);
    line-height: 1.7;
    margin-top: 0.5rem;
}

/* Ink decorations */
.ink-decoration {
    position: absolute;
    pointer-events: none;
    opacity: 0.3;
}

.ink-deco-1 {
    width: 30px;
    bottom: 15%;
    left: 10%;
}

.ink-deco-2 {
    width: 40px;
    top: 20%;
    right: 8%;
}

/* ========================================
   Section II: The Contradictions Journal
   ======================================== */

.section-journal {
    background-color: var(--bg-light);
    background-image:
        radial-gradient(ellipse at 20% 30%, rgba(58,48,32,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(58,48,32,0.06) 0%, transparent 40%);
    padding: 6rem 2rem;
    min-height: auto;
}

.journal-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 2;
}

.journal-header h2 {
    color: #2C2C2C;
}

.journal-header .hand-drawn-divider {
    margin-top: 1rem;
}

/* Connecting line */
.journal-connecting-lines {
    position: absolute;
    left: 50%;
    top: 0;
    width: 6px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

.connecting-line {
    fill: none;
    stroke: #8B7355;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Journal entries */
.journal-entries {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.journal-entry {
    position: relative;
    width: var(--width, 55%);
    transform: rotate(var(--rotation, 0deg));
    padding: 2rem 2.5rem;
    margin-bottom: 3rem;
    background: rgba(248,242,232,0.6);
    border-left: 2px solid rgba(184,150,46,0.3);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.journal-entry:hover {
    transform: rotate(0deg);
    box-shadow: 0 4px 20px rgba(58,48,32,0.08);
}

.entry-left {
    margin-left: 5%;
    margin-right: auto;
}

.entry-right {
    margin-left: auto;
    margin-right: 5%;
}

.entry-annotation {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.journal-entry h3 {
    color: #B8962E;
}

.journal-entry p {
    color: #2C2C2C;
    line-height: 1.9;
}

/* Journal ink decorations */
.ink-deco-journal-1 {
    width: 25px;
    top: 30%;
    right: 5%;
}

.ink-deco-journal-2 {
    width: 20px;
    bottom: 15%;
    left: 4%;
}

/* ========================================
   Section III: The Bubble Interlude
   ======================================== */

.section-bubbles {
    background-color: #3A3020;
    background-image:
        radial-gradient(ellipse at 50% 50%, rgba(212,175,55,0.05) 0%, transparent 60%);
    min-height: 100vh;
    padding: 4rem 2rem;
    position: relative;
}

.bubbles-header {
    text-align: center;
    position: relative;
    z-index: 3;
    margin-bottom: 2rem;
}

.bubbles-header h2 {
    color: #D4AF37;
}

.bubbles-header .annotation-text {
    color: #C8B89A;
    opacity: 0.6;
}

/* Bubbles container */
.bubbles-container {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 400px;
    overflow: hidden;
}

.bubble {
    position: absolute;
    width: var(--size, 100px);
    height: var(--size, 100px);
    left: var(--x, 50%);
    bottom: -150px;
    border-radius: 48% 52% 45% 55% / 50% 48% 52% 50%;
    background: rgba(232,220,200,0.08);
    border: 1px solid #B8962E;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: rise var(--duration, 20s) var(--delay, 0s) linear infinite, wobble 4s ease-in-out infinite;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    z-index: 2;
}

.bubble:hover {
    border-color: #D4AF37;
    background: rgba(232,220,200,0.15);
}

.bubble.popped {
    transform: scale(0) !important;
    opacity: 0 !important;
    pointer-events: none;
    animation: none;
}

.bubble-text {
    color: #C8B89A;
    font-size: clamp(0.85rem, 1.3vw, 1.1rem);
    text-align: center;
    pointer-events: none;
    opacity: 0.9;
}

@keyframes rise {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(calc(-70vh - 200px));
    }
}

@keyframes wobble {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.97);
    }
    50% {
        transform: scale(1.03);
    }
    75% {
        transform: scale(0.98);
    }
}

/* Bubble reveal text */
.bubble-reveal {
    position: absolute;
    z-index: 3;
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: #D4AF37;
    text-align: center;
    opacity: 0;
    animation: fadeInReveal 0.5s 0.3s both;
    pointer-events: none;
    white-space: nowrap;
}

@keyframes fadeInReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reveal container */
.bubble-reveals-container {
    position: relative;
    z-index: 3;
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 2rem;
}

.revealed-text {
    font-family: 'Caveat', cursive;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: #D4AF37;
    opacity: 0;
    animation: fadeInReveal 0.5s both;
    text-align: center;
}

/* ========================================
   Section IV: The Midnight Reflection
   ======================================== */

.section-midnight {
    background-color: #1A1A1A;
    background-image:
        radial-gradient(ellipse at 50% 30%, rgba(212,175,55,0.03) 0%, transparent 50%);
    padding: 6rem 2rem;
    align-items: center;
}

/* Midnight line */
.midnight-line-container {
    position: absolute;
    left: 50%;
    top: 0;
    width: 6px;
    height: 100%;
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
}

.midnight-line-svg {
    width: 100%;
    height: 100%;
}

.midnight-line {
    fill: none;
    stroke: #D4AF37;
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.2;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 3s ease;
}

.midnight-line.drawn {
    stroke-dashoffset: 0;
}

/* Midnight text */
.midnight-reflections {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.midnight-text {
    font-family: 'Lora', serif;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: #C8B89A;
    line-height: 2.4;
    opacity: 0;
    transform: translateX(var(--offset, 0));
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.midnight-text.visible {
    opacity: 1;
    transform: translateX(0);
}

.midnight-text.gold-accent {
    color: #D4AF37;
    font-style: italic;
}

/* Gold leaf accents */
.gold-leaf {
    position: absolute;
    width: 3px;
    height: 18px;
    background: linear-gradient(135deg, #D4AF37 0%, #F0D060 30%, #D4AF37 50%, #B8962E 70%, #D4AF37 100%);
    background-size: 200% 200%;
    animation: goldShimmer 4s ease-in-out infinite;
    opacity: 0.4;
    z-index: 1;
}

.gold-leaf-1 {
    top: 15%;
    left: 20%;
    transform: rotate(15deg);
    height: 25px;
}

.gold-leaf-2 {
    top: 40%;
    right: 15%;
    transform: rotate(-10deg);
    height: 20px;
}

.gold-leaf-3 {
    bottom: 35%;
    left: 12%;
    transform: rotate(25deg);
    height: 15px;
}

.gold-leaf-4 {
    bottom: 15%;
    right: 22%;
    transform: rotate(-20deg);
    height: 22px;
}

/* Midnight footer */
.midnight-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-top: 6rem;
}

.midnight-footer .annotation-text {
    color: #8B7355;
    opacity: 0.5;
    font-size: clamp(0.85rem, 1.3vw, 1rem);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .journal-entry {
        width: 90% !important;
        transform: rotate(0deg) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .bubble {
        --size: 80px !important;
    }

    .bubbles-container {
        height: 60vh;
    }

    .midnight-text {
        --offset: 0px !important;
    }

    .gold-leaf {
        display: none;
    }

    .clock-watermark {
        width: 80vw;
        height: 80vw;
    }

    .ink-decoration {
        display: none;
    }
}

@media (max-width: 480px) {
    .section-morning {
        padding: 1.5rem;
    }

    .section-journal {
        padding: 4rem 1rem;
    }

    .journal-entry {
        padding: 1.5rem;
    }

    .bubbles-container {
        height: 50vh;
    }

    .midnight-reflections {
        padding: 0 1rem;
    }
}
