
/* ====== Base ====== */
:root{
  --bg:#ffffff;
  --text:#222;
  --muted:#6b7280;
  --accent:#111;
  --grid-gap: 18px;
  --sidebar-w: 280px;
  --max-content: 1100px;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color:var(--text);
  background:var(--bg);
  line-height:1.6;

}

main.content {
    opacity: 0;
    transition: opacity 0.7s ease;
}
body.loaded main.content {
    opacity: 1;
}

/* ====== Sidebar (desktop) ====== */
.sidebar{
  position: fixed;
  top:0;
  left:0;
  bottom:0;
  width: var(--sidebar-w);
  padding: 36px 28px;
  overflow:auto;
  border-right:1px solid #eee;
  background:#fff;
}
.sidebar p {
    font-size: 15px;
    color: #666;
    margin-top: 2px;
    font-style: italic;
    max-width: 180px;
    line-height: 1.4;
}

.brand-title{
  display:block;
  font-weight:800;
  letter-spacing:.2px;
  font-size: 26px;
  color:var(--accent);
  text-decoration:none;
  margin-bottom:4px;
    line-height: 1.5rem;
}
.brand-sub{
  color:var(--muted);
  font-weight:400;
  font-size:14px;
  margin-bottom:22px;
}

.nav ul{
  list-style:none;
  margin:0 0 22px 0;
  padding:0;
}
.nav li+li{ margin-top:10px; }
.nav a{
  text-decoration:none;
  color:var(--text);
  transition:opacity .2s ease;
}
.nav li.active a{ font-weight:600; }
.nav a:hover{ opacity:.7; }

.nav-secondary{
  margin-top:28px;
  color:var(--muted);
}

.nav ul:last-of-type li:last-child {
    margin-top: 25px;
    font-weight: 500;
}

.nav ul:last-of-type li:last-child a {
    color: #000;
    border-bottom: 1px solid rgba(0,0,0,0.2);
}

.nav ul:last-of-type li:last-child a:hover {
    border-bottom-color: rgba(0,0,0,0.5);
}


/* ====== Topbar (mobile) ====== */
.topbar{
  position: sticky;
  top:0;
  display:none; /* hidden on desktop */
  align-items:center;
  justify-content:flex-start;
  gap:16px;
  padding:12px 16px;
  border-bottom:1px solid #eee;
  background:#fff;
  z-index: 50;
}
.topbar-title{
  font-weight:600;
}

/* Hamburger */
.hamburger{
  width:36px;
  height:28px;
  display:inline-flex;
  flex-direction:column;
  justify-content:space-between;
  background:transparent;
  border:0;
  padding:4px 2px;
  cursor:pointer;
}
.hamburger span{
  height:2px;
  background:#111;
  width:100%;
  display:block;
}

/* ====== Main content ====== */
.content{
  margin-left: calc(var(--sidebar-w) + 20px);
  padding: 40px 40px 80px;
  max-width: var(--max-content);
}

.page-title {
    margin: 0 0 10px 0;
    font-weight: 800;
    letter-spacing: .6px;
    line-height: 2rem;
}

.page-subtitle {
    margin: 0 0 20px 0;
    font-weight: 400;
    color: var(--muted);
    font-size: 1.2rem;
    letter-spacing: 0.4px;
    line-height: 1.6;
    font-style: italic;
}
.intro{
  margin: 28px 0;
    color: #777777;
}
.intro p{ margin: 0 0 10px 0; }

/* ====== Gallery grid ====== */
.gallery{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  margin: 50px 0;
}
.gallery.gallery-5 {
    grid-template-columns: repeat(5, 1fr);
}
.gallery.gallery-3 {
    grid-template-columns: repeat(3, 1fr);
}
.gallery.gallery-2 {
    grid-template-columns: repeat(2, 1fr);
}
.gallery.gallery-1 {
    grid-template-columns: 1fr;
}

.gallery-item{
  margin:0;
}
.gallery img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: zoom-in;
}
.gallery img {
    position: relative;
    transition: filter .3s ease;
}

.gallery img:hover {
    filter: brightness(0.7); /* leggermente più scura */
    box-shadow: none; /* nessuna ombra o spostamento */
    transform: none;
}

/* ====== Lightbox ====== */
.lightbox{
  position: fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.6);
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease;
  z-index: 100;
  padding: 24px;
}
.lightbox.open{
  opacity:1;
  pointer-events:auto;
}
.lightbox img{
  max-width: min(92vw, 1400px);
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.lightbox-close{
  position:absolute;
  top:16px;
  right:16px;
  width:40px;
  height:40px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  border:0;
  font-size:20px;
  line-height:40px;
  cursor:pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
}

/* Custom layout control for static galleries */
.gallery-item.wide  { grid-column: span 2; }
.gallery-item.tall  { grid-row: span 2; }
.gallery-item.square img { aspect-ratio: 1 / 1; }
.gallery-item.wide img   { aspect-ratio: 4 / 3; }
.gallery-item.tall img   { aspect-ratio: 3 / 4; }

/* ====== Variante: galleria senza spazio orizzontale ====== */
.gallery.tight-x {
    column-gap: 0; /* nessuno spazio orizzontale */
    row-gap: var(--grid-gap); /* mantiene lo spazio verticale */
}

.gallery.tight-x .gallery-item {
    margin: 0;
}

.gallery.tight-x img {
    border-radius: 0; /* opzionale: immagini perfettamente contigue */
}

/* ====== Caption sotto le immagini ====== */
.gallery-item {
    display: flex;
    flex-direction: column;
}

.gallery-item figcaption {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    margin-top: 6px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.gallery-1 .gallery-item figcaption {
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* ====== Overlay titolo in home ====== */
.home-gallery .gallery-item {
    position: relative;
    overflow: hidden;
}

.home-gallery .gallery-item img {
    transition: filter .3s ease;
}

.home-gallery .gallery-item figcaption {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: white;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    transition: background .3s ease, opacity .3s ease;
}

/* ====== Stile link testuali ====== */
a {
    color: #222; /* colore di base: neutro, leggibile */
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease;
    border-bottom: 1px solid transparent;
}

a:hover {
    color: #000; /* leggermente più intenso */
    border-bottom: 1px solid rgba(0, 0, 0, 0.4); /* piccolo accento tipografico */
}

/* Variante più chiara per link su sfondi scuri (es. overlay, figcaption) */
.dark a {
    color: #f8f8f8;
    border-bottom-color: transparent;
}

.dark a:hover {
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* ====== Virgolettato / Citazione ====== */
.quote {
    font-size: 18px;
    line-height: 1.6;
    font-weight: 400;
    max-width: 700px;
    margin: 60px auto;
    padding: 0 20px;
    text-align: center;
    font-style: italic;
    position: relative;
}

.quote .author {
    display: block;
    margin-top: 15px;
    font-size: 16px;
    font-weight: 500;
    color: #555;
    font-style: normal;
}

/* Hover effect */
.home-gallery .gallery-item:hover img {
    filter: brightness(0.7);
}

.home-gallery .gallery-item:hover figcaption {
    background: rgba(0, 0, 0, 0.35);
    opacity: 1;
}

/* Per mobile: mostra titolo sempre visibile */
@media (max-width: 768px) {
    .home-gallery .gallery-item figcaption {
        background: rgba(0,0,0,0.35);
        opacity: 1;
        font-size: 16px;
    }
}

/* ====== Responsive ====== */
@media (max-width: 1200px){
  .gallery{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px){
  :root{ --sidebar-w: 260px; }
  .gallery, .gallery.gallery-2, .gallery.gallery-3 { grid-template-columns: repeat(2, 1fr); }
  .content{ margin-left: 0; padding: 24px 20px 60px; }
  .topbar{ display:flex; }
  .sidebar{
    position: fixed;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 60;
  }
  body.menu-open .sidebar{ transform: translateX(0); }
}
@media (max-width: 540px){
  .gallery, .gallery.gallery-2, .gallery.gallery-3 { grid-template-columns: 1fr; column-gap: 0; }
  .gallery-item.wide  { grid-column: span 1; }
  .page-title{ font-size: 22px; }
}

/* ====== Titolo nella topbar mobile ====== */
.mobile-brand {
    display: none;
}

@media (max-width: 900px) {
    .topbar {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 80px;
        background: #fff;
        border-bottom: 1px solid #ddd;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1100;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    .hamburger {
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .mobile-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        line-height: 1.1;
    }

    .mobile-title {
        font-size: 19px;
        font-weight: 600;
        color: #111;
        margin: 0;
        letter-spacing: 0.3px;
    }

    .mobile-subtitle {
        font-size: 14px;
        color: #555;
        margin: 4px 0 0;
        font-style: italic;
    }
}

/* Nascondi il nome e sottotitolo nella sidebar su mobile */
@media (max-width: 900px) {
    .sidebar .brand {
        display: none;
    }
}

/* Margine superiore per tutto il contenuto sotto la topbar su mobile */
@media (max-width: 900px) {
    main.content, .sidebar {
        margin-top: 80px;
    }
}

/* ====== Pagina contatti ====== */
.contact {
    text-align: center;
    margin-top: 100px;
}

.contact .intro {
    font-size: 18px;
    line-height: 1.8;
    color: #333;
}

.contact .contact-mail {
    display: inline-block;
    margin-top: 12px;
    font-size: 22px;
    font-weight: 500;
    color: #000;
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.2);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.contact .contact-mail:hover {
    color: #555;
    border-bottom-color: rgba(0,0,0,0.4);
}