/* MonoFestival - sito pubblico
   VeeStudio per Officine Zephiro
   I colori, i font e le misure del wall arrivano dalle impostazioni del backend
   e vengono iniettati come variabili CSS nella pagina. */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: clamp(1rem, .95rem + .2vw, 1.075rem);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.is-locked {
    overflow: hidden;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.015em;
    margin: 0;
}

::selection {
    background: var(--primary);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.is-hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.shell {
    width: min(1400px, 100% - 2.5rem);
    margin-inline: auto;
}

.shell--narrow {
    width: min(880px, 100% - 2.5rem);
}

.section {
    padding: clamp(3rem, 7vw, 6.5rem) 0;
}

.section--tight {
    padding: clamp(2rem, 4vw, 3.5rem) 0;
}

.section__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.section__title {
    font-size: clamp(1.7rem, 1.2rem + 2.2vw, 3rem);
}

.section__intro {
    color: var(--muted);
    max-width: 60ch;
    margin: .6rem 0 0;
}

.eyebrow {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .74rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 .7rem;
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
    position: relative;
    min-height: var(--hero-height, 100svh);
    display: grid;
    place-items: center;
    overflow: hidden;
    isolation: isolate;
    background: #000;
}

.hero__media,
.hero__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.hero__media img {
    object-fit: cover;
    object-position: center;
}

/* Il video di YouTube viene ingrandito fino a coprire l'area dell'hero:
   niente bande nere qualunque sia la proporzione dello schermo.
   Nessuna regola generica sugli iframe, altrimenti prevarrebbe su queste
   misure per specificità e annullerebbe il centraggio. */
.hero__video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, calc(var(--hero-height, 100svh) * 16 / 9));
    height: max(100%, calc(100vw * 9 / 16));

    /* Il limite generale max-width: 100% impedirebbe l'ingrandimento
       necessario a coprire gli schermi verticali. */
    max-width: none;
    max-height: none;

    transform: translate(-50%, -50%);
    pointer-events: none;
    border: 0;
}

.hero__veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, .35) 70%, var(--bg) 100%),
        rgba(0, 0, 0, calc(var(--hero-overlay, 35) / 100));
    z-index: 1;
}

.hero__inner {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: clamp(4rem, 10vh, 8rem) 1.5rem;
    display: grid;
    justify-items: center;
    gap: 1.2rem;
}

.hero__logo {
    width: min(340px, 62vw);
    height: auto;
    filter: drop-shadow(0 10px 34px rgba(0, 0, 0, .55));
}

.hero__title {
    font-size: clamp(2.4rem, 1.5rem + 5vw, 5.5rem);
    text-transform: uppercase;
    letter-spacing: -.02em;
}

/* Claim sotto il logo: corpo contenuto, per non competere con il marchio. */
.hero__claim {
    margin: .2rem 0 0;
    max-width: 44ch;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(.95rem, .85rem + .5vw, 1.35rem);
    line-height: 1.45;
    text-wrap: balance;
    text-shadow: 0 2px 20px rgba(0, 0, 0, .65);
}

.hero__scroll {
    position: absolute;
    bottom: 1.6rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: var(--text);
    opacity: .7;
    display: grid;
    justify-items: center;
    gap: .35rem;
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.hero__scroll:hover {
    text-decoration: none;
    opacity: 1;
}

.hero__scroll span::after {
    content: "";
    display: block;
    width: 1px;
    height: 34px;
    margin: .4rem auto 0;
    background: linear-gradient(to bottom, currentColor, transparent);
    animation: hero-hint 2.2s ease-in-out infinite;
}

@keyframes hero-hint {
    0%, 100% { transform: scaleY(.55); opacity: .5; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* --- Claim e riga edizione ---------------------------------------------- */

.claim {
    text-align: center;
    padding: clamp(3rem, 8vw, 7rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}

.claim__text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.35rem, 1rem + 2.4vw, 2.9rem);
    line-height: 1.22;
    letter-spacing: -.015em;
    margin: 0 auto;
    max-width: 24ch;
    text-wrap: balance;
}

.edition-line {
    text-align: center;
    padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem);
}

/* Due righi: il primo con il corpo grande, il secondo appena più contenuto. */
.edition-line__box {
    display: inline-grid;
    gap: .35rem;
    font-family: var(--font-display);
    color: var(--text);
    border-top: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
    padding: clamp(1rem, 2.5vw, 1.6rem) clamp(1.2rem, 4vw, 2.6rem);

    /* Larghezza in pixel e non in "ch": l'unità si calcola sul corpo del
       contenitore, che qui è più piccolo di quello del titolo. */
    max-width: min(900px, 92vw);
    text-decoration: none;
}

a.edition-line__box:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.edition-line__title {
    font-weight: 700;
    font-size: clamp(1.35rem, 1rem + 2.4vw, 2.9rem);
    line-height: 1.15;
    letter-spacing: -.015em;
    text-wrap: balance;
}

.edition-line__subtitle {
    font-weight: 600;
    font-size: clamp(1.05rem, .9rem + 1.2vw, 1.85rem);
    line-height: 1.2;
    color: var(--primary);
    text-wrap: balance;
}

/* --- Loghi -------------------------------------------------------------- */

.logos {
    text-align: center;
    padding: clamp(2rem, 5vw, 3.5rem) 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, #ffffff 12%);
}

.logos__title {
    color: var(--muted);
    font-size: .82rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin: 0 0 1.4rem;
}

.logos__row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 5vw, 4rem);
    flex-wrap: wrap;
}

.logos__row img {
    height: auto;
    max-height: var(--logo-height, 90px);
    width: auto;
    max-width: min(320px, 70vw);
    object-fit: contain;
}

/* --- Wall --------------------------------------------------------------- */

.wall__selector {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
}

.wall__tab {
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .9rem;
    padding: .5rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s;
    white-space: nowrap;
}

.wall__tab:hover {
    border-color: var(--primary);
}

.wall__tab[aria-selected="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.wall__tab small {
    display: block;
    font-weight: 400;
    font-size: .7rem;
    opacity: .75;
    letter-spacing: .04em;
}

select.wall__select {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: .55rem 1rem;
    font: inherit;
}

.wall__meta {
    color: var(--muted);
    font-size: .88rem;
}

/* Righe giustificate: le misure definitive le calcola il JavaScript
   partendo dalle proporzioni salvate a database. */
.wall__grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: var(--wall-gap, 12px);
}

.wall__grid.is-justified {
    display: block;
    grid-template-columns: none;
}

.wall__grid.is-masonry {
    display: block;
    columns: 4 260px;
    column-gap: var(--wall-gap, 12px);
}

.wall__grid.is-masonry .wall__item {
    margin-bottom: var(--wall-gap, 12px);
    break-inside: avoid;
}

.wall__item {
    position: relative;
    display: block;
    padding: 0;
    border: 0;
    background: #0d0f14;
    border-radius: 4px;
    overflow: hidden;
    cursor: zoom-in;
    color: inherit;
    text-align: left;
    width: 100%;
}

.wall__grid.is-justified .wall__item {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    will-change: transform;
}

.wall__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .4s;
}

.wall__grid:not(.is-justified) .wall__item img {
    aspect-ratio: var(--item-aspect, 1.5);
    height: auto;
}

.wall__item:hover img {
    transform: scale(1.035);
}

.wall__item img.is-loading {
    opacity: 0;
}

.wall__item::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
    pointer-events: none;
    border-radius: inherit;
}

.wall__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.wall__play span {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(10, 10, 12, .55);
    border: 1px solid rgba(255, 255, 255, .5);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    transition: transform .25s, background .25s;
}

.wall__play span::before {
    content: "";
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 15px solid #fff;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
}

.wall__item:hover .wall__play span {
    transform: scale(1.08);
    background: var(--primary);
}

.wall__caption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 1.6rem .8rem .7rem;
    font-size: .82rem;
    line-height: 1.35;
    background: linear-gradient(to top, rgba(0, 0, 0, .78), transparent);
    opacity: 0;
    transition: opacity .25s;
}

.wall__item:hover .wall__caption,
.wall__item:focus-visible .wall__caption {
    opacity: 1;
}

.wall__grid.show-captions .wall__caption {
    opacity: 1;
}

.wall__more {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.wall__empty {
    color: var(--muted);
    padding: 2rem 0;
}

/* --- Premio Officine Zephiro -------------------------------------------- */

.award {
    border-top: 1px solid var(--line);
}

.award__subtitle {
    max-width: 52ch;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1rem, .9rem + .5vw, 1.3rem);
    color: var(--text);
    opacity: .85;
}

.award__intro {
    max-width: 70ch;
    margin: 0 0 clamp(1.5rem, 3vw, 2.2rem);
    color: var(--muted);
    white-space: pre-line;
}

.award__book {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
    margin-bottom: clamp(1.8rem, 4vw, 3rem);
}

@media (max-width: 780px) {
    .award__book {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.award__cover {
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    display: block;
    width: 100%;
}

.award__cover img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
    transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}

.award__cover:hover img {
    transform: translateY(-4px);
}

@media (max-width: 780px) {
    .award__cover {
        max-width: 220px;
    }
}

.award__details {
    display: grid;
    gap: .7rem;
}

.award__label {
    margin: 0;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    font-weight: 600;
    color: var(--primary);
}

.award__title {
    font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.3rem);
}

.award__author {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.02rem;
    color: var(--light);
}

.award__description {
    margin: 0;
    max-width: 70ch;
    color: var(--muted);
    white-space: pre-line;
}

.award__gallery {
    margin-top: clamp(1rem, 2vw, 1.5rem);
}

/* --- Eventi ------------------------------------------------------------- */

.events__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: clamp(1rem, 2vw, 1.6rem);
}

.event-card {
    display: flex;
    flex-direction: column;
    background: color-mix(in srgb, var(--bg) 84%, #ffffff 16%);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform .28s cubic-bezier(.2, .7, .2, 1), border-color .28s;
    padding: 0;
}

.event-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
    text-decoration: none;
}

.event-card__poster {
    background: #0d0f14;
    aspect-ratio: 4 / 5;
    overflow: hidden;
}

.event-card__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.event-card__body {
    padding: 1.1rem 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    flex: 1;
}

.event-card__date {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--primary);
}

.event-card__title {
    font-size: 1.15rem;
}

.event-card__place {
    color: var(--muted);
    font-size: .9rem;
}

.event-card__more {
    margin-top: auto;
    font-size: .84rem;
    color: var(--primary);
    font-weight: 600;
}

.event-card--past {
    opacity: .62;
}

.badge-highlight {
    display: inline-block;
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--secondary);
    color: #06210a;
    font-weight: 700;
}

/* --- Pulsanti ----------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .92rem;
    padding: .75rem 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: filter .18s, background .18s, color .18s;
}

.button:hover {
    filter: brightness(1.1);
    text-decoration: none;
}

.button--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line-strong);
}

.button--ghost:hover {
    border-color: var(--primary);
    filter: none;
}

.button[disabled] {
    opacity: .5;
    cursor: default;
}

/* --- Footer ------------------------------------------------------------- */

.footer {
    border-top: 1px solid var(--line);
    padding: clamp(2.5rem, 5vw, 4rem) 0 2.5rem;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}

/* Patrocini a fine pagina, separati dai crediti da una linea leggera. */
.footer__patrons {
    padding-bottom: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: clamp(1.8rem, 4vw, 2.8rem);
    border-bottom: 1px solid var(--line);
}

/* Tre loghi affiancati: la larghezza massima è ridotta perché restino
   sulla stessa riga, l'altezza resta quella impostata dal backend. */
.footer__patrons .logos__row {
    gap: clamp(1.2rem, 3.5vw, 3rem);
}

.footer__patrons .logos__row img {
    max-width: min(300px, 42vw);
}

.footer__patrons-title {
    color: var(--muted);
    font-size: .82rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin: 0 0 1.2rem;
}

.footer__logo {
    width: 120px;
    margin: 0 auto 1.4rem;
    opacity: .9;
}

.footer__links {
    display: flex;
    gap: 1.2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.footer__links a {
    color: var(--text);
    font-size: .9rem;
}

.footer__credit {
    margin: 0;
}

.footer__credit a {
    color: var(--text);
    font-weight: 600;
}

.footer__credit a:hover {
    color: var(--primary);
}

.footer__extra {
    margin: .6rem 0 0;
    font-size: .82rem;
    opacity: .75;
}

/* --- Finestre modali (wall e eventi) ------------------------------------ */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    background: rgba(6, 7, 9, .94);
    backdrop-filter: blur(6px);
}

.overlay.is-open {
    display: block;
}

.overlay__close,
.overlay__nav {
    position: absolute;
    z-index: 3;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

.overlay__close:hover,
.overlay__nav:hover {
    background: var(--primary);
}

.overlay__close {
    top: 1rem;
    right: 1rem;
}

.overlay__nav--prev {
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.overlay__nav--next {
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.overlay__stage {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    padding: clamp(1rem, 4vw, 3rem);
    gap: 1rem;
}

.overlay__frame {
    display: grid;
    place-items: center;
    min-height: 0;
}

.overlay__frame img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.overlay__frame .video-box {
    width: min(1200px, 100%);
    aspect-ratio: 16 / 9;
    max-height: 100%;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.overlay__frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.overlay__info {
    text-align: center;
    color: #e9ecf1;
    font-size: .92rem;
    max-width: 70ch;
    margin-inline: auto;
}

.overlay__info strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.05rem;
    margin-bottom: .2rem;
}

.overlay__counter {
    color: var(--muted);
    font-size: .8rem;
    letter-spacing: .1em;
}

/* Modale dell evento: due colonne con locandina e dettagli */

.event-modal {
    position: relative;
    z-index: 2;
    width: min(1040px, calc(100% - 2rem));
    max-height: calc(100vh - 4rem);
    margin: 2rem auto;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    overflow: auto;
    display: grid;
    grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
}

@media (max-width: 780px) {
    .event-modal {
        grid-template-columns: 1fr;
    }
}

.event-modal__poster {
    background: #0d0f14;
}

.event-modal__poster img {
    width: 100%;
    height: 100%;
    max-height: 60vh;
    object-fit: cover;
    display: block;
}

.event-modal__body {
    padding: clamp(1.4rem, 3vw, 2.2rem);
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.event-modal__title {
    font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2.1rem);
}

.event-modal__meta {
    display: grid;
    gap: .35rem;
    color: var(--muted);
    font-size: .92rem;
}

.event-modal__meta strong {
    color: var(--text);
    font-weight: 600;
}

.event-modal__description {
    white-space: pre-line;
}

.event-modal__map {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    min-height: 220px;
    background: #0d0f14;
}

.event-modal__map iframe {
    width: 100%;
    height: 240px;
    border: 0;
    display: block;
}

.event-modal__actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: .6rem;
}

/* --- Manutenzione -------------------------------------------------------- */

.maintenance {
    min-height: 100svh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem;
}

.maintenance img {
    width: 200px;
    margin-bottom: 2rem;
}
