body {
    background-color: #000;
    color: #eaeaea;
    font-family: "IBM Plex Sans", sans-serif;
}

/* NAVBAR */
.navbar {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    transition: 0.3s;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.9);
}

.navbar-brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.navbar-nav .nav-link {
    font-size: 18px;
    font-weight: 500;
    padding: 8px 14px;
    margin-left: 8px;

    color: #fff !important;

    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;

    transition: 0.25s;
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
}

.navbar a {
    color: #fff !important;
}

/* HERO */
.hero-home {
    position: relative;
    min-height: 55vh;
    height: auto;
    background: url("../immagini/banner.jpg") center/cover no-repeat;
}

.hero-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
}

.hero-home-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: 120px;
    padding-bottom: 40px;
}

/* ASCII ANSI STYLE */
.ascii-title {
    font-family: "Courier New", monospace;
    font-size: clamp(6px, 2vw, 35px);
    line-height: 1.1;
    color: #ffffff;
    text-align: center;

    text-shadow:
        0 0 2px #ffffff,
        0 0 4px #cccccc;

    background: rgba(0, 0, 0, 0.7);
    padding: 12px;

    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    box-sizing: border-box;
}

/* HERO TEXT */
.hero-home-text {
    margin-top: 20px;
    font-size: 25px;
    color: #ddd;
}

/* ARTICOLI */
.featured-article {
    background: #111;
}

.featured-article-body {
    padding: 20px;
}

.mag-card {
    background: #111;
    border: none;
    transition: 0.3s;
}

.mag-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

/*principale*/
.featured-article-body h2 {
    font-family: "Playfair Display", serif;
    font-size: 56px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

.featured-article-body p {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 25px;
    line-height: 1.7;
    color: #ccc;
}

/*piccoli*/
.mag-card h5 {
    font-family: "Playfair Display", serif;
    font-size: 35px;
    font-weight: 700;
    line-height: 1.3;
}

.mag-card p {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 22px;
    line-height: 1.6;
    color: #bbb;
}

/* SIDEBAR */
.sidebar-box h5 {
    font-family: "Playfair Display", serif;
    font-size: 26px;
    font-weight: 700;
}

.sidebar-box p {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 17px;
    line-height: 1.6;
    color: #ccc;
}

/* FOOTER */
footer {
    background: #000;
    padding: 40px 0;
    border-top: 1px solid #222;
}

/* PAGINA ARCHIVIO */
.hero-archive {
    min-height: 55vh;
    padding-bottom: 40px;
}

.archive-page {
    margin-top: 30px;
}

.archive-search-box {
    background: #111;
    padding: 20px;
    border: 1px solid #222;
}

.archive-search-input,
.archive-filter-input {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 14px 16px;
    font-size: 16px;
}

.archive-search-input::placeholder,
.archive-filter-input::placeholder {
    color: #888;
}

.archive-search-input:focus,
.archive-filter-input:focus {
    background: #000;
    color: #fff;
    border-color: #999;
    box-shadow: none;
}

.archive-search-btn {
    background: #fff;
    color: #000;
    border: none;
    font-weight: 600;
    padding: 14px 16px;
}

.archive-search-btn:hover {
    background: #ddd;
}

.archive-panel {
    background: #111;
    border: 1px solid #222;
    padding: 24px;
    min-height: 500px;
    margin-bottom: 20px;
}

.archive-panel-title {
    font-family: "Playfair Display", serif;
    font-size: 28px;
    margin-bottom: 20px;
}

.archive-tree {
    max-height: 60vh;
    overflow-y: auto;
}


/* ========================================
   FIX DEFINITIVO ASCII / MOBILE
======================================== */

.ascii-wrapper {
    width: 100%;
}

/* desktop */
.ascii-mobile-title {
    display: none;
}

/* mobile */
@media (max-width: 768px) {

    .ascii-title {
        display: none;
    }

    .ascii-mobile-title {
        display: block;
        font-family: "Playfair Display", serif;
        font-size: 24px;
        text-align: center;
        color: #fff;
        margin-bottom: 10px;
    }

    /* FIX CRITICO: evita sovrapposizione */
    .hero-home-content {
        padding-top: 80px;
    }

    .hero-home-text {
        margin-top: 10px;
    }
}

/* FIX MODALE SCURA */
#docModal .modal-content,
#docModal .archive-modal-content {
    background: #111 !important;
    color: #fff !important;
    border: 1px solid #333 !important;
}

#docModal .modal-header,
#docModal .archive-modal-header,
#docModal .modal-footer,
#docModal .archive-modal-footer {
    background: #111 !important;
    color: #fff !important;
    border-color: #333 !important;
}

#docModal .modal-body,
#docModal .archive-modal-body {
    background: #111 !important;
    color: #fff !important;
}

#docModal .modal-title,
#docModal .archive-modal-meta,
#docModal .archive-document-text {
    color: #fff !important;
}

#docModal .archive-document-text {
    white-space: pre-wrap;
    font-family: "Courier New", monospace;
    background: #111 !important;
}

#docModal .btn-close {
    filter: invert(1);
}


/* =========================
   PAGEFIND - TEMA SCURO
========================= */

#pagefind-search {
    --pagefind-ui-primary: #ffffff;
    --pagefind-ui-text: #eaeaea;
    --pagefind-ui-background: #111111;
    --pagefind-ui-border: #333333;
    --pagefind-ui-tag: #222222;
    --pagefind-ui-border-radius: 4px;
    --pagefind-ui-font: "IBM Plex Sans", sans-serif;
}

#pagefind-search,
#pagefind-search * {
    color: #eaeaea !important;
}

#pagefind-search .pagefind-ui__search-input {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    padding: 12px 14px !important;
}

#pagefind-search .pagefind-ui__search-input::placeholder {
    color: #666 !important;
}

#pagefind-search .pagefind-ui__result {
    background: #111 !important;
    border-top: 1px solid #333 !important;
    padding: 18px 0 !important;
}

#pagefind-search .pagefind-ui__result-title,
#pagefind-search .pagefind-ui__result-title a {
    color: #ffffff !important;
    font-family: "Playfair Display", serif;
    font-size: 22px !important;
    text-decoration: none !important;
}

#pagefind-search .pagefind-ui__result-excerpt {
    background: transparent !important;
    color: #cccccc !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
}

#pagefind-search .pagefind-ui__result-excerpt mark {
    background: #f5e663 !important;
    color: #000 !important;
    padding: 1px 3px;
}

#pagefind-search .pagefind-ui__message,
#pagefind-search .pagefind-ui__result-nested,
#pagefind-search .pagefind-ui__result-nested a {
    color: #cccccc !important;
}

#pagefind-search .pagefind-ui__button {
    background: #222 !important;
    color: #fff !important;
    border: 1px solid #444 !important;
}

/* =========================
   FIX TESTI ARCHIVIO
========================= */

pre {
    white-space: pre-wrap;       /* mantiene formattazione ma va a capo */
    word-wrap: break-word;       /* spezza parole lunghissime */
    overflow-wrap: break-word;   /* fallback moderno */
    
    max-width: 100%;
    overflow-x: auto;            /* evita tagli orizzontali */

    font-family: "Courier New", monospace;
    background: #111;
    padding: 15px;
    border: 1px solid #333;

    line-height: 1.5;
}

/* =========================
   FONT DOCUMENTI ARCHIVIO
========================= */

.archive-document-text {
    font-size: 18px;        /* aumenta dimensione base */
    line-height: 1.6;
}

.archive-document-text pre {
    font-size: 17px;        /* font monospace più leggibile */
}


/* =========================
   ARTICOLI
========================= */

.article-page {
    max-width: 900px;
}

.article-page h2 {
    margin-bottom: 2rem;
}

.article-page h3 {
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.article-page p {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* =========================
   CONTATTI
========================= */

.contact-links {
    list-style: disc;
    padding-left: 2rem;
}

.contact-links li {
    display: list-item;
    margin-bottom: 12px;
}

.contact-links a {
    color: #eaeaea;
    text-decoration: none;
}

.contact-links a:hover {
    text-decoration: underline;
}

/* =========================
   MODALE
========================= */

#docModalBody {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
}



#docModal .archive-document-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "IBM Plex Sans", sans-serif;
    line-height: 1.7;
}

@media (max-width: 768px) {
    #docModal .modal-footer .btn {
        width: 100%;
    }
}

#docModal .archive-document-text [data-pagefind-body] {
    display: block !important;
}


.archive-tree a.tree-file {
    display: grid;
    grid-template-columns: max-content max-content auto;
    column-gap: 16px;
    align-items: center;

    background: none;
    border: none;
    color: #eaeaea;
    text-align: left;
    padding: 4px 0;
    text-decoration: none;
    cursor: pointer;

    font-family: "IBM Plex Mono", monospace;
}

.archive-tree a.tree-file:hover {
    text-decoration: underline;
}

#docModalBody img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
}

/* =========================
   PAGINA CARTELLE ARCHIVIO
========================= */

.archive-folders-page h3 {
    font-family: "Playfair Display", serif;
    font-size: 2.2rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.archive-folders-page p {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #ccc;
}

.archive-folders-page p a {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: underline;
}

.archive-folders-page p a:hover {
    color: #dddddd;
}

/* =========================
   ALBERO ARCHIVIO
========================= */

.tree-date{
    display:inline-block;
    min-width:95px;
    white-space:nowrap;
    font-size:17px;
}

.tree-time{
    display:inline-block;
    min-width:65px;
    margin-right:12px;
    white-space:nowrap;
    font-size:17px;
}

.tree-name{
    white-space:nowrap;
    font-size:17px;
}

.tree-year{
    display:flex;
    align-items:center;
    gap:10px;

    margin:12px 0 6px;
    color:#bdbdbd;
    font-weight:600;
}

.tree-year::before,
.tree-year::after{
    content:"";
    flex:1;
    border-bottom:1px solid #444;
}

/* =========================
   ALBERO ARCHIVIO
========================= */

.archive-tree-list{
    list-style:none;
    margin:0;
    padding-left:18px;
}

.archive-tree-list li{
    margin:2px 0;
}

.tree-dir{

    background:none;
    border:none;

    color:#ffffff;

    font-family:"IBM Plex Sans",sans-serif;
    font-size:18px;
    font-weight:600;

    padding:2px 0;

    cursor:pointer;

    text-align:left;

}

.tree-dir:hover{
    color:#d6d6d6;
}

.tree-file{
    color:#dcdcdc;
    font-size:17px;
    text-decoration:none;
}

.tree-file:hover{
    color:#ffffff;
    text-decoration:underline;
}

.tree-year{
    margin-top:18px;
    margin-bottom:10px;
    font-size:17px;
}