/* =============================================================
   Customizations for Coop Sophia — v1.2
   ============================================================= */


/* =========================================================
   0. FORZA LIGHT MODE — switch nascosto, tema bloccato
   ========================================================= */

/* Forza le variabili Pico al tema chiaro su qualsiasi data-theme */
:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
    color-scheme:            light !important;
    --pico-background-color: #ffffff !important;
    --pico-color:            #454d5d !important;
}

/* Nasconde lo switch nella navbar */
.theme-switch-container {
    display: none !important;
}

/* Blocca il body in chiaro anche se JS setta data-theme="dark" */
body {
    background-color: #f0f0f0 !important;
}


/* =========================================================
   1. COLORI E TIPOGRAFIA
   ========================================================= */

:root {
    --pico-primary:       #b07d2e;
    --pico-primary-hover: #8a6020;
    --pico-font-size:     17px;
    --pico-line-height:   1.6;
}

/* =========================================================
   2. DARK MODE — disabilitata (light forzato nella sez. 0)
   ========================================================= */

/* Blocco disabilitato: il tema è bloccato in light mode.
   Per riattivare il dark mode, rimuovere la sezione 0
   e decommentare le regole qui sotto.

:root:not([data-theme="light"]) {
    color-scheme: dark;
    --pico-background-color: #1a1a2e;
    --pico-color:            #e0e0e0;
}

[data-theme="light"] {
    color-scheme: light;
    --pico-background-color: #ffffff;
    --pico-color:            #454d5d;
}
*/


/* =========================================================
   3. LAYOUT PRINCIPALE
   ========================================================= */

body {
    background-color: #111318;
}

[data-theme="light"] body {
    background-color: #f0f0f0;
}

main {
    padding: 30px;
    background-color: var(--pico-background-color);
}

main.container {
    padding-top:   20px;
    padding-left:  12px;
    padding-right: 12px;
}

body > footer, body > header, body > main {
    padding-block: unset;
}

address, blockquote, dl, ol, p, pre, table, ul {
    color: unset;
}


/* =========================================================
   4. HEADER
   ========================================================= */

header.main-header {
    background-color: rgba(17, 19, 24, 0.72);
    z-index: 999;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="light"] header.main-header {
    background-color: rgba(255, 255, 255, 0.82);
}

nav.container {
    padding-top:    2px;
    padding-bottom: 2px;
    min-height:     70px;
}


/* =========================================================
   5. LOGO
   ========================================================= */

.custom-logo-link {
    display: inline-flex;
    align-items: center;
}

.custom-logo {
    height:     60px !important;
    width:      auto !important;
    max-width:  none;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.custom-logo:hover {
    transform: scale(1.05);
}

nav.container > ul > li.custom_logo {
    padding: 0 !important;
}

a.blog_name_link {
    display: none;
}


/* =========================================================
   6. HERO BANNER (home)
   ========================================================= */

.hero-banner {
    background-size:     cover;
    background-position: center;
    background-repeat:   no-repeat;
    min-height:          420px;
    display:             flex;
    align-items:         center;
    justify-content:     center;
    text-align:          center;
    position:            relative;
    margin-bottom:       0;
}

/* Overlay scuro per leggibilità */
.hero-banner::before {
    content:  "";
    position: absolute;
    inset:    0;
    background: rgba(0, 0, 0, 0.48);
    z-index:  1;
}

.hero-banner > * {
    position: relative;
    z-index:  2;
}

/* H1 nel banner: slogan, non tagline tecnica */
.hero-banner h1 {
    font-size:      2rem;
    font-weight:    600;
    color:          white;
    text-shadow:    0 2px 12px rgba(0,0,0,0.5);
    letter-spacing: 0.01em;
    text-transform: none;
    line-height:    1.3;
    max-width:      700px;
    margin:         0 auto;
}

.hero-banner .hero-sub {
    font-size:   1rem;
    color:       rgba(255,255,255,0.8);
    margin-top:  0.5rem;
    letter-spacing: 0.05em;
}

.slogan {
    padding: 5% 8%;
}

[data-theme="light"] .hero-banner h1 {
    color: white;
}


/* =========================================================
   7. HERO PAGINE INTERNE
   ========================================================= */

.hero-background {
    height:              300px;
    background-size:     cover;
    background-position: center;
    position:            relative;
    display:             flex;
    align-items:         center;
    color:               white;
}

.hero-overlay {
    background: rgba(0, 0, 0, 0.45);
    width:      100%;
    height:     100%;
    display:    flex;
    align-items: center;
}

header.hero-section div.hero-overlay div.container h1,
header.hero-section div.hero-overlay div.container p {
    color:        white !important;
    margin-left:  auto;
    margin-right: auto;
}

header.overlay-header {
    background-color: rgba(20, 20, 24, 0.72);
}


/* =========================================================
   8. TIPOGRAFIA
   ========================================================= */

/* h2 usa il verde brand, non il blu */
h2 {
    color: var(--pico-primary);
}

h2 strong {
    font-weight: lighter;
}

section.home-content {
    padding-left:  4%;
    padding-right: 4%;
    line-height:   1.8;
    font-size:     1.05rem;
    color:         var(--pico-color);
}

/* Rimuove eccesso di spaziatura dai paragrafi vuoti in home */
section.home-content p:empty {
    display: none;
}

.white { color: white; }
.current_lang { color: white; }


/* =========================================================
   9. CATEGORIE IN EVIDENZA
   ========================================================= */

p.category-desc {
    color:       white;
    opacity:     0.75;
    font-size:   larger;
    line-height: 1.5;
}


/* =========================================================
   10. NEWS CARDS — immagine sopra, testo sotto
   ========================================================= */

.news-card {
    display:        flex;
    flex-direction: column;
    height:         100%;
    border:         1px solid rgba(128,128,128,0.2);
    border-radius:  8px;
    overflow:       hidden;
    background:     var(--pico-background-color);
    transition:     transform 0.25s ease, box-shadow 0.25s ease;
}

.news-card:hover {
    transform:  translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* L'immagine occupa la parte alta della card */
.card-image-container {
    display:        flex;
    flex-direction: column;
    flex:           1;
}

.card-image {
    order: -1;     /* Immagine sempre prima */
    overflow: hidden;
}

.card-image a img {
    width:       100%;
    height:      180px;
    object-fit:  cover;
    display:     block;
    transition:  transform 0.3s ease;
}

.news-card:hover .card-image a img {
    transform: scale(1.04);
}

/* Header titolo: sotto all'immagine, non sovrapposto */
header.overlay-header {
    order:            0;
    position:         static;
    background-color: transparent;
    padding:          12px 14px 4px;
    pointer-events:   auto;
}

header.overlay-header h4 {
    color:       var(--pico-color);
    font-size:   0.95rem;
    font-weight: 600;
    line-height: 1.35;
    margin:      0;
}

[data-theme="light"] header.overlay-header h4 {
    color: #222;
}

/* Excerpt */
.card-image-container > p {
    display:     block !important;
    font-size:   0.82rem;
    color:       var(--pico-color);
    opacity:     0.7;
    padding:     4px 14px 0;
    margin:      0;
    line-height: 1.4;
    flex:        1;
}

/* Footer card con bottone */
article div.card-image-container footer {
    padding:    10px 14px 14px;
    width:      auto;
    text-align: left;
    background: transparent;
}

article div.card-image-container footer > a {
    border-color:     transparent;
    background-color: var(--pico-primary);
    color:            white;
    width:            auto;
    font-size:        0.82rem;
    padding:          0.3rem 0.9rem;
    border-radius:    4px;
}

article div.card-image-container footer > a:hover {
    background-color: var(--pico-primary-hover);
}

section.latest-news h2 {
    text-align: center;
}


/* =========================================================
   11. ARTICOLI E PAGINE
   ========================================================= */

article.post {
    background-color: var(--pico-background-color);
    font-size:        1.1rem;
    line-height:      1.75;
    color:            var(--pico-color);
    padding:          16px;
}

article.post > header {
    background-color: var(--pico-background-color);
}

section.page-content p {
    background-color: var(--pico-background-color);
    font-size:        1.1rem;
    line-height:      1.75;
    color:            var(--pico-color);
    padding:          8px 0;
}

figure {
    text-align: center;
}


/* =========================================================
   12. BOTTONI E LINK
   ========================================================= */

button.outline,
.outline {
    border-color: rgba(128,128,128,0.5);
    color:        var(--pico-color);
}

button.outline:hover,
.outline:hover {
    border-color: var(--pico-primary);
    color:        var(--pico-primary);
}

.outline.secondary:hover {
    background-color: var(--pico-primary);
    border-color:     var(--pico-primary);
    color:            white;
}

a[role="button"] {
    display:       inline-block;
    border-radius: 20px 8px;
}

:where(a:not([role="button"])), [role="link"] {
    color: var(--pico-color);
}

div.entry-meta > p > a {
    color: white;
}

a.report {
    display:          block;
    border:           1px #c2c7d0 solid;
    width:            300px;
    padding:          5px;
    background-color: #5e5e5e;
    color:            white;
    text-decoration:  none;
    text-align:       center;
}


/* =========================================================
   13. FOOTER
   ========================================================= */

footer.container {
    padding:          24px 32px;
    background-color: #252228;
    color:            whitesmoke;
    border-top:       1px solid #3a383a;
    max-width:        100%;
}

[data-theme="light"] footer.container {
    background-color: #f5f5f7;
    color:            #454d5d;
    border-top:       1px solid #e0e0e0;
}

.company-footer p {
    font-size:     0.75rem;
    margin-bottom: 0.2rem;
}

/* Collassa la griglia a 2 colonne se footer-2 è vuoto */
.company-footer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

/* Nasconde celle footer vuote senza lasciare buco */
.company-footer > div:empty {
    display: none;
}


/* =========================================================
   14. COOKIE CONSENT
   ========================================================= */

dialog#eth-modal > * {
    color: white;
}

div.buttons {
    display: inline-flex;
    gap:     8px;
}

.eth-manage-privacy {
    display:         flex;
    align-items:     center;
    font-size:       28px;
    text-decoration: none;
    opacity:         0.7;
    transition:      opacity 0.2s;
}

.eth-manage-privacy:hover {
    opacity: 1;
}


/* =========================================================
   15. LINK DI DOWNLOAD
   Si applica automaticamente per estensione file —
   nessuna classe manuale necessaria nell'editor.
   ========================================================= */

a[href$=".pdf"],
a[href$=".pptx"], a[href$=".ppt"],
a[href$=".docx"], a[href$=".doc"],
a[href$=".xlsx"], a[href$=".xls"],
a[href$=".zip"],  a[href$=".rar"] {
    display:         inline-flex;
    align-items:     center;
    gap:             10px;
    padding:         8px 14px 8px 12px;
    margin:          3px 0;
    border-radius:   6px;
    border:          1px solid rgba(128,128,128,0.2);
    background:      rgba(128,128,128,0.06);
    color:           var(--pico-color);
    text-decoration: none;
    font-size:       0.9rem;
    transition:      transform 0.2s ease, border-color 0.2s ease;
}

a[href$=".pdf"]:hover,
a[href$=".pptx"]:hover, a[href$=".ppt"]:hover,
a[href$=".docx"]:hover, a[href$=".doc"]:hover,
a[href$=".xlsx"]:hover, a[href$=".xls"]:hover,
a[href$=".zip"]:hover,  a[href$=".rar"]:hover {
    transform:    translateX(4px);
    border-color: rgba(128,128,128,0.45);
}

/* Etichetta colorata per tipo di file */
a[href$=".pdf"]::before,
a[href$=".pptx"]::before, a[href$=".ppt"]::before,
a[href$=".docx"]::before, a[href$=".doc"]::before,
a[href$=".xlsx"]::before, a[href$=".xls"]::before,
a[href$=".zip"]::before,  a[href$=".rar"]::before {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    width:           34px;
    height:          34px;
    border-radius:   5px;
    font-size:       10px;
    font-weight:     700;
    flex-shrink:     0;
    letter-spacing:  .03em;
}

/* Freccia download */
a[href$=".pdf"]::after,
a[href$=".pptx"]::after, a[href$=".ppt"]::after,
a[href$=".docx"]::after, a[href$=".doc"]::after,
a[href$=".xlsx"]::after, a[href$=".xls"]::after,
a[href$=".zip"]::after,  a[href$=".rar"]::after {
    content:      "↓";
    margin-left:  auto;
    font-size:    14px;
    opacity:      0.4;
    padding-left: 8px;
}

a[href$=".pdf"]::before {
    content:    "PDF";
    background: #FCEBEB;
    color:      #A32D2D;
}

a[href$=".pptx"]::before,
a[href$=".ppt"]::before {
    content:    "PPT";
    background: #FAEEDA;
    color:      #854F0B;
}

a[href$=".docx"]::before,
a[href$=".doc"]::before {
    content:    "DOC";
    background: #E6F1FB;
    color:      #185FA5;
}

a[href$=".xlsx"]::before,
a[href$=".xls"]::before {
    content:    "XLS";
    background: #EAF3DE;
    color:      #3B6D11;
}

a[href$=".zip"]::before,
a[href$=".rar"]::before {
    content:    "ZIP";
    background: #EEEDFE;
    color:      #534AB7;
}
