:root {
    --bg: #f6f3ea;
    --surface: #fffdfa;
    --ink: #1f2629;
    --ink-soft: #4d575a;
    --brand: #8b2f2f;
    --brand-strong: #6d1f1f;
    --line: #d6d0c4;
    --shadow: 0 18px 40px rgba(43, 35, 22, 0.12);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(0.95rem, 0.92rem + 0.14vw, 1.02rem);
    color: var(--ink);
    background:
        radial-gradient(circle at 12% -15%, rgba(139, 47, 47, 0.14), transparent 36%),
        radial-gradient(circle at 90% 15%, rgba(154, 120, 57, 0.16), transparent 30%),
        var(--bg);
    min-height: 100vh;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    font-feature-settings: "liga" 1, "kern" 1;
}

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

a {
    color: var(--brand-strong);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    background: #fff;
    color: #000;
    padding: 0.6rem 1rem;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

.site-shell {
    width: min(1240px, 94vw);
    margin: 0 auto;
    padding: 1rem 0 2rem;
}

.site-header {
    background: linear-gradient(145deg, rgba(255, 253, 246, 0.97), rgba(255, 251, 238, 0.96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: sticky;
    top: 0.8rem;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.brand-wrap {
    display: grid;
    grid-template-columns: 68px 1fr;
    gap: 0.8rem;
    align-items: center;
}

.brand-logo img {
    width: 68px;
    height: 68px;
    object-fit: contain;
}

.brand-kicker {
    font-family: "Cormorant Garamond", Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
}

.brand-title {
    margin: 0.1rem 0 0;
    font-family: "Cinzel", "Fraunces", "Cormorant Garamond", Garamond, serif;
    font-size: clamp(1.5rem, 5vw, 2.4rem);
    line-height: 1.03;
    letter-spacing: 0.04em;
    font-weight: 800;
    text-transform: uppercase;
}

.brand-title a {
    color: var(--ink);
}

.brand-subtitle {
    margin: 0.2rem 0 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    color: var(--ink-soft);
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.main-nav {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 0.34rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

@media (max-width: 759px) {
    .main-nav ul {
        justify-content: flex-start;
    }
}

.main-nav a {
    font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    line-height: 1;
    display: inline-block;
    padding: 0.3rem 0.58rem;
    border: 1px solid rgba(139, 47, 47, 0.3);
    border-radius: 999px;
    white-space: nowrap;
    color: var(--brand-strong);
    background: rgba(255, 255, 255, 0.72);
    font-weight: 600;
}

.main-nav a[aria-current="page"],
.main-nav a:hover,
.main-nav a:focus-visible {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    text-decoration: none;
}

.site-main {
    margin-top: 1.4rem;
    padding: 0.2rem;
}

.page-intro {
    margin-bottom: 1.1rem;
}

.eyebrow {
    margin: 0;
    font-family: "Cormorant Garamond", Georgia, serif;
    color: var(--brand-strong);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.88rem;
    font-weight: 700;
}

h2,
h3 {
    font-family: "Fraunces", "Cormorant Garamond", Garamond, serif;
    font-variation-settings: "SOFT" 55;
}

.page-intro h2 {
    margin: 0.15rem 0 0.45rem;
    font-size: clamp(1.4rem, 4.7vw, 2.05rem);
}

.page-intro p {
    margin: 0;
    color: var(--ink-soft);
}

.home-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.home-sidebar {
    display: grid;
    gap: 0;
}

.sidebar-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(30, 29, 22, 0.08);
}

.sidebar-panel h3 {
    margin: 0.3rem 0 0.55rem;
    font-size: 1.3rem;
    line-height: 1.15;
}

.sidebar-panel p {
    margin: 0.35rem 0;
}

.editoriale-panel {
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.editoriale-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
}

.editoriale-title-row h3 {
    margin: 0.3rem 0 0.55rem;
}

.editoriale-mobile-toggle {
    display: none;
    border: 1px solid rgba(109, 31, 31, 0.45);
    background: rgba(255, 255, 255, 0.9);
    color: var(--brand-strong);
    border-radius: 7px;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.38rem 0.5rem;
    cursor: pointer;
}

.editoriale-mobile-toggle:hover,
.editoriale-mobile-toggle:focus-visible {
    background: rgba(109, 31, 31, 0.1);
}

.editoriale-full {
    font-size: 0.92rem;
    line-height: 1.45;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding-right: 0.35rem;
}

.photo-slider {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #e9e3d6;
    min-height: 220px;
}

.photo-slide {
    display: none;
    margin: 0;
    position: relative;
}

.photo-slide.is-active {
    display: block;
}

.photo-slide img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.photo-slide figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0.55rem 0.65rem;
    font-size: 0.9rem;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0));
}

.slider-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
}

.slider-control.prev {
    left: 0.45rem;
}

.slider-control.next {
    right: 0.45rem;
}

.slider-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.55rem;
    z-index: 3;
    display: flex;
    justify-content: center;
    gap: 0.35rem;
}

.slider-dots button {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.4);
    padding: 0;
    cursor: pointer;
}

.slider-dots button[aria-current="true"] {
    background: #fff;
}

.home-main {
    min-width: 0;
}

.home-rows {
    display: grid;
    gap: 1rem;
}

.home-photo-section {
    margin-top: 0.2rem;
}

@media (max-width: 1119px) {
    .editoriale-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 54px;
    }

    .editoriale-panel {
        overflow: visible;
    }

    .editoriale-panel[data-mobile-collapsed="true"] .editoriale-full {
        display: none;
    }
}

.cards-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.cards-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.article-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(30, 29, 22, 0.08);
    transition: transform 240ms ease, box-shadow 240ms ease;
}

.article-card:hover,
.article-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 18px 32px rgba(30, 29, 22, 0.13);
}

.card-media {
    order: 2;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #eae5d8;
    width: 100%;
    position: relative;
    z-index: 0;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease;
}

.article-card:hover .card-media img,
.article-card:focus-within .card-media img {
    transform: scale(1.04);
}

.card-content {
    order: 1;
    flex: 1 1 auto;
    width: 100%;
    padding: 0.82rem;
    color: var(--ink);
    background: var(--surface);
    position: relative;
    z-index: 1;
}

.card-rubrica {
    margin: 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--brand);
    font-weight: 700;
}

.card-content h3 {
    margin: 0.35rem 0 0.35rem;
    font-size: 1.16rem;
    line-height: 1.14;
    font-weight: 620;
}

.card-content h3 a {
    color: var(--ink);
}

.card-content p {
    margin: 0.3rem 0;
    line-height: 1.4;
    font-size: 0.9rem;
}

/* Defensive rules: keep title and excerpt visible even with aggressive global CSS */
.article-card .card-content h3,
.article-card .card-content h3 a,
.article-card .card-content p {
    display: block;
    opacity: 1;
    visibility: visible;
    color: var(--ink);
}

.article-card .card-content h3 a {
    text-decoration: none;
}

.article-card .card-content h3 a:hover,
.article-card .card-content h3 a:focus-visible {
    text-decoration: underline;
}

.card-meta {
    font-family: "Cormorant Garamond", Georgia, serif;
    color: var(--ink-soft);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.card-date-overlay {
    position: absolute;
    left: 0.5rem;
    bottom: 0.5rem;
    z-index: 2;
    display: inline-block;
    padding: 0.2rem 0.46rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 0.72rem;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.read-more {
    color: var(--brand-strong);
    font-weight: 700;
    font-size: 0.86rem;
}

.article-page {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    padding: clamp(1rem, 2vw, 1.8rem);
    box-shadow: 0 10px 30px rgba(26, 25, 18, 0.1);
}

.article-header h2 {
    margin: 0.2rem 0 0.6rem;
    font-size: clamp(1.7rem, 4.9vw, 2.8rem);
    line-height: 1.06;
}

.article-meta {
    margin: 0;
    color: var(--ink-soft);
}

.article-hero {
    margin: 1rem 0;
    border-radius: 14px;
    overflow: hidden;
}

.article-body {
    font-size: clamp(1.08rem, 1.02rem + 0.25vw, 1.2rem);
    line-height: 1.78;
}

.article-body p,
.article-body li {
    margin: 0.92rem 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
    margin: 1.2rem 0 0.6rem;
}

.pagination {
    margin-top: 1.1rem;
    display: flex;
    gap: 0.7rem;
    align-items: center;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
}

.empty-state,
.not-found {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.site-footer {
    margin-top: 1.7rem;
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.94rem;
    border-top: 1px solid var(--line);
    padding-top: 1.2rem;
}

.reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: rise 500ms ease forwards;
    animation-delay: var(--delay, 0ms);
}

@keyframes rise {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 760px) {
    .site-header {
        padding: 1.1rem 1.2rem;
    }

    .brand-wrap {
        grid-template-columns: 82px 1fr;
        gap: 1rem;
    }

    .brand-logo img {
        width: 82px;
        height: 82px;
    }

    .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cards-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-rows {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .home-rows .cards-row {
        display: contents;
    }

    .home-photo-section {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1120px) {
    .cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-layout {
        grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
        align-items: stretch;
    }

    .home-sidebar {
        height: 100%;
    }

    .editoriale-panel {
        height: 100%;
        max-height: 100%;
    }

    .editoriale-full {
        overflow-y: auto;
    }

    .cards-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-rows {
        grid-template-columns: 1fr;
    }

    .home-rows .cards-row {
        display: grid;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal,
    .article-card,
    .card-media img {
        animation: none;
        transition: none;
        transform: none;
        opacity: 1;
    }
}
