/* --- RESET & VARIABILI --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --nin-red: #E60012;
    --bg-body: #f4f7f6;
    --bg-card: #ffffff;
    --text-main: #222222;
    --text-meta: #555555;
    --border-color: #e0e0e0;
    --header-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-hover: 0 10px 25px rgba(230, 0, 18, 0.15);
    --footer-bg: #ffffff;
    --badge-bg: #E60012;
    --badge-text: #ffffff;
    --menu-overlay: rgba(255, 255, 255, 0.98);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --modal-bg: #ffffff;
}

body.dark-mode {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-meta: #b0b0b0;
    --border-color: #333333;
    --header-bg: #1e1e1e;
    --sidebar-bg: #1e1e1e;
    --shadow-card: 0 4px 20px rgba(0,0,0,0.4);
    --shadow-hover: 0 10px 25px rgba(230, 0, 18, 0.3);
    --footer-bg: #1a1a1a;
    --badge-bg: #ff3344;
    --menu-overlay: rgba(18, 18, 18, 0.98);
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --modal-bg: #1e1e1e;
}

body {
    margin: 0; padding: 0;
    padding-bottom: 120px;
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* --- HEADER --- */
header {
    background-color: var(--header-bg);
    padding: 15px 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: sticky; top: 0; z-index: 1000;
    border-bottom: 3px solid var(--nin-red);
}
.logo-link { text-decoration: none; display: inline-block; }
.logo-container {
    display: inline-flex; align-items: center; transform: skewX(-12deg);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.15); border-radius: 4px; overflow: hidden;
}
.logo-part-nintendo { background-color: var(--nin-red); color: white; padding: 10px 15px 10px 25px; font-weight: 900; font-size: 1.4rem; text-transform: uppercase; }
.logo-part-news24 { background-color: var(--text-main); color: var(--nin-red); padding: 10px 25px 10px 15px; font-weight: 700; font-size: 1.4rem; text-transform: uppercase; }
.logo-part-nintendo span, .logo-part-news24 span { display: inline-block; transform: skewX(12deg); }

/* --- SIDEBAR --- */
.hamburger-btn {
    display: none; position: fixed; top: 18px; left: 20px;
    background: none; border: none; cursor: pointer; z-index: 1100; padding: 10px;
}
.hamburger-btn span {
    display: block; width: 28px; height: 3px; margin-bottom: 5px;
    background-color: var(--text-main); border-radius: 3px; transition: all 0.3s ease;
}
.hamburger-btn.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

.sidebar {
    position: fixed; left: 20px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 15px; z-index: 900;
    background: var(--sidebar-bg); padding: 15px 10px;
    border-radius: 50px; box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
}
.sidebar a, .sidebar button {
    display: flex; align-items: center; justify-content: center;
    width: 45px; height: 45px; border-radius: 50%; text-decoration: none;
    color: var(--text-main); background: transparent; font-size: 20px;
    border: none; cursor: pointer; transition: transform 0.2s, color 0.2s;
}
.sidebar a:hover, .sidebar button:hover { transform: scale(1.15); color: var(--nin-red); }

/* --- MOBILE MENU --- */
.mobile-menu-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--menu-overlay); z-index: 1050;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 25px; transform: translateX(-100%); transition: transform 0.3s ease-in-out;
    padding: 20px; overflow-y: auto;
}
.mobile-menu-overlay.active { transform: translateX(0); }
.mobile-menu-links { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.mobile-menu-overlay a, .mobile-menu-overlay button {
    color: var(--text-main); text-decoration: none; font-size: 1.3rem; font-weight: 800;
    display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer;
}
.mobile-menu-disclaimer {
    margin-top: 40px; font-size: 0.75rem; color: var(--text-meta); text-align: center;
    line-height: 1.5; max-width: 90%; border-top: 1px solid var(--border-color); padding-top: 20px;
}

.icon-svg { width: 24px; height: 24px; fill: currentColor; }
.icon-ui { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-menu-overlay .icon-svg, .mobile-menu-overlay .icon-ui { width: 28px; height: 28px; }

/* --- LAYOUT A GRIGLIA (CORE DEL CAMBIAMENTO) --- */
.container {
    max-width: 1200px; /* Allargato per ospitare 2 colonne */
    margin: 40px auto;
    padding: 0 20px;
    padding-left: 80px; /* Spazio per la sidebar */
    
    /* ATTIVAZIONE GRID */
    display: grid;
    grid-template-columns: 1fr; /* Default Mobile: 1 colonna */
    gap: 30px; /* Spazio tra le card */
}

/* --- NEWS CARD DESIGN --- */
.news-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%; /* Forza altezze uguali nella griglia */
}

.news-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.news-card a {
    text-decoration: none; color: inherit;
    display: flex;
    flex-direction: column; /* IMMAGINE SOPRA, TESTO SOTTO */
    height: 100%;
}

.img-wrapper {
    width: 100%;
    height: 200px; /* Altezza fissa immagine */
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    z-index: 1;
    background-color: #000;
}

.img-wrapper img {
    width: 100%; height: 100%; object-fit: cover;
    position: relative; z-index: 2;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.news-card:hover .img-wrapper img { transform: scale(1.08); }

.glow-effect {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background-image: var(--bg-img); background-size: cover; background-position: center;
    filter: blur(25px) saturate(1.8); opacity: 0.5; z-index: 1; transform: scale(1.1);
}

.source-badge {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.7); color: white; padding: 3px 8px;
    border-radius: 4px; font-size: 0.6rem; font-weight: 700;
    z-index: 3; backdrop-filter: blur(2px);
}

.content {
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Occupa tutto lo spazio rimanente */
    justify-content: flex-start;
    background: var(--bg-card);
}

.card-header { display: flex; gap: 5px; margin-bottom: 12px; flex-wrap: wrap; }

.badge-platform {
    background-color: var(--badge-bg); color: var(--badge-text);
    font-size: 0.65rem; font-weight: 800; padding: 4px 8px;
    border-radius: 6px; letter-spacing: 0.5px; text-transform: uppercase;
}

h3 {
    margin: 0; font-size: 1.15rem; line-height: 1.4;
    color: var(--text-main); font-weight: 800;
    margin-bottom: auto; /* Spinge il footer in basso */
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}

.card-footer-meta {
    margin-top: 15px; border-top: 1px solid var(--border-color); padding-top: 10px;
}

.meta-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.date-meta { font-size: 0.75rem; color: var(--text-meta); font-weight: 700; text-transform: uppercase; }
.author-meta { font-size: 0.75rem; color: var(--text-meta); font-style: italic; }

.cats-container { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-tag {
    font-size: 0.7rem; color: var(--text-meta);
    background: rgba(0,0,0,0.05); padding: 2px 6px;
    border-radius: 4px; font-weight: 600; text-transform: uppercase;
}
body.dark-mode .cat-tag { background: rgba(255,255,255,0.1); }

/* --- PAGINA PRIVACY --- */
.page-card {
    background: var(--bg-card); border-radius: 16px; padding: 40px;
    box-shadow: var(--shadow-card); border: 1px solid var(--border-color); margin-bottom: 40px;
}
.page-title {
    font-size: 2rem; font-weight: 900; color: var(--nin-red);
    margin-bottom: 30px; text-transform: uppercase;
    border-bottom: 2px solid var(--border-color); padding-bottom: 20px;
}
.privacy-content h2 { margin-top: 30px; margin-bottom: 15px; font-size: 1.4rem; color: var(--text-main); font-weight: 800; }
.privacy-content p, .privacy-content li, .privacy-content div { font-size: 1rem; line-height: 1.6; color: var(--text-main); margin-bottom: 15px; }
.privacy-content ul { padding-left: 20px; margin-bottom: 20px; }
.privacy-content a { color: var(--nin-red); text-decoration: none; font-weight: 700; }
.privacy-content a:hover { text-decoration: underline; }
.cf-credits { font-size: 0.8rem; color: var(--text-meta); font-style: italic; margin-top: 10px; margin-bottom: 30px; }

/* --- MODAL --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--modal-overlay); z-index: 2000;
    justify-content: center; align-items: center; backdrop-filter: blur(5px);
}
.modal-overlay.active { display: flex; animation: fadeIn 0.3s; }
.modal-content {
    background: var(--modal-bg); padding: 30px; border-radius: 20px;
    max-width: 600px; width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative; text-align: center; border: 1px solid var(--border-color);
}
.modal-close {
    position: absolute; top: 15px; right: 15px; background: none; border: none;
    font-size: 1.5rem; color: var(--text-main); cursor: pointer; padding: 10px;
}
.modal-title { font-size: 1.5rem; font-weight: 900; margin-bottom: 20px; color: var(--nin-red); }
.modal-text { font-size: 0.9rem; line-height: 1.6; color: var(--text-main); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- FOOTER & LOADER --- */
footer {
    position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000;
    text-align: center; padding: 20px;
    color: var(--text-meta); font-size: 0.8rem;
    background: var(--footer-bg); border-top: 3px solid var(--nin-red);
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
}
footer strong { display: block; color: var(--text-main); font-weight: 700; }

.loader { text-align: center; padding: 40px; display: none; }
.spinner {
    width: 40px; height: 40px; border: 4px solid var(--border-color);
    border-top: 4px solid var(--nin-red); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.end-msg { text-align: center; padding: 30px; color: var(--text-meta); display: none; }

/* --- MEDIA QUERIES (RESPONSIVE) --- */

/* TABLET & DESKTOP (2 COLONNE) */
@media (min-width: 900px) {
    .container {
        grid-template-columns: 1fr 1fr; /* Attiva le 2 colonne */
    }
}

/* MOBILE (1 COLONNA, ADATTAMENTI VARI) */
@media (max-width: 899px) {
    .container {
        padding: 20px; padding-top: 20px; margin-top: 0;
        padding-left: 20px; /* Rimuove spazio sidebar */
    }
    .hamburger-btn { display: block; }
    .sidebar { display: none; }
    header { padding: 12px 0; }
    .logo-container { transform: scale(0.85) skewX(-12deg); }
    .page-card { padding: 25px; }
    footer { position: static; margin-top: 40px; border-top: 1px solid var(--border-color); padding: 20px 10px; box-shadow: none; }
}