/* ============================================
   eyes.plus - Bioluminescent Optics
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-bg: #0A0E1F;
    --primary-dark: #162447;
    --secondary-dark: #1B3A5C;
    --accent-aqua: #7DF9FF;
    --accent-violet: #8B5CF6;
    --warm-accent: #F5C542;
    --text-primary: #E8EEF6;
    --text-secondary: #C4D4E8;
    --gradient-start: #0D1B2A;
    --gradient-end: #1F4068;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease-organic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-snap: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Sclera Frame --- */
#sclera-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    border: 80px solid var(--deep-bg);
    background: transparent;
}

@media (max-width: 768px) {
    #sclera-frame {
        border-width: 24px;
    }
}

/* --- Wordmark --- */
#wordmark {
    position: fixed;
    top: 32px;
    left: 32px;
    z-index: 200;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 300;
    color: var(--text-primary);
    opacity: 0.6;
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: opacity 0.3s var(--ease-organic);
}

#wordmark:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    #wordmark {
        top: 8px;
        left: 8px;
        font-size: 12px;
    }
}

/* --- Pill Navigation --- */
#pill-nav {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-aqua);
    opacity: 0.25;
    cursor: pointer;
    transition: opacity 0.4s var(--ease-organic), transform 0.4s var(--ease-organic);
}

.nav-dot.active {
    opacity: 0.6;
    transform: scale(1.6);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

@media (max-width: 768px) {
    #pill-nav {
        right: 8px;
    }
}

/* --- Sections Base --- */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120px 80px;
    background: radial-gradient(ellipse at center, var(--gradient-start) 0%, var(--gradient-end) 60%, var(--deep-bg) 100%);
}

@media (max-width: 768px) {
    .section {
        padding: 80px 40px;
    }
}

.section-inner {
    position: relative;
    max-width: 720px;
    width: 100%;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic);
}

.section-inner.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-heading {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: 48px;
    text-align: center;
}

.body-text {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.72;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* --- Hero Section --- */
#hero {
    position: relative;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
}

.iris-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#pupil-zone {
    width: 60vmin;
    height: 60vmin;
    max-width: 600px;
    max-height: 600px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#iris-svg {
    width: 100%;
    height: 100%;
}

#hero-title {
    position: absolute;
    bottom: calc(50% + 34vmin);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.8s var(--ease-organic);
    z-index: 10;
}

#hero-title.visible {
    opacity: 1;
}

/* --- Cornea Section --- */
#cornea {
    background: linear-gradient(180deg, var(--deep-bg) 0%, var(--primary-dark) 40%, var(--deep-bg) 100%);
}

#cornea .section-inner {
    border-radius: 24px;
    padding: 64px 48px;
}

.cornea-content {
    position: relative;
}

.refraction-line {
    width: 100%;
    height: 1px;
    background: var(--accent-aqua);
    opacity: 0.1;
    margin: 24px 0;
    transition: transform 0.6s var(--ease-organic);
}

/* --- Lens Section --- */
#lens {
    background: radial-gradient(ellipse at center, var(--gradient-start) 0%, var(--primary-dark) 50%, var(--deep-bg) 100%);
}

#lens .section-inner {
    border-radius: 24px;
    padding: 64px 48px;
}

.blur-text {
    filter: blur(8px);
    transition: filter 1.2s var(--ease-organic);
}

.blur-text.focused {
    filter: blur(0px);
}

/* --- Retina Section --- */
#retina {
    background: radial-gradient(ellipse at center, #0D1B2A 0%, #162447 40%, #0A0E1F 100%);
}

.retina-inner {
    max-width: 800px;
    padding: 64px 48px;
}

.retina-heading {
    color: var(--accent-aqua);
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 36px;
}

.retina-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(125, 249, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(125, 249, 255, 0.08) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0;
    transition: opacity 1s var(--ease-organic);
}

.retina-grid-bg.visible {
    opacity: 1;
}

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

.retina-text {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 28px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-organic), transform 0.6s var(--ease-organic);
}

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

.retina-label {
    color: var(--accent-aqua);
    font-weight: 400;
    letter-spacing: 0.06em;
}

/* --- Afterimage Section --- */
#afterimage {
    min-height: 50vh;
    height: 50vh;
    background: var(--text-primary);
}

.afterimage-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.afterimage-title {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--deep-bg);
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

.afterimage-title.visible {
    opacity: 1;
}

/* --- Lens Flare Accents --- */
.lens-flare-accent {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 197, 66, 0.06) 0%, transparent 70%);
    filter: blur(60px);
    pointer-events: none;
    top: -60px;
    right: 15%;
}

/* --- Snellen Background --- */
.snellen-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.snellen-letter {
    font-family: var(--font-display);
    color: var(--text-primary);
    display: block;
    text-align: center;
    letter-spacing: 0.15em;
    user-select: none;
}

.snellen-1 { font-size: 120px; opacity: 0.04; }
.snellen-2 { font-size: 80px; opacity: 0.05; }
.snellen-3 { font-size: 60px; opacity: 0.05; }
.snellen-4 { font-size: 44px; opacity: 0.06; }
.snellen-5 { font-size: 32px; opacity: 0.06; }
.snellen-6 { font-size: 22px; opacity: 0.07; }
.snellen-7 { font-size: 16px; opacity: 0.07; }
.snellen-8 { font-size: 10px; opacity: 0.08; }

/* --- Concentric Ripple Borders on sections --- */
#cornea .section-inner,
#lens .section-inner {
    box-shadow:
        0 0 0 1px rgba(125, 249, 255, 0.12),
        0 0 0 3px rgba(125, 249, 255, 0.06),
        0 0 0 6px rgba(125, 249, 255, 0.03);
}

/* --- Iris SVG draw animation classes --- */
.iris-ring {
    stroke: var(--accent-aqua);
    fill: none;
    opacity: 0;
    transition: opacity 0.4s var(--ease-organic);
}

.iris-ring.drawn {
    opacity: 0.15;
}

.iris-radial {
    stroke: var(--secondary-dark);
    fill: none;
}

.iris-flare {
    opacity: 0;
    transition: opacity 0.5s var(--ease-organic);
}

.iris-flare.drawn {
    opacity: 1;
}

#pupil-circle {
    transform-origin: 300px 300px;
    transform: scale(0);
    transition: transform 0.4s ease-out;
}

#pupil-circle.drawn {
    transform: scale(1);
}

/* --- Prefers reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .blur-text {
        filter: none;
    }

    #hero-title {
        opacity: 1;
    }

    #pupil-circle {
        transform: scale(1);
    }

    .iris-ring {
        opacity: 0.15;
    }

    .retina-text {
        opacity: 1;
        transform: none;
    }

    .section-inner {
        opacity: 1;
        transform: none;
    }

    .afterimage-title {
        opacity: 1;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-heading {
        font-size: 28px;
    }

    #cornea .section-inner,
    #lens .section-inner {
        padding: 40px 24px;
    }

    .retina-inner {
        padding: 40px 24px;
    }

    .retina-heading {
        font-size: 24px;
    }

    .retina-text {
        font-size: 12px;
    }

    #pupil-zone {
        width: 80vmin;
        height: 80vmin;
    }

    #hero-title {
        bottom: calc(50% + 44vmin);
    }
}
