/* ============================================================
   turingtest.club - Styles
   Colors: #0A0E27, #F5F5F7, #00D9FF, #FF006B, #6B5BE5, #2A2E4A, #E8EEF5, #FF3366
   Fonts: IBM Plex Mono, Fira Sans, Space Grotesk
   ============================================================ */

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

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

body {
    background-color: #0A0E27;
    color: #F5F5F7;
    font-family: 'Fira Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    cursor: crosshair;
}

::selection {
    background: #6B5BE5;
    color: #F5F5F7;
}

/* --- Scanline Overlay --- */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(10, 14, 39, 0.06) 1px,
        rgba(10, 14, 39, 0.06) 2px
    );
    animation: scanlineScroll 12s linear infinite;
}

@keyframes scanlineScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(40px); }
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

/* --- Fibonacci Background --- */
#fibonacci-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
}

/* --- Glitch Text Effect --- */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: #00D9FF;
    z-index: -1;
}

.glitch-text::after {
    color: #FF006B;
    z-index: -1;
}

.glitch-text.glitching::before {
    opacity: 0.8;
    animation: glitchShiftCyan 0.4s steps(2) forwards;
}

.glitch-text.glitching::after {
    opacity: 0.8;
    animation: glitchShiftMagenta 0.4s steps(2) forwards;
}

@keyframes glitchShiftCyan {
    0% { transform: translate(-3px, 0); }
    25% { transform: translate(2px, -1px); }
    50% { transform: translate(-2px, 1px); }
    75% { transform: translate(3px, 0); }
    100% { transform: translate(0, 0); opacity: 0; }
}

@keyframes glitchShiftMagenta {
    0% { transform: translate(3px, 0); }
    25% { transform: translate(-2px, 1px); }
    50% { transform: translate(2px, -1px); }
    75% { transform: translate(-3px, 0); }
    100% { transform: translate(0, 0); opacity: 0; }
}

/* --- Hero Section --- */
#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    overflow: hidden;
}

#hero-title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.2rem, 8vw, 6.5rem);
    letter-spacing: 0.12em;
    text-align: center;
    color: #F5F5F7;
    transition: transform 0.1s ease;
    padding: 0 1rem;
    word-break: break-all;
}

#hero-subtitle {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: #F5F5F7;
    opacity: 0.7;
    margin-top: 2rem;
    letter-spacing: 0.05em;
    transition: opacity 0.5s ease;
}

/* --- Scroll Transition Section --- */
#scroll-transition {
    position: relative;
    width: 100%;
    height: 150vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 20vh;
    z-index: 10;
    overflow: hidden;
}

#transition-container {
    display: flex;
    gap: 0.5em;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.2rem, 8vw, 6.5rem);
    letter-spacing: 0.12em;
    position: relative;
}

.transition-word {
    display: inline-block;
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#word-turing.slide-left {
    transform: translateX(-120vw);
    opacity: 0;
}

.thinking-word {
    position: absolute;
    left: 0;
    top: 0;
    color: #00D9FF;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.thinking-word.visible {
    opacity: 1;
    transform: translateY(0);
}

#thought-stream {
    margin-top: 8vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 700px;
    padding: 0 2rem;
}

.thought-line {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    color: #E8EEF5;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    text-align: center;
    line-height: 1.6;
}

.thought-line.visible {
    opacity: 0.8;
    transform: translateY(0);
}

/* --- Content Area --- */
#content-area {
    position: relative;
    z-index: 10;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Content Sections --- */
.content-section {
    margin-bottom: 20vh;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.content-section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* --- Prompt Text --- */
.prompt-text {
    margin-bottom: 4rem;
}

.prompt-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #00D9FF;
    display: block;
    margin-bottom: 1rem;
}

.section-heading {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: 0.06em;
    color: #F5F5F7;
    line-height: 1.3;
}

/* --- Broken Grid --- */
.content-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.grid-cell {
    padding: 1.5rem;
    position: relative;
}

.cell-wide {
    grid-column: span 7;
}

.cell-narrow {
    grid-column: span 5;
}

.cell-medium {
    grid-column: span 6;
}

.cell-full {
    grid-column: span 12;
}

.offset-cell {
    transform: translateY(14px) translateX(-12px);
}

.offset-cell-right {
    transform: translateY(-14px) translateX(12px);
}

.reverse-grid .cell-medium {
    grid-column: 5 / span 8;
}

.reverse-grid .cell-narrow {
    grid-column: 1 / span 4;
}

.reverse-grid .cell-wide {
    grid-column: span 12;
}

.grid-cell p {
    color: #E8EEF5;
    line-height: 1.7;
}

.grid-cell p em {
    color: #FF006B;
    font-style: italic;
}

/* --- Stat Blocks --- */
.stat-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    border: 1px solid #2A2E4A;
    background: rgba(42, 46, 74, 0.3);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.stat-block:hover {
    border-color: #6B5BE5;
    box-shadow: 0 0 20px rgba(107, 91, 229, 0.3);
}

.stat-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.12em;
    color: #00D9FF;
}

.stat-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6B5BE5;
}

/* --- Binary Stream --- */
.binary-stream {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: #2A2E4A;
    overflow: hidden;
    padding: 1rem;
}

.binary-stream span {
    opacity: 0.4;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.binary-stream span.active {
    opacity: 1;
    color: #00D9FF;
}

/* --- Threshold Visual --- */
.threshold-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    height: 200px;
    position: relative;
}

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

.human-side {
    background: linear-gradient(135deg, rgba(255, 0, 107, 0.1) 0%, transparent 100%);
}

.machine-side {
    background: linear-gradient(225deg, rgba(0, 217, 255, 0.1) 0%, transparent 100%);
}

.side-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #F5F5F7;
    opacity: 0.7;
    z-index: 2;
}

.human-side .side-label {
    color: #FF006B;
}

.machine-side .side-label {
    color: #00D9FF;
}

.pulse-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0.3;
}

.human-side .pulse-ring {
    color: #FF006B;
    animation: pulseRing 3s ease-in-out infinite;
}

.machine-side .pulse-ring {
    color: #00D9FF;
    animation: pulseRing 3s ease-in-out infinite 1.5s;
}

@keyframes pulseRing {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

.threshold-center {
    width: 60px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, transparent, rgba(107, 91, 229, 0.3), transparent);
    position: relative;
    z-index: 2;
}

.threshold-question {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 3rem;
    color: #6B5BE5;
    animation: questionPulse 2s ease-in-out infinite;
}

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

/* --- Query Interface --- */
.query-interface {
    max-width: 700px;
    margin: 0 auto;
}

.query-input-wrapper {
    display: flex;
    gap: 0;
    border: 1px solid #2A2E4A;
    background: rgba(10, 14, 39, 0.8);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.query-input-wrapper:hover {
    border-color: #6B5BE5;
}

.query-input-wrapper:focus-within {
    border-color: #00D9FF;
    box-shadow: 0 0 30px rgba(0, 217, 255, 0.15),
                inset 0 0 30px rgba(0, 217, 255, 0.05);
}

.query-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #F5F5F7;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.05em;
    padding: 1.2rem 1.5rem;
    caret-color: #00D9FF;
}

.query-input::placeholder {
    color: #2A2E4A;
    font-family: 'Fira Sans', sans-serif;
}

.query-button {
    background: transparent;
    border: none;
    border-left: 1px solid #2A2E4A;
    padding: 1.2rem 2rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.query-button:hover {
    background: rgba(0, 217, 255, 0.1);
}

.query-button:hover .button-text {
    color: #00D9FF;
}

.button-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6B5BE5;
    transition: color 0.3s ease;
}

/* Hover multi-layered states for buttons */
.query-button::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    transition: border-color 0.15s ease;
    pointer-events: none;
}

.query-button:hover::before {
    border-color: #00D9FF;
    animation: buttonGlitch 0.4s ease forwards;
}

@keyframes buttonGlitch {
    0% { border-color: #00D9FF; }
    33% { border-color: #FF006B; }
    66% { border-color: #6B5BE5; }
    100% { border-color: #6B5BE5; box-shadow: 0 0 15px rgba(107, 91, 229, 0.4); }
}

.query-response {
    margin-top: 2rem;
    min-height: 80px;
    padding: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    color: #E8EEF5;
    line-height: 1.6;
    border-left: 2px solid #2A2E4A;
    opacity: 0;
    transition: opacity 0.5s ease;
    position: relative;
}

.query-response.active {
    opacity: 1;
}

.query-response.thinking {
    border-left-color: #6B5BE5;
}

.response-cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background: #00D9FF;
    vertical-align: text-bottom;
    animation: cursorBlink 0.8s steps(2) infinite;
    opacity: 0;
}

.query-response.thinking .response-cursor {
    opacity: 1;
}

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

/* --- Recursive Box --- */
.recursive-box {
    width: 160px;
    height: 160px;
    border: 1px solid #6B5BE5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: recursiveRotate 20s linear infinite;
}

.recursive-inner {
    width: 70%;
    height: 70%;
    border: 1px solid rgba(107, 91, 229, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(15deg);
}

.recursive-inner .recursive-inner {
    border-color: rgba(107, 91, 229, 0.3);
}

.recursive-symbol {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    color: #6B5BE5;
    opacity: 0.6;
}

@keyframes recursiveRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Footer --- */
#site-footer {
    position: relative;
    z-index: 10;
    padding: 6rem 2rem;
    text-align: center;
    border-top: 1px solid #2A2E4A;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.12em;
    color: #F5F5F7;
}

.footer-tagline {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: #2A2E4A;
    letter-spacing: 0.05em;
}

/* --- Interactive Hover Effects --- */
a, .interactive-element {
    position: relative;
    text-decoration: none;
    color: #F5F5F7;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: linear-gradient(to right, #00D9FF, #FF006B);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* --- Element hover shift (nervous energy) --- */
.grid-cell {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.grid-cell:hover {
    transform: translate(
        calc(var(--hover-shift-x, 0) * 1px),
        calc(var(--hover-shift-y, 0) * 1px)
    );
}

/* --- Staggered section entry animation --- */
.content-section.in-view .grid-cell {
    animation: cascadeIn 0.6s ease forwards;
    opacity: 0;
}

.content-section.in-view .grid-cell:nth-child(1) { animation-delay: 0s; }
.content-section.in-view .grid-cell:nth-child(2) { animation-delay: 0.15s; }
.content-section.in-view .grid-cell:nth-child(3) { animation-delay: 0.3s; }
.content-section.in-view .grid-cell:nth-child(4) { animation-delay: 0.45s; }

@keyframes cascadeIn {
    0% {
        opacity: 0;
        transform: translateY(30px) translateX(-8px);
    }
    80% {
        opacity: 1;
        transform: translateY(-3px) translateX(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

/* Lag catch-up animation for occasional cells */
.content-section.in-view .grid-cell.lagging {
    animation: cascadeLag 1s ease forwards;
}

@keyframes cascadeLag {
    0% {
        opacity: 0;
        transform: translateY(50px) translateX(-15px);
    }
    50% {
        opacity: 0.3;
        transform: translateY(20px) translateX(-5px);
    }
    70% {
        opacity: 0.8;
        transform: translateY(5px) translateX(3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

/* --- Typewriter Trail Effect (hover on interactive elements) --- */
.typewriter-trail {
    position: absolute;
    pointer-events: none;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: inherit;
    letter-spacing: 0.12em;
    color: #6B5BE5;
    white-space: nowrap;
    animation: trailFade 0.8s ease forwards;
    z-index: 50;
}

@keyframes trailFade {
    0% { opacity: 0.6; transform: translateX(-5px); }
    100% { opacity: 0; transform: translateX(-20px); }
}

/* --- RGB Shift on content blocks --- */
.rgb-shift {
    position: relative;
}

.rgb-shift::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    mix-blend-mode: screen;
    opacity: 0;
}

.rgb-shifting::before {
    animation: rgbShift 0.4s steps(3) forwards;
}

@keyframes rgbShift {
    0% {
        opacity: 0.5;
        transform: translateX(-3px);
        background: rgba(0, 217, 255, 0.15);
    }
    33% {
        transform: translateX(2px);
        background: rgba(255, 0, 107, 0.15);
    }
    66% {
        transform: translateX(-2px);
        background: rgba(107, 91, 229, 0.15);
    }
    100% {
        opacity: 0;
        transform: translateX(0);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .cell-wide,
    .cell-narrow,
    .cell-medium,
    .cell-full {
        grid-column: span 1;
    }

    .reverse-grid .cell-medium,
    .reverse-grid .cell-narrow,
    .reverse-grid .cell-wide {
        grid-column: span 1;
    }

    .offset-cell,
    .offset-cell-right {
        transform: none;
    }

    #hero-title {
        font-size: clamp(1.8rem, 10vw, 3.5rem);
        word-break: break-all;
    }

    #transition-container {
        font-size: clamp(1.8rem, 10vw, 3.5rem);
        flex-direction: column;
        align-items: center;
    }

    .thinking-word {
        position: relative;
    }

    .threshold-visual {
        flex-direction: column;
        height: auto;
        gap: 1rem;
    }

    .threshold-center {
        width: 100%;
        height: 60px;
    }

    .query-input-wrapper {
        flex-direction: column;
    }

    .query-button {
        border-left: none;
        border-top: 1px solid #2A2E4A;
    }
}

@media (max-width: 480px) {
    #content-area {
        padding: 0 1rem;
    }

    .prompt-text {
        margin-bottom: 2rem;
    }

    .section-heading {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }
}
