/* ======================================
   eyes.cash — Styles
   Surreal Dreamscape / Eye Anatomy Architecture
   ====================================== */

/* ---- CSS Custom Properties ---- */
:root {
    --obsidian-void: #0B0A0F;
    --velvet-dusk: #1A1520;
    --sovereign-gold: #D4AF37;
    --pale-aureate: #F2D06B;
    --burnished-amber: #8B6914;
    --aged-vellum: #E8DCC8;
    --tarnished-bronze: #8B7355;
    --lapis-depth: #2C3E6B;
    --arterial-wine: #6B1A1A;
    --retinal-white: #FFFFF0;
}

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

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

body {
    background-color: var(--obsidian-void);
    color: var(--aged-vellum);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    overflow-x: hidden;
}

/* ---- Grain Overlay ---- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: soft-light;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ---- Blink Overlay ---- */
#blink-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    background: var(--obsidian-void);
    clip-path: circle(100% at 50% 50%);
    opacity: 0;
    transition: none;
}

#blink-overlay.blinking {
    opacity: 1;
    animation: blink-close 0.4s ease-in forwards, blink-open 0.4s ease-out 0.6s forwards;
}

#blink-overlay.blink-closed {
    box-shadow: inset 0 0 100px rgba(107, 26, 26, 0.4);
}

@keyframes blink-close {
    0% { clip-path: circle(100% at 50% 50%); }
    100% { clip-path: circle(5% at 50% 50%); }
}

@keyframes blink-open {
    0% { clip-path: circle(5% at 50% 50%); }
    100% { clip-path: circle(100% at 50% 50%); }
}

/* ---- Typography ---- */
h1, h2, .iris-heading, .pupil-heading, .lens-heading, .vitreous-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    color: var(--sovereign-gold);
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.3);
    letter-spacing: 0.04em;
}

h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.tagline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    color: var(--aged-vellum);
    font-size: clamp(1rem, 2vw, 1.4rem);
    letter-spacing: 0.05em;
}

.accent-numeral {
    font-family: 'Bodoni Moda', serif;
    font-weight: 900;
    font-style: italic;
    font-size: 5rem;
    color: var(--sovereign-gold);
    text-shadow: 0 0 60px rgba(212, 175, 55, 0.4);
    font-feature-settings: 'onum' 1;
}

.secondary {
    color: var(--tarnished-bronze);
}

/* ---- Section Base ---- */
.eye-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ---- Candle-Atmospheric Lighting ---- */
.section-lighting {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.section-lighting-deep {
    background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.04) 0%, transparent 50%);
}

.section-lighting-vitreous {
    background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.06) 0%, rgba(26, 21, 32, 0.5) 60%, transparent 100%);
}

/* ======================================
   Section 0: CORNEA — Opening
   ====================================== */
#cornea {
    background: var(--obsidian-void);
    flex-direction: column;
    z-index: 10;
}

#cornea-rosette {
    position: absolute;
    width: clamp(300px, 50vw, 500px);
    height: clamp(300px, 50vw, 500px);
    opacity: 0;
    transition: opacity 1.5s ease;
    z-index: 1;
}

#cornea-rosette.visible {
    opacity: 1;
}

#cornea-rosette svg {
    width: 100%;
    height: 100%;
    animation: slow-rotate 120s linear infinite;
}

.guilloche-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

.guilloche-path.drawn {
    stroke-dashoffset: 0;
}

#cornea-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

#site-title {
    font-size: clamp(2.8rem, 7vw, 6rem);
    font-weight: 900;
    letter-spacing: 0.15em;
    color: var(--sovereign-gold);
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.3);
    opacity: 0;
    transition: opacity 0.5s ease;
}

#site-title.visible {
    opacity: 1;
    animation: gold-pulse 3s ease-in-out infinite;
}

#site-tagline {
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 1s ease;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

#site-tagline.visible {
    opacity: 1;
}

@keyframes gold-pulse {
    0%, 100% { text-shadow: 0 0 40px rgba(212, 175, 55, 0.2); }
    50% { text-shadow: 0 0 40px rgba(212, 175, 55, 0.4); }
}

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

/* ======================================
   Ciliary Borders
   ====================================== */
.ciliary-border {
    position: relative;
    height: 40px;
    overflow: hidden;
    z-index: 5;
}

.ciliary-border svg {
    width: 100%;
    height: 100%;
}

.ciliary-wave {
    opacity: 0.2;
    animation: ciliary-pulse 8s ease-in-out infinite;
}

.ciliary-wave:nth-child(2) {
    animation-delay: -4s;
}

@keyframes ciliary-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

/* ======================================
   Section 1: IRIS — Concentric Rings
   ====================================== */
#iris {
    background: var(--obsidian-void);
    min-height: 120vh;
    perspective: 800px;
}

.iris-ring-container {
    position: relative;
    width: clamp(320px, 80vw, 700px);
    height: clamp(320px, 80vw, 700px);
    display: grid;
    place-items: center;
    z-index: 1;
}

.iris-ring {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iris-ring-outer {
    width: 100%;
    height: 100%;
    animation: counter-rotate 120s linear infinite;
}

.iris-ring-outer .iris-ring-svg {
    width: 100%;
    height: 100%;
}

.iris-ring-svg .filigree-spokes line {
    stroke: var(--sovereign-gold);
    stroke-width: 0.5;
}

.iris-ring-middle {
    width: 75%;
    height: 75%;
    animation: slow-rotate 100s linear infinite;
}

.iris-ring-inner {
    width: 30%;
    height: 30%;
}

.iris-text-block {
    position: absolute;
    text-align: center;
    max-width: 220px;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
    transform: translateY(20px);
}

.iris-text-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.iris-text-top {
    top: -5%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
}
.iris-text-top.visible {
    transform: translateX(-50%) translateY(0);
}

.iris-text-right {
    top: 50%;
    right: -15%;
    transform: translateY(-50%) translateX(20px);
}
.iris-text-right.visible {
    transform: translateY(-50%) translateX(0);
}

.iris-text-bottom {
    bottom: -5%;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
}
.iris-text-bottom.visible {
    transform: translateX(-50%) translateY(0);
}

.iris-text-left {
    top: 50%;
    left: -15%;
    transform: translateY(-50%) translateX(-20px);
}
.iris-text-left.visible {
    transform: translateY(-50%) translateX(0);
}

.iris-heading {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    margin-bottom: 0.5rem;
}

.iris-body {
    font-size: clamp(0.85rem, 1.3vw, 1rem);
    color: var(--aged-vellum);
    line-height: 1.6;
}

.pupil-mandala {
    width: 100%;
    height: 100%;
    animation: slow-rotate 60s linear infinite;
    mix-blend-mode: screen;
}

.pupil-mandala svg {
    width: 100%;
    height: 100%;
}

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

/* ======================================
   Section 2: PUPIL — Deep Black
   ====================================== */
#pupil {
    background: var(--obsidian-void);
    min-height: 100vh;
}

.pupil-chamber {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.pupil-rosette {
    position: absolute;
    width: clamp(300px, 60vw, 500px);
    height: clamp(300px, 60vw, 500px);
    opacity: 0.5;
    animation: slow-rotate 90s linear infinite;
}

.pupil-rosette svg {
    width: 100%;
    height: 100%;
}

.pupil-text {
    position: relative;
    z-index: 2;
    max-width: 500px;
}

.pupil-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin: 1rem 0;
}

.pupil-body {
    color: var(--aged-vellum);
    font-weight: 300;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
}

/* ======================================
   Section 3: LENS — Refractive
   ====================================== */
#lens {
    background: linear-gradient(180deg, var(--obsidian-void) 0%, var(--velvet-dusk) 50%, var(--obsidian-void) 100%);
    min-height: 100vh;
}

.lens-chamber {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.lens-rosette {
    position: absolute;
    width: clamp(400px, 70vw, 600px);
    height: clamp(400px, 70vw, 600px);
    opacity: 0.4;
}

.lens-rosette svg {
    width: 100%;
    height: 100%;
}

.lens-text-container {
    position: relative;
    z-index: 2;
    max-width: 600px;
}

.lens-text-refracted {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--pale-aureate);
    opacity: 0.7;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease, opacity 0.5s ease;
    filter: blur(0px);
}

.lens-text-refracted[data-refract="1"] {
    transform: skewX(-3deg) translateX(-15px);
}

.lens-text-refracted[data-refract="2"] {
    transform: skewX(2deg) translateX(10px);
}

.lens-text-refracted[data-refract="3"] {
    transform: skewX(-1deg) translateX(-5px);
}

.lens-text-refracted.focused {
    filter: blur(0px);
    opacity: 1;
    transform: skewX(0deg) translateX(0);
}

.lens-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin: 2rem 0 1rem;
}

.lens-body {
    color: var(--aged-vellum);
    font-weight: 300;
    max-width: 500px;
    margin: 0 auto;
}

/* ======================================
   Section 4: VITREOUS — Floating Zone
   ====================================== */
#vitreous {
    background: var(--obsidian-void);
    min-height: 120vh;
}

.vitreous-chamber {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.vitreous-floater {
    position: absolute;
    opacity: 0.15;
    pointer-events: none;
}

.vitreous-floater-1 {
    width: 150px;
    height: 150px;
    top: 15%;
    left: 10%;
    animation: float-drift-1 20s ease-in-out infinite;
}

.vitreous-floater-2 {
    width: 100px;
    height: 100px;
    top: 60%;
    right: 15%;
    animation: float-drift-2 25s ease-in-out infinite;
}

.vitreous-floater-3 {
    width: 180px;
    height: 180px;
    bottom: 20%;
    left: 30%;
    animation: float-drift-3 30s ease-in-out infinite;
}

.vitreous-floater svg {
    width: 100%;
    height: 100%;
}

@keyframes float-drift-1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(20px, -15px) rotate(5deg); }
    66% { transform: translate(-10px, 10px) rotate(-3deg); }
}

@keyframes float-drift-2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-15px, 20px) rotate(-4deg); }
    66% { transform: translate(10px, -10px) rotate(6deg); }
}

@keyframes float-drift-3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(10px, 15px) rotate(3deg); }
    66% { transform: translate(-20px, -5px) rotate(-5deg); }
}

.vitreous-text {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 550px;
    padding: 2rem;
}

.vitreous-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 1.5rem;
}

.vitreous-body {
    color: var(--aged-vellum);
    font-weight: 300;
    margin-bottom: 1.2rem;
}

/* ======================================
   Section 5: RETINA — Final Revelation
   ====================================== */
#retina {
    min-height: 100vh;
    background: var(--obsidian-void);
    transition: background-color 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#retina.bright {
    background: var(--retinal-white);
}

.retina-chamber {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.retina-filigree-dense {
    position: absolute;
    width: clamp(500px, 90vw, 800px);
    height: clamp(500px, 90vw, 800px);
    opacity: 0.3;
    transition: opacity 1s ease;
}

.retina-filigree-dense svg {
    width: 100%;
    height: 100%;
}

#retina.bright .retina-filigree-dense {
    opacity: 0.6;
}

#retina.bright .retina-filigree-dense svg g {
    stroke: var(--obsidian-void);
}

#retina.bright .retina-filigree-dense svg circle,
#retina.bright .retina-filigree-dense svg line,
#retina.bright .retina-filigree-dense svg path {
    stroke: var(--velvet-dusk);
}

.retina-rays line {
    stroke: var(--sovereign-gold);
}

#retina.bright .retina-rays line {
    stroke: var(--velvet-dusk);
}

.retina-text {
    position: relative;
    z-index: 2;
    text-align: center;
}

.retina-final-word {
    font-family: 'Bodoni Moda', serif;
    font-weight: 900;
    font-style: italic;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--lapis-depth);
    opacity: 0;
    transition: opacity 1.5s ease, color 1s ease;
    font-feature-settings: 'onum' 1;
}

#retina.bright .retina-final-word {
    opacity: 1;
    color: var(--lapis-depth);
}

/* ======================================
   Floating Banknote Fragments
   ====================================== */
#banknote-fragments {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.banknote-fragment {
    position: absolute;
    width: 140px;
    height: 60px;
    opacity: 0.15;
    transition: opacity 0.3s ease;
}

.banknote-fragment:hover {
    opacity: 1;
}

.banknote-fragment svg {
    width: 100%;
    height: 100%;
}

.banknote-fragment:nth-child(1) { top: 12vh; left: 5vw; }
.banknote-fragment:nth-child(2) { top: 25vh; right: 8vw; left: auto; }
.banknote-fragment:nth-child(3) { top: 40vh; left: 15vw; }
.banknote-fragment:nth-child(4) { top: 55vh; right: 12vw; left: auto; }
.banknote-fragment:nth-child(5) { top: 68vh; left: 8vw; }
.banknote-fragment:nth-child(6) { top: 78vh; right: 5vw; left: auto; }
.banknote-fragment:nth-child(7) { top: 18vh; right: 20vw; left: auto; }
.banknote-fragment:nth-child(8) { top: 85vh; left: 25vw; }
.banknote-fragment:nth-child(9) { top: 35vh; right: 25vw; left: auto; }
.banknote-fragment:nth-child(10) { top: 50vh; left: 30vw; }

/* ======================================
   Eye Navigation Icon
   ====================================== */
#eye-nav {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s ease;
    animation: eye-pulse 3s ease-in-out infinite;
}

#eye-nav.visible {
    opacity: 1;
}

#eye-nav svg {
    width: 100%;
    height: 100%;
}

#eye-nav:hover svg ellipse {
    stroke: var(--pale-aureate);
}

#eye-nav:hover svg circle:first-of-type {
    fill: var(--pale-aureate);
}

@keyframes eye-pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ======================================
   Filigree Hover Brightening
   ====================================== */
.rosette:hover svg,
.pupil-mandala:hover svg,
.iris-ring-outer:hover .iris-ring-svg {
    opacity: 1;
}

.rosette svg,
.pupil-mandala svg,
.iris-ring-outer .iris-ring-svg {
    transition: opacity 0.3s ease;
}

/* ======================================
   Responsive — Mobile Adjustments
   ====================================== */
@media (max-width: 768px) {
    .iris-ring-container {
        width: 90vw;
        height: 90vw;
    }

    .iris-text-block {
        max-width: 150px;
        font-size: 0.85rem;
    }

    .iris-text-right {
        right: -10%;
    }

    .iris-text-left {
        left: -10%;
    }

    .banknote-fragment:nth-child(n+5) {
        display: none;
    }

    .accent-numeral {
        font-size: 3rem;
    }

    .vitreous-floater {
        display: none;
    }

    #eye-nav {
        bottom: 1rem;
        left: 1rem;
    }
}

@media (max-width: 480px) {
    .iris-ring-middle {
        width: 85%;
        height: 85%;
    }

    .iris-text-block {
        max-width: 120px;
    }

    .iris-heading {
        font-size: 1rem;
    }

    .iris-body {
        font-size: 0.75rem;
    }

    .banknote-fragment:nth-child(n+4) {
        display: none;
    }
}

/* ======================================
   Dim-to-black after inactivity (retina)
   ====================================== */
#retina.dimming {
    animation: dim-to-black 3s ease forwards;
}

@keyframes dim-to-black {
    0% { background: var(--retinal-white); }
    100% { background: var(--obsidian-void); }
}

#retina.dimming .retina-final-word {
    animation: fade-text-out 3s ease forwards;
}

@keyframes fade-text-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

#retina.dimming .retina-filigree-dense svg circle,
#retina.dimming .retina-filigree-dense svg line,
#retina.dimming .retina-filigree-dense svg path {
    transition: stroke 3s ease;
    stroke: var(--sovereign-gold);
}
