/*
 Theme Name: ekoes-test
 Theme URI: https://www.ekoesillustration.com
 Description: Tema personalizzato EKOES
 Author: EKOES
 Version: 1.0
*/

/* =========================================================
   VARIABILI GLOBALI
========================================================= */
:root {
  --gap: 10px;
  --overlay-color: rgba(94,186,230,0.8);
  --font: "Lato", system-ui, -apple-system, "Segoe UI",
          Roboto, "Helvetica Neue", Arial;
}

/* =========================================================
   RESET BASE + FIX SCROLLBAR
========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: #111;
  background: #fff;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   HEADER
========================================================= */
.ekoes-header-plus {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 40px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}

.header-left,
.header-right {
  flex: 0 0 200px;
  display: flex;
  align-items: center;
}

.header-left {
  justify-content: flex-start;
  padding-left: 18px;
  transform: translateY(10px);
}

.ekoes-logo-inner img {
  max-height: 130px;
  transition: transform .85s cubic-bezier(.25,.85,.25,1);
}

.ekoes-logo-inner:hover img {
  transform: scale(1.075);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.ekoes-cloud-gif {
  max-height: 160px;
  object-fit: contain;
}

.header-right {
  justify-content: flex-end;
  gap: 26px;
  padding-right: 20px;
  transform: translateY(48px);
}

.ekoes-menu a {
  font-size: 14px;
  position: relative;
  padding-bottom: 4px;
  transition: color .25s;
}

.ekoes-menu a:hover {
  color: #777;
}

.ekoes-menu a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 60%;
  height: 2px;
  background: var(--overlay-color);
  transform: translateX(-50%) scaleX(0);
  transition: transform .25s;
}

.ekoes-menu a:hover::after,
.ekoes-menu a.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* =========================================================
   FILTRI
========================================================= */
.filters-wrap {
  width: 100%;
  padding: 20px 40px 10px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  opacity: 0;
  transform: translateY(12px);
  animation: filtersFadeDown .65s ease-out forwards .9s;
}

@keyframes filtersFadeDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filters-wrap button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  letter-spacing: 1.5px;
  padding: 10px 16px;
  opacity: .7;
  position: relative;
}

.filters-wrap button.active {
  opacity: 1;
}

.filters-wrap button::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 40%;
  height: 2px;
  background: var(--overlay-color);
  transform: translateX(-50%) scaleX(0);
  transition: transform .25s;
}

.filters-wrap button:hover::after,
.filters-wrap button.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* =========================================================
   GRID
========================================================= */
.portfolio-grid {
  width: 96vw;
  margin: 40px auto 60px;
  position: relative;
}

.grid-sizer,
.portfolio-item {
  width: 25%;
}

.portfolio-item {
  position: absolute;
  padding: var(--gap);
  cursor: pointer;
}

.portfolio-item-inner {
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-26px);
  transition: opacity 1s, transform 1s;
}

.portfolio-item-inner.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.portfolio-item-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s;
}

.portfolio-item-inner:hover img {
  transform: scale(1.05);
}

.item-overlay {
  position: absolute;
  inset: 0;
  background: var(--overlay-color);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .3s;
}

.portfolio-item-inner:hover .item-overlay {
  opacity: 1;
}

.item-overlay,
.item-overlay * {
  color: #fff !important;
}

/* =========================================================
   RESPONSIVE GRID
========================================================= */
@media (max-width:1200px) {
  .grid-sizer,
  .portfolio-item {
    width: 33.333%;
  }
}

@media (max-width:900px) {
  .grid-sizer,
  .portfolio-item {
    width: 50%;
  }
}

@media (max-width:600px) {
  .grid-sizer,
  .portfolio-item {
    width: 100%;
  }
}

/* =========================================================
   POPUP — GENERICO (PORTFOLIO) — DEF
========================================================= */
html.popup-open,
body.popup-open {
  overflow: hidden;
  height: 100%;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.popup-overlay.active {
  display: flex;
}

.popup-card {
  position: relative;
  width: calc(100vw - 120px);
  height: calc(100vh - 120px);
  max-width: 1600px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  overflow: hidden;
}

.popup-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.popup-close {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 28px;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: .5;
  z-index: 10;
  line-height: 1;
}

.popup-close:hover {
  opacity: 1;
}

.popup-prev,
.popup-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 34px;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: .35;
  z-index: 100000;
  line-height: 1;
}

.popup-prev:hover,
.popup-next:hover {
  opacity: 1;
}

.popup-prev {
  left: 24px;
}

.popup-next {
  right: 24px;
}

@media (max-width:768px) {
  .popup-card {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    padding: 32px 20px;
  }

  .popup-prev {
    left: 12px;
  }

  .popup-next {
    right: 12px;
  }
}

/* =========================================================
   POPUP — CHI SIAMO (LAYOUT DEFINITIVO)
========================================================= */

.popup-card.popup-chi-siamo {
  height: auto !important;
  max-height: none !important;
  overflow: visible; /* 🔑 FONDAMENTALE */
  align-items: flex-start;
}


/* =========================================================
   SCENA — QUESTA CONTROLLA L’ALTEZZA DELLA CARD
========================================================= */

.popup-chi-siamo-inner {
  position: relative;
  min-height: 67vh;      /* ⬅️ più compatta */
  padding-bottom: 6vh;   /* ⬅️ meno aria sotto */
}


/* =========================================================
   TESTO
========================================================= */

.chi-siamo-text {
  max-width: 780px;          /* ⬅️ un filo più stretto = righe migliori */
  margin: 40px auto 0;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* TITOLO */
.chi-siamo-text h3 {
  font-size: 40px;
  font-weight: 400;
  margin-bottom: 28px;
  line-height: 1.1;
}

.chi-siamo-text h3 strong {
  font-weight: 700;
}

/* PARAGRAFI — UN SOLO STILE */
.chi-siamo-text p {
  font-size: 18px;
  line-height: 1.7;
  margin: 0 0 18px;
  color: #333;
}

/* =========================================================
   ILLUSTRAZIONE — ORA SCALA DAVVERO
========================================================= */

.chi-siamo-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.chi-siamo-bg img {
  width: 60vw;        /* PROVA: 60 / 65 / 70 */
  max-width: 1200px;
  height: auto;
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 768px) {
  .chi-siamo-text h3 {
    font-size: 32px;
  }

  .chi-siamo-text p {
    font-size: 15.5px;
  }
}

.chi-siamo-bg img {
  max-width: none !important;   /* 🔥 SBLOCCA */
}
.popup-card.popup-contatti {
  width: 520px;
  max-width: calc(100vw - 40px);
  padding: 40px 36px 44px;
  align-items: flex-start;
}

/* CONTENUTO */
.contatti-inner {
  text-align: center;
}

/* TITOLO */
.contatti-inner h3 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* INTRO */
.contatti-intro {
  font-size: 16px;
  color: #555;
  margin-bottom: 28px;
}

/* LISTA */
.contatti-list p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 18px;
  color: #333;
}

.contatti-list strong {
  font-weight: 600;
}

/* LINK */
.contatti-list a {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contatti-list a:hover {
  opacity: 0.7;
}

/* FOOTER */
.contatti-footer {
  margin-top: 26px;
  font-size: 14px;
  color: #777;
}
/* =========================================================
   POPUP — CONTATTI (FIX DEFINITIVO)
========================================================= */

/* overlay resta uguale */
#contattiPopup.popup-overlay {
  align-items: center;
}

/* card: NESSUNA altezza forzata */
.popup-card.popup-contatti {
  width: 420px;
  max-width: calc(100vw - 40px);

  height: auto !important;
  min-height: unset !important;
  max-height: unset !important;

  padding: 36px 32px;
  display: block;              /* 🔑 stop flex verticale */
}

/* contenuto compatto */
.popup-card.popup-contatti .contatti-inner {
  text-align: center;
}

/* titolo */
.popup-card.popup-contatti h3 {
  font-size: 30px;
  margin: 0 0 10px;
}

/* intro */
.popup-card.popup-contatti .contatti-intro {
  font-size: 15px;
  margin-bottom: 22px;
  color: #555;
}

/* voci contatto */
.popup-card.popup-contatti .contatti-list p {
  margin: 0 0 16px;
  line-height: 1.6;
}

/* footer */
.popup-card.popup-contatti .contatti-footer {
  margin-top: 20px;
  font-size: 13px;
  color: #777;
}
