/* ================================================
   a6c.dev v2 — Surreal Dreamscape
   Fonts: Anybody, Instrument Sans, Red Hat Mono
   Colors: #0B0E1A, #2D1B69, #9B72CF, #F0ECF9,
           #E8A838, #2EEBC6, #1A0F3D, #151A2E
   ================================================ */

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

:root {
    --void-black: #0B0E1A;
    --astral-violet: #2D1B69;
    --phantom-lavender: #9B72CF;
    --lucid-white: #F0ECF9;
    --dream-amber: #E8A838;
    --rift-teal: #2EEBC6;
    --shadow-indigo: #1A0F3D;
    --checker-dark: #151A2E;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-black);
    color: var(--lucid-white);
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.2vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

a {
    color: var(--phantom-lavender);
    text-decoration: none;
    transition: color 300ms ease, transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94), background-position 300ms ease;
    display: inline-block;
    background: linear-gradient(90deg, rgba(232, 168, 56, 0.12) 50%, transparent 50%);
    background-size: 200% 100%;
    background-position: 100% 0;
}

a:hover {
    color: var(--rift-teal);
    transform: skewY(1.5deg) scaleX(1.02);
    background-position: 0 0;
}

::selection {
    background: var(--astral-violet);
    color: var(--lucid-white);
}

/* --- Star-field canvas --- */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2000ms ease;
}

#starfield.visible {
    opacity: 0.4;
}

/* --- The Floating Eye --- */
.floating-eye {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 30vw;
    min-width: 250px;
    max-width: 500px;
    z-index: 10;
    opacity: 0;
    transition: opacity 1500ms ease, transform 1500ms ease;
    pointer-events: none;
}

.floating-eye.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.floating-eye.scrolled {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translate(-50%, 0) scale(0.25);
    width: 30vw;
    opacity: 0.45;
    transition: opacity 800ms ease, transform 800ms ease, top 800ms ease;
}

.eye-svg {
    width: 100%;
    height: auto;
    animation: eyeRotate 120s linear infinite;
}

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

.iris-ring {
    animation: irisPulse 4s ease-in-out infinite alternate;
}

.ring-outer { animation-delay: -0.5s; }
.ring-1 { animation-delay: 0s; }
.ring-2 { animation-delay: 0.5s; }
.ring-3 { animation-delay: 1s; }

@keyframes irisPulse {
    from { transform-origin: 200px 100px; transform: scale(1); }
    to { transform-origin: 200px 100px; transform: scale(1.05); }
}

.pupil {
    transition: transform 200ms ease-out;
    transform-origin: 200px 100px;
}

/* Pupil contract animation on load */
@keyframes pupilContract {
    0% { r: 20; }
    40% { r: 14; }
    100% { r: 20; }
}

.pupil.contract {
    animation: pupilContract 800ms ease-in-out;
}

/* --- Hero / Opening Viewport --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 5;
    background: transparent;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(170deg, #0B0E1A 0%, #2D1B69 45%, #1A0F3D 100%);
    opacity: 0;
    transition: opacity 2000ms ease;
    z-index: -1;
}

.hero.gradient-visible::before {
    opacity: 1;
}

/* Surreal horizon */
.hero-horizon {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 3000ms ease;
}

.hero.gradient-visible .hero-horizon {
    opacity: 1;
}

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

/* Floating geometric solids in hero */
.hero-geo {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2000ms ease;
}

.hero.gradient-visible .hero-geo {
    opacity: 1;
}

.hero-geo-cube {
    width: 50px;
    height: 50px;
    border: 1.5px solid rgba(155, 114, 207, 0.2);
    top: 18%;
    right: 15%;
    transform: rotate(45deg);
    animation: heroGeoDrift1 12s ease-in-out infinite alternate;
    box-shadow: 0 20px 30px rgba(11, 14, 26, 0.6);
}

.hero-geo-sphere {
    width: 35px;
    height: 35px;
    border: 1.5px solid rgba(46, 235, 198, 0.15);
    border-radius: 50%;
    top: 30%;
    left: 12%;
    animation: heroGeoDrift2 10s ease-in-out infinite alternate;
    box-shadow: 0 15px 25px rgba(11, 14, 26, 0.5);
}

.hero-geo-tetra {
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-bottom: 38px solid rgba(232, 168, 56, 0.1);
    top: 25%;
    right: 30%;
    animation: heroGeoDrift3 14s ease-in-out infinite alternate;
    filter: drop-shadow(0 18px 20px rgba(11, 14, 26, 0.5));
}

@keyframes heroGeoDrift1 {
    from { transform: rotate(45deg) translateY(0); }
    to { transform: rotate(45deg) translateY(-20px); }
}

@keyframes heroGeoDrift2 {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(-12px) translateX(8px); }
}

@keyframes heroGeoDrift3 {
    from { transform: translateY(0); }
    to { transform: translateY(-16px); }
}

.hero-content {
    position: relative;
    padding-left: 40%;
    padding-top: 45vh;
    transform: translate(0, -50%);
    z-index: 3;
}

.logotype {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-stretch: 125%;
    font-size: clamp(48px, 8vw, 120px);
    color: var(--lucid-white);
    letter-spacing: -0.02em;
    min-height: 1.2em;
    transition: font-stretch 400ms ease;
    cursor: default;
    white-space: nowrap;
}

.logotype:hover {
    font-stretch: 135%;
}

.logotype .cursor {
    display: inline-block;
    width: 3px;
    height: 0.9em;
    background: var(--phantom-lavender);
    margin-left: 4px;
    animation: cursorBlink 1s step-end infinite;
    vertical-align: baseline;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-tagline {
    font-family: 'Instrument Sans', sans-serif;
    font-size: clamp(14px, 1.5vw, 20px);
    color: var(--phantom-lavender);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1000ms ease, transform 1000ms ease;
    margin-top: 12px;
    letter-spacing: 0.15em;
    text-transform: lowercase;
}

.hero-tagline.visible {
    opacity: 0.7;
    transform: translateY(0);
}

/* Scroll chevron */
.scroll-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 800ms ease;
    animation: chevronBounce 1.5s ease-in-out infinite alternate;
    z-index: 4;
}

.scroll-chevron.visible {
    opacity: 0.6;
}

@keyframes chevronBounce {
    from { transform: translateX(-50%) translateY(0); }
    to { transform: translateX(-50%) translateY(8px); }
}

/* --- Penrose Staircase Connectors --- */
.penrose-connector {
    position: relative;
    width: 100%;
    height: 120px;
    z-index: 2;
    overflow: hidden;
}

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

.penrose-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 1200ms ease-out;
}

.penrose-connector.revealed .penrose-path {
    stroke-dashoffset: 0;
}

/* --- Room (Section) Base --- */
.room {
    position: relative;
    min-height: 70vh;
    padding: 80px 5vw;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-frame {
    position: relative;
    max-width: 900px;
    width: 100%;
    padding: 60px 50px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms ease 200ms, transform 800ms ease 200ms;
}

.room.revealed .room-frame {
    opacity: 1;
    transform: translateY(0);
}

/* Arch frame - arched doorway */
.arch-frame {
    position: relative;
}

.arch-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(155, 114, 207, 0.4);
    border-radius: 50% 50% 4px 4px / 20% 20% 4px 4px;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 0%, rgba(45, 27, 105, 0.2) 0%, transparent 70%);
}

/* Gothic pointed arch frame */
.gothic-frame {
    position: relative;
}

.gothic-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(155, 114, 207, 0.3);
    clip-path: polygon(50% 0%, 100% 8%, 100% 100%, 0% 100%, 0% 8%);
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 0%, rgba(45, 27, 105, 0.15) 0%, transparent 60%);
}

/* Moorish frame with scalloped arch */
.moorish-frame {
    position: relative;
}

.moorish-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(155, 114, 207, 0.35);
    border-radius: 8px;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 30%, rgba(45, 27, 105, 0.2) 0%, transparent 65%);
}

.moorish-border::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 40px;
    border: 1px solid rgba(155, 114, 207, 0.3);
    border-top: none;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

.moorish-border::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 35%;
    right: 35%;
    height: 25px;
    border: 1px solid rgba(155, 114, 207, 0.2);
    border-top: none;
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

/* --- Room Headings --- */
.room-heading {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    font-stretch: 100%;
    font-size: clamp(36px, 6vw, 96px);
    color: var(--lucid-white);
    margin-bottom: 30px;
    line-height: 1.1;
    transition: font-stretch 400ms ease;
}

.room-heading:hover {
    font-stretch: 115%;
}

.room-text {
    margin-bottom: 20px;
    color: rgba(240, 236, 249, 0.85);
    max-width: 700px;
}

/* --- Broken Grid Offsets (asymmetric spacing) --- */
.room-about {
    padding-left: 8vw;
    padding-right: 15vw;
}

.room-work {
    padding-left: 5vw;
    padding-right: 5vw;
}

.room-code {
    padding-left: 15vw;
    padding-right: 8vw;
}

.room-approach {
    padding-left: 10vw;
    padding-right: 12vw;
}

/* --- Project Cards --- */
.cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 30px;
    margin-top: 40px;
}

.project-card {
    position: relative;
    background: var(--void-black);
    border: 1px solid rgba(155, 114, 207, 0.4);
    padding: 0;
    cursor: default;
    transform-style: preserve-3d;
    transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 300ms ease;
}

.card-1 {
    transform: rotate(-3deg);
    box-shadow: 12px 12px 0px var(--shadow-indigo);
}

.card-2 {
    transform: rotate(2deg);
    box-shadow: 12px 12px 0px var(--shadow-indigo);
    margin-top: 30px;
}

.card-3 {
    transform: rotate(4deg);
    box-shadow: 12px 12px 0px var(--shadow-indigo);
    margin-top: -20px;
}

.card-4 {
    transform: rotate(-2deg);
    box-shadow: 12px 12px 0px var(--shadow-indigo);
    margin-top: 15px;
}

.project-card:hover {
    box-shadow: 16px 16px 0px var(--shadow-indigo);
    transform: skewY(1.5deg) scaleX(1.02);
}

.card-inner {
    padding: 30px 25px;
    position: relative;
    overflow: hidden;
}

.card-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(232, 168, 56, 0.08) 50%, transparent 100%);
    transition: left 400ms ease;
    z-index: 0;
}

.project-card:hover .card-inner::before {
    left: 0;
}

.card-title {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    font-size: clamp(18px, 2vw, 28px);
    color: var(--lucid-white);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.card-desc {
    font-size: clamp(13px, 1.1vw, 16px);
    color: rgba(240, 236, 249, 0.75);
    line-height: 1.7;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.card-tag {
    font-family: 'Red Hat Mono', monospace;
    font-size: 12px;
    color: var(--rift-teal);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

/* --- Code Block --- */
.code-block {
    background: var(--shadow-indigo);
    border-left: 3px solid var(--phantom-lavender);
    padding: 24px 28px;
    margin: 30px 0;
    overflow-x: auto;
    position: relative;
    border-radius: 0 4px 4px 0;
}

/* Scanline overlay */
.code-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(255, 255, 255, 0.02) 2px,
        rgba(255, 255, 255, 0.02) 3px
    );
    pointer-events: none;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Red Hat Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: 0.02em;
    color: var(--lucid-white);
}

.code-block .kw {
    color: var(--rift-teal);
}

.code-block .fn {
    color: var(--phantom-lavender);
}

.code-block .str {
    color: var(--dream-amber);
}

/* --- Approach Steps --- */
.approach-steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin-top: 40px;
}

.approach-step {
    position: relative;
    padding: 20px 0;
    transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.approach-step:hover {
    transform: skewY(1.5deg) scaleX(1.02);
}

.step-number {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-size: clamp(48px, 5vw, 80px);
    color: var(--astral-violet);
    opacity: 0.4;
    line-height: 1;
    display: block;
    margin-bottom: 8px;
}

.step-title {
    font-family: 'Anybody', sans-serif;
    font-weight: 600;
    font-size: clamp(20px, 2.5vw, 32px);
    color: var(--dream-amber);
    margin-bottom: 10px;
}

.step-desc {
    font-size: clamp(13px, 1.1vw, 16px);
    color: rgba(240, 236, 249, 0.75);
    line-height: 1.7;
}

/* --- Floating Geometrics --- */
.floating-geo {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 600ms ease, transform 600ms ease-out;
}

.room.revealed .floating-geo {
    opacity: 1;
}

.geo-cube {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(155, 114, 207, 0.25);
    top: 15%;
    right: 8%;
    transform: rotate(45deg) translateX(80px);
    animation: geoDrift 8s ease-in-out infinite alternate;
}

.room.revealed .geo-cube {
    transform: rotate(45deg) translateX(0);
}

.geo-cube-2 {
    top: auto;
    bottom: 20%;
    right: auto;
    left: 5%;
    width: 40px;
    height: 40px;
    animation-duration: 10s;
}

.geo-sphere {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(46, 235, 198, 0.2);
    border-radius: 50%;
    bottom: 20%;
    left: 5%;
    transform: translateX(-60px);
    animation: geoDrift 6s ease-in-out infinite alternate-reverse;
}

.room.revealed .geo-sphere {
    transform: translateX(0);
}

.geo-tetra {
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 52px solid rgba(232, 168, 56, 0.15);
    top: 10%;
    left: 3%;
    transform: translateY(-60px);
    animation: geoDrift 9s ease-in-out infinite alternate;
}

.room.revealed .geo-tetra {
    transform: translateY(0);
}

@keyframes geoDrift {
    from { transform: translateY(0); }
    to { transform: translateY(-15px); }
}

/* --- Recursive Windows --- */
.recursive-window {
    position: absolute;
    width: 120px;
    height: 80px;
    border: 1px solid rgba(155, 114, 207, 0.2);
    background: linear-gradient(135deg, rgba(11, 14, 26, 0.8), rgba(45, 27, 105, 0.3));
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms ease;
    overflow: hidden;
}

.room.revealed .recursive-window {
    opacity: 0.6;
}

/* Grid pattern simulating miniaturized page content */
.recursive-window .rw-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: grayscale(1) blur(1px);
}

.recursive-window .rw-inner::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    width: 50%;
    height: 4px;
    background: rgba(240, 236, 249, 0.15);
    box-shadow:
        0 10px 0 rgba(240, 236, 249, 0.08),
        0 20px 0 rgba(240, 236, 249, 0.08),
        0 34px 0 rgba(155, 114, 207, 0.1),
        0 44px 0 rgba(240, 236, 249, 0.06);
}

.recursive-window .rw-inner::after {
    content: '';
    position: absolute;
    top: 10%;
    right: 15%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(155, 114, 207, 0.2);
}

.recursive-window::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(90deg, rgba(155, 114, 207, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(155, 114, 207, 0.08) 1px, transparent 1px);
    background-size: 20px 15px;
}

.rw-1 {
    top: 10%;
    right: 3%;
}

.rw-2 {
    bottom: 15%;
    left: 2%;
    width: 100px;
    height: 66px;
}

/* --- Footer Abyss --- */
.footer-abyss {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    overflow: hidden;
}

.checkerboard-floor {
    position: absolute;
    bottom: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background:
        repeating-conic-gradient(
            var(--void-black) 0% 25%,
            var(--checker-dark) 0% 50%
        ) 0 0 / 60px 60px;
    transform: perspective(600px) rotateX(60deg);
    transform-origin: center bottom;
    opacity: 0.5;
}

.footer-content {
    position: relative;
    text-align: center;
    z-index: 2;
    padding: 40px;
}

.footer-name {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-stretch: 125%;
    font-size: clamp(32px, 5vw, 64px);
    color: var(--lucid-white);
    margin-bottom: 10px;
    transition: font-stretch 400ms ease;
}

.footer-name:hover {
    font-stretch: 135%;
}

.footer-whisper {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 14px;
    color: var(--phantom-lavender);
    opacity: 0.6;
    margin-bottom: 30px;
    letter-spacing: 0.1em;
}

.footer-links {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 30px;
}

.footer-link {
    font-family: 'Red Hat Mono', monospace;
    font-size: 14px;
    color: var(--phantom-lavender);
    letter-spacing: 0.02em;
    transition: color 300ms ease, transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: inline-block;
    background: none;
}

.footer-link:hover {
    color: var(--rift-teal);
    transform: skewY(1.5deg) scaleX(1.02);
}

.footer-year {
    font-family: 'Red Hat Mono', monospace;
    font-size: 12px;
    color: rgba(240, 236, 249, 0.3);
    letter-spacing: 0.2em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-content {
        padding-left: 10%;
        padding-top: 50vh;
    }

    .room {
        padding: 60px 20px;
    }

    .room-about,
    .room-work,
    .room-code,
    .room-approach {
        padding-left: 20px;
        padding-right: 20px;
    }

    .room-frame {
        padding: 40px 25px;
    }

    .cards-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .card-1,
    .card-2,
    .card-3,
    .card-4 {
        transform: rotate(0deg);
        margin-top: 0;
    }

    .approach-steps {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .floating-eye {
        width: 50vw;
    }

    .floating-eye.scrolled {
        width: 50vw;
        transform: translate(-50%, 0) scale(0.2);
    }

    .recursive-window {
        display: none;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }

    .hero-geo {
        display: none;
    }
}

@media (max-width: 480px) {
    .logotype {
        font-size: clamp(36px, 12vw, 64px);
    }

    .floating-eye {
        width: 70vw;
    }

    .hero-content {
        padding-left: 8%;
    }
}
