/* Colors base càlids */
:root {
  --color-fons: #f8f9fa;
  --color-blanc-suau: rgba(255, 255, 255, 0.85);
  --color-ombra: rgba(0, 0, 0, 0.1);
  --color-text: #333;
}

/*Aquest estil fa que el salt cap a la secció sigui suau*/
html {
  scroll-behavior: smooth;
}


/* Estil base del body */
body {
  font-family: 'Segoe UI', sans-serif;
  line-height: 1.6;
  background-color: var(--color-fons);
  /*color: #333;*/
  padding: 2rem;
  background-image: url('/receptes/img/estovallesgris.jpg');
  background-size: 300px 300px;
  background-repeat: repeat;
  background-position: center;
  /* Fons subtil amb superposició blanca translúcida */
  position: relative;
}

/*Això fa que el patró d’estovalles quedi visible però discret, 
amb el text molt més llegible. I amb position: relative al <body>, 
la capa queda just darrere del contingut.*/
body::before {
  content: '';
  position: absolute;
  inset: 0;
  /* background-color: rgba(255, 255, 255, 0.7); /* blanc translúcid */
  background-color: rgba(255, 255, 255, 0.4);
  /* més suau */
  z-index: -1;
}

.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50% 50% 25% 25%;
  margin-left: 1rem;
  border: 4px solid #402A13;
}

@media (max-width: 600px) {
  .avatar {
    width: 100px;
    height: 100px;
  }
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 600px) {
  .container {
    padding: 0 10px;
  }
}

/* Estil integrat per tots els blocs principals */
nav,
section,
.recepta-container,
.intro-historia,
.ingredients,
.preparacio,
.consell,
footer {
  /* background-color: var(--color-blanc-suau);*/
  color: #333;
  /* text-align: center;*/
  border-radius: 12px;
  box-shadow: 0 2px 6px var(--color-ombra);
  padding: 1rem;
  backdrop-filter: blur(3px);
  margin-bottom: 1.5rem;
  margin: 1rem 1rem 1rem 1rem;
}

header {
  background: #cc9966;
  border-radius: 12px;
  color: white;
  text-align: center;
  padding: 2rem;
}

.logo {
  width: 100%;
  max-width: 100%;
  /* o la mida màxima que vulguis */
  height: auto;
  border-radius: 10px;
}

@media (max-width: 600px) {
  .logo {
    max-width: 300px;
    /* o la mida que prefereixis per mòbil */
  }
}

nav.categories {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #eceae7;
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 1rem 0;
}

/*style="display: flex; justify-content: center; background-color: #eceae7;margin-top: 2rem;" class="categories" */
nav.categories ul {
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #cc9966;
  padding: 1rem;
  list-style: none;
}

nav.categories a {
  margin: 0 1rem;
  text-decoration: none;
  color: #333;
  font-weight: bold;
}

nav.categories a:hover {
  color: #ffffff;
  background-color: #cc9966;
  border-bottom: 4px solid #1a0d01;

}

.etiquetes {
  /*background: #bbb5af;*/
  text-align: center;
  margin: 2rem;
}

.tag-filter button {
  margin: 0.5rem;
  padding: 0.5rem 1rem;
  background: #cc9966;
  border: none;
  cursor: pointer;
  border-radius: 8px;

}

.receptes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
}

.recepta {
  color: #333;
  background: white;
  padding: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
}

@media screen and (max-width: 600px) {
  .receptes-grid {

    grid-template-columns: 1fr;
  }

  .recepta {
    width: 100%;
    margin: 0;
  }
}

.recepta img {
  width: 100%;
  /*  Mida completa */
  /*width:"400";*/
  border-radius: 4px;
}

.recepta .etiquetes span {
  background: #35990e;
  color: white;
  word-wrap: break-word;
  white-space: nowrap;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.menu-toggle {
  display: none;
  font-size: 2rem;
  padding: 1rem;
  text-align: right;
  cursor: pointer;
  background: #eee;
}

/* Estil base per seccions */
.categoria {
  position: relative;
  margin: 3rem 0;
  padding-top: .5rem;
  /* Evita col·lapse de marges */
}

.categoria h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 .5rem 0;
  padding-bottom: .5rem;
  text-align: center;
  color: #5a4a3a;
  /* Color terra */
  background-color: white;
  font-size: 2.2rem;
  justify-content: center;
  border-radius: 12px;

  /* Línia decorativa 
  &::after {
    content: "";
    flex: 1;
    height: 3px;
    background: linear-gradient(90deg, #d4a017, transparent);
    margin-left: 10px;
}*/
  /* Icona */
  .fa-seedling {
    color: #8fd19e;
    /* Verd suau */
    font-size: 1.2em;
  }
}

.categoria i {
  color: #cc9966;
  font-size: 2rem;
}

/* Versió fosca per contrast */
body.dark .categoria>h2 {
  color: #f9f4e8;

  &::after {
    background: linear-gradient(90deg, #c45a1a, transparent);
  }
}

/* Versió mòbil amb menú hamburguesa */
@media (max-width: 600px) {
  .menu-toggle {
    display: block;
  }

  nav.categories {
    display: none;
    flex-direction: column;
    align-items: center;
  }

  nav.categories.visible {
    display: flex;
  }

  nav.categories ul {
    flex-direction: column;
    padding: 0;
  }

  nav.categories li {
    margin: 0.5rem 0;
  }
}

/* Footer */
footer {
  /*background-color: var(--bg-secondary);*/
  background-color: #f7e9d3;
  padding: 60px 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
  margin: 1rem;
}

.footer-column h3 {
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  position: relative;
  display: inline-block;
  margin: 1rem;
  border-bottom: 4px solid #1b0202;
}

.footer-column h3::after {
  content: '';
  position: absolute;
  width: 40px;
  height: 3px;
  background: var(--primary-color);
  bottom: -8px;
  left: 0;
  border-radius: 2px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.8rem;
}

.footer-links a {
  text-decoration: none;
  color: var(--text-light);
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary-color);
  padding-left: 5px;
}

.footer-contact p {
  margin-bottom: 0.8rem;
  color: var(--text-light);
}

.footer-contact i {
  margin-right: 10px;
  color: var(--primary-color);
}

.footer-social {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.footer-social a {
  color: var(--text-light);
  font-size: 1.2rem;
  transition: var(--transition);
}

.footer-social a:hover {
  color: var(--primary-color);
  transform: translateY(-3px);
}

.copyright {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-light);
  font-size: 0.9rem;
}

/* botons de descàrrega-impresió */
.download-btn {
  display: inline-block;
  background-color: #a7d9a5;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  font-weight: bold;
  text-decoration: none;
  transition: background-color 0.3s ease;
  margin-top: 1rem;
}

.download-btn:hover {
  background-color: #88c286;
}