/*
Theme Name: NSVault
Theme URI: https://nsvault.me
Author: NSVault.me
Author URI: https://nsvault.me
Description: The Ultimate Vault WordPress theme for Nintendo Switch ROM archives. Features a dark aesthetic with red accents, a curated Best ROMs carousel, New ROMs list, and Latest Updated ROMs grid. Includes a custom "ROM" post type with meta fields for file size, version, format, genre, developer, and more.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nsvault
Tags: dark, custom-post-type, archive, gaming, roms, two-columns, right-sidebar
*/

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; background: #000; color: #f5f5f5; line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: #ED1C24; text-decoration: none; transition: color 0.2s; }
a:hover { color: #fff; }
h1, h2, h3, h4, h5, h6 { font-family: 'Poppins', ui-sans-serif, sans-serif; font-weight: 700; color: #fff; line-height: 1.3; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #262626; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #ED1C24; }

/* ===== Navbar ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: #000; border-bottom: 1px solid #1a1a1a; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.site-logo { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.25rem; color: #fff; letter-spacing: -0.02em; }
.site-logo .accent { color: #ED1C24; }
.main-nav { display: none; gap: 1.5rem; }
.main-nav a { display: flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; font-weight: 500; color: #fff; }
.main-nav a:hover { color: #ED1C24; }
.main-nav svg { width: 16px; height: 16px; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.search-toggle, .menu-toggle { padding: 0.5rem; color: #fff; border-radius: 0.25rem; transition: color 0.2s; }
.search-toggle:hover, .menu-toggle:hover { color: #ED1C24; }
.search-toggle svg, .menu-toggle svg { width: 20px; height: 20px; }
@media (min-width: 768px) { .main-nav { display: flex; } .menu-toggle { display: none; } }

/* Mobile menu */
.mobile-nav { display: none; overflow: hidden; border-top: 1px solid #1a1a1a; background: #000; }
.mobile-nav.open { display: block; }
.mobile-nav a { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 500; color: #fff; }
.mobile-nav a:hover { color: #ED1C24; background: #0d0d0d; }

/* Scroll progress */
.scroll-progress { position: fixed; top: 64px; left: 0; right: 0; z-index: 40; height: 2px; }
.scroll-progress-bar { height: 100%; background: #ED1C24; transition: width 0.1s; width: 0; }

/* ===== Section Header ===== */
.section-header { margin-bottom: 1.5rem; }
.section-header .bar { display: inline-block; width: 4px; height: 28px; background: #ED1C24; border-radius: 2px; vertical-align: middle; margin-right: 0.75rem; }
.section-header h2 { display: inline; font-size: 1.5rem; vertical-align: middle; }
.section-header .subtitle { margin-top: 0.5rem; margin-left: 1rem; color: #999; font-size: 0.875rem; }
@media (min-width: 640px) { .section-header h2 { font-size: 1.5rem; } }

/* ===== Carousel ===== */
.carousel-controls { display: flex; justify-content: flex-end; gap: 0.5rem; margin-bottom: 1rem; }
.carousel-controls button { width: 36px; height: 36px; border-radius: 0.25rem; border: 1px solid #262626; background: #0d0d0d; color: #999; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.carousel-controls button:hover { color: #ED1C24; border-color: #ED1C24; }
.carousel-controls svg { width: 20px; height: 20px; }
.carousel-track { display: flex; gap: 1rem; overflow-x: auto; scroll-behavior: smooth; padding-bottom: 0.5rem; scrollbar-width: none; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track .rom-card { flex: 0 0 160px; scroll-snap-align: start; }
@media (min-width: 640px) { .carousel-track .rom-card { flex: 0 0 180px; } }
.carousel-dots { display: flex; justify-content: center; gap: 0.375rem; margin-top: 1rem; }
.carousel-dots .dot { height: 4px; border-radius: 9999px; background: #262626; width: 6px; transition: all 0.3s; }
.carousel-dots .dot.active { background: #ED1C24; width: 20px; }

/* ===== ROM Card (grid + carousel) ===== */
.rom-card { display: block; }
.rom-card .card-inner { position: relative; border-radius: 0.375rem; overflow: hidden; background: #0d0d0d; border: 1px solid #1a1a1a; transition: border-color 0.2s; }
.rom-card:hover .card-inner { border-color: rgba(237, 28, 36, 0.5); }
.rom-card .cover { aspect-ratio: 3/4; position: relative; overflow: hidden; }
.rom-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.rom-card:hover .cover img { transform: scale(1.05); }
.rom-card .cover-overlay { position: absolute; inset: 0; background: linear-gradient(to top, #000, transparent 60%); }
.rom-card .badge { position: absolute; top: 0.5rem; left: 0.5rem; padding: 2px 6px; border-radius: 0.25rem; background: #ED1C24; color: #fff; font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.05em; font-weight: 700; }
.rom-card .card-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 0.75rem; }
.rom-card .card-title { color: #fff; font-weight: 600; font-size: 0.875rem; line-height: 1.25; font-family: 'Poppins', sans-serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rom-card .card-dev { font-size: 0.75rem; color: #999; margin-top: 0.125rem; }
.rom-card .card-meta { display: flex; align-items: center; gap: 0.375rem; margin-top: 0.5rem; }
.rom-card .card-meta .dl-icon { width: 14px; height: 14px; color: #ED1C24; }
.rom-card .card-meta .size { font-size: 0.75rem; color: #fff; }
.rom-card .card-meta .ver { font-size: 0.75rem; color: #22c55e; }
.rom-card .card-meta .fmt { font-size: 0.75rem; color: #666; }
.rom-card .card-rating { display: flex; align-items: center; gap: 0.25rem; }
.rom-card .card-rating .star { width: 12px; height: 12px; color: #ED1C24; fill: #ED1C24; }

/* ===== New ROMs Row (list) ===== */
.rom-grid-list { display: grid; grid-template-columns: 1fr; gap: 0 2rem; background: #0d0d0d; border-radius: 0.375rem; border: 1px solid #1a1a1a; }
@media (min-width: 1024px) { .rom-grid-list { grid-template-columns: 1fr 1fr; } }
.rom-row { display: flex; gap: 0.75rem; padding: 0.75rem; border-bottom: 1px solid #1a1a1a; transition: background 0.2s; }
.rom-row:hover { background: #000; }
.rom-row .thumb { width: 80px; height: 80px; border-radius: 0.25rem; overflow: hidden; flex-shrink: 0; background: #0d0d0d; border: 1px solid #1a1a1a; }
.rom-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rom-row .row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.rom-row .row-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.rom-row .badge-genre { padding: 2px 6px; border-radius: 0.25rem; background: rgba(237, 28, 36, 0.15); color: #ED1C24; font-family: monospace; font-size: 9px; letter-spacing: 0.05em; font-weight: 600; }
.rom-row .badge-status { padding: 2px 6px; border-radius: 0.25rem; border: 1px solid #262626; color: #666; font-family: monospace; font-size: 9px; letter-spacing: 0.05em; }
.rom-row .row-title { color: #fff; font-weight: 600; font-size: 0.875rem; line-height: 1.25; font-family: 'Poppins', sans-serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rom-row:hover .row-title { color: #ED1C24; }
.rom-row .row-footer { display: flex; align-items: center; justify-content: space-between; }
.rom-row .row-ver { font-size: 0.75rem; color: #999; font-family: monospace; }
.rom-row .row-date { font-size: 0.75rem; color: #666; }
.rom-row .row-dl { display: flex; align-items: center; gap: 0.25rem; }
.rom-row .row-dl svg { width: 14px; height: 14px; color: #ED1C24; }
.rom-row .row-dl .size { font-size: 0.75rem; color: #fff; }

/* ===== Grid ===== */
.rom-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 640px) { .rom-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .rom-grid { grid-template-columns: repeat(5, 1fr); } }

/* ===== Section spacing ===== */
.site-main section { padding: 2rem 0; }
.site-main .container { padding: 0 1rem; }

/* ===== View more link ===== */
.view-more { display: flex; justify-content: flex-end; margin-top: 1rem; }
.view-more a { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: #ED1C24; font-weight: 500; }
.view-more a:hover { text-decoration: underline; }
.view-more svg { width: 16px; height: 16px; }

/* ===== About section ===== */
.about-section { max-width: 768px; margin: 0 auto; text-align: center; padding: 2.5rem 1rem; }
.about-section .about-header { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1rem; }
.about-section .about-header .bar { width: 4px; height: 28px; background: #ED1C24; border-radius: 2px; }
.about-section h2 { font-size: 1.25rem; }
.about-section p { color: #999; font-size: 0.875rem; line-height: 1.7; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid #1a1a1a; background: #000; margin-top: 3rem; }
.footer-ticker { overflow: hidden; border-bottom: 1px solid #1a1a1a; padding: 0.5rem 0; background: #0d0d0d; }
.footer-ticker .ticker-track { display: flex; white-space: nowrap; animation: ticker 45s linear infinite; }
.footer-ticker .ticker-track span { font-family: monospace; font-size: 10px; color: #666; letter-spacing: 0.15em; text-transform: uppercase; padding: 0 1rem; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.footer-content { max-width: 1280px; margin: 0 auto; padding: 3rem 1rem; display: grid; grid-template-columns: 1fr; gap: 2.5rem; }
@media (min-width: 640px) { .footer-content { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-content { grid-template-columns: repeat(4, 1fr); } }
.footer-col h4 { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; font-weight: 600; color: #fff; font-family: 'Poppins', sans-serif; margin-bottom: 1rem; }
.footer-col h4 svg { width: 16px; height: 16px; color: #ED1C24; }
.footer-col ul li { margin-bottom: 0.625rem; }
.footer-col ul li a { color: #999; font-size: 0.875rem; }
.footer-col ul li a:hover { color: #ED1C24; }
.footer-brand .site-logo { display: inline-block; font-size: 1.25rem; }
.footer-brand p { color: #999; font-size: 0.875rem; line-height: 1.6; margin-top: 0.75rem; max-width: 16rem; }
.footer-bottom { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid #1a1a1a; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
@media (min-width: 640px) { .footer-bottom { flex-direction: row; justify-content: space-between; max-width: 1280px; margin: 2.5rem auto 0; padding: 1.5rem 1rem 0; } }
.footer-bottom .copyright { color: #666; font-size: 0.75rem; }
.footer-bottom .status { display: flex; align-items: center; gap: 0.5rem; }
.footer-bottom .status .dot { width: 6px; height: 6px; border-radius: 9999px; background: #22c55e; }
.footer-bottom .status span { font-family: monospace; font-size: 10px; color: #22c55e; letter-spacing: 0.1em; text-transform: uppercase; }

/* ===== Archive Filters ===== */
.filter-bar { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; background: #0d0d0d; border-radius: 0.375rem; border: 1px solid #1a1a1a; padding: 1rem; }
@media (min-width: 1024px) { .filter-bar { flex-direction: row; align-items: center; } }
.filter-bar .search-wrap { position: relative; flex: 1; }
.filter-bar .search-wrap svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #666; }
.filter-bar .search-wrap input { width: 100%; padding: 0.625rem 1rem 0.625rem 2.5rem; border-radius: 0.25rem; background: #000; border: 1px solid #262626; font-size: 0.875rem; color: #fff; outline: none; }
.filter-bar .search-wrap input:focus { border-color: #ED1C24; }
.filter-bar .filter-selects { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.filter-bar select { width: 160px; padding: 0.625rem 0.75rem; border-radius: 0.25rem; background: #000; border: 1px solid #262626; font-size: 0.875rem; color: #fff; outline: none; }
.filter-bar select:focus { border-color: #ED1C24; }
.format-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.format-pills a { padding: 0.375rem 0.875rem; border-radius: 0.25rem; font-family: monospace; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; border: 1px solid #262626; background: #0d0d0d; color: #999; }
.format-pills a.active { background: #ED1C24; color: #fff; border-color: #ED1C24; }
.format-pills a:hover { color: #fff; border-color: #ED1C24; }
.result-count { font-family: monospace; font-size: 0.75rem; color: #999; margin-bottom: 1rem; }
.empty-state { background: #0d0d0d; border-radius: 0.375rem; border: 1px solid #1a1a1a; padding: 4rem; text-align: center; }
.empty-state p { color: #999; font-size: 0.875rem; }

/* ===== Single ROM Page ===== */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-size: 0.875rem; }
.breadcrumb a { color: #999; }
.breadcrumb a:hover { color: #ED1C24; }
.breadcrumb .sep { color: #333; }
.breadcrumb .current { color: #ED1C24; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rom-detail { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 1024px) { .rom-detail { grid-template-columns: 1fr 2fr; } }
.rom-detail .cover-wrap { aspect-ratio: 3/4; border-radius: 0.375rem; overflow: hidden; background: #0d0d0d; border: 1px solid #1a1a1a; }
.rom-detail .cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.rom-detail h1 { font-size: 1.5rem; }
@media (min-width: 640px) { .rom-detail h1 { font-size: 1.875rem; } }
.rom-detail .dev-line { margin-top: 0.5rem; color: #999; font-size: 0.875rem; font-family: monospace; }
.rom-detail .rating-row { display: flex; gap: 1rem; margin-top: 1rem; }
.rom-detail .rating-badge { display: flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.625rem; border-radius: 0.25rem; background: rgba(237,28,36,0.15); border: 1px solid rgba(237,28,36,0.3); }
.rom-detail .rating-badge svg { width: 16px; height: 16px; color: #ED1C24; fill: #ED1C24; }
.rom-detail .rating-badge span { color: #ED1C24; font-weight: 700; font-size: 0.875rem; }
.rom-detail .dl-count { display: flex; align-items: center; gap: 0.375rem; font-size: 0.875rem; color: #999; }
.rom-detail .dl-count svg { width: 16px; height: 16px; color: #ED1C24; }
.rom-detail .description { color: #999; font-size: 0.875rem; line-height: 1.7; margin-top: 1rem; }
.download-buttons { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.btn-download { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 1rem 1.5rem; border-radius: 0.25rem; font-weight: 600; font-size: 0.875rem; transition: all 0.2s; width: 100%; }
.btn-download.primary { background: #ED1C24; color: #fff; }
.btn-download.primary:hover { background: #c4161c; color: #fff; }
.btn-download.secondary { border: 1px solid #262626; color: #fff; }
.btn-download.secondary:hover { background: #1a1a1a; border-color: #ED1C24; color: #fff; }
.btn-download svg { width: 20px; height: 20px; }
.btn-download.secondary svg { width: 16px; height: 16px; }
.rom-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.btn-action { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; border-radius: 0.25rem; border: 1px solid #262626; color: #999; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; }
.btn-action:hover { color: #fff; border-color: #ED1C24; }
.btn-action svg { width: 16px; height: 16px; }

/* ===== Specs Table ===== */
.specs-grid { background: #0d0d0d; border-radius: 0.375rem; border: 1px solid #1a1a1a; overflow: hidden; }
.specs-grid .spec-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.specs-grid .spec-row .spec-icon { width: 16px; height: 16px; color: #ED1C24; flex-shrink: 0; }
.specs-grid .spec-row .spec-label { font-family: monospace; font-size: 10px; color: #666; letter-spacing: 0.15em; text-transform: uppercase; display: block; }
.specs-grid .spec-row .spec-value { font-size: 0.875rem; color: #fff; font-family: monospace; font-weight: 500; }
@media (min-width: 640px) { .specs-grid { display: grid; grid-template-columns: 1fr 1fr; } .specs-grid .spec-row { border-bottom: 1px solid #1a1a1a; } .specs-grid .spec-row:nth-last-child(-n+2) { border-bottom: none; } .specs-grid .spec-row:nth-child(odd) { border-right: 1px solid #1a1a1a; } }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 2rem; }
.pagination a, .pagination span { padding: 0.5rem 0.875rem; border-radius: 0.25rem; border: 1px solid #262626; background: #0d0d0d; font-size: 0.875rem; color: #999; }
.pagination a:hover, .pagination .current { background: #ED1C24; color: #fff; border-color: #ED1C24; }

/* ===== Search Form (Command Palette) ===== */
.search-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding-top: 15vh; }
.search-overlay.open { display: flex; }
.search-overlay .backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.search-modal { position: relative; width: 100%; max-width: 36rem; margin: 0 1rem; background: #0d0d0d; border-radius: 0.5rem; overflow: hidden; border: 1px solid #262626; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8); }
.search-modal .search-input-bar { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid #1a1a1a; }
.search-modal .search-input-bar svg { width: 20px; height: 20px; color: #ED1C24; flex-shrink: 0; }
.search-modal input { flex: 1; background: transparent; color: #fff; outline: none; font-size: 1rem; }
.search-modal input::placeholder { color: #666; }
.search-modal .close-btn { color: #666; padding: 0.25rem; }
.search-modal .close-btn:hover { color: #fff; }
.search-modal .close-btn svg { width: 16px; height: 16px; }
.search-results { max-height: 40vh; overflow-y: auto; padding: 0.25rem 0; }
.search-result-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; transition: background 0.2s; }
.search-result-item:hover { background: #1a1a1a; }
.search-result-item img { width: 40px; height: 48px; border-radius: 0.25rem; object-fit: cover; border: 1px solid #262626; }
.search-result-item .sr-title { font-size: 0.875rem; font-weight: 500; color: #fff; }
.search-result-item:hover .sr-title { color: #ED1C24; }
.search-result-item .sr-meta { display: flex; gap: 0.5rem; margin-top: 0.125rem; }
.search-result-item .sr-meta span { font-family: monospace; font-size: 10px; color: #999; }
.search-modal .search-footer { padding: 0.75rem 1.25rem; border-top: 1px solid #1a1a1a; display: flex; justify-content: space-between; }
.search-modal .search-footer span { font-family: monospace; font-size: 10px; color: #666; letter-spacing: 0.1em; }

/* ===== 404 ===== */
.error404 .container { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.error404 h1 { font-size: 6rem; color: #ED1C24; }
.error404 p { color: #999; margin-bottom: 1.5rem; }

/* ===== Clearfix ===== */
.clearfix::after { content: ''; display: table; clear: both; }