/* === Aula Moderna — main.css === */

:root {
    --am-primary: #0369A1;
    --am-primary-dark: #075985;
    --am-secondary: #16A34A;
    --am-accent: #EA580C;
    --am-bg: #FFFFFF;
    --am-bg-soft: #F8FAFC;
    --am-text: #374151;
    --am-text-light: #6B7280;
    --am-border: #E5E7EB;
    --am-footer-bg: #1E293B;
    --am-footer-text: #CBD5E1;
    --am-font-heading: 'Petrona', Georgia, serif;
    --am-font-body: 'Urbanist', -apple-system, sans-serif;
    --am-radius: 10px;
    --am-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --am-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --am-container: 1200px;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--am-font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--am-text);
    background: var(--am-bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--am-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--am-primary-dark); }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--am-font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: #1E293B;
}
ul, ol { list-style: none; }

/* === Utilities === */
.am-container {
    max-width: var(--am-container);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.am-content-narrow { max-width: 780px; }
.am-content-legal { max-width: 720px; }
.am-sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

/* === Header === */
.am-header {
    background: var(--am-bg);
    border-bottom: 1px solid var(--am-border);
    position: relative;
    z-index: 100;
    transition: box-shadow 0.3s;
}
.am-header--sticky {
    position: sticky;
    top: 0;
    box-shadow: var(--am-shadow);
}
.am-header-inner {
    max-width: var(--am-container);
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.am-logo { display: flex; align-items: center; flex-shrink: 0; }
.am-logo svg { height: 36px; width: auto; }

.am-nav { margin-left: auto; }
.am-nav-list {
    display: flex;
    gap: 1.75rem;
    align-items: center;
}
.am-nav-list li { position: relative; }
.am-nav-list a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--am-text);
    padding: 0.25rem 0;
    transition: color 0.2s;
}
.am-nav-list a:hover { color: var(--am-primary); }
.am-nav-list .current-menu-item > a,
.am-nav-list .current_page_item > a { color: var(--am-primary); }

/* Dropdown */
.am-nav-list .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--am-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    padding: 0.5rem 0;
    min-width: 200px;
    box-shadow: var(--am-shadow-hover);
    z-index: 200;
}
.am-nav-list li:hover > .sub-menu { display: block; }
.am-nav-list .sub-menu a {
    display: block;
    padding: 0.4rem 1.25rem;
    font-size: 0.9rem;
}

/* Search toggle */
.am-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--am-text-light);
    padding: 0.25rem;
    display: flex;
    transition: color 0.2s;
}
.am-search-toggle:hover { color: var(--am-primary); }

/* Search bar */
.am-search-bar {
    border-top: 1px solid var(--am-border);
    background: var(--am-bg-soft);
}
.am-search-bar-inner {
    max-width: var(--am-container);
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
}

/* Mobile menu toggle */
.am-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}
.am-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--am-text);
    transition: all 0.3s;
}
.am-menu-toggle--active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.am-menu-toggle--active span:nth-child(2) { opacity: 0; }
.am-menu-toggle--active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* === Hero === */
.am-hero {
    background: linear-gradient(135deg, #0369A1, #0284C7);
    color: #FFFFFF;
    padding: 4rem 1.25rem 3.5rem;
    text-align: center;
}
.am-hero-inner {
    max-width: 700px;
    margin: 0 auto;
}
.am-hero-title {
    font-size: 2.5rem;
    color: #FFFFFF;
    margin-bottom: 0.75rem;
}
.am-hero-subtitle {
    font-size: 1.15rem;
    opacity: 0.9;
    margin-bottom: 1.75rem;
    font-weight: 300;
}

/* Level Pills */
.am-level-pills {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}
.am-pill {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    color: #FFFFFF;
    transition: background 0.2s;
}
.am-pill:hover { background: rgba(255,255,255,0.35); color: #FFFFFF; }
.am-pill--accent { background: var(--am-accent); }
.am-pill--active {
    background: var(--am-primary);
    color: #FFFFFF;
}

/* === Intro === */
.am-intro {
    padding: 2.5rem 0 0;
    background: var(--am-bg);
}
.am-intro-text {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--am-text-light);
}

/* === Subject Icons === */
.am-subjects {
    padding: 3rem 0;
    background: var(--am-bg);
}
.am-subject-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    text-align: center;
}
.am-subject-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    border-radius: var(--am-radius);
    transition: background 0.2s, transform 0.2s;
    color: var(--am-text);
}
.am-subject-item:hover {
    background: var(--am-bg-soft);
    transform: translateY(-2px);
    color: var(--am-primary);
}
.am-subject-icon { font-size: 2rem; }
.am-subject-label { font-size: 0.9rem; font-weight: 600; }

/* === Stats === */
.am-stats {
    background: var(--am-bg-soft);
    padding: 2.5rem 0;
    border-top: 1px solid var(--am-border);
    border-bottom: 1px solid var(--am-border);
}
.am-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    text-align: center;
}
.am-stat-number {
    display: block;
    font-family: var(--am-font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--am-primary);
}
.am-stat-label {
    font-size: 0.85rem;
    color: var(--am-text-light);
    font-weight: 500;
}

/* === Section Titles === */
.am-section-title {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

/* === Card Grid === */
.am-latest, .am-archive { padding: 3rem 0; }
.am-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.am-card-grid--2 { grid-template-columns: repeat(2, 1fr); }
.am-card-grid--3 { grid-template-columns: repeat(3, 1fr); }

.am-card {
    background: var(--am-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.am-card:hover {
    box-shadow: var(--am-shadow-hover);
    transform: translateY(-2px);
}
.am-card-img { display: block; overflow: hidden; }
.am-card-img img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s;
}
.am-card:hover .am-card-img img { transform: scale(1.03); }

.am-card-body { padding: 1.25rem; }
.am-card-cat {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--am-primary);
    margin-bottom: 0.5rem;
}
.am-card-cat--appr { color: var(--am-secondary); }
.am-card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.am-card-title a { color: #1E293B; }
.am-card-title a:hover { color: var(--am-primary); }
.am-card-excerpt {
    font-size: 0.9rem;
    color: var(--am-text-light);
    margin-bottom: 0.75rem;
}
.am-card-date {
    font-size: 0.8rem;
    color: var(--am-text-light);
}

/* === Featured Section === */
.am-featured {
    padding: 3rem 0;
    background: var(--am-bg-soft);
}
.am-featured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}
.am-featured-text p {
    color: var(--am-text-light);
    margin-bottom: 1.5rem;
}
.am-featured-item {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--am-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}
.am-featured-item:hover { border-color: var(--am-primary); }
.am-featured-item h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: #1E293B;
}
.am-featured-materia {
    font-size: 0.8rem;
    color: var(--am-secondary);
    font-weight: 500;
}

/* === Button === */
.am-btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    background: var(--am-primary);
    color: #FFFFFF;
    border-radius: var(--am-radius);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}
.am-btn:hover { background: var(--am-primary-dark); color: #FFFFFF; }

/* === Filter Pills === */
.am-filter-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

/* === Single Article === */
.am-single { padding: 2.5rem 0 3rem; }
.am-article-header { margin-bottom: 2rem; }
.am-article-title {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}
.am-article-meta {
    font-size: 0.9rem;
    color: var(--am-text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.am-meta-sep { color: var(--am-border); }
.am-article-hero {
    margin-bottom: 2rem;
    border-radius: var(--am-radius);
    overflow: hidden;
}
.am-article-content {
    font-size: 1.05rem;
    line-height: 1.8;
}
.am-article-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 0.75rem;
}
.am-article-content h3 {
    font-size: 1.25rem;
    margin: 1.75rem 0 0.5rem;
}
.am-article-content p { margin-bottom: 1.25rem; }
.am-article-content ul, .am-article-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}
.am-article-content ul { list-style: disc; }
.am-article-content ol { list-style: decimal; }
.am-article-content li { margin-bottom: 0.4rem; }
.am-article-content blockquote {
    border-left: 3px solid var(--am-primary);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--am-bg-soft);
    font-style: italic;
    color: var(--am-text-light);
}
.am-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}
.am-article-content th, .am-article-content td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--am-border);
    text-align: left;
}
.am-article-content th {
    background: var(--am-bg-soft);
    font-weight: 600;
}
.am-article-content a { text-decoration: underline; }
.am-article-content a:hover { text-decoration: none; }

/* Sources box (for Approfondimenti) */
.am-sources {
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--am-bg-soft);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
}
.am-sources h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--am-primary);
}
.am-sources ul { list-style: decimal; padding-left: 1.25rem; }
.am-sources li {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--am-text-light);
}

/* === Post Navigation === */
.am-post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--am-border);
}
.am-post-nav-prev, .am-post-nav-next {
    display: block;
    padding: 1rem;
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    transition: border-color 0.2s;
}
.am-post-nav-prev:hover, .am-post-nav-next:hover { border-color: var(--am-primary); }
.am-post-nav-next { text-align: right; grid-column: 2; }
.am-post-nav-label {
    font-size: 0.8rem;
    color: var(--am-text-light);
    display: block;
    margin-bottom: 0.25rem;
}
.am-post-nav-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1E293B;
    display: block;
}

/* === Breadcrumb === */
.am-breadcrumb {
    font-size: 0.85rem;
    color: var(--am-text-light);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.am-breadcrumb a { color: var(--am-text-light); }
.am-breadcrumb a:hover { color: var(--am-primary); }
.am-breadcrumb-sep { color: var(--am-border); }
.am-breadcrumb-current { color: var(--am-text); font-weight: 500; }

/* === Archive Header === */
.am-archive-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--am-border);
}
.am-archive-title { font-size: 2rem; margin-bottom: 0.5rem; }
.am-archive-desc { color: var(--am-text-light); font-size: 1rem; }

/* === Search Form === */
.am-searchform {
    display: flex;
    gap: 0;
}
.am-search-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--am-border);
    border-right: none;
    border-radius: var(--am-radius) 0 0 var(--am-radius);
    font-family: var(--am-font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.am-search-input:focus { border-color: var(--am-primary); }
.am-search-submit {
    padding: 0.6rem 1rem;
    background: var(--am-primary);
    color: #FFFFFF;
    border: 1px solid var(--am-primary);
    border-radius: 0 var(--am-radius) var(--am-radius) 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}
.am-search-submit:hover { background: var(--am-primary-dark); }

/* === 404 === */
.am-404 { padding: 4rem 0; text-align: center; }
.am-404-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--am-primary);
}
.am-404-text {
    max-width: 500px;
    margin: 0 auto 2rem;
    color: var(--am-text-light);
}
.am-404-search {
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* === Legal Pages === */
.am-legal { padding: 2.5rem 0 3rem; }
.am-legal-text { font-size: 0.95rem; line-height: 1.8; }
.am-legal-text h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
.am-legal-text h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

/* === Footer === */
.am-footer {
    background: var(--am-footer-bg);
    color: var(--am-footer-text);
    padding: 3rem 0 0;
}
.am-footer-inner {
    max-width: var(--am-container);
    margin: 0 auto;
    padding: 0 1.25rem;
}
.am-footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2.5rem;
}
.am-footer-heading {
    font-size: 1rem;
    color: #FFFFFF;
    margin-bottom: 1rem;
    font-family: var(--am-font-heading);
}
.am-footer-text {
    font-size: 0.9rem;
    line-height: 1.7;
}
.am-footer-links li { margin-bottom: 0.5rem; }
.am-footer-links a {
    color: var(--am-footer-text);
    font-size: 0.9rem;
    transition: color 0.2s;
}
.am-footer-links a:hover { color: #FFFFFF; }
.am-footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 1.25rem 0;
    text-align: center;
    font-size: 0.85rem;
}

/* === Pagination === */
.am-main .nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.am-main .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    font-size: 0.9rem;
    color: var(--am-text);
    transition: all 0.2s;
}
.am-main .page-numbers:hover { border-color: var(--am-primary); color: var(--am-primary); }
.am-main .page-numbers.current {
    background: var(--am-primary);
    color: #FFFFFF;
    border-color: var(--am-primary);
}

/* === No Results === */
.am-no-results {
    text-align: center;
    padding: 3rem 0;
    color: var(--am-text-light);
}

/* === Stretched card link (single <a> per card) === */
.am-card { position: relative; }
.am-card-title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* === Responsive === */
@media (max-width: 1023px) {
    .am-subject-grid { grid-template-columns: repeat(3, 1fr); }
    .am-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    .am-card-grid { grid-template-columns: repeat(2, 1fr); }
    .am-card-grid--3 { grid-template-columns: repeat(2, 1fr); }
    .am-featured-grid { grid-template-columns: 1fr; gap: 2rem; }
    .am-footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
    /* Header mobile */
    .am-menu-toggle { display: flex; }
    .am-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--am-bg);
        border-bottom: 1px solid var(--am-border);
        box-shadow: var(--am-shadow);
        z-index: 100;
    }
    .am-nav--open { display: block; }
    .am-nav-list {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
    }
    .am-nav-list a {
        display: block;
        padding: 0.65rem 1.25rem;
    }
    .am-nav-list .sub-menu {
        position: static;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }

    /* Hero mobile */
    .am-hero { padding: 2.5rem 1.25rem 2rem; }
    .am-hero-title { font-size: 1.75rem; }
    .am-hero-subtitle { font-size: 1rem; }

    /* Content mobile */
    .am-subject-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .am-subject-icon { font-size: 1.5rem; }
    .am-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .am-card-grid,
    .am-card-grid--2,
    .am-card-grid--3 { grid-template-columns: 1fr; }

    .am-article-title { font-size: 1.5rem; }
    .am-archive-title { font-size: 1.5rem; }

    .am-post-nav { grid-template-columns: 1fr; }
    .am-post-nav-next { text-align: left; grid-column: 1; }

    .am-footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
