/* =========================================================
   IMPORTS
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Lato:wght@300;400;700&display=swap');

/* =========================================================
   RESET & BASE
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Lato', sans-serif;
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.35s ease, color 0.35s ease;
}

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

a {
  text-decoration: none;
  transition: color 0.2s ease;
}

ul {
  list-style: none;
}

/* =========================================================
   LIGHT THEME
   ========================================================= */

[data-theme="light"] {
  --color-bg:          #EAE2D6;
  --color-surface:     #D5C3AA;
  --color-surface-alt: #f2ece3;
  --color-text-main:   #2C2A28;
  --color-text-muted:  #867666;
  --color-accent:      #E1B80D;
  --color-hover:       #cfa90c;
  --color-active:      #b9970b;
  --color-border:      rgba(134, 118, 102, 0.25);
  --color-shadow:      rgba(0, 0, 0, 0.08);
  --color-success:     #4FAF88;
  --color-danger:      #D46A6A;
  --color-white-soft:  #FFFFFF;

  --header-bg:         rgba(234, 226, 214, 0.92);
  --card-bg:           linear-gradient(180deg, #D5C3AA, #f2ece3);
  --footer-bg:         #e3dbcf;
  --btn-text:          #1E1F26;
  --toggle-icon:       '☀️';

  background: var(--color-bg);
  color: var(--color-text-main);
}

/* =========================================================
   DARK THEME
   ========================================================= */

[data-theme="dark"] {
  --color-bg:          #1B1916;
  --color-surface:     #252219;
  --color-surface-alt: #2e2a21;
  --color-text-main:   #EAE2D6;
  --color-text-muted:  #9E8E7A;
  --color-accent:      #E1B80D;
  --color-hover:       #f0cb1a;
  --color-active:      #cfa90c;
  --color-border:      rgba(200, 180, 150, 0.15);
  --color-shadow:      rgba(0, 0, 0, 0.35);
  --color-success:     #4FAF88;
  --color-danger:      #D46A6A;
  --color-white-soft:  #FFFFFF;

  --header-bg:         rgba(27, 25, 22, 0.95);
  --card-bg:           linear-gradient(180deg, #252219, #2e2a21);
  --footer-bg:         #131210;
  --btn-text:          #1E1F26;
  --toggle-icon:       '🌙';

  background: var(--color-bg);
  color: var(--color-text-main);
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */

h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  color: var(--color-text-main);
  line-height: 1.25;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem);  font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }

p { color: var(--color-text-muted); }

a { color: var(--color-accent); }
a:hover { color: var(--color-active); }

/* =========================================================
   LAYOUT
   ========================================================= */

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

main {
  flex: 1;
  padding: 2rem 0 4rem;
}

/* =========================================================
   HEADER & NAV
   ========================================================= */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.35s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo span {
  color: var(--color-accent);
}

/* Nav links */
.nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.nav-links a {
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-accent);
  background: rgba(225, 184, 13, 0.1);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text-main);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme toggle */
.theme-toggle {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--color-surface-alt);
  transform: scale(1.08);
}

/* Mobile nav */
.mobile-nav {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--header-bg);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  padding: 1rem 1.5rem;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.mobile-nav a:hover,
.mobile-nav a.active {
  color: var(--color-accent);
  background: rgba(225, 184, 13, 0.1);
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.hero-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  color: var(--color-text-main);
  margin-bottom: 1rem;
}

.hero-subtitle {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 540px;
}

/* =========================================================
   ARTICLE GRID  (edita la llista d'articles a index.html)
   ========================================================= */

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-title {
  font-family: 'Playfair Display', serif;
  color: var(--color-text-main);
}

.section-link {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.75rem;
}

/* Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--color-shadow);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.14);
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;     /* quadrat */
  overflow: hidden;
  background: var(--color-surface);
  position: relative;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-img-wrap img {
  transform: scale(1.05);
}

/* Placeholder quan no hi ha imatge */
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.card-body {
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.card-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--color-text-main);
  line-height: 1.35;
}

.card-text {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  flex: 1;
}

.card-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-accent);
  transition: color 0.2s;
}

.card-link:hover { color: var(--color-active); }

/* =========================================================
   BOTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.35rem;
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-accent);
  color: var(--btn-text);
}
.btn-primary:hover { background: var(--color-hover); color: var(--btn-text); }

.btn-secondary {
  background: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: rgba(134, 118, 102, 0.1); }

/* =========================================================
   FORMULARIS
   ========================================================= */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

input, textarea, select {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--color-white-soft);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--color-surface);
}

input::placeholder, textarea::placeholder {
  color: rgba(134, 118, 102, 0.6);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(225, 184, 13, 0.2);
}

textarea { resize: vertical; min-height: 120px; }

/* =========================================================
   PAGE HERO (pàgines secundàries)
   ========================================================= */

.page-hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.page-hero .label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.6rem;
}

.page-content {
  max-width: 740px;
  margin: 0 auto;
}

.page-content h2 {
  margin: 2rem 0 0.75rem;
}

.page-content p {
  margin-bottom: 1rem;
}

.page-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

/* =========================================================
   ARTICLE PAGE
   ========================================================= */

.article-header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.article-meta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.article-meta .tag {
  color: var(--color-accent);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.article-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.article-body {
  max-width: 700px;
  margin: 0 auto;
}

.article-body p {
  margin-bottom: 1.25rem;
  font-size: 1rem;
}

.article-body h2 {
  margin: 2rem 0 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.back-link:hover { color: var(--color-accent); }

/* =========================================================
   XARXES SOCIALS
   ========================================================= */

.social-bar {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 1.5rem 0;
}

.social-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.social-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-right: 0.5rem;
}

.social-icons {
  display: flex;
  gap: 0.6rem;
}

.social-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--color-text-muted);
  transition: background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
}

.social-icon:hover {
  background: var(--color-accent);
  color: var(--btn-text);
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer {
  background: var(--footer-bg);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-copy {
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--color-accent); }

/* =========================================================
   QUI SOM — timeline
   ========================================================= */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.team-card {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.team-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-surface);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px solid var(--color-accent);
}

/* =========================================================
   AMAZON — productes
   ========================================================= */

.amazon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.amazon-card {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.amazon-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px var(--color-shadow);
}

.amazon-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}

.amazon-info {
  padding: 1rem 1.1rem 1.25rem;
}

.amazon-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.amazon-price {
  font-weight: 700;
  color: var(--color-accent);
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

/* =========================================================
   ALERTES
   ========================================================= */

.alert {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success { border-color: var(--color-success); color: var(--color-success); }
.alert-danger   { border-color: var(--color-danger);  color: var(--color-danger);  }

/* =========================================================
   UTILITATS
   ========================================================= */

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--color-text-muted); }
.text-center  { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }
}

@media (max-width: 480px) {
  .articles-grid {
    grid-template-columns: 1fr 1fr;
  }

  .header-inner {
    height: 58px;
  }
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fadeUp 0.4s ease both;
}

/* staggered */
.card:nth-child(1)  { animation-delay: 0.05s; }
.card:nth-child(2)  { animation-delay: 0.10s; }
.card:nth-child(3)  { animation-delay: 0.15s; }
.card:nth-child(4)  { animation-delay: 0.20s; }
.card:nth-child(5)  { animation-delay: 0.25s; }
.card:nth-child(6)  { animation-delay: 0.30s; }
.card:nth-child(7)  { animation-delay: 0.35s; }
.card:nth-child(8)  { animation-delay: 0.40s; }
.card:nth-child(9)  { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.50s; }
.card:nth-child(11) { animation-delay: 0.55s; }
.card:nth-child(12) { animation-delay: 0.60s; }
