/* ===========================================
   sora.day - Coastal McBling Dreamscape
   =========================================== */

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

:root {
    --deep-water: #0E1B2E;
    --tidal-silver: #B8C5D4;
    --sea-glass: #5E9EAD;
    --foam-white: #E8EDF2;
    --twilight-blush: #8B6F7E;
    --bling-gold: #A8956E;
    --shallow-water: #2D6B74;
    --abyss: #070D17;
    --mid-blue: #1B3A5C;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--abyss);
    color: var(--tidal-silver);
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    font-weight: 400;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Sidebar --- */
#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

#sidebar-border {
    position: absolute;
    right: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, var(--sea-glass), var(--twilight-blush), var(--bling-gold), var(--shallow-water), var(--sea-glass));
    background-size: 100% 300%;
    animation: borderCycle 8s ease-in-out infinite;
}

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

#sidebar-content {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    background: linear-gradient(180deg, rgba(14, 27, 46, 0.85), rgba(7, 13, 23, 0.92));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

#sidebar-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sidebar-logo {
    font-family: 'Space Mono', monospace;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--foam-white);
    text-transform: lowercase;
}

.sidebar-sub {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--sea-glass);
    opacity: 0.7;
}

#sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.nav-glyph {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.4s ease;
    will-change: opacity;
}

.nav-glyph:hover {
    opacity: 1;
}

.nav-glyph.active {
    opacity: 1;
}

#tide-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tide-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--sea-glass);
    opacity: 0.5;
    text-transform: uppercase;
}

/* --- Mobile Top Bar --- */
#topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 110;
    background: linear-gradient(180deg, rgba(7, 13, 23, 0.95), rgba(14, 27, 46, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(94, 158, 173, 0.2);
}

.topbar-logo {
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--foam-white);
}

.topbar-dot {
    color: var(--sea-glass);
    opacity: 0.7;
}

#topbar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#topbar-toggle:hover {
    opacity: 1;
}

/* --- Main Content --- */
#main-content {
    margin-left: 280px;
    position: relative;
    z-index: 1;
}

/* --- Layer Shared --- */
.layer {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
}

/* --- Opening Layer --- */
#layer-opening {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(170deg, var(--deep-water) 0%, var(--mid-blue) 45%, var(--shallow-water) 100%);
}

#layer-opening .layer-bg {
    background: radial-gradient(ellipse at 30% 20%, rgba(168, 149, 110, 0.08) 0%, transparent 60%);
}

.sora-title-container {
    position: relative;
    z-index: 2;
}

#sora-title {
    font-family: 'Space Mono', monospace;
    font-size: clamp(4rem, 18vw, 14rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: transparent;
    -webkit-text-stroke: 1px var(--foam-white);
    text-transform: lowercase;
    position: relative;
    line-height: 1;
    animation: titleBorder 8s ease-in-out infinite;
    will-change: -webkit-text-stroke-color;
}

@keyframes titleBorder {
    0% { -webkit-text-stroke-color: var(--foam-white); }
    25% { -webkit-text-stroke-color: var(--sea-glass); }
    50% { -webkit-text-stroke-color: var(--twilight-blush); }
    75% { -webkit-text-stroke-color: var(--bling-gold); }
    100% { -webkit-text-stroke-color: var(--foam-white); }
}

.opening-subtitle {
    margin-top: 32px;
    z-index: 2;
}

.accent-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--tidal-silver);
    opacity: 0.6;
    letter-spacing: 0.04em;
}

/* Diamond floats */
.diamond-float {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1px solid var(--bling-gold);
    opacity: 0.2;
    transform: rotate(45deg);
    will-change: transform;
}

.diamond-float-1 {
    top: 25%;
    left: 15%;
    animation: floatDiamond 40s ease-in-out infinite alternate;
}

.diamond-float-2 {
    top: 60%;
    right: 20%;
    width: 20px;
    height: 20px;
    border-color: var(--sea-glass);
    animation: floatDiamond 35s ease-in-out infinite alternate-reverse;
    animation-delay: -10s;
}

.diamond-float-3 {
    bottom: 20%;
    left: 40%;
    width: 40px;
    height: 40px;
    border-color: var(--twilight-blush);
    opacity: 0.15;
    animation: floatDiamond 50s ease-in-out infinite alternate;
    animation-delay: -25s;
}

@keyframes floatDiamond {
    0% { transform: rotate(45deg) translate(0, 0); }
    25% { transform: rotate(45deg) translate(15px, -20px); }
    50% { transform: rotate(45deg) translate(-10px, -35px); }
    75% { transform: rotate(45deg) translate(20px, -15px); }
    100% { transform: rotate(45deg) translate(-5px, -30px); }
}

/* --- Descent Layers --- */
.descent-layer {
    padding: 120px 60px;
    min-height: 100vh;
}

.layer-bg-1 {
    background: linear-gradient(170deg, rgba(14, 27, 46, 0.6) 0%, rgba(27, 58, 92, 0.4) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.layer-bg-2 {
    background: linear-gradient(170deg, rgba(27, 58, 92, 0.5) 0%, rgba(45, 107, 116, 0.3) 50%, rgba(139, 111, 126, 0.2) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.layer-bg-3 {
    background: linear-gradient(170deg, rgba(139, 111, 126, 0.15) 0%, rgba(14, 27, 46, 0.7) 100%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.layer-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.offset-left {
    align-self: flex-start;
    margin-right: auto;
}

.offset-right {
    align-self: flex-end;
    margin-left: auto;
}

/* --- Glass Cards --- */
.glass-card {
    background: rgba(14, 27, 46, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(94, 158, 173, 0.2);
    border-radius: 2px;
    padding: 48px 56px;
    box-shadow: 0 24px 48px rgba(27, 58, 92, 0.2);
    position: relative;
    overflow: hidden;
    animation: cardBorder 10s ease-in-out infinite;
    will-change: border-color;
}

@keyframes cardBorder {
    0% { border-color: rgba(94, 158, 173, 0.2); }
    25% { border-color: rgba(139, 111, 126, 0.25); }
    50% { border-color: rgba(168, 149, 110, 0.2); }
    75% { border-color: rgba(45, 107, 116, 0.25); }
    100% { border-color: rgba(94, 158, 173, 0.2); }
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168, 149, 110, 0.3), transparent);
}

.glass-card-warm {
    background: rgba(139, 111, 126, 0.1);
    border-color: rgba(139, 111, 126, 0.2);
}

.glass-card-deep {
    background: rgba(7, 13, 23, 0.6);
    border-color: rgba(45, 107, 116, 0.2);
}

.poetic-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 400;
    line-height: 1.5;
    color: var(--foam-white);
    opacity: 0.85;
}

.italic-accent {
    color: var(--tidal-silver);
}

/* --- Decorations --- */
.layer-decoration {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

#layer-1 .layer-decoration {
    right: 5%;
    top: 10%;
    animation: driftSlow 45s ease-in-out infinite alternate;
    will-change: transform;
}

.decoration-right {
    left: 5% !important;
    right: auto !important;
    bottom: 10% !important;
    top: auto !important;
    animation: driftSlow 55s ease-in-out infinite alternate-reverse !important;
    will-change: transform;
}

#layer-3 .layer-decoration {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: driftSlow 60s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes driftSlow {
    0% { transform: translate(0, 0); }
    25% { transform: translate(10px, -15px); }
    50% { transform: translate(-8px, 10px); }
    75% { transform: translate(12px, 5px); }
    100% { transform: translate(-5px, -10px); }
}

.concentric-circles {
    opacity: 0.6;
}

.concentric-offset {
    opacity: 0.4;
}

/* Crystal hexagons */
.crystal-hex {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}

.crystal-hex-1 {
    right: 15%;
    bottom: 15%;
    animation: driftSlow 50s ease-in-out infinite alternate;
    animation-delay: -15s;
}

.crystal-hex-2 {
    left: 10%;
    top: 20%;
    animation: driftSlow 40s ease-in-out infinite alternate-reverse;
    animation-delay: -8s;
}

/* Wave backgrounds */
.wave-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 0;
    pointer-events: none;
}

.wave-bg-deep {
    top: 0;
    bottom: auto;
}

.wave-path {
    will-change: stroke-dashoffset;
}

.wave-path-1 {
    stroke-dasharray: 20 10;
    animation: waveFlow 30s linear infinite;
}

.wave-path-2 {
    stroke-dasharray: 15 12;
    animation: waveFlow 25s linear infinite reverse;
}

.wave-path-3 {
    stroke-dasharray: 25 8;
    animation: waveFlow 35s linear infinite;
}

.wave-path-4 {
    stroke-dasharray: 18 14;
    animation: waveFlow 28s linear infinite reverse;
}

@keyframes waveFlow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 300; }
}

/* --- Section Dividers --- */
.section-divider {
    position: absolute;
    left: 280px;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(94, 158, 173, 0.2), transparent);
    z-index: 5;
    pointer-events: none;
}

.divider-1 { top: 100vh; }
.divider-2 { top: 200vh; }
.divider-3 { top: 300vh; }

/* --- Tidal Floor --- */
#layer-floor {
    min-height: 100vh;
    background: var(--abyss);
    flex-direction: column;
    gap: 48px;
}

.layer-bg-floor {
    background: radial-gradient(ellipse at center, rgba(45, 107, 116, 0.06) 0%, transparent 70%);
}

.floor-circles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
}

.pulse-ring {
    transform-origin: 300px 300px;
}

.pulse-ring-1 {
    animation: pulseExpand 8s ease-in-out infinite;
}

.pulse-ring-2 {
    animation: pulseExpand 8s ease-in-out infinite;
    animation-delay: -1.6s;
}

.pulse-ring-3 {
    animation: pulseExpand 8s ease-in-out infinite;
    animation-delay: -3.2s;
}

.pulse-ring-4 {
    animation: pulseExpand 8s ease-in-out infinite;
    animation-delay: -4.8s;
}

.pulse-ring-5 {
    animation: pulseExpand 8s ease-in-out infinite;
    animation-delay: -6.4s;
}

@keyframes pulseExpand {
    0%, 100% { opacity: 0.08; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.05); }
}

.floor-text {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.haiku-line {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--tidal-silver);
    opacity: 0.6;
}

.haiku-line:nth-child(2) {
    opacity: 0.5;
}

.haiku-line:nth-child(3) {
    opacity: 0.4;
}

/* --- Sparkle Field --- */
#sparkle-field {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    will-change: opacity;
}

.sparkle::before,
.sparkle::after {
    content: '';
    position: absolute;
    background: var(--bling-gold);
}

.sparkle::before {
    width: 100%;
    height: 1px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.sparkle::after {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.sparkle-small {
    width: 2px;
    height: 2px;
}

.sparkle-large {
    width: 6px;
    height: 6px;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.7; }
}

/* --- Rhinestone Scatter (tiny diamonds) --- */
.rhinestone {
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--bling-gold);
    transform: rotate(45deg);
    pointer-events: none;
    will-change: opacity;
}

@keyframes rhinestoneGlow {
    0%, 100% { opacity: 0.1; border-color: var(--bling-gold); }
    33% { opacity: 0.25; border-color: var(--sea-glass); }
    66% { opacity: 0.15; border-color: var(--twilight-blush); }
}

/* --- Tide Clock Animation --- */
#tide-svg {
    opacity: 0.6;
}

#tide-wave-1,
#tide-wave-2 {
    stroke-dasharray: 200;
    animation: tideFlow 6s ease-in-out infinite;
    will-change: stroke-dashoffset;
}

#tide-wave-2 {
    animation-delay: -3s;
    animation-duration: 8s;
}

@keyframes tideFlow {
    0% { stroke-dashoffset: 0; }
    50% { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 200; }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    #topbar {
        display: flex;
    }

    #main-content {
        margin-left: 0;
        padding-top: 56px;
    }

    .descent-layer {
        padding: 80px 24px;
    }

    .glass-card {
        padding: 32px 28px;
    }

    .section-divider {
        left: 0;
    }

    #sora-title {
        font-size: clamp(3rem, 16vw, 8rem);
    }

    .layer-decoration {
        opacity: 0.4;
    }

    .layer-decoration svg {
        width: 200px;
        height: 200px;
    }

    .concentric-offset svg {
        width: 250px;
        height: 250px;
    }

    .floor-circles svg {
        width: 300px;
        height: 300px;
    }

    .crystal-hex-1,
    .crystal-hex-2 {
        opacity: 0.3;
    }

    .offset-left,
    .offset-right {
        align-self: center;
        margin: 0 auto;
    }
}

/* Sidebar open state on mobile */
#sidebar.mobile-open {
    display: flex;
    width: 100%;
    z-index: 120;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* --- Small Screens --- */
@media (max-width: 480px) {
    .poetic-text {
        font-size: clamp(1.2rem, 6vw, 2rem);
    }

    .descent-layer {
        padding: 60px 16px;
    }

    .glass-card {
        padding: 24px 20px;
    }
}
