/* =====================================================
   eyes.team - Victorian Optometrist's Consulting Room
   Palette: Burgundy-Cream Victorian Optics
   ===================================================== */

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

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

body {
    background: #1A0A0F;
    color: #F2E8D5;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.72;
    cursor: none;
    overflow-x: hidden;
}

/* --- Custom Cursor: Brass Monocle --- */
#monocle-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 36px;
    height: 52px;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-18px, -18px);
    will-change: transform;
    transition: opacity 0.2s;
}

.cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border: 1.5px solid #C9A86C;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transform: translate(-12px, -12px);
    will-change: transform, opacity;
}

#trail-1 { width: 20px; height: 20px; transform: translate(-10px, -10px); }
#trail-2 { width: 16px; height: 16px; transform: translate(-8px, -8px); }
#trail-3 { width: 12px; height: 12px; transform: translate(-6px, -6px); }

/* --- Magnification Zone --- */
#magnification-zone {
    position: fixed;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(201, 168, 108, 0.3);
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transform: translate(-60px, -60px) scale(0.8);
    transition: opacity 0.3s, transform 0.3s;
    background: radial-gradient(circle, rgba(201, 168, 108, 0.05) 0%, transparent 70%);
    will-change: transform, opacity;
}

#magnification-zone.active {
    opacity: 1;
    transform: translate(-60px, -60px) scale(1);
}

/* --- Background Iris Filigree --- */
#iris-filigree-bg {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
    animation: iris-rotate 120s linear infinite;
}

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

@keyframes iris-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Paper Grain Texture (CSS noise simulation) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* --- Typography --- */
.kinetic-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #F2E8D5;
    line-height: 1.1;
}

h1.kinetic-heading {
    font-size: clamp(64px, 10vw, 120px);
}

h2.kinetic-heading {
    font-size: clamp(36px, 5vw, 64px);
    margin-bottom: 0.4em;
}

h3.card-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(20px, 2.5vw, 32px);
    color: #C9A86C;
    letter-spacing: 0.08em;
    margin-bottom: 0.3em;
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.2vw, 20px);
    line-height: 1.72;
    color: #EDE0CC;
    max-width: 600px;
}

.annotation, .fell-text {
    font-family: 'IM Fell English', Georgia, serif;
    font-weight: 400;
    font-size: clamp(12px, 0.9vw, 14px);
    color: #9E6B73;
    letter-spacing: 0.02em;
}

.card-text {
    font-size: clamp(11px, 0.8vw, 13px);
    color: #9E6B73;
    line-height: 1.5;
}

.diagram-label {
    font-family: 'IM Fell English', Georgia, serif;
}

/* --- Kinetic Typography: Char-level animation --- */
.kinetic-heading .char {
    display: inline-block;
    filter: blur(6px);
    opacity: 0.3;
    transition: filter 0.4s ease-out, opacity 0.4s ease-out, transform 0.2s ease-out;
}

.kinetic-heading .char.focused {
    filter: blur(0);
    opacity: 1;
}

.kinetic-heading .char.space {
    width: 0.3em;
}

/* Heading hover magnification effect */
.kinetic-heading .char:hover {
    transform: scale(1.08);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Fade-in text (body paragraphs) --- */
.fade-text {
    opacity: 0.4;
    filter: blur(2px);
    transition: opacity 0.6s ease-out, filter 0.6s ease-out;
}

.fade-text.visible {
    opacity: 1;
    filter: blur(0);
}

/* --- Parallax Sections --- */
.parallax-section {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    will-change: transform;
}

.bg-layer {
    z-index: 1;
}

.mid-layer {
    z-index: 2;
}

.fg-layer {
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* --- Section fade edges --- */
.section-fade-top,
.section-fade-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 15vh;
    pointer-events: none;
    z-index: 4;
}

.section-fade-top {
    top: 0;
    background: linear-gradient(to bottom, rgba(26, 10, 15, 1) 0%, rgba(26, 10, 15, 0) 100%);
}

.section-fade-bottom {
    bottom: 0;
    background: linear-gradient(to top, rgba(26, 10, 15, 1) 0%, rgba(26, 10, 15, 0) 100%);
}

/* --- Darkness Zone Dividers --- */
.darkness-zone {
    height: 30vh;
    background: #1A0A0F;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
}

.brass-rule {
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #A8882D 30%, #C9A86C 50%, #A8882D 70%, transparent);
    opacity: 0.4;
}

/* --- Vignette Overlay --- */
.vignette-overlay {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1A0A0F 0%, #6B1D2A 40%, #1A0A0F 100%);
    opacity: 0.6;
}

/* =====================================================
   SECTION 1: THE BARE EYE
   ===================================================== */
#section-bare-eye .bg-layer {
    background: radial-gradient(ellipse at center, #6B1D2A 0%, #1A0A0F 70%);
    opacity: 0.4;
}

.bare-eye-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.bare-eye-content h1 {
    text-shadow: 0 0 60px rgba(232, 168, 48, 0.15);
}

.bare-eye-content .annotation {
    margin-top: 8px;
}

.gaze-line {
    margin-top: 32px;
    opacity: 0.6;
}

/* =====================================================
   SECTION 2: THE MONOCLE
   ===================================================== */
#section-monocle .bg-layer {
    background: radial-gradient(ellipse at center, rgba(107, 29, 42, 0.3) 0%, #1A0A0F 60%);
}

.monocle-brass-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vmin;
    height: 60vmin;
}

.monocle-frame-svg {
    width: 100%;
    height: 100%;
}

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

.monocle-circle {
    width: 55vmin;
    height: 55vmin;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8vmin;
    text-align: center;
    overflow: hidden;
    background: radial-gradient(ellipse at center, rgba(26, 10, 15, 0.9) 0%, rgba(26, 10, 15, 0.7) 100%);
}

.monocle-circle .body-text {
    max-width: 45vmin;
    font-size: clamp(14px, 1.1vw, 18px);
}

.monocle-circle .annotation {
    margin-top: 16px;
}

/* =====================================================
   SECTION 3: THE STEREOSCOPE
   ===================================================== */
#section-stereoscope .bg-layer {
    background: radial-gradient(ellipse at 30% 50%, rgba(107, 29, 42, 0.25) 0%, #1A0A0F 50%),
                radial-gradient(ellipse at 70% 50%, rgba(107, 29, 42, 0.25) 0%, #1A0A0F 50%);
}

.lens-rings-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.stereoscope-content {
    display: flex;
    gap: 6vw;
    padding: 0 8vw;
    width: 100%;
    align-items: flex-start;
}

.stereo-column {
    flex: 1;
    max-width: 500px;
}

.stereo-left {
    margin-top: 5vh;
}

.stereo-right {
    margin-top: 17vh;
}

.stereo-illustration {
    width: 100%;
    max-width: 240px;
    margin: 20px auto;
}

.stereo-illustration svg {
    width: 100%;
    height: auto;
}

.stereo-column .body-text {
    max-width: 100%;
}

/* =====================================================
   SECTION 4: THE PHOROPTER
   ===================================================== */
#section-phoropter .bg-layer {
    background: radial-gradient(ellipse at center, rgba(107, 29, 42, 0.2) 0%, #1A0A0F 65%);
}

.phoropter-wheel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vmin;
    height: 80vmin;
}

.phoropter-frame-svg {
    width: 100%;
    height: 100%;
}

.phoropter-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
}

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

.phoropter-subtitle {
    text-align: center;
    margin-bottom: 2vh;
    position: relative;
    z-index: 2;
}

.phoropter-cards {
    position: relative;
    width: 70vmin;
    height: 70vmin;
}

.phoropter-card {
    position: absolute;
    width: 140px;
    text-align: center;
    transform-origin: center center;
}

.card-lens-frame {
    width: 80px;
    height: 80px;
    margin: 0 auto 8px;
}

.card-frame-svg {
    width: 100%;
    height: 100%;
}

/* Cards positioned in circular layout via JS, but set fallback */
.phoropter-card[data-angle="0"]   { top: 0; left: 50%; transform: translateX(-50%); }
.phoropter-card[data-angle="72"]  { top: 20%; right: 0; }
.phoropter-card[data-angle="144"] { bottom: 10%; right: 5%; }
.phoropter-card[data-angle="216"] { bottom: 10%; left: 5%; }
.phoropter-card[data-angle="288"] { top: 20%; left: 0; }

/* =====================================================
   SECTION 5: THE KALEIDOSCOPE
   ===================================================== */
#section-kaleidoscope .bg-layer {
    background: radial-gradient(ellipse at center, rgba(107, 29, 42, 0.25) 0%, #1A0A0F 55%);
}

.kaleidoscope-pattern {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vmin;
    height: 90vmin;
}

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

.kaleidoscope-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5vh 8vw;
    text-align: center;
    width: 100%;
}

.kaleidoscope-fragments {
    display: flex;
    gap: 3vw;
    margin-top: 4vh;
    flex-wrap: wrap;
    justify-content: center;
}

.k-fragment {
    flex: 1;
    min-width: 250px;
    max-width: 380px;
    padding: 24px;
    border: 1px solid rgba(201, 168, 108, 0.15);
    background: radial-gradient(ellipse at center, rgba(107, 29, 42, 0.1) 0%, transparent 100%);
    position: relative;
}

.k-fragment::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border: 1px solid rgba(201, 168, 108, 0.08);
    transform: rotate(1deg);
    pointer-events: none;
}

.k-fragment .body-text {
    max-width: 100%;
    font-size: clamp(14px, 1vw, 17px);
}

.gaze-line-bottom {
    margin-top: 5vh;
    opacity: 0.5;
}

/* =====================================================
   SECTION 6: THE CAMERA OBSCURA
   ===================================================== */
#section-obscura .bg-layer {
    background: radial-gradient(ellipse at center, rgba(107, 29, 42, 0.35) 0%, #1A0A0F 60%);
}

.obscura-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 0 8vw;
}

.obscura-aperture {
    width: 300px;
    max-width: 80vw;
    margin-bottom: 16px;
}

.prism-svg {
    width: 100%;
    height: auto;
}

.obscura-text {
    max-width: 650px;
}

.gaze-line-final {
    margin-top: 32px;
    opacity: 0.4;
}

/* =====================================================
   SVG Frame Drawing Animation
   ===================================================== */
.ornamental-frame .frame-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.8s ease-out;
}

.ornamental-frame.drawn .frame-path {
    stroke-dashoffset: 0;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .stereoscope-content {
        flex-direction: column;
        align-items: center;
        gap: 4vh;
        padding: 0 5vw;
    }

    .stereo-left,
    .stereo-right {
        margin-top: 0;
        text-align: center;
    }

    .monocle-circle {
        width: 80vmin;
        height: 80vmin;
        padding: 6vmin;
    }

    .monocle-brass-frame {
        width: 85vmin;
        height: 85vmin;
    }

    .kaleidoscope-fragments {
        flex-direction: column;
        align-items: center;
    }

    .k-fragment {
        min-width: unset;
        width: 90%;
    }

    .phoropter-cards {
        width: 90vw;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
        position: static;
    }

    .phoropter-card {
        position: static;
        transform: none !important;
        width: 130px;
    }

    body {
        cursor: auto;
    }

    #monocle-cursor,
    .cursor-trail,
    #magnification-zone {
        display: none;
    }
}

/* =====================================================
   Scroll position indicator (gaze-line nav)
   ===================================================== */
#scroll-indicator {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #C9A86C;
    background: transparent;
    transition: background 0.3s, transform 0.3s;
    cursor: none;
}

.scroll-dot.active {
    background: #E8A830;
    box-shadow: 0 0 8px rgba(232, 168, 48, 0.4);
    transform: scale(1.4);
}
