/* =========================================================
   EU Projects page - header and fixed background refinement
   This file is loaded only by eu-projects.php.
   ========================================================= */

body.eu-projects-page {
  background-image: url('sfondo-pagina-eu.png') !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-attachment: fixed !important;
  background-color: #dff4f8 !important;
}

body.eu-projects-page::before {
  background: rgba(255, 255, 255, 0.28) !important;
}

body.eu-projects-page .eu-main-header {
  position: relative !important;
  isolation: isolate;
  overflow: visible;
  min-height: 320px;
  padding: 28px 24px 86px 24px !important;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  background: transparent !important;
  box-shadow: none !important;
  animation: slideIn 1s ease-in-out;
}

/* Il layer fotografico dell'header viene mascherato. 
   Sotto la curva non esiste più immagine dell'header: si vede direttamente lo sfondo pagina. */
body.eu-projects-page .eu-main-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(11, 37, 71, 0.48) 0%, rgba(15, 57, 104, 0.42) 54%, rgba(12, 39, 73, 0.56) 100%),
    linear-gradient(90deg, rgba(8, 28, 56, 0.28), rgba(8, 28, 56, 0.06) 46%, rgba(8, 28, 56, 0.30)),
    url('sfondo-header-eu.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center 52%;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 1000' preserveAspectRatio='none'%3E%3Cpath d='M0,0 H1440 V820 C1320,870 1276,875 1156,844 C1022,809 918,792 758,844 C625,887 548,870 395,828 C258,792 130,886 0,846 Z' fill='black'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 1000' preserveAspectRatio='none'%3E%3Cpath d='M0,0 H1440 V820 C1320,870 1276,875 1156,844 C1022,809 918,792 758,844 C625,887 548,870 395,828 C258,792 130,886 0,846 Z' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* Linea bianca dell'onda, senza riempimento. */
body.eu-projects-page .eu-main-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 84px;
  z-index: 2;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath d='M0,76 C130,116 258,22 395,58 C548,100 625,117 758,74 C918,22 1022,39 1156,74 C1276,105 1360,95 1440,56' fill='none' stroke='%23ffffff' stroke-width='6' stroke-opacity='0.88' stroke-linecap='round'/%3E%3Cpath d='M0,76 C130,116 258,22 395,58 C548,100 625,117 758,74 C918,22 1022,39 1156,74 C1276,105 1360,95 1440,56' fill='none' stroke='%23ffffff' stroke-width='4' stroke-opacity='0.65' stroke-linecap='round' transform='translate(0,-12)'/%3E%3C/svg%3E");
}

body.eu-projects-page .eu-main-header > * {
  position: relative;
  z-index: 3;
}

body.eu-projects-page .eu-main-header .image-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

body.eu-projects-page .eu-main-header .image-container img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.34));
}

body.eu-projects-page .eu-main-header h1 {
  max-width: 1120px;
  margin: 0 auto;
  color: #ffffff;
  font-size: clamp(2rem, 3.9vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: 0.2px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.48);
}

body.eu-projects-page .eu-main-header h2 {
  max-width: 980px;
  margin: 18px auto 0 auto;
  color: #ffffff;
  font-size: clamp(1.12rem, 2.3vw, 1.55rem);
  line-height: 1.35;
  font-weight: 700;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.50);
}

/* Hero layout: title above the European logos and labels below them. */
body.eu-projects-page .eu-page-hero {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 180px;
  grid-template-areas:
    "hero-title hero-title"
    "hero-text-1 hero-logos"
    "hero-text-2 hero-logos"
    "hero-pills hero-pills";
  column-gap: 34px;
  row-gap: 0;
  align-items: center;
}

body.eu-projects-page .eu-page-hero-text {
  display: contents;
}

body.eu-projects-page .eu-page-hero-text h2 {
  grid-area: hero-title;
  white-space: nowrap;
  margin: 0 0 14px 0;
}

body.eu-projects-page .eu-page-hero-text p:nth-of-type(1) {
  grid-area: hero-text-1;
}

body.eu-projects-page .eu-page-hero-text p:nth-of-type(2) {
  grid-area: hero-text-2;
}

body.eu-projects-page .eu-page-logos {
  grid-area: hero-logos;
}

body.eu-projects-page .eu-page-pill-row {
  grid-area: hero-pills;
  flex-wrap: nowrap;
  width: 100%;
}

body.eu-projects-page .eu-page-pill {
  white-space: nowrap;
}

body.eu-projects-page .container {
  position: relative;
  z-index: 1;
  margin-top: 30px;
}

body.eu-projects-page .eu-page-hero,
body.eu-projects-page .eu-role-band {
  background: linear-gradient(135deg, rgba(13, 44, 84, 0.94) 0%, rgba(24, 75, 138, 0.94) 100%) !important;
  backdrop-filter: blur(2px);
}

/* Partner Information Form con immagine laterale e preview ingrandita. */
body.eu-projects-page .eu-pif-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr);
  gap: 22px;
  align-items: stretch;
  margin: 28px 0;
}

body.eu-projects-page .eu-pif-row .eu-section {
  margin: 0;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.eu-projects-page .eu-pif-image-card {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  align-self: center;
  width: fit-content;
  max-width: 100%;
  min-height: auto;
  height: auto;
  padding: 8px;
  box-sizing: border-box;
  border: 1px solid rgba(221, 229, 239, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  cursor: zoom-in;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

body.eu-projects-page .eu-pif-image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

body.eu-projects-page .eu-pif-image-card img {
  display: block;
  width: auto;
  max-width: 245px;
  height: auto;
  max-height: 285px;
  object-fit: contain;
  border-radius: 13px;
}

body.eu-projects-page .eu-image-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.eu-projects-page .eu-image-modal:target {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.eu-projects-page .eu-image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 18, 38, 0.78);
  backdrop-filter: blur(5px);
}

body.eu-projects-page .eu-image-modal-panel {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 940px);
  max-height: 92vh;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
}

body.eu-projects-page .eu-image-modal-panel img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: calc(92vh - 24px);
  border-radius: 16px;
  object-fit: contain;
}

body.eu-projects-page .eu-image-modal-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ffffff;
  color: #0d2c54;
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

body.eu-projects-page .eu-image-modal-close:hover {
  transform: scale(1.06);
  background: #f2f6fb;
}


@media (max-width: 900px) {
  body.eu-projects-page .eu-page-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero-title"
      "hero-text-1"
      "hero-text-2"
      "hero-logos"
      "hero-pills";
  }

  body.eu-projects-page .eu-page-hero-text h2 {
    white-space: normal;
  }

  body.eu-projects-page .eu-page-pill-row {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  html {
    background-color: #dff4f8;
  }

  body.eu-projects-page {
    background-image: none !important;
    background-color: transparent !important;
    background-attachment: scroll !important;
  }

  body.eu-projects-page::before {
    content: "";
    position: fixed !important;
    top: -12vh;
    right: -3vw;
    bottom: -12vh;
    left: -3vw;
    width: auto;
    height: auto;
    pointer-events: none;
    z-index: -1;
    background-color: #dff4f8 !important;
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.28)),
      url('sfondo-pagina-eu.png') !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
  }

  body.eu-projects-page .eu-main-header {
    min-height: 285px;
    padding: 24px 18px 76px 18px !important;
  }

  body.eu-projects-page .eu-main-header::before {
    background-position: center top;
  }

  body.eu-projects-page .eu-main-header::after {
    height: 62px;
  }

  body.eu-projects-page .eu-main-header .image-container img {
    width: 118px;
    height: 118px;
  }

  body.eu-projects-page .eu-main-header h1 {
    font-size: 2rem;
  }

  body.eu-projects-page .eu-main-header h2 {
    font-size: 1.08rem;
    margin-top: 12px;
  }
}

@media (max-width: 480px) {
  body.eu-projects-page .eu-main-header {
    min-height: 260px;
    padding-bottom: 66px !important;
  }

  body.eu-projects-page .eu-main-header .image-container img {
    width: 96px;
    height: 96px;
  }

  body.eu-projects-page .eu-main-header h1 {
    font-size: 1.62rem;
  }

  body.eu-projects-page .eu-main-header h2 {
    font-size: 0.96rem;
  }
}

@media (max-width: 900px) {
  body.eu-projects-page .eu-pif-row {
    grid-template-columns: 1fr;
  }

  body.eu-projects-page .eu-pif-image-card {
    min-height: auto;
  }

  body.eu-projects-page .eu-pif-image-card img {
    max-height: 360px;
  }
}

@media (max-width: 480px) {
  body.eu-projects-page .eu-image-modal {
    padding: 14px;
  }

  body.eu-projects-page .eu-image-modal-close {
    top: -12px;
    right: -8px;
    width: 38px;
    height: 38px;
    font-size: 30px;
  }
}


/* Card background illustrations in cartoon PNG style. */
body.eu-projects-page .eu-info-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: rgba(255, 255, 255, 0.94);
}

body.eu-projects-page .eu-info-card > * {
  position: relative;
  z-index: 3;
}

body.eu-projects-page .eu-info-card::before {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 47%;
  height: 74%;
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: contain;
  opacity: 1;
  z-index: 1;
  pointer-events: none;
}

body.eu-projects-page .eu-info-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.99) 0%, rgba(255,255,255,0.96) 42%, rgba(255,255,255,0.76) 66%, rgba(255,255,255,0.45) 100%);
  z-index: 2;
  pointer-events: none;
}

body.eu-projects-page .bg-digiwell::before { background-image: url("card-digiwell.png"); }
body.eu-projects-page .bg-changing-lives::before { background-image: url("card-changing-lives.png"); }
body.eu-projects-page .bg-vr-sen::before { background-image: url("card-vr-sen.png"); }
body.eu-projects-page .bg-digital-wellbeing::before { background-image: url("card-digital-wellbeing.png"); }
body.eu-projects-page .bg-ai-literacy::before { background-image: url("card-ai-literacy.png"); }
body.eu-projects-page .bg-privacy::before { background-image: url("card-privacy.png"); }
body.eu-projects-page .bg-tourism::before { background-image: url("card-tourism.png"); }
body.eu-projects-page .bg-governance::before { background-image: url("card-governance.png"); }
body.eu-projects-page .bg-training::before { background-image: url("card-training.png"); }

@media (max-width: 900px) {
  body.eu-projects-page .eu-info-card::before {
    width: 40%;
    height: 62%;
    opacity: 1;
  }

  body.eu-projects-page .eu-info-card::after {
    background: linear-gradient(90deg, rgba(255,255,255,0.99) 0%, rgba(255,255,255,0.96) 48%, rgba(255,255,255,0.82) 72%, rgba(255,255,255,0.58) 100%);
  }
}

@media (max-width: 768px) {
  body.eu-projects-page .eu-info-card::before {
    width: 36%;
    height: 54%;
    opacity: 0.96;
  }

  body.eu-projects-page .eu-info-card::after {
    background: linear-gradient(90deg, rgba(255,255,255,0.995) 0%, rgba(255,255,255,0.97) 52%, rgba(255,255,255,0.86) 76%, rgba(255,255,255,0.68) 100%);
  }
}

/* Collaborator-project illustrations.
   The twelve cards already use the same ::before image system as the existing
   project cards. Replace "none" with the corresponding PNG file when each
   illustration is ready. */
body.eu-projects-page .collaborator-project-card-01::before { background-image: url("card-mail-art-4-seniors.png"); }
body.eu-projects-page .collaborator-project-card-02::before { background-image: url("card-revenge-porn-project.png"); }
body.eu-projects-page .collaborator-project-card-03::before { background-image: url("card-health-literacy-medical-curricula.png"); }
body.eu-projects-page .collaborator-project-card-04::before { background-image: url("card-challenged.png"); }
body.eu-projects-page .collaborator-project-card-05::before { background-image: url("card-environment-security.png"); }
body.eu-projects-page .collaborator-project-card-06::before { background-image: url("card-ctrl-alt-del.png"); }
body.eu-projects-page .collaborator-project-card-07::before { background-image: url("card-emotional-support-seniors.png"); }
body.eu-projects-page .collaborator-project-card-08::before { background-image: url("card-positive-emotional-life-active-aging.png"); }
body.eu-projects-page .collaborator-project-card-09::before { background-image: url("card-streamers.png"); }
body.eu-projects-page .collaborator-project-card-10::before { background-image: url("card-assets.png"); }
body.eu-projects-page .collaborator-project-card-11::before { background-image: url("card-astractive.png"); }
body.eu-projects-page .collaborator-project-card-12::before { background-image: url("card-ethical-green-food-labelling.png"); }

/* Long project names and references remain readable on narrow screens. */
body.eu-projects-page .eu-collaborator-projects-panel .eu-info-card h3,
body.eu-projects-page .eu-collaborator-projects-panel .eu-info-card p {
  overflow-wrap: anywhere;
}
