/* ═══════════════════════════════════════
   RETRO MODE — Side-scrolling 8-bit layout
   Horizontal navigation like a platformer
   ═══════════════════════════════════════ */

@import url('https://unpkg.com/nes.css@2.3.0/css/nes.min.css');

/* Hide terminal/BBS containers */
#term-output { display: none !important; }
#bbs-output { display: none !important; }

/* Ensure main content visible */
main { display: flex !important; }
#site-header { display: block !important; }
#site-footer { display: none; } /* Footer content is in the last section */

/* Show scroll controls */
#scroll-controls { display: flex !important; }
#level-bar { display: flex !important; }

/* ═══ HEADER ═══ */

#site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 10px 0;
    background: rgba(12,12,20,0.95);
    border-bottom: 4px solid var(--border);
}

#site-header .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo img { height: 36px; image-rendering: pixelated; }
.site-logo .site-title { display: none; }

.nav-toggle { display: none; }

.nav-list {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-list a {
    color: var(--muted);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.nav-list a:hover { color: var(--accent); }
.nav-list a.nav-active { color: var(--accent); }

/* ═══ HORIZONTAL SCROLL CONTAINER ═══ */

main {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    height: 100vh;
    padding-top: 60px; /* header height */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

main::-webkit-scrollbar { display: none; }

/* ═══ SECTIONS AS HORIZONTAL PANELS ═══ */

.section {
    min-width: 100vw;
    max-width: 100vw;
    height: calc(100vh - 60px);
    scroll-snap-align: start;
    overflow-y: auto;
    padding: 0;
    display: flex;
    align-items: center;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg);
}

.section::-webkit-scrollbar { width: 6px; }
.section::-webkit-scrollbar-track { background: var(--bg); }
.section::-webkit-scrollbar-thumb { background: var(--accent); }

.section > .wrap {
    padding: 40px 48px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}

/* Section backgrounds — alternating for visual rhythm */
#hero {
    background: url('../images/hero-bg.webp') center/cover;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(12,12,20,0.8);
    z-index: 0;
}

#hero > .wrap { position: relative; z-index: 1; }

#games { background: var(--elevated); align-items: flex-start; }
#tools { background: var(--bg); }
#about { background: var(--surface); }
#newsletter { background: var(--elevated); }

/* Content containers */
#tools > .wrap,
#about > .wrap,
#newsletter > .wrap {
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

/* Games section — shelf grid fills the viewport */
#games > .wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
    padding-top: 12px;
    padding-bottom: 60px;
}

/* Hide section-head in games — title is in the grid tile */
#games .section-head { display: none; }

/* ═══ HERO ═══ */

.hero-sub {
    font-size: 0.5rem;
    color: var(--muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

#hero h1 {
    font-size: 1.4rem;
    color: var(--accent);
    text-shadow: 0 0 30px rgba(0,255,153,0.3);
    margin-bottom: 24px;
}

.hero-tagline {
    font-size: 0.6rem;
    color: var(--muted);
    margin-bottom: 48px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 48px;
}

.stat {
    text-align: center;
    padding: 16px 24px;
    border: 4px solid var(--border);
    background: var(--surface);
    min-width: 110px;
}

.stat-val {
    display: block;
    font-size: 1.4rem;
    color: var(--accent);
}

.stat-lbl {
    font-size: 0.4rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ═══ CTAs ═══ */

.cta {
    display: inline-block;
    font-family: var(--font);
    font-size: 0.6rem;
    padding: 10px 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    color: var(--bg) !important;
    background: var(--accent);
    border: 4px solid;
    border-color: #fff var(--border) var(--border) #fff;
    transition: all 0.2s;
}

.cta:hover {
    background: #33ffbb;
    box-shadow: 0 0 20px rgba(0,255,153,0.3);
}

.cta--secondary {
    background: var(--primary);
    color: var(--text) !important;
}

.cta--secondary:hover {
    background: #9b3cf3;
}

/* ═══ SECTIONS ═══ */

.section-head {
    text-align: center;
    margin-bottom: 48px;
}

.section-head h2 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 12px;
}

.section-head p {
    max-width: 520px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 0.55rem;
}

/* ═══ GAME SHELF (Grid) ═══ */

.shelf {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex: 1;
    min-height: 0;
}

/* Cards as compact tiles */
.shelf .card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 4px solid var(--border);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    margin: 0;
}

.shelf .card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    z-index: 100;
}

.shelf .card--featured { grid-column: span 1; }

/* Tile image — fills the tile */
.shelf .card-img {
    flex: 1;
    min-height: 0;
    background-position: center;
    background-size: cover;
    opacity: 1;
}

/* Tile label — game name shown at bottom of tile */
.shelf .card-body {
    padding: 10px 12px;
    background: var(--surface);
    border-top: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Only show name and badge by default */
.shelf .card-body h3 {
    font-size: 0.55rem;
    color: var(--primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shelf .card-body .badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.35rem;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid;
    width: fit-content;
    order: -1;
}

.badge--green { color: var(--accent); border-color: var(--accent); }
.badge--yellow { color: var(--warn); border-color: var(--warn); }
.badge--red { color: var(--danger); border-color: var(--danger); }

/* Hide details by default */
.shelf .card-body p,
.shelf .card-body .features,
.shelf .card-body .tags,
.shelf .card-body .cta {
    display: none;
}

/* ═══ HOVER POPUP ═══ */

.shelf .card:hover .card-body {
    position: absolute;
    bottom: 0;
    left: -4px;
    right: -4px;
    max-height: 85%;
    overflow-y: auto;
    padding: 14px;
    gap: 8px;
    background: rgba(18, 18, 30, 0.97);
    border: 4px solid var(--accent);
    border-bottom: none;
    z-index: 10;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.shelf .card:hover .card-body p,
.shelf .card:hover .card-body .tags {
    display: block;
}

.shelf .card:hover .card-body .features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.shelf .card:hover .card-body .cta {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.45rem;
    padding: 6px 12px;
    /* surface the link right under the title so it isn't lost below the scroll fold */
    order: -1;
}

.shelf .card:hover .card-body .badge { order: -3; }
.shelf .card:hover .card-body h3 { order: -2; }

.shelf .card:hover .card-body p {
    font-size: 0.45rem;
    color: var(--muted);
    line-height: 1.8;
}

.shelf .card:hover .card-body .features li {
    font-size: 0.4rem;
    color: var(--muted);
}

.shelf .card:hover .card-body .features li::before {
    content: '> ';
    color: var(--accent);
}

.shelf .card:hover .card-body .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ═══ DECORATIVE TILES ═══ */

.deco {
    background: var(--bg);
    border: 4px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.deco::after {
    font-family: var(--font);
    color: var(--accent);
    opacity: 0.3;
    text-align: center;
    line-height: 1.4;
    white-space: pre;
    animation: decoFloat 4s ease-in-out infinite;
}

@keyframes decoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Pixel art decorations via ASCII */
[data-deco="plant"]::after {
    content: '  @\n /@\\\n  |\n [_]';
    font-size: 0.7rem;
    color: var(--accent);
}

[data-deco="joystick"]::after {
    content: '  O\n  |\n [=]';
    font-size: 0.8rem;
    color: var(--primary);
    animation-delay: -1s;
}

[data-deco="trophy"]::after {
    content: '\\o/\n ||\n===';
    font-size: 0.8rem;
    color: var(--warn);
    animation-delay: -2s;
}

[data-deco="cactus"]::after {
    content: ' |\n-|-\n | \n[_]';
    font-size: 0.7rem;
    color: var(--accent);
    animation-delay: -0.5s;
}

[data-deco="heart"]::after {
    content: ' /\\\n<  >\n \\/ ';
    font-size: 0.9rem;
    color: var(--danger);
    animation-delay: -1.5s;
    animation-name: decoPulse;
}

@keyframes decoPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

[data-deco="floppy"]::after {
    content: '.--.\n|==|\n|  |\n\'--\'';
    font-size: 0.65rem;
    color: var(--secondary);
    animation-delay: -3s;
}

[data-deco="potion"]::after {
    content: ' oo\n ||\n/~~\\\n\\__/';
    font-size: 0.6rem;
    color: var(--primary);
    animation-delay: -2.5s;
}

/* ═══ SHELF TITLE TILE ═══ */

.shelf-title {
    background: var(--bg);
    border: 4px solid var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    position: relative;
    overflow: hidden;
}

.shelf-title::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px dashed rgba(0,255,153,0.2);
}

.shelf-title h2 {
    font-size: 0.65rem;
    color: var(--accent);
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(0,255,153,0.3);
}

.shelf-title p {
    font-size: 0.35rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ═══ WRAP TRANSITION ═══ */
/* Screen transition effect for infinite loop wrapping */

main.warp-out {
    animation: warpOut 0.25s ease-in forwards;
}

main.warp-in {
    animation: warpIn 0.25s ease-out forwards;
}

@keyframes warpOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.95); }
}

@keyframes warpIn {
    0% { opacity: 0; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 4px; }

.tag {
    padding: 2px 6px;
    font-size: 0.35rem;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(138,43,226,0.15);
    color: var(--primary);
    border: 2px solid rgba(138,43,226,0.3);
}

/* ═══ TOOLS GRID ═══ */

.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card-grid .card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    background: var(--surface);
    border: 4px solid var(--border);
    transition: border-color 0.2s;
}

.card-grid .card:hover { border-color: var(--accent); }

.card-grid .card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-grid .card-body h3 {
    font-size: 0.7rem;
    color: var(--primary);
}

.card-grid .card-body p {
    font-size: 0.5rem;
    color: var(--muted);
    line-height: 2;
}

.card-grid .card-body .cta {
    align-self: flex-start;
    font-size: 0.5rem;
    padding: 8px 16px;
}

/* ═══ ABOUT ═══ */

.about-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.about-img {
    height: 320px;
    border: 4px solid var(--border);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.about-img.visible { opacity: 1; }

.about-text h2 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 20px;
}

.about-text > p {
    font-size: 0.55rem;
    color: var(--muted);
    margin-bottom: 12px;
    line-height: 2;
}

.values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.value h4 {
    font-size: 0.55rem;
    color: var(--accent);
    margin-bottom: 6px;
}

.value p {
    font-size: 0.45rem;
    color: var(--muted);
    line-height: 1.8;
}

/* ═══ NEWSLETTER ═══ */

.newsletter-box {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    border: 4px solid var(--border);
    background: var(--surface);
    padding: 40px 32px;
}

.newsletter-box h2 {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 14px;
}

.newsletter-box > p {
    font-size: 0.5rem;
    color: var(--muted);
    margin-bottom: 28px;
}

.newsletter-form {
    display: flex;
    gap: 8px;
    max-width: 400px;
    margin: 0 auto;
}

.newsletter-form input {
    flex: 1;
    font-family: var(--font);
    font-size: 0.5rem;
    padding: 10px 14px;
    background: var(--bg);
    color: var(--text);
    border: 4px solid var(--border);
    outline: none;
}

.newsletter-form input::placeholder { color: var(--muted); opacity: 0.5; }
.newsletter-form input:focus { border-color: var(--accent); }

.newsletter-form button {
    font-family: var(--font);
    font-size: 0.5rem;
    padding: 10px 18px;
    background: var(--accent);
    color: var(--bg);
    border: 4px solid;
    border-color: #fff var(--border) var(--border) #fff;
    cursor: pointer;
    text-transform: uppercase;
    white-space: nowrap;
}

.newsletter-form button:hover { background: #33ffbb; }

/* ═══ SCROLL CONTROLS ═══ */

#scroll-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: none; /* shown via !important when retro mode */
    align-items: center;
    gap: 12px;
    background: rgba(12,12,20,0.9);
    border: 3px solid var(--border);
    padding: 6px 12px;
}

.scroll-arrow {
    font-family: var(--font);
    font-size: 0.8rem;
    color: var(--accent);
    background: transparent;
    border: 3px solid var(--accent);
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.scroll-arrow:hover {
    background: var(--accent);
    color: var(--bg);
}

.scroll-arrow:active {
    transform: scale(0.9);
}

#scroll-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.scroll-dot {
    width: 10px;
    height: 10px;
    background: var(--border);
    border: 2px solid var(--muted);
    cursor: pointer;
    transition: all 0.2s;
}

.scroll-dot:hover { border-color: var(--accent); }
.scroll-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(0,255,153,0.4);
}

.scroll-auto-btn {
    font-family: var(--font);
    font-size: 0.4rem;
    color: var(--muted);
    background: transparent;
    border: 2px solid var(--border);
    padding: 6px 10px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.scroll-auto-btn:hover { color: var(--accent); border-color: var(--accent); }
.scroll-auto-btn.active {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
}

/* ═══ LEVEL BAR ═══ */

#level-bar {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 800;
    display: none; /* shown via !important when retro mode */
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 6px 16px;
    background: rgba(12,12,20,0.85);
    border-bottom: 2px solid var(--border);
    font-size: 0.45rem;
}

#level-label {
    color: var(--warn);
    letter-spacing: 2px;
}

#level-name {
    color: var(--accent);
    letter-spacing: 1px;
}

/* ═══ FOOTER (embedded in last section) ═══ */

.footer-logo { display: none; }
.footer-nav { display: none; }
.copyright {
    font-size: 0.4rem;
    color: rgba(255,255,255,0.2);
    text-align: center;
    margin-top: 24px;
}

/* ═══ RESPONSIVE ═══ */

@media (max-width: 900px) {
    .shelf { grid-template-columns: repeat(3, 1fr); }
    .card-grid { grid-template-columns: 1fr; }
    .about-layout { grid-template-columns: 1fr; gap: 24px; }
    .about-img { height: 200px; }
}

@media (max-width: 768px) {
    #hero h1 { font-size: 0.9rem; }
    .hero-stats { flex-wrap: wrap; gap: 10px; }
    .stat { min-width: 80px; padding: 10px 14px; }
    .stat-val { font-size: 1rem; }
    .features { grid-template-columns: 1fr; }
    .values { grid-template-columns: 1fr; }

    .nav-toggle {
        display: block;
        font-size: 1.2rem;
        color: var(--text);
        background: none;
        border: none;
        cursor: pointer;
    }

    .nav-list {
        display: none;
        position: absolute;
        top: 56px; left: 0; right: 0;
        background: rgba(12,12,20,0.98);
        flex-direction: column;
        padding: 20px;
        gap: 14px;
        border-bottom: 4px solid var(--border);
        z-index: 999;
    }

    .nav-list.active { display: flex; }

    .newsletter-form { flex-direction: column; }

    #scroll-controls { bottom: 12px; padding: 4px 8px; gap: 8px; }
    .scroll-arrow { padding: 6px 10px; font-size: 0.65rem; }
}

@media (max-width: 480px) {
    #hero h1 { font-size: 0.7rem; }
    .section > .wrap { padding: 24px 16px; }
    .card-body { padding: 16px; }
    .newsletter-box { padding: 24px 16px; }
}
