/* ==========================================================================
   turingtest.club  -  Bauhaus + Aurora + Card-Flip
   Palette: #0a1628 #00E5A0 #7B2FBE #1a0a3e #0D0221 #FF6B8A #E8D5B7
   Fonts:   Archivo Black, Press Start 2P, DM Sans, Inter (fallback)
   ========================================================================== */

:root {
    --void:      #0D0221;
    --void-2:    #1a0a3e;
    --void-3:    #0a1628;
    --cream:     #E8D5B7;
    --green:     #00E5A0;
    --violet:    #7B2FBE;
    --coral:     #FF6B8A;

    --gap:       2px;
    --radius:    0;
    --shadow:    0 8px 32px rgba(123, 47, 190, 0.12);
    --shadow-h:  0 12px 48px rgba(123, 47, 190, 0.28);

    --font-display: "Archivo Black", "Inter", sans-serif;
    --font-pixel:   "Press Start 2P", "Inter", monospace;
    --font-body:    "DM Sans", "Inter", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--void);
    color: var(--cream);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Aurora gradient backdrop  +  CRT scanlines
   -------------------------------------------------------------------------- */

.aurora-bg {
    position: fixed;
    inset: 0;
    z-index: -3;
    background: linear-gradient(135deg,
        var(--void) 0%,
        var(--void-2) 25%,
        var(--void) 50%,
        var(--void-3) 75%,
        var(--void) 100%);
    background-size: 400% 400%;
    animation: auroraShift 25s ease-in-out infinite;
}

@keyframes auroraShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.aurora-layer {
    position: fixed;
    width: 80vmax;
    height: 80vmax;
    z-index: -2;
    pointer-events: none;
    will-change: transform;
    border-radius: 50%;
    filter: blur(60px);
    mix-blend-mode: screen;
}

.aurora-1 {
    top: 30%; left: -20%;
    background: radial-gradient(circle at center, rgba(0, 229, 160, 0.10) 0%, rgba(0, 229, 160, 0) 60%);
    animation: drift1 20s ease-in-out infinite;
}
.aurora-2 {
    top: 50%; left: 30%;
    background: radial-gradient(circle at center, rgba(123, 47, 190, 0.14) 0%, rgba(123, 47, 190, 0) 60%);
    animation: drift2 28s ease-in-out infinite;
}
.aurora-3 {
    top: 70%; left: 40%;
    background: radial-gradient(circle at center, rgba(255, 107, 138, 0.08) 0%, rgba(255, 107, 138, 0) 60%);
    animation: drift3 35s ease-in-out infinite;
}

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(20vw, -10vh) scale(1.15); }
}
@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) scale(1.1); }
    50%      { transform: translate(-15vw, 12vh) scale(0.95); }
}
@keyframes drift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(10vw, -18vh) scale(1.2); }
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* --------------------------------------------------------------------------
   Stage layout
   -------------------------------------------------------------------------- */

.stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    padding: 0;
    perspective: 1200px;
}

/* --------------------------------------------------------------------------
   Hero card
   -------------------------------------------------------------------------- */

.hero {
    width: 100%;
    min-height: 100vh;
    display: flex;
    padding: var(--gap);
    background: var(--violet);
}

.hero-card {
    flex: 1 1 auto;
    position: relative;
    background: var(--void);
    color: var(--cream);
    padding: clamp(2rem, 6vw, 5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    transform: perspective(1200px) rotateX(0.5deg);
    animation: heroBreathe 8s ease-in-out infinite;
    opacity: 0;
    animation: heroBreathe 8s ease-in-out infinite, heroFadeIn 1.2s 0.4s forwards ease-out;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: perspective(1200px) rotateX(0.5deg) translateY(20px); }
    to   { opacity: 1; transform: perspective(1200px) rotateX(0.5deg) translateY(0); }
}

@keyframes heroBreathe {
    0%, 100% { transform: perspective(1200px) rotateX(0.5deg) scale(1); }
    50%      { transform: perspective(1200px) rotateX(0.5deg) scale(1.005); }
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 229, 160, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 138, 0.10) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(123, 47, 190, 0.10) 0%, transparent 60%);
    animation: heroAurora 12s ease-in-out infinite;
}

@keyframes heroAurora {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.05); }
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
}

.hero-label {
    font-family: var(--font-pixel);
    font-size: clamp(0.6rem, 1.2vw, 0.85rem);
    letter-spacing: 0.15em;
    color: var(--green);
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3rem, 14vw, 11rem);
    line-height: 0.88;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--cream);
    position: relative;
    z-index: 2;
    margin: 1.5rem 0;
    background: linear-gradient(135deg, var(--cream) 0%, var(--cream) 50%, var(--coral) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShift 12s ease-in-out infinite;
}

@keyframes titleShift {
    0%, 100% { background: linear-gradient(135deg, var(--cream) 0%, var(--cream) 70%, var(--coral) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    33%      { background: linear-gradient(135deg, var(--cream) 0%, var(--green) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    66%      { background: linear-gradient(135deg, var(--coral) 0%, var(--cream) 60%, var(--violet) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
}

.hero-sub {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 56ch;
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    color: var(--cream);
    opacity: 0.85;
    position: relative;
    z-index: 2;
}

.hero-foot {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-pixel);
    font-size: clamp(0.55rem, 1vw, 0.8rem);
    letter-spacing: 0.15em;
    color: var(--green);
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(232, 213, 183, 0.2);
    padding-top: 1.25rem;
}

.hero-foot-tag { display: inline-block; }

/* --------------------------------------------------------------------------
   Card grid
   -------------------------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--gap);
    background: var(--violet);
    padding: var(--gap);
    transform: perspective(1200px) rotateX(0.5deg);
    transform-origin: center top;
}

.card {
    position: relative;
    width: 100%;
    perspective: 1200px;
    cursor: pointer;
    transition: box-shadow 0.3s ease;
    box-shadow: var(--shadow);
    background: var(--void);
}

.card.ratio-1x1 { aspect-ratio: 1 / 1; }
.card.ratio-3x2 { aspect-ratio: 3 / 2; grid-column: span 2; }
.card.ratio-2x3 { aspect-ratio: 2 / 3; grid-row: span 2; }

@media (max-width: 720px) {
    .card.ratio-3x2 { grid-column: span 1; aspect-ratio: 3 / 2; }
    .card.ratio-2x3 { grid-row: span 1; aspect-ratio: 1 / 1; }
}

.card.is-revealed { z-index: 5; }

/* Stagger entrance */
.card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease, box-shadow 0.3s ease;
}
.card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    box-shadow: var(--shadow-h);
}

.card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.7s ease;
}

.card.is-flipped .card-inner,
.card:hover .card-inner {
    transform: rotateY(180deg);
    box-shadow: 0 0 0 1px var(--green), 0 0 32px rgba(0, 229, 160, 0.45);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    padding: clamp(1rem, 2vw, 1.6rem);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.card-front { transform: rotateY(0deg); }
.card-back  { transform: rotateY(180deg); }

/* Card scan-line texture */
.card-front::after,
.card-back::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}
.card-back::after {
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 4px
    );
}

/* Duotone variants */
.mode-dark .card-front  { background: var(--void);  color: var(--cream); }
.mode-dark .card-back   { background: var(--cream); color: var(--void); }

.mode-light .card-front { background: var(--cream); color: var(--void); }
.mode-light .card-back  { background: var(--void);  color: var(--cream); }

.card-tag {
    font-family: var(--font-pixel);
    font-size: clamp(0.55rem, 1vw, 0.78rem);
    letter-spacing: 0.18em;
    color: var(--green);
    position: relative;
    z-index: 2;
}

.mode-light .card-tag { color: var(--violet); }

.card-tag-strip {
    position: absolute;
    top: -22px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--coral);
    z-index: 3;
    text-transform: uppercase;
    pointer-events: none;
}

.card-prompt {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(1rem, 1.6vw, 1.3rem);
    line-height: 1.4;
    position: relative;
    z-index: 2;
    margin: auto 0;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-pixel);
    font-size: clamp(0.5rem, 0.8vw, 0.7rem);
    letter-spacing: 0.18em;
    opacity: 0.7;
    position: relative;
    z-index: 2;
}

.card-back .bauhaus {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.card-reveal {
    position: relative;
    z-index: 2;
    font-family: var(--font-display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    font-size: clamp(1.4rem, 3vw, 2.6rem);
    line-height: 1;
    margin: auto 0 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   Footer card  (inverted duotone)
   -------------------------------------------------------------------------- */

.footer-zone {
    width: 100%;
    padding: var(--gap);
    background: var(--violet);
}

.footer-card {
    position: relative;
    background: var(--cream);
    color: var(--void);
    padding: clamp(2rem, 5vw, 4rem);
    overflow: hidden;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform: perspective(1200px) rotateX(0.5deg);
}

.footer-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(13, 2, 33, 0.04) 2px,
        rgba(13, 2, 33, 0.04) 4px
    );
}

.footer-label {
    font-family: var(--font-pixel);
    font-size: clamp(0.6rem, 1.1vw, 0.8rem);
    letter-spacing: 0.18em;
    color: var(--violet);
    position: relative;
    z-index: 2;
}

.footer-text {
    font-family: var(--font-display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    font-size: clamp(1.5rem, 4vw, 3.2rem);
    line-height: 1.05;
    margin: 1.5rem 0;
    color: var(--void);
    position: relative;
    z-index: 2;
}

.footer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-pixel);
    font-size: clamp(0.55rem, 1vw, 0.75rem);
    letter-spacing: 0.18em;
    color: var(--void);
    position: relative;
    z-index: 2;
    border-top: 1px solid rgba(13, 2, 33, 0.25);
    padding-top: 1rem;
}

.glyph-line {
    display: inline-block;
    width: 28px;
    height: 1px;
    background: var(--void);
}

.glyph-circle {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--cream);
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(0, 229, 160, 0.6);
}

/* --------------------------------------------------------------------------
   Custom scrollbar
   -------------------------------------------------------------------------- */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--green); }
::-webkit-scrollbar-thumb:hover { background: var(--coral); }

/* Firefox */
html { scrollbar-color: var(--green) var(--void); scrollbar-width: thin; }

/* --------------------------------------------------------------------------
   Selection
   -------------------------------------------------------------------------- */

::selection { background: var(--green); color: var(--void); }

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

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