/*
Theme Name: MyBestReviews Minimal
Theme URI: https://www.mybestreviews.net
Description: A lightweight, high-performance magazine theme with no dependencies.
Version: 2.0.4
Text Domain: mybestreviews-minimal
*/

:root {
    /* Typography */
    --font-heading: 'Merriweather', Georgia, 'Times New Roman', serif;
    --font-body: 'Merriweather', Georgia, serif;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Colors */
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-text-light: #555555;
    --color-accent: #b91c1c;
    /* Deep Red */
    --color-border: #e5e5e5;

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;
    --gap: 2rem;
}

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

/* Local Merriweather: no external Google Fonts request */
@font-face {
    font-family: 'Merriweather';
    src: url('./fonts/merriweather-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Merriweather';
    src: url('./fonts/merriweather-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    font-size: 18px;
    /* Readable base size */
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: #000;
    line-height: 1.2;
    margin-bottom: 0.5em;
    font-weight: 700;
}

/* Content Headings Spacing */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin-top: 2em;
    margin-bottom: 1em;
}

.entry-content h1:first-child,
.entry-content h2:first-child,
.entry-content h3:first-child,
.entry-content h4:first-child,
.entry-content h5:first-child,
.entry-content h6:first-child {
    margin-top: 0;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-accent);
}

/* Content Text Links Visibility */
.entry-content p a,
.entry-content li a,
.comment-content p a,
.comment-content li a,
.post-excerpt a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.entry-content p a:hover,
.entry-content li a:hover,
.comment-content p a:hover,
.comment-content li a:hover,
.post-excerpt a:hover {
    text-decoration-thickness: 2px;
    color: #000;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    transition: box-shadow 0.3s ease, padding 0.3s ease;
}

.site-header.is-scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0;
    /* Slightly shrink on scroll */
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--color-accent);
    color: #fff;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    background-color: #000;
}

/* Breadcrumbs */
.breadcrumbs {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breadcrumbs a {
    color: var(--color-text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--color-accent);
}

.breadcrumbs .separator {
    margin: 0 0.5rem;
    color: #ccc;
}

.header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.custom-logo {
    max-height: 80px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.main-navigation {
    width: 100%;
}

/* Top-Level Menu (Flexbox) */
#primary-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0;
    margin: 0;
    position: relative;
    flex-wrap: wrap;
}

/* Minimalist Search Bar */
.header-search {
    margin: 0.25rem auto;
    /* Center horizontally and add some space */
    width: 100%;
    display: flex;
    justify-content: center;
}

.search-form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e5e5;
    border-radius: 50px;
    padding: 0.2rem 0.8rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    max-width: 340px;
}

.search-form:focus-within {
    border-color: #b91c1c;
    /* Deep Red Accent */
    box-shadow: 0 10px 15px -3px rgba(185, 28, 28, 0.1), 0 4px 6px -2px rgba(185, 28, 28, 0.05);
    background: #ffffff;
}

.search-field {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: var(--color-text);
    width: 100%;
    outline: none;
    font-family: var(--font-ui);
    margin-bottom: 0;
    /* Override default input margin */
}

.search-field::placeholder {
    color: #999;
}

.search-submit {
    background: transparent;
    border: none;
    padding: 0.5rem;
    color: #b91c1c;
    /* Deep Red Accent */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    margin-bottom: 0;
    /* Override default input margin */
    margin-right: 0;
}

.search-submit:hover {
    background-color: rgba(185, 28, 28, 0.1);
}

.search-submit svg {
    width: 20px;
    height: 20px;
}

/* Mobile-first header defaults */
.header-inner {
    gap: 0.75rem;
}

.header-search {
    width: 100%;
}

.search-form {
    width: 100%;
    max-width: 400px;
}

.custom-logo {
    max-width: 300px;
    height: auto;
}

/* Desktop enhancement */
@media (min-width: 900px) {
    .site-header {
        backdrop-filter: blur(10px);
    }
}

/* Sub-Menus (Dropdowns common reset) */
#primary-menu ul {
    list-style: none;
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border: 1px solid var(--color-border);
    min-width: 160px;
    z-index: 999;
    padding: 0.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    /* Reset Flex properties if inherited */
    gap: 0;
    flex-direction: column;
    text-align: left;
}

#primary-menu li {
    position: relative;
    /* Anchor for submenus */
}

#primary-menu li:hover>ul,
#primary-menu li:focus-within>ul {
    display: block;
}

#primary-menu ul li {
    display: block;
    width: 100%;
    margin: 0;
}

#primary-menu ul a {
    padding: 0.5rem 1rem;
    display: block;
    white-space: nowrap;
    text-transform: none;
    /* Optional: cleaner look for subitems */
    color: var(--color-text);
}

#primary-menu ul a:hover {
    background-color: #f9f9f9;
    color: var(--color-accent);
}

/* Polylang Alignment & Desktop Layout */
@media (min-width: 900px) {

    .header-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .site-branding {
        flex: 0 0 auto;
        margin-right: 0.5rem;
    }

    .site-branding .custom-logo {
        max-height: 60px;
    }

    .main-navigation {
        flex: 1 1 auto;
        display: flex;
        justify-content: center;
    }

    #primary-menu {
        flex-wrap: nowrap;
        gap: 0.75rem;
        font-size: 0.85rem;
        padding-right: 0;
    }

    .header-search {
        flex: 0 0 auto;
        margin: 0;
        width: auto;
    }

    .search-form {
        max-width: 170px;
        padding: 0.15rem 0.5rem;
    }

    .search-field {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
    }

    /* Ensure the sub-menu for lang aligns correctly to the right */
    .main-navigation .pll-parent-menu-item ul,
    .main-navigation .lang-item ul {
        left: auto;
        right: 0;
        text-align: right;
    }
}

/* Hero Section (First Post) */
.hero-post {
    margin: 3rem 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-meta {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

@media (min-width: 900px) {
    .hero-post {
        grid-template-columns: 1.5fr 1fr;
        align-items: center;
        gap: 3rem;
    }

    .hero-image {
        order: -1;
    }
}

/* Post Grid */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem 2rem;
    margin-bottom: 4rem;
}

@media (min-width: 600px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.post-card {
    display: flex;
    flex-direction: column;
}

.post-thumbnail {
    margin-bottom: 1rem;
    aspect-ratio: 16/10;
    object-fit: cover;
    background-color: #f0f0f0;
}

.post-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.post-excerpt {
    font-size: 1rem;
    color: var(--color-text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive image containers */
.front-page-hero {
    position: relative;
    margin-bottom: 3rem;
    overflow: hidden;
}

.hero-image-full {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

@media (min-width: 768px) {
    .hero-image-full {
        height: clamp(400px, 50vh, 600px);
        object-fit: cover;
    }
}

.entry-hero-image {
    max-width: 1000px;
    margin: 0 auto 3rem;
    text-align: center;
}

.entry-hero-image img {
    width: 100%;
    height: auto;
}

.front-page-content {
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 4rem;
}

.featured-articles-section {
    margin-bottom: 4rem;
}

.featured-articles-section .section-title,
.latest-articles-section .section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    color: #1a1a1a;
    text-transform: uppercase;
}

.featured-card {
    border: 2px solid #ed1c24;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(237, 28, 36, 0.1);
}

.featured-card .post-thumbnail,
.latest-articles-section .post-thumbnail {
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.featured-card .post-thumbnail {
    height: 250px;
}

.latest-articles-section .post-thumbnail {
    height: 200px;
}

.entry-hero-image + .container {
    max-width: 800px;
}

.single .entry-header,
.page .entry-header {
    text-align: center;
    margin-bottom: 3rem;
}

.single .entry-title,
.page .entry-title {
    font-size: 2.1rem;
    margin-bottom: 1rem;
}

.single .entry-content,
.page .entry-content {
    font-size: 1.125rem;
}

@media (min-width: 900px) {
    .single .entry-title,
    .page .entry-title {
        font-size: 3rem;
    }
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 3rem 0;
    text-align: center;
    font-family: var(--font-ui);
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* Pagination */
.navigation.pagination {
    margin: 4rem 0;
    text-align: center;
}

.nav-links {
    display: inline-flex;
    gap: 1rem;
}

.nav-links a,
.nav-links span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    font-family: var(--font-ui);
    font-size: 0.9rem;
}

.nav-links .current {
    background-color: #000;
    color: #fff;
    border-color: #000;
}

/* Forms & Comments */
input[type="text"],
input[type="email"],
input[type="url"],
textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--color-border);
    margin-bottom: 1rem;
    font-family: inherit;
}

input[type="submit"] {
    background-color: #000;
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    font-family: var(--font-ui);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

input[type="submit"]:hover {
    background-color: var(--color-accent);
}

.comment-list {
    list-style: none;
    margin: 2rem 0;
}

.comment-body {
    border-bottom: 1px solid var(--color-border);
    padding: 2rem 0;
}

.comment-meta {
    margin-bottom: 1rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.header-ad-container {
    padding: 10px 0;
    overflow: hidden;
    background-color: transparent;
    /* Mantiene il look pulito */
}

/* Nasconde il contenitore se non ci sono annunci (opzionale) */
.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}
/* Front page layout */
.front-page-container {
    padding-bottom: 4rem;
}

.latest-articles-section .posts-grid {
    margin-bottom: 0;
}

@media (max-width: 599px) {
    .featured-articles-section .section-title,
    .latest-articles-section .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .featured-card .post-thumbnail {
        height: 220px;
    }

    .latest-articles-section .post-thumbnail {
        height: 200px;
    }
}
