/* =========================================================
   RESET E BASE
   ========================================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    min-width: 940px; /* Forza la vista orizzontale/desktop anche su cellulari e tablet */
    width: 100%;
    overflow-x: auto;
}

body {
    padding: 20px 10px 30px 10px;
    background-image: url('images/battle_of_worringen_by_wraithdt-d6vscaq.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #ffffff;
    font-family: 'Segoe UI', Arial, sans-serif;
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================================
   HEADER UNIFICATO (INDEX.HTM + MEDIOEVO.HTM + ALTRE PAGINE)
   ========================================================= */
.header-images {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap; /* Impedisce di andare a capo in verticale */
    justify-content: center;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 900px;
    margin: 16px auto 20px auto;
}

.header-images a {
    display: block;
    line-height: 0;
    border: 0;
    text-decoration: none;
}

/* Proporzione esatta 700px (77.78%) + 200px (22.22%) = 900px */
.header-images a:first-child {
    width: 77.78%;
    flex: 0 0 77.78%;
}

.header-images a:last-child {
    width: 22.22%;
    flex: 0 0 22.22%;
}

.header-images img {
    width: 100%;
    height: 200px;
    max-height: 200px;
    object-fit: cover;
    display: block;
    border: 0;
    border-radius: 0;
}

/* =========================================================
   HOME PAGE (INDEX.HTM)
   ========================================================= */
.home-center {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.home-nav-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap; /* Sempre in fila orizzontale */
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 15px auto 20px auto;
}

.home-nav-row img {
    display: block;
    border: 0;
}

.home-portrait {
    display: block;
    margin: 10px auto 0 auto;
    max-width: 400px;
    height: auto;
    border: 0;
}

/* =========================================================
   CONTENITORE PRINCIPALE
   ========================================================= */
.content-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto 30px auto;
    padding: 25px 15px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.content-container h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    letter-spacing: 1px;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.9);
    color: #4da6ff;
    text-transform: uppercase;
}

/* =========================================================
   RIGA DRAPPO + CANONICA
   ========================================================= */
.drappo-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap; /* Sempre affiancati in orizzontale */
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.drappo-row .drappo-gif {
    height: 100px;
    width: auto;
    display: block;
}

.drappo-row .canonica-box {
    max-width: 300px;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    display: block;
}

.drappo-row .canonica-box img {
    width: 100%;
    height: auto;
    display: block;
}

/* =========================================================
   GALLERIA E GRID (SEMPRE SU PIŁ COLONNE ORIZZONTALI)
   ========================================================= */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr)); /* 4 colonne orizzontali fisse */
    gap: 20px;
    justify-items: center;
    align-items: center;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #000;
    width: 100%;
    max-width: 200px;
    aspect-ratio: 4 / 5;
    display: block;
    text-decoration: none;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 85, 179, 0.8);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
}

/* =========================================================
   DIVISORI A TUTTA LARGHEZZA
   ========================================================= */
.divider-container {
    width: 100%;
    margin: 25px 0;
    display: block;
}

.divider-container img {
    width: 100%;
    height: auto;
    max-height: 35px;
    object-fit: fill;
    display: block;
}

/* =========================================================
   PULSANTE CHIUDI (PAGINA)
   ========================================================= */
.btn-close {
    background-color: #003366;
    color: #ffffff;
    border: 1px solid #4da6ff;
    padding: 12px 35px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    letter-spacing: 1px;
    margin-top: 20px;
}

.btn-close:hover {
    background-color: #004080;
    box-shadow: 0 0 12px rgba(77, 166, 255, 0.6);
    transform: scale(1.03);
}

/* =========================================================
   STILI SPECIFICI PER MEDIOEVO.HTM
   ========================================================= */
body.medioevo-page {
    display: block;
    padding: 15px 10px 30px 10px;
}

.medioevo-wrap {
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
    text-align: center;
}

.medioevo-bar {
    display: block;
    width: 100%;
    max-width: 1000px;
    height: 10px;
    margin: 18px auto;
}

.medioevo-stage-table {
    margin: 16px auto;
    background-color: #000000;
    border-collapse: collapse;
    border-spacing: 0;
    border: 0;
}

.medioevo-stage-table td {
    background-color: #000000;
    padding: 0;
    border: 0;
    vertical-align: middle;
    line-height: 0;
}

.medioevo-stage-table img {
    display: block;
    height: 369px;
    border: 0;
}

.medioevo-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap; /* Sempre in fila orizzontale */
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 16px auto;
}

.medioevo-row a,
.medioevo-row img {
    display: block;
    line-height: 0;
}

.medioevo-marquee {
    width: 180px;
    height: 100px;
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    vertical-align: middle;
    line-height: 0;
}

.medioevo-marquee img {
    width: 180px;
    height: 100px;
    display: inline-block;
    vertical-align: middle;
}