/*========================
ESTILS GENERALS
========================*/
html, body {
  margin: 0;
  padding: 0;
  font-family: "Instrument Sans", sans-serif;
  background-color: whitesmoke;
  color: black;
  width: 100%;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  transition: color 0.3s ease, opacity 0.3s ease;
}

/* HEADER */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: black;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  max-width: 1080px;
  margin: 40px auto;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header a,
.header span {
  color: white;
}

.header a:hover {
  color: darkred;
  opacity: 0.8;
}

/* FOOTER */
footer, .footer {
  text-align: center;
  font-weight: 800;
  padding: 20px 20px 20px;
  font-size: 1em;
  color: darkred;
}

/* PORTFOLIO */
.portfolio .intro {
  max-width: 1080px;
  margin: 80px auto;
  text-align: left;
  position: relative;
  padding: 0 40px;
}

.portfolio .intro h1 {
  font-family: "Instrument Serif", serif;
  font-size: 20em;
  color: darkred;
  text-align: center;
  margin: 100px 0;
  line-height: 0.9;
  padding: 40px 0;
  white-space: nowrap;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 150vw;
  animation: title-breath 6s ease-in-out infinite;
  display: inline-block;
}

@keyframes title-breath {
  0% { text-shadow: 0 0 0px darkred; color: darkred; }
  25% { text-shadow: 0 0 10px #b30000; color: #b30000; }
  50% { text-shadow: 0 0 0px darkred; color: darkred; }
  75% { text-shadow: 0 0 10px #b30000; color: #b30000; }
  100% { text-shadow: 0 0 0px darkred; color: darkred; }
}

.portfolio .intro h2 {
  font-size: 2em;
  line-height: 1.4;
  color: black;
  margin-top: 40px;
  position: relative;
  z-index: 2;
  padding-right: 80px;
}

.portfolio .intro img {
  width: 55%;
  border-radius: 20px;
  margin-top: -270px;
  display: block;
  position: relative;
  top: 30px;
  right: -530px;
  z-index: 1;
  margin-bottom: 80px;
  filter: saturate(140%) brightness(130%);
  transform-origin: 50% 50%;
  animation: slow-tilt 1s ease-in-out infinite alternate;
}

@keyframes slow-tilt {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(5deg); }
}

/* Grid de 4 columnes */
.portfolio .four-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  margin: 120px auto;
  max-width: 1200px;
  text-align: left;
  padding: 0 40px;
}

.portfolio .col {
  font-weight: 510;
  font-size: 1.1em;
  line-height: 1.4;
}

/* PROJECTES DESTACATS */
.portfolio .section-gradient {
  background: linear-gradient(to bottom, whitesmoke 0%, darkred 40%, black 100%);
  width: 100%;
  padding: 120px 0;
  position: relative;
  overflow: hidden;
}

.portfolio .section-gradient .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 40px;
}

.portfolio .section-title {
  font-family: "Instrument Serif", serif;
  font-size: 5em;
  line-height: 1;
  color: darkred;
  text-align: left;
  margin: 0 0 60px;
}

.portfolio .portfolio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 60px;
}

.portfolio .item {
  text-align: center;
}

.portfolio .item img {
  width: 100%;
  border-radius: 20px;
  filter: grayscale(100%) contrast(120%) saturate(50%);
  transition: filter 0.5s, transform 0.5s;
  animation: img-breath 5s ease-in-out infinite;
}

.portfolio .item img:hover {
  filter: grayscale(0%) contrast(100%) saturate(100%);
  transform: scale(1.03);
  cursor: pointer;
}

.portfolio .item h3 {
  font-family: "Instrument Serif", serif;
  font-size: 2.5em;
  margin: 20px 0 10px;
  color: whitesmoke;
}

.portfolio .item p {
  font-size: 1em;
  line-height: 1.5;
  max-width: 700px;
  margin: 0 auto;
  color: whitesmoke;
}

@keyframes img-breath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* CV */
.cv .cv-grid {
  display: flex;
  flex-wrap: wrap;
  max-width: 1080px;
  margin: 80px auto;
  gap: 60px;
  padding: 0 40px;
}

/* COLUMNA ESQUERRA */
.cv .left {
  flex: 1 1 460px;
  display: flex;
  flex-direction: column;
  margin-top: 15px;
}

.cv .left h1 {
  font-family: "Instrument Serif", serif;
  font-size: 7em;
  line-height: 0.9;
  margin: 0;
  color: darkred;
}

.cv .subtitle-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 15px 0 30px;
  flex-wrap: wrap;
}

.cv .subtitle {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0;
  white-space: normal;
  max-width: 40%;
}

.cv .location {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0;
  text-align: right;
}

.cv .profile-photo {
  width: 100%;
  max-width: 480px;
  border-radius: 20px;
  margin-bottom: 30px;
}

.cv .bio {
  line-height: 1.4;
  font-size: 1.1em;
  margin-top: 0;
  text-align: left;
}

/* COLUMNA DRETA */
.cv .right {
  flex: 1.2 1 480px;
  display: flex;
  flex-direction: column;
  gap: 50px;
}

/* EDUCACIÓ */
.cv .edu-formation {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* EXPERIÈNCIA */
.cv .col.experience {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* HABILITATS */
.cv .col.skills {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cv .col.skills ul {
  padding-left: 20px;
  line-height: 1.6;
  margin: 0;
}

.cv .col.skills ul li {
  font-size: 1.1em;
  margin-bottom: 5px;
}

.cv .col h2 {
  font-family: "Instrument Serif", serif;
  color: darkred;
  font-size: 2em;
  margin-bottom: 15px;
}

.cv .item {
  margin-bottom: 20px;
}

.cv .item .date {
  font-weight: 700;
  font-size: 0.9em;
  margin-bottom: 5px;
}

.cv ul {
  padding-left: 20px;
  line-height: 1.6;
  margin: 0;
}

.cv .col.languages ul,
.cv .contact ul {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
  line-height: 1.6;
}

.cv .col.languages ul li,
.cv .contact ul li {
  font-size: 1.1em;
  margin-bottom: 5px;
}

/* CONTACTE */
.cv .contact h2 {
  font-family: "Instrument Serif", serif;
  color: darkred;
  font-size: 2em;
  margin-bottom: 15px;
}

.cv .contact p {
  font-size: 1.1em;
  line-height: 1.6;
  margin: 0 0 5px 0;
}

/* RESPONSIVE */
@media screen and (max-width: 475px) {

  /* CV */
  .cv .cv-grid {
    flex-direction: column;
    padding: 20px 28px;
    gap: 40px;
  }

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: black;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    max-width: 90%;
    margin: 20px auto 0; 
  }

  .cv .left h1 {
    font-size: 6em;
    line-height: 0.9em;
    margin-top: 5px;
    text-align: center;
  }

  .cv .subtitle-block {
    justify-content: space-between; 
    text-align: left;
    gap: 4px;
    font-size: 0.9em;
  }

  .cv .profile-photo {
    width: 90%;
    max-width: 360px;
    margin: 15px auto 25px;
  }

  .cv .bio {
    text-align: center;
  }

  .cv .edu-formation {
    flex-direction: column;
    gap: 20px;
  }

  .cv footer {
    text-align: center;
    font-size: 0.7em;
    padding: 10px;
  }

  /* PORTFOLIO */
  .portfolio .intro {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 40px auto;
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: visible;
  }

  .portfolio .intro h1 {
    font-family: "Instrument Serif", serif;
    font-size: 7rem;
    color: darkred;
    line-height: 1;
    margin: 50px;
    padding: 0;
    width: auto;
    white-space: normal;
    position: static;
    left: auto;
    transform: none;
    display: inline-block;
    animation: title-breath 6s ease-in-out infinite;
  }

  .portfolio .intro h2 {
    font-size: 1.25rem;
    line-height: 1.4;
    color: black;
    text-align: center;
    margin-top: 60px;
    max-width: 720px;
    padding: 0 4px;
    z-index: 2;
  }

  .portfolio .intro img {
    width: 90%;
    max-width: 420px;
    margin: 18px auto 36px;
    display: block;
    border-radius: 20px;
    position: relative;
    top: 0;
    right: 0;
    z-index: 1;
    filter: saturate(140%) brightness(130%);
    transform-origin: 50% 50%;
    animation: slow-tilt 2s ease-in-out infinite alternate;
  }

  .portfolio .four-cols,
  .portfolio .portfolio {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    margin: 0 auto 60px;
    padding: 0 12px;
    width: 100%;
    max-width: 100%;
    justify-items: center;
    text-align: center;
    box-sizing: border-box;
  }

  .portfolio .section-gradient {
    padding: 60px 0 20px;
    margin: 0;
  }

  .portfolio .section-title {
    font-size: 2.6rem;
    text-align: center;
    margin: 0 auto 28px;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
  }

  .portfolio .item img {
    width: 100%;
    border-radius: 16px;
    margin: 0 auto;
    display: block;
    filter: brightness(100%) saturate(110%) contrast(105%);
    transition: transform 1s ease;
    animation: img-breath 5s ease-in-out infinite;
  }

  .portfolio .item h3 {
    font-size: 1.6rem;
  }

  .portfolio .item p {
    font-size: 0.95rem;
    max-width: 92%;
    margin: 0.6rem auto 0;
  }
}