/*
Theme Name: Epistemica
Theme URI: https://epistemica.it
Author: Epistemica Team
Author URI: https://epistemica.it
Description: Tema WordPress elegante per Scienza, Filosofia e Intelligenza Artificiale. Design minimalista con layout masonry, colori pastello e tipografia raffinata.
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: epistemica
Domain Path: /languages
Tags: blog, news, science, philosophy, ai, minimal, pastel, masonry
*/

/* ============================================
   FONTS
   ============================================ */
@font-face {
    font-family: 'Noto Serif SC';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/NotoSerifCJKsc-Regular.otf') format('opentype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Serif SC';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/NotoSerifCJKsc-Medium.otf') format('opentype');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'MiSans';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/MiSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'MiSans';
    src: url('https://assets-persist.lovart.ai/agent-static-assets/MiSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --primary-bg: #FDFBF7;
    --text-dark: #1A1A1A;
    --text-gray: #5F6368;
    --accent-lavender: #E6E6FA;
    --accent-mint: #E0F2F1;
    --accent-peach: #FCE4EC;
    --accent-blue: #E3F2FD;
    --card-shadow: 0 20px 40px -10px rgba(0,0,0,0.06);
    --card-hover-shadow: 0 30px 60px -15px rgba(0,0,0,0.1);
    --transition-fast: 0.3s ease;
    --transition-medium: 0.4s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.8;
}

/* ============================================
   DECORATIVE BLOBS
   ============================================ */
.blob {
    position: fixed;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    pointer-events: none;
}

.blob-1 {
    top: -10%;
    left: -5%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--accent-lavender), transparent);
}

.blob-2 {
    top: 20%;
    right: -10%;
    width: 1000px;
    height: 1000px;
    background: radial-gradient(circle, var(--accent-blue), transparent);
}

.blob-3 {
    bottom: 10%;
    left: 20%;
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, var(--accent-mint), transparent);
}

.blob-4 {
    top: 60%;
    right: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-peach), transparent);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    width: 100%;
    padding: 24px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(253, 251, 247, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.site-logo {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-dark);
}

.site-logo a:hover {
    opacity: 1;
}

.main-navigation ul {
    display: flex;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-navigation a {
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 500;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    position: relative;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--text-dark);
    transition: width var(--transition-fast);
}

.main-navigation a:hover,
.main-navigation a.active,
.main-navigation .current-menu-item a {
    opacity: 1;
}

.main-navigation a:hover::after,
.main-navigation a.active::after,
.main-navigation .current-menu-item a::after {
    width: 100%;
}

.search-toggle {
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-dark);
    padding: 8px;
    transition: transform var(--transition-fast);
}

.search-toggle:hover {
    transform: scale(1.1);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-dark);
}

/* ============================================
   SEARCH OVERLAY
   ============================================ */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(253, 251, 247, 0.98);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-content {
    width: 90%;
    max-width: 700px;
    padding: 40px;
}

.search-overlay-form {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

.search-overlay-form input {
    flex: 1;
    padding: 20px 28px;
    font-size: 20px;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 50px;
    background: white;
    font-family: 'MiSans', sans-serif;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-overlay-form input:focus {
    border-color: var(--text-dark);
}

.search-overlay-form button {
    padding: 16px 40px;
    background: var(--text-dark);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-overlay-form button:hover {
    background: #333;
}

.search-overlay-close {
    position: absolute;
    top: 40px;
    right: 40px;
    font-size: 32px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    transition: transform var(--transition-fast);
}

.search-overlay-close:hover {
    transform: rotate(90deg);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    padding: 60px 5% 40px;
    text-align: center;
    position: relative;
}

.hero-title {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: clamp(48px, 8vw, 100px);
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #1a1a1a, #4a4a4a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: clamp(16px, 2vw, 22px);
    color: var(--text-gray);
    font-weight: 300;
    letter-spacing: 0.03em;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================
   MASONRY GRID
   ============================================ */
.masonry-grid {
    padding: 40px 5% 80px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

.masonry-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.masonry-column:nth-child(2) {
    padding-top: 60px;
}

/* ============================================
   ARTICLE CARDS
   ============================================ */
.article-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-hover-shadow);
}

.article-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card-link:hover {
    opacity: 1;
}

.card-image-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    background: #f5f5f5;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.article-card:hover .card-image-container img {
    transform: scale(1.03);
}

.card-tall .card-image-container {
    height: 450px;
}

.card-standard .card-image-container {
    height: 280px;
}

.card-vertical .card-image-container {
    height: 380px;
}

.card-content {
    padding: 28px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.category-tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent-lavender);
    color: var(--text-dark);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    width: fit-content;
}

.category-science { background: var(--accent-mint); }
.category-philo { background: var(--accent-peach); }
.category-tech { background: var(--accent-blue); }
.category-lit { background: #FFF3E0; }
.category-ia-mente { background: #E8EAF6; }
.category-logic { background: #E0F7FA; }

.card-title {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 22px;
    line-height: 1.35;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-dark);
}

.card-excerpt {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-gray);
    margin-bottom: 20px;
}

.card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #9AA0A6;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 16px;
}

.read-more {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
    transition: gap var(--transition-fast);
}

.article-card:hover .read-more {
    gap: 10px;
}

/* ============================================
   CATEGORIES SECTION
   ============================================ */
.categories-section {
    padding: 0 5% 80px;
    max-width: 1600px;
    margin: 0 auto;
}

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

.category-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 20px;
    transition: all var(--transition-fast);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.category-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.category-icon.ia-mente { background: #E3F2FD; color: #1565C0; }
.category-icon.science { background: #F3E5F5; color: #7B1FA2; }
.category-icon.logic { background: #E0F2F1; color: #00695C; }
.category-icon.philo { background: #FFF3E0; color: #E65100; }

.category-text h4 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.category-text span {
    font-size: 12px;
    color: #888;
}

/* ============================================
   NEWSLETTER SECTION
   ============================================ */
.newsletter-section {
    margin: 0 5% 80px;
    background: linear-gradient(135deg, #F3E5F5, #E1F5FE);
    border-radius: 32px;
    padding: 60px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    max-width: 1400px;
}

.newsletter-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    pointer-events: none;
}

.newsletter-title {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: clamp(32px, 4vw, 42px);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.newsletter-description {
    color: var(--text-gray);
    font-size: 16px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 6px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    z-index: 1;
}

.newsletter-form input {
    flex: 1;
    border: none;
    padding: 14px 24px;
    font-family: 'MiSans', sans-serif;
    font-size: 15px;
    outline: none;
    background: transparent;
}

.newsletter-form button {
    background: var(--text-dark);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 40px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.newsletter-form button:hover {
    background: #333;
    transform: translateY(-2px);
}

.newsletter-message {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-gray);
    min-height: 20px;
}

.newsletter-message.success {
    color: #2E7D32;
}

.newsletter-message.error {
    color: #C62828;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: white;
    padding: 40px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    max-width: 1600px;
    margin: 0 auto;
}

.footer-logo {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 22px;
    font-weight: 500;
}

.footer-copyright {
    color: var(--text-gray);
    font-size: 14px;
}

.footer-socials {
    display: flex;
    gap: 16px;
}

.footer-socials a {
    font-size: 20px;
    color: #555;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.footer-socials a:hover {
    color: var(--text-dark);
    background: var(--accent-lavender);
    opacity: 1;
}

/* ============================================
   SINGLE POST
   ============================================ */
.single-post {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 5% 80px;
}

.post-header {
    text-align: center;
    margin-bottom: 40px;
}

.post-category {
    display: inline-block;
    padding: 6px 16px;
    background: var(--accent-lavender);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
}

.post-title {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.2;
    margin-bottom: 20px;
    font-weight: 500;
}

.post-meta {
    color: var(--text-gray);
    font-size: 14px;
}

.post-featured-image {
    width: 100%;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: var(--card-shadow);
}

.post-featured-image img {
    width: 100%;
    height: auto;
}

.post-content {
    font-size: 17px;
    line-height: 1.85;
    color: var(--text-dark);
}

.post-content p {
    margin-bottom: 24px;
}

.post-content h2 {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 28px;
    margin: 48px 0 20px;
    font-weight: 500;
}

.post-content h3 {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 22px;
    margin: 36px 0 16px;
    font-weight: 500;
}

.post-content blockquote {
    border-left: 4px solid var(--accent-lavender);
    padding-left: 24px;
    margin: 32px 0;
    font-style: italic;
    color: var(--text-gray);
}

.post-content ul,
.post-content ol {
    margin: 24px 0;
    padding-left: 24px;
}

.post-content li {
    margin-bottom: 8px;
}

/* ============================================
   ARCHIVE PAGES
   ============================================ */
.archive-header {
    padding: 60px 5% 40px;
    text-align: center;
}

.archive-title {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 500;
    margin-bottom: 16px;
}

.archive-description {
    color: var(--text-gray);
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 40px 5% 80px;
}

.pagination a,
.pagination span {
    padding: 12px 20px;
    border-radius: 12px;
    background: white;
    color: var(--text-dark);
    font-weight: 500;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pagination a:hover {
    background: var(--accent-lavender);
    transform: translateY(-2px);
}

.pagination .current {
    background: var(--text-dark);
    color: white;
}

/* ============================================
   404 PAGE
   ============================================ */
.error-404 {
    text-align: center;
    padding: 120px 5%;
}

.error-404 h1 {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 120px;
    font-weight: 500;
    color: var(--accent-lavender);
    margin-bottom: 20px;
}

.error-404 h2 {
    font-family: 'Noto Serif SC', Georgia, serif;
    font-size: 32px;
    margin-bottom: 16px;
}

.error-404 p {
    color: var(--text-gray);
    margin-bottom: 32px;
}

.btn-home {
    display: inline-block;
    padding: 16px 40px;
    background: var(--text-dark);
    color: white;
    border-radius: 50px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-home:hover {
    background: #333;
    transform: translateY(-2px);
    opacity: 1;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .masonry-column:nth-child(2) {
        padding-top: 0;
    }
    
    .masonry-column:nth-child(3) {
        display: none;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .main-navigation {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: white;
        z-index: 150;
        padding: 80px 32px;
        transition: left var(--transition-medium);
        box-shadow: 10px 0 40px rgba(0,0,0,0.1);
    }
    
    .main-navigation.active {
        left: 0;
    }
    
    .main-navigation ul {
        flex-direction: column;
        gap: 24px;
    }
    
    .main-navigation a {
        font-size: 18px;
    }
    
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 140;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-fast);
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .masonry-grid {
        grid-template-columns: 1fr;
        padding: 30px 5% 60px;
    }
    
    .masonry-column:nth-child(2),
    .masonry-column:nth-child(3) {
        display: none;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .newsletter-section {
        margin: 0 5% 60px;
        padding: 40px 24px;
    }
    
    .newsletter-form {
        flex-direction: column;
        border-radius: 20px;
    }
    
    .newsletter-form input,
    .newsletter-form button {
        border-radius: 16px;
        width: 100%;
    }
    
    .site-footer {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }
    
    .card-tall .card-image-container,
    .card-standard .card-image-container,
    .card-vertical .card-image-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 16px 5%;
    }
    
    .site-logo {
        font-size: 22px;
    }
    
    .hero-section {
        padding: 40px 5% 30px;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .card-title {
        font-size: 18px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus styles */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--text-dark);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
