/* ========================================
   WORDWEAVING BADGE — RETRO PIXEL STYLES
   ======================================== */

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

:root {
    --color-bg: #000000;
    --color-bg-alt: #0a0a0a;
    --color-gold: #f5c842;
    --color-gold-dim: #c9a020;
    --color-gold-glow: #ffe066;
    --color-green: #33ff66;
    --color-green-dim: #1a9940;
    --color-cyan: #00ffff;
    --color-magenta: #ff00ff;
    --color-red: #ff3333;
    --color-white: #e0e0e0;
    --color-gray: #666666;
    --color-dark-gray: #1a1a1a;
    --color-card-bg: #0d0d0d;
    --color-card-border: #2a2a2a;

    --font-pixel: 'Press Start 2P', monospace;
    --font-silk: 'Silkscreen', monospace;
    --font-dot: 'DotGothic16', monospace;

    --glow-gold: 0 0 10px rgba(245, 200, 66, 0.4), 0 0 30px rgba(245, 200, 66, 0.15);
    --glow-green: 0 0 10px rgba(51, 255, 102, 0.4), 0 0 30px rgba(51, 255, 102, 0.15);
    --glow-cyan: 0 0 10px rgba(0, 255, 255, 0.4), 0 0 30px rgba(0, 255, 255, 0.15);
}

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

body {
    background-color: var(--color-bg);
    color: var(--color-white);
    font-family: var(--font-dot);
    overflow-x: hidden;
    line-height: 1.6;
}

::selection {
    background: var(--color-gold);
    color: var(--color-bg);
}

/* --- Scanlines Overlay --- */
.scanlines {
    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 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
}

/* --- Pixel Particles --- */
.pixel-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.pixel-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--color-gold);
    opacity: 0;
    animation: floatParticle 8s infinite linear;
}

@keyframes floatParticle {
    0% { opacity: 0; transform: translateY(100vh) scale(0.5); }
    10% { opacity: 0.8; }
    90% { opacity: 0.3; }
    100% { opacity: 0; transform: translateY(-10vh) scale(1.2); }
}

/* --- Navigation --- */
#site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--color-dark-gray);
}

#main-nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
}

.nav-logo {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--color-gold);
    text-decoration: none;
    text-shadow: var(--glow-gold);
    letter-spacing: 2px;
    transition: text-shadow 0.3s;
}

.nav-logo:hover {
    text-shadow: 0 0 15px rgba(245, 200, 66, 0.8), 0 0 40px rgba(245, 200, 66, 0.4);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 24px;
}

.nav-links a {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--color-gray);
    text-decoration: none;
    letter-spacing: 2px;
    transition: color 0.3s, text-shadow 0.3s;
    padding: 4px 0;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-green);
    text-shadow: var(--glow-green);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--color-green);
    transition: width 0.3s;
    box-shadow: var(--glow-green);
}

.nav-links a:hover::after {
    width: 100%;
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px 24px 40px;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(245, 200, 66, 0.04) 0%, transparent 60%),
        var(--color-bg);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: 1000px;
    width: 100%;
}

.hero-title-group {
    text-align: center;
}

.hero-pre-title {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--color-gold-dim);
    letter-spacing: 4px;
    margin-bottom: 16px;
    animation: fadeInDown 1s ease-out;
}

.hero-title {
    font-family: var(--font-pixel);
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    color: var(--color-gold);
    text-shadow:
        0 0 10px rgba(245, 200, 66, 0.6),
        0 0 40px rgba(245, 200, 66, 0.3),
        0 0 80px rgba(245, 200, 66, 0.1);
    letter-spacing: 6px;
    margin-bottom: 16px;
    position: relative;
    animation: fadeInDown 1s ease-out 0.2s both;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: inherit;
    font-size: inherit;
    letter-spacing: inherit;
}

.glitch::before {
    color: var(--color-cyan);
    z-index: -1;
    animation: glitch-1 3s infinite linear;
}

.glitch::after {
    color: var(--color-magenta);
    z-index: -2;
    animation: glitch-2 3s infinite linear;
}

@keyframes glitch-1 {
    0%, 93%, 100% { transform: translate(0); opacity: 0; }
    93.5% { transform: translate(-3px, 1px); opacity: 0.7; }
    94% { transform: translate(3px, -1px); opacity: 0.7; }
    94.5% { transform: translate(-1px, 2px); opacity: 0; }
}

@keyframes glitch-2 {
    0%, 96%, 100% { transform: translate(0); opacity: 0; }
    96.5% { transform: translate(3px, -2px); opacity: 0.7; }
    97% { transform: translate(-3px, 1px); opacity: 0.7; }
    97.5% { transform: translate(2px, 1px); opacity: 0; }
}

.hero-tagline {
    font-family: var(--font-silk);
    font-size: clamp(0.6rem, 1.5vw, 0.85rem);
    color: var(--color-green);
    text-shadow: var(--glow-green);
    letter-spacing: 3px;
    animation: fadeInDown 1s ease-out 0.4s both;
}

/* --- Badge Display --- */
.badge-display {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: fadeInUp 1.2s ease-out 0.6s both;
}

.badge-glow {
    position: absolute;
    width: 500px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(245, 200, 66, 0.1) 0%, transparent 70%);
    filter: blur(40px);
    animation: pulseGlow 4s ease-in-out infinite;
}

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

.badge-container {
    position: relative;
    display: inline-block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.badge-image {
    display: block;
    max-height: 70vh;
    width: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 0 20px rgba(245, 200, 66, 0.3));
    transition: filter 0.5s;
}

.badge-container:hover .badge-image {
    filter: drop-shadow(0 0 30px rgba(245, 200, 66, 0.5));
}

.screenshot-overlay {
    position: absolute;
    /* 
       Position will be computed by JavaScript to match the badge's 
       screen area at 142,142 offset from the natural image origin,
       scaled proportionally to the rendered size.
    */
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.screenshot-overlay .screenshot {
    position: absolute;
    top: 0;
    left: 0;
    width: 128px;
    height: 128px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.screenshot-overlay .screenshot.active {
    opacity: 1;
}

/* --- Hero CTA --- */
.hero-cta-group {
    text-align: center;
    animation: fadeInUp 1s ease-out 0.8s both;
}

.hero-blink {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    color: var(--color-green);
    text-shadow: var(--glow-green);
    letter-spacing: 3px;
    animation: blink 1.2s steps(2, start) infinite;
}

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

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: fit-content;
    text-align: center;
    animation: fadeInUp 1s ease-out 1.2s both;
}

.scroll-indicator span {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--color-gray);
    letter-spacing: 3px;
    display: block;
    margin-bottom: 8px;
}

.scroll-arrow {
    font-size: 0.8rem;
    color: var(--color-gold-dim);
    animation: bounceDown 1.5s ease-in-out infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- Section Shared Styles --- */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-family: var(--font-pixel);
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    color: var(--color-gold);
    text-shadow: var(--glow-gold);
    letter-spacing: 6px;
}

.title-underline {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    margin: 16px auto 0;
    box-shadow: var(--glow-gold);
}

/* --- Features Section --- */
.features-section {
    padding: 100px 24px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.features-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 80px;
    background: linear-gradient(to bottom, transparent, var(--color-gold-dim), transparent);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    padding: 32px 24px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s, transform 0.3s, box-shadow 0.4s;
}

.feature-card:hover {
    border-color: var(--color-gold-dim);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(245, 200, 66, 0.08);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 16px;
    display: block;
}

.feature-title {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--color-gold);
    text-shadow: 0 0 8px rgba(245, 200, 66, 0.3);
    letter-spacing: 2px;
    margin-bottom: 12px;
    line-height: 1.8;
}

.feature-desc {
    font-family: var(--font-dot);
    font-size: 0.85rem;
    color: var(--color-gray);
    line-height: 1.8;
    transition: color 0.3s;
}

.feature-card:hover .feature-desc {
    color: var(--color-white);
}

.feature-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-card-border), transparent);
}

/* --- Screenshots Gallery --- */
.screenshots-section {
    padding: 100px 24px;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--color-card-border);
    background: var(--color-dark-gray);
    transition: border-color 0.3s, transform 0.3s;
    cursor: pointer;
    aspect-ratio: 1;
}

.gallery-item:hover {
    border-color: var(--color-gold);
    transform: scale(1.03);
    z-index: 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
    transition: filter 0.3s;
}

.gallery-item:hover img {
    filter: brightness(1.2) contrast(1.1);
}

.gallery-label {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 0;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--color-gold);
    text-shadow: var(--glow-gold);
    letter-spacing: 3px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s, transform 0.3s;
}

.gallery-item:hover .gallery-label {
    opacity: 1;
    transform: translateY(0);
}

/* --- Specs Section --- */
.specs-section {
    padding: 100px 24px;
    max-width: 700px;
    margin: 0 auto;
}

.specs-table-wrapper {
    border: 1px solid var(--color-card-border);
    background: var(--color-card-bg);
    overflow: hidden;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-silk);
    font-size: 0.75rem;
}

.specs-table tr {
    border-bottom: 1px solid var(--color-card-border);
    transition: background 0.3s;
}

.specs-table tr:last-child {
    border-bottom: none;
}

.specs-table tr:hover {
    background: rgba(245, 200, 66, 0.03);
}

.spec-label {
    padding: 14px 20px;
    color: var(--color-gold-dim);
    letter-spacing: 2px;
    width: 40%;
    border-right: 1px solid var(--color-card-border);
    font-family: var(--font-pixel);
    font-size: 0.5rem;
}

.spec-value {
    padding: 14px 20px;
    color: var(--color-white);
    letter-spacing: 1px;
}

/* --- Purchase Section --- */
.purchase-section {
    padding: 100px 24px;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.purchase-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.purchase-text {
    font-family: var(--font-silk);
    font-size: 0.85rem;
    color: var(--color-white);
    letter-spacing: 1px;
    line-height: 1.8;
    max-width: 500px;
}

.purchase-btn-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.purchase-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.purchase-btn-sub {
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--color-gray);
    letter-spacing: 3px;
}

.purchase-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background: transparent;
    border: 2px solid var(--color-gold);
    color: var(--color-gold);
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    letter-spacing: 3px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--glow-gold);
}

.purchase-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--color-gold);
    transition: left 0.3s ease;
    z-index: -1;
}

.purchase-btn:hover::before {
    left: 0;
}

.purchase-btn:hover {
    color: var(--color-bg);
    text-shadow: none;
    box-shadow: 0 0 20px rgba(245, 200, 66, 0.6), 0 0 50px rgba(245, 200, 66, 0.3);
    transform: translateY(-2px);
}

.purchase-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.1rem;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.purchase-note {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--color-gray);
    letter-spacing: 3px;
    animation: blink 1.5s steps(2, start) infinite;
}

/* --- Footer --- */
.site-footer {
    padding: 60px 24px 40px;
    text-align: center;
    border-top: 1px solid var(--color-dark-gray);
    background: var(--color-bg-alt);
}

.footer-text {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--color-gold);
    text-shadow: var(--glow-gold);
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.footer-sub {
    font-family: var(--font-silk);
    font-size: 0.65rem;
    color: var(--color-gray);
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.footer-divider {
    width: 40px;
    height: 2px;
    background: var(--color-card-border);
    margin: 0 auto 20px;
}

.footer-copy {
    font-family: var(--font-pixel);
    font-size: 0.4rem;
    color: var(--color-gray);
    letter-spacing: 2px;
}

/* --- Animations --- */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scroll-triggered reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 0.4rem;
    }

    .hero-section {
        padding-top: 100px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .badge-display {
        padding: 20px;
    }

    .badge-image {
        max-height: 55vh;
    }

    .specs-table {
        font-size: 0.6rem;
    }

    .spec-label {
        font-size: 0.4rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        display: none;
    }

    .hero-title {
        letter-spacing: 3px;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .feature-card {
        padding: 24px 16px;
    }
}
