/* --------------------------------------------------
   BASE
-------------------------------------------------- */

body {
    font-family: "Trebuchet MS", Arial, Verdana, sans-serif;
    font-size: 15px;
    color: black;
    margin: 0;
    padding: 0;
    background: white;
}

/* contenitore centrale */
.container {
    width: 100%;
    max-width: 900px;
    margin: auto;
    padding: 1rem;
}
.topbar {
    display: flex;
    align-items: center;      /* centratura verticale */
    justify-content: space-between;
    margin-bottom: 12px;
}

.topbar-left {
    font-size: 20px;
    font-weight: bold;
    color: maroon;
}

.topbar-right {
    gap: 6px;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
}


/* --------------------------------------------------
   GRIGLIA IMMAGINI
-------------------------------------------------- */

/* variabile controllata da JS */
:root {
    --cell-width: 100px;
}

#grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--cell-width), 1fr));
    gap: 8px;
}

/* celle normali */
.cell {
    text-align: center;
    cursor: pointer;
}

/* miniature */
.cell img {
    width: 100%;
    height: auto;
    display: block;
}

.title {
    margin-top: 2px;
    font-size: 10px;      /* più piccolo */
    line-height: 11px;
    font-family: "Trebuchet MS", Arial, Verdana, sans-serif;
}

/* --------------------------------------------------
   CELLE PAESE (senza immagine, senza bordo)
-------------------------------------------------- */

.catcell {
    display: flex;
    align-items: center;        /* centratura verticale */
    justify-content: center;    /* centratura orizzontale */
    text-align: center;

    /* altezza proporzionale alla dimensione delle celle */
    min-height: calc(var(--cell-width) * 0.8);

    padding: 0 4px;
    cursor: pointer;
    background: transparent;
}

.catcell img {
    display: none !important;   /* rimozione definitiva del transparent.gif */
}

.catcell .overlay {
    font-weight: bold;
    font-size: 12px;
    color: black;
    font-family: "Trebuchet MS", Arial, Verdana, sans-serif;

    /* permette centratura anche su 2–3 righe */
    display: inline-block;
    line-height: 1.2;
}

/* --------------------------------------------------
   PULSANTI + / -
-------------------------------------------------- */

.size-btn {
    background: maroon;
    color: white;
    border: none;
    padding: 2px 8px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
}

.size-btn:hover {
    background: #600000;
}
.exit-btn {
    background: black;
    color: white;
    border: none;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
}
/* --------------------------------------------------
   OVERLAY FULLSCREEN
-------------------------------------------------- */

#viewer-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: white;
    z-index: 99999;
    overflow: auto;
    display: none;
}

#viewer-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 18px;
    box-sizing: border-box;
}

/* titolo overlay */
#viewer-header-title {
    text-align: center;
    margin: 0;
    font-size: 18px;
    color: black;
    font-family: "Trebuchet MS", Arial, Verdana, sans-serif;
}

/* immagine grande */
#viewer-img {
    max-width: 95%;
    height: auto;
    display: block;
    margin: 20px auto;
}

/* titolo immagine */
#viewer-title {
    text-align: center;
    font-size: 13px;
    margin-top: 14px;     /* più spazio sopra */
    margin-bottom: 6px;   /* più spazio sotto */
    font-family: "Trebuchet MS", Arial, Verdana, sans-serif;
}

#viewer-country {
    text-align: center;
    font-size: 12px;      /* leggermente più grande */
    color: dimgray;
    margin-top: 4px;      /* più distanziato dal titolo immagine */
    font-family: "Trebuchet MS", Arial, Verdana, sans-serif;
}


/* pulsanti overlay */
.viewer-buttons {
    display: flex;
    justify-content: center;   /* centratura orizzontale */
    align-items: center;       /* centratura verticale */
    gap: 20px;                 /* spazio tra le icone */
    margin-top: 20px;
}

.viewer-btn {
    background: transparent;   /* nessun sfondo */
    border: none;              /* nessun bordo */
    padding: 0;                /* nessun padding */
    cursor: pointer;

    display: flex;             /* centratura interna */
    align-items: center;
    justify-content: center;

    width: 40px;               /* quadrato invisibile */
    height: 40px;              /* centratura perfetta */
}

.viewer-btn:hover {
    background: transparent;   /* nessun effetto hover */
}

.viewer-icon {
    width: 32px;               /* dimensione ideale */
    height: 25px;
    display: block;
}
