/* ================================================
   eyes.plus - Digital Zen Garden
   Palette: "Raked Stone Garden"
   ================================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: #F4F6F8;
    color: #5A6570;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Scan Line Overlay --- */
#scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(30, 35, 40, 0.03) 2px,
        rgba(30, 35, 40, 0.03) 3px
    );
    opacity: 1;
    transition: opacity 0.3s ease;
}

#scan-lines.scan-active {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(30, 35, 40, 0.15) 2px,
        rgba(30, 35, 40, 0.15) 3px
    );
    animation: scan-scroll 0.3s linear;
}

@keyframes scan-scroll {
    from { background-position-y: 0; }
    to { background-position-y: 10px; }
}

/* --- Navigation Indicator --- */
#nav-indicator {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 999;
}

.nav-circle {
    width: 40px;
    height: 40px;
    border: 1px solid #7A8A96;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    background: rgba(244, 246, 248, 0.9);
    animation: border-glitch 6s ease-in-out infinite;
}

@keyframes border-glitch {
    0%, 100% { border-radius: 50%; }
    48% { border-radius: 50%; }
    50% { border-radius: 45%; }
    52% { border-radius: 50%; }
    78% { border-radius: 50%; }
    80% { border-radius: 47%; }
    82% { border-radius: 50%; }
}

.nav-dot {
    width: 6px;
    height: 6px;
    background: #7A8A96;
    border-radius: 50%;
}

.nav-labels {
    position: absolute;
    top: 50px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    background: rgba(244, 246, 248, 0.95);
    padding: 12px 16px;
    border: 1px solid #B8C4CE;
}

#nav-indicator:hover .nav-labels {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.nav-label {
    font-family: 'Zilla Slab', serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2C3340;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.nav-label:hover {
    color: #3D9B8F;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Zilla Slab', serif;
    color: #2C3340;
    letter-spacing: 0.02em;
    line-height: 1.08;
}

.stone-heading {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 700;
    margin-bottom: 12px;
}

.specimen-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A8A96;
    display: block;
    margin-top: 16px;
}

/* --- Opening Section --- */
.opening-section {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F4F6F8;
    position: relative;
}

.opening-content {
    text-align: center;
    opacity: 0;
    animation: fade-in 1s ease 0.4s forwards;
}

@keyframes fade-in {
    to { opacity: 1; }
}

.eye-glyph {
    width: clamp(120px, 25vw, 240px);
    height: auto;
    display: block;
    margin: 0 auto 40px;
}

#eye-glyph-hero .eye-lid-top,
#eye-glyph-hero .eye-lid-bottom {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: draw-line 2s cubic-bezier(0.22, 1, 0.36, 1) 0.6s forwards;
}

#eye-glyph-hero .eye-iris-outer {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw-line 1.5s cubic-bezier(0.22, 1, 0.36, 1) 1.2s forwards;
}

#eye-glyph-hero .eye-iris-inner {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: draw-line 1.2s cubic-bezier(0.22, 1, 0.36, 1) 1.6s forwards;
}

#eye-glyph-hero .eye-pupil {
    opacity: 0;
    animation: fade-in 0.5s ease 2s forwards;
}

#eye-glyph-hero .eye-circuit {
    opacity: 0;
    animation: fade-in 0.8s ease 2.2s forwards;
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

.site-title {
    font-family: 'Zilla Slab', serif;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    font-weight: 700;
    color: #2C3340;
    letter-spacing: 0.02em;
    line-height: 1.08;
    opacity: 0;
    animation: fade-in 1s ease 2.5s forwards;
}

.site-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A8A96;
    margin-top: 16px;
    opacity: 0;
    animation: fade-in 1s ease 3s forwards;
}

.site-instruction {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: #5A6570;
    margin-top: 40px;
    opacity: 0;
    animation: fade-in 1s ease 3.5s forwards;
}

/* --- Garden Cluster --- */
.garden-cluster {
    position: relative;
    padding: 80px 40px;
    min-height: 80vh;
}

.raked-sand-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.garden-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: auto auto;
    gap: 2px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* First cluster layout */
.garden-grid .stone-large {
    grid-column: 1 / 6;
    grid-row: 1 / 3;
}

.garden-grid .stone-small:nth-child(2) {
    grid-column: 8 / 11;
    grid-row: 1 / 2;
}

.garden-grid .stone-small:nth-child(3) {
    grid-column: 9 / 12;
    grid-row: 2 / 3;
}

/* Second cluster layout */
.garden-grid-2 .stone-xlarge {
    grid-column: 5 / 12;
    grid-row: 2 / 4;
}

.garden-grid-2 .stone-small {
    grid-column: 1 / 4;
    grid-row: 1 / 2;
}

.garden-grid-2 .stone-medium {
    grid-column: 2 / 5;
    grid-row: 2 / 3;
}

/* Third cluster layout - triangular */
.garden-grid-3 .stone-equal:nth-child(1) {
    grid-column: 2 / 6;
    grid-row: 1 / 2;
}

.garden-grid-3 .stone-equal:nth-child(2) {
    grid-column: 5 / 9;
    grid-row: 2 / 3;
}

.garden-grid-3 .stone-equal:nth-child(3) {
    grid-column: 8 / 12;
    grid-row: 1 / 2;
}

/* --- Grid Stone (Card) --- */
.grid-stone {
    background: #E8ECF0;
    border: 2px solid #B8C4CE;
    padding: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.grid-stone.visible {
    opacity: 1;
    transform: translateY(0);
}

.grid-stone.glitch-active {
    transition: none;
}

.grid-stone.glitch-residue {
    border-left: 2px solid #3D9B8F;
}

.grid-stone.glitch-residue:nth-child(2) {
    border-left-color: #C75D6A;
}

.grid-stone.glitch-residue:nth-child(3) {
    border-left-color: #6B7FD7;
}

.stone-content {
    padding: 28px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.stone-large .stone-content {
    min-height: 400px;
}

.stone-small .stone-content {
    min-height: 200px;
}

.stone-xlarge .stone-content {
    min-height: 400px;
}

.stone-medium .stone-content {
    min-height: 260px;
}

.stone-equal .stone-content {
    min-height: 300px;
}

.stone-body {
    flex: 1;
    font-size: clamp(0.85rem, 1vw, 1rem);
    line-height: 1.72;
    color: #5A6570;
}

/* --- Botanical SVGs --- */
.botanical-container {
    position: relative;
    width: 100%;
    height: 140px;
    margin-bottom: 20px;
    overflow: hidden;
}

.stone-large .botanical-container {
    height: 180px;
}

.stone-xlarge .botanical-container {
    height: 180px;
}

.botanical-svg {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    width: auto;
}

.botanical-clean {
    animation: botanical-breathe-clean 8s ease-in-out infinite;
}

.botanical-glitched {
    animation: botanical-breathe-glitch 8s ease-in-out infinite;
}

@keyframes botanical-breathe-clean {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes botanical-breathe-glitch {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* --- Breathing Sections --- */
.breathing-section {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.breathing-dark {
    background: #1E2328;
}

.breathing-light {
    background: #F4F6F8;
}

.breathing-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.breathing-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: #7A8A96;
    line-height: 1.8;
    margin-top: 40px;
}

.breathing-text-light {
    color: #5A6570;
}

.botanical-large {
    width: 300px;
    height: 300px;
    margin: 0 auto;
}

.botanical-large .botanical-svg {
    position: relative;
    left: auto;
    transform: none;
    width: 100%;
    height: 100%;
}

.breathing-botanical {
    animation: botanical-drift 12s ease-in-out infinite alternate;
}

@keyframes botanical-drift {
    0% { transform: translate(0, 0); }
    33% { transform: translate(3px, -2px); }
    66% { transform: translate(-2px, 3px); }
    100% { transform: translate(1px, -1px); }
}

/* --- Eye Glyph Mid --- */
.eye-glyph-mid {
    width: clamp(80px, 15vw, 160px);
    display: block;
    margin: 0 auto 20px;
}

.eye-circuit-rotating {
    transform-origin: 100px 60px;
    animation: rotate 30s linear infinite;
}

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

/* --- Glitch Trigger Zones --- */
.glitch-trigger {
    height: 1px;
    width: 100%;
    position: relative;
}

/* --- Closing Section --- */
.closing-section {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1E2328;
    position: relative;
    overflow: hidden;
}

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

.botanical-composite {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vh;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.composite-botanical {
    position: absolute;
    width: clamp(200px, 40vw, 500px);
    height: auto;
}

.composite-botanical:nth-child(1) { transform: rotate(0deg) translate(0, 0); }
.composite-botanical:nth-child(2) { transform: rotate(72deg) translate(20px, -10px); }
.composite-botanical:nth-child(3) { transform: rotate(144deg) translate(-15px, 20px); }
.composite-botanical:nth-child(4) { transform: rotate(216deg) translate(10px, 15px); }
.composite-botanical:nth-child(5) { transform: rotate(288deg) translate(-20px, -5px); }

.eye-glyph-closing {
    width: clamp(160px, 35vw, 400px);
    display: block;
    margin: 0 auto 40px;
    position: relative;
    z-index: 3;
    animation: closing-rotate 60s linear infinite;
}

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

.closing-title {
    font-family: 'Zilla Slab', serif;
    font-size: clamp(2rem, 4.5vw, 4rem);
    font-weight: 700;
    color: #E8ECF0;
    letter-spacing: 0.02em;
    line-height: 1.08;
    position: relative;
    z-index: 3;
}

.closing-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7A8A96;
    margin-top: 16px;
    position: relative;
    z-index: 3;
}

/* --- Glitch Effect Classes --- */
.glitch-event .grid-stone {
    transition: none !important;
}

.glitch-event #scan-lines {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(30, 35, 40, 0.15) 2px,
        rgba(30, 35, 40, 0.15) 3px
    );
}

/* --- Heading Glitch Filter --- */
.heading-glitch {
    filter: url(#glitch-displacement);
}

/* --- Closing scan line fade --- */
.closing-section #scan-lines {
    opacity: 0;
}

body.at-closing #scan-lines {
    opacity: 0;
    transition: opacity 2s ease;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .garden-cluster {
        padding: 60px 20px;
    }

    .garden-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .garden-grid .stone-large {
        grid-column: 1 / 5;
        grid-row: 1 / 2;
    }

    .garden-grid .stone-small:nth-child(2) {
        grid-column: 1 / 4;
        grid-row: 2 / 3;
    }

    .garden-grid .stone-small:nth-child(3) {
        grid-column: 3 / 7;
        grid-row: 3 / 4;
    }

    .garden-grid-2 .stone-xlarge {
        grid-column: 1 / 7;
        grid-row: 2 / 3;
    }

    .garden-grid-2 .stone-small {
        grid-column: 1 / 4;
        grid-row: 1 / 2;
    }

    .garden-grid-2 .stone-medium {
        grid-column: 4 / 7;
        grid-row: 1 / 2;
    }

    .garden-grid-3 .stone-equal:nth-child(1) {
        grid-column: 1 / 4;
        grid-row: 1 / 2;
    }

    .garden-grid-3 .stone-equal:nth-child(2) {
        grid-column: 4 / 7;
        grid-row: 1 / 2;
    }

    .garden-grid-3 .stone-equal:nth-child(3) {
        grid-column: 2 / 6;
        grid-row: 2 / 3;
    }
}

@media (max-width: 600px) {
    .garden-grid,
    .garden-grid-2,
    .garden-grid-3 {
        grid-template-columns: 1fr;
    }

    .garden-grid .stone-large,
    .garden-grid .stone-small:nth-child(2),
    .garden-grid .stone-small:nth-child(3),
    .garden-grid-2 .stone-xlarge,
    .garden-grid-2 .stone-small,
    .garden-grid-2 .stone-medium,
    .garden-grid-3 .stone-equal:nth-child(1),
    .garden-grid-3 .stone-equal:nth-child(2),
    .garden-grid-3 .stone-equal:nth-child(3) {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .stone-content {
        padding: 20px 16px;
    }

    .stone-large .stone-content,
    .stone-xlarge .stone-content {
        min-height: 300px;
    }

    .stone-small .stone-content,
    .stone-medium .stone-content,
    .stone-equal .stone-content {
        min-height: 220px;
    }

    #nav-indicator {
        top: 16px;
        right: 16px;
    }
}
