/* style.css - RUVA Design System & Base Styling */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600&family=Montserrat:wght@300;400;500&display=swap');

:root {
    /* Color Palette - RUVA Logo System */
    --clr-bg: #110E08;
    /* Deep Obsidian */
    --clr-surface: #1A1510;
    /* Midnight Smoke */
    --clr-surface-light: #2A2016;
    /* Aged Walnut */
    --clr-text-primary: #F0E4C8;
    /* Ivory Cream */
    --clr-text-secondary: #C8B898;
    /* Parchment */
    --clr-accent: #B8844A;
    /* Antique Gold */
    --clr-accent-hover: #E2C99A;
    /* Pale Lustre */
    --clr-background-dark: #0D0A06;
    /* Void Black */

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;

    /* Spacing & Layout */
    --nav-height: 100px;
    --section-pad: max(6rem, 8vh);
    --container-max-width: 1400px;
    --grid-gap: 2rem;

    /* Motion Easing */
    --ease-subtle: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.8s var(--ease-subtle);
    --transition-med: 0.5s var(--ease-subtle);
    --transition-fast: 0.3s var(--ease-subtle);
}

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

html,
body {
    width: 100%;
    overflow-x: hidden;
}

html.lenis {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

body {
    background-color: var(--clr-bg);
    /* Dark luxury cinematic gradient overlay */
    background-image:
        radial-gradient(ellipse at top left, rgba(42, 32, 22, 0.45) 0%, rgba(26, 21, 16, 0.15) 40%, transparent 70%),
        radial-gradient(ellipse at top right, rgba(42, 32, 22, 0.45) 0%, rgba(26, 21, 16, 0.15) 40%, transparent 70%),
        radial-gradient(ellipse at center, transparent 40%, rgba(13, 10, 6, 0.8) 100%);
    background-attachment: fixed;
    background-size: 100vw 100vh;
    background-repeat: no-repeat;
    color: var(--clr-text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Base */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 400;
    line-height: 1.2;
    color: var(--clr-text-primary);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: -0.01em;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

p {
    font-size: clamp(1rem, 1.2vw, 1.125rem);
    color: var(--clr-text-secondary);
    max-width: 65ch;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 5%;
}

.section {
    padding-top: var(--section-pad);
    padding-bottom: var(--section-pad);
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.grid {
    display: grid;
    gap: var(--grid-gap);
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    white-space: nowrap;
    clip-path: inset(100%);
    clip: rect(0 0 0 0);
    overflow: hidden;
}

::selection {
    background-color: var(--clr-accent);
    color: var(--clr-bg);
}

/* ========================================= */
/* SCROLLYTELLING ANIMATION SECTION          */
/* ========================================= */
#scrolly-section {
    position: relative;
    /* 400vh to allow enough scroll depth for 480 frames */
    height: 400vh;
    background-color: var(--clr-bg);
}

.scrolly-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Center the canvas and text properly */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
    /* Placed behind header (1000) but above body base */
}

.content-over-scrolly {
    position: relative;
    z-index: 10;
    background-color: var(--clr-bg);
}

#jewellery-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* JS always sets width/height via canvas.style — no CSS fallback needed */
    /* High-quality interpolation for photographic frames */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    image-rendering: optimizeQuality;
    /* Dark background fills the letterbox bars on portrait mobile */
    background-color: var(--clr-background-dark);
    z-index: 1;
}

/* Loading Overlay */
#scrolly-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--clr-bg);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    transition: opacity 1s var(--ease-subtle);
}

#scrolly-loader p {
    font-family: var(--font-body);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Text Overlays container */
.scrolly-text-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Above header (z-index 1000) so RUVA can overlap it */
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scrolly-text {
    position: absolute;
    opacity: 0;
    /* Hidden by default, JS controls this */
    width: 100%;
    max-width: 1200px;
    /* Constrain text width on ultrawide */
    padding: 0 5%;
    /* Smooth opacity transitions controlled via JS mostly, but adding a base transition */
    transition: opacity 0.1s linear, transform 0.1s linear;
}

.scrolly-text h2 {
    font-family: var(--font-heading);
    font-weight: 300;
    /* Lighter weight for minimalism */
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    /* Scaled down significantly */

    /* Shiny Text Effect */
    background-image: linear-gradient(120deg, #C9A96E 0%, #C9A96E 35%, #F0E4C8 50%, #C9A96E 65%, #C9A96E 100%);
    background-size: 200% auto;

    /* Text clipping */
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;

    /* Shiny Animation */
    animation: shiny-text-pan 3s linear infinite;

    opacity: 0.9;
    letter-spacing: 0.05em;
    /* Add tracking for elegance */

    /* Drop shadow on text-clipped gradients requires drop-shadow filter */
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
    line-height: 1.3;
}

@keyframes shiny-text-pan {
    0% {
        background-position: 150% center;
    }

    100% {
        background-position: -50% center;
    }
}

/* Alignment Utilities Specific to Scrolly */
.scrolly-text.text-center {
    text-align: center;
}

.scrolly-text.text-left {
    text-align: left;
}

.scrolly-text.text-right {
    text-align: right;
}

/* Adjustments for the specific text blocks */
#scrolly-text-1 {
    top: auto;
    bottom: 12%;
    /* 'downward but little upward' */
}

#scrolly-text-1 h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    /* Increased size a little */
}

#scrolly-text-2 {
    top: auto;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 100%;
    text-align: center;
}

#scrolly-text-2 h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-weight: 300;
    letter-spacing: 0.06em;
    line-height: 1.4;
    margin: 0 auto;
    max-width: 700px;
    /* Warm soft gold gradient for premium feel */
    background-image: linear-gradient(120deg, #C9A96E 0%, #E2C99A 45%, #C9A96E 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: shiny-text-pan 5s linear infinite;
    /* Slower, more elegant reveal */
    filter: drop-shadow(0 2px 16px rgba(201, 167, 107, 0.35));
    text-transform: none;
}

#scrolly-text-3 {
    top: 50%;
    transform: translateY(-50%);
    max-width: 100%;
}

#scrolly-text-3 h2 {
    max-width: 350px;
    margin: 0 0 0 auto;
    /* Ensures it stays most right */
}

#scrolly-text-4 {
    top: 0;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    padding-top: 5vh;
    /* Sits near the top, moved down slightly from absolute top */
}

#scrolly-text-4 h2 {
    font-size: clamp(4rem, 11vw, 9rem);
    /* Large commanding RUVA title */
    font-weight: 400;
    letter-spacing: 0.3em;
    line-height: 1;
    margin: 0 auto;
    padding-left: 0.3em;
}

@media (max-width: 768px) {
    #scrolly-text-4 {
        padding-top: 15vh;
    }
}

/* ========================================= */

/* Animations */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-in;
}

.fade-in.visible {
    opacity: 1;
}