/* ==========================================================================
   Cobla Catània - Estils Globals
   ========================================================================== */

/* Google Fonts: Playfair Display (headings) + Open Sans (body) */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Playfair+Display:wght@400;700&display=swap');

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */
:root {
  /* Colors */
  --color-primary: #8B1A1A;      /* Granat/bordeus */
  --color-secondary: #2C3E50;    /* Blau fosc per textos */
  --color-accent: #C0392B;       /* Accent vermell */
  --color-background: #FAFAFA;   /* Fons clar */
  --color-surface: #FFFFFF;      /* Targetes i superfícies */
  --color-text: #2C3E50;         /* Text principal */
  --color-text-light: #636E70;   /* Text secundari (contrast ≥4.5:1 WCAG AA) */
  --color-footer-bg: #1A1A2E;    /* Fons peu de pàgina */

  /* Tipografia */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Open Sans', sans-serif;

  /* Spacing */
  --section-padding: 80px 20px;
  --container-max-width: 1200px;
}

/* ==========================================================================
   Reset bàsic
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

ul,
ol {
  list-style: none;
}

/* ==========================================================================
   Estils globals de tipografia
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-secondary);
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
}

h3 {
  font-size: 1.5rem;
  font-weight: 400;
}

p {
  margin-bottom: 1em;
}

/* ==========================================================================
   Enllaços globals
   ========================================================================== */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* Focus visible per accessibilitat (WCAG 2.1 AA) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   Contenidor principal
   ========================================================================== */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 20px;
}

section {
  padding: var(--section-padding);
}

/* ==========================================================================
   Breakpoints Responsive
   ========================================================================== */

/* Tauleta: 768px - 1024px */
@media (max-width: 1024px) {
  :root {
    --section-padding: 60px 16px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.25rem;
  }
}

/* Mòbil: < 768px */
@media (max-width: 767px) {
  :root {
    --section-padding: 40px 12px;
  }

  body {
    font-size: 15px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.125rem;
  }
}

/* ==========================================================================
   Header i Navegació
   ========================================================================== */
#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 16px 20px;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

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

.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-links li a {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-secondary);
  transition: color 0.3s ease;
}

.nav-links li a:hover {
  color: var(--color-primary);
}

/* Menú hamburguesa */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger-line {
  display: block;
  width: 24px;
  height: 3px;
  background-color: var(--color-secondary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburguesa visible en mòbil (≤768px) */
@media (max-width: 768px) {
  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background-color: var(--color-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px 0;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links li a {
    display: block;
    padding: 12px 24px;
    font-size: 1rem;
  }

  .nav-links li a:hover {
    background-color: var(--color-background);
  }

  .nav-social {
    justify-content: center;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin-left: 0;
    padding-top: 12px;
    margin-top: 4px;
  }

  .nav-container {
    position: relative;
  }

  /* Animació hamburguesa oberta */
  .nav-hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .nav-hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .nav-hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
}

/* Icones socials a la navegació */
.nav-social {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-icon {
  width: 20px;
  height: 20px;
  fill: var(--color-secondary);
  transition: fill 0.3s ease;
}

.nav-social a:hover .nav-icon {
  fill: var(--color-primary);
}

/* ==========================================================================
   Secció Hero
   ========================================================================== */
.hero {
  position: relative;
  padding: 0;
}

.hero-image {
  width: 100%;
  height: 60vh;
  min-height: 400px;
  overflow: hidden;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 40px 20px;
}

.hero-text h1 {
  color: var(--color-primary);
  margin-bottom: 16px;
}

.hero-text p {
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 800px;
}

.hero-events {
  margin-top: 32px;
}

@media (max-width: 767px) {
  .hero-image {
    height: 40vh;
    min-height: 250px;
  }

  .hero-content {
    padding: 24px 16px;
  }
}

/* ==========================================================================
   Títol de secció
   ========================================================================== */
.section-title {
  text-align: center;
  margin-bottom: 40px;
  font-family: var(--font-heading);
}

/* ==========================================================================
   Secció Agenda
   ========================================================================== */
.agenda-calendar-container {
  max-width: 900px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.agenda-calendar-container iframe {
  display: block;
  width: 100%;
  min-height: 500px;
}

@media (max-width: 767px) {
  .agenda-calendar-container iframe {
    min-height: 400px;
    height: 450px;
  }
}

/* ==========================================================================
   Secció Història
   ========================================================================== */
.historia-content {
  max-width: 750px;
  margin: 0 auto;
  line-height: 1.8;
}

.historia-content p {
  margin-bottom: 1.25em;
}

/* ==========================================================================
   Secció Components
   ========================================================================== */
.components-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.instrument-group {
  background-color: var(--color-surface);
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.instrument-card {
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-name {
  font-size: 0.95rem;
  color: var(--color-text);
}

.director-section {
  text-align: center;
  padding-top: 32px;
  border-top: 2px solid var(--color-primary);
  max-width: 400px;
  margin: 0 auto;
}

.director-title {
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.director-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
}

@media (max-width: 1024px) {
  .components-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ==========================================================================
   Secció Galeria
   ========================================================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.gallery-item {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.03);
}

.gallery-video-container {
  max-width: 800px;
  margin: 40px auto 0;
}

.gallery-video {
  width: 100%;
  border-radius: 8px;
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  color: #fff;
  font-size: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  transition: opacity 0.2s ease;
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 0.7;
}

/* ==========================================================================
   Secció Contacte
   ========================================================================== */
.contacte-content {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.contacte-name {
  color: var(--color-primary);
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.contacte-role {
  color: var(--color-text-light);
  margin-bottom: 24px;
}

.contacte-list {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contacte-list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.contacte-label {
  font-weight: 700;
  min-width: 100px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  background-color: var(--color-footer-bg);
  color: #fff;
  padding: 40px 20px;
}

.footer-content {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-info p {
  margin: 0;
}

.footer-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.footer-location {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-social a {
  color: #fff;
  transition: opacity 0.3s ease;
}

.footer-social a:hover {
  opacity: 0.7;
  color: #fff;
}

.footer-icon {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.footer-copyright {
  width: 100%;
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 8px;
}

.footer-copyright p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

@media (max-width: 767px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-social {
    justify-content: center;
  }
}

/* ==========================================================================
   Accessibilitat i desbordament
   ========================================================================== */

/* Focus visible reforçat per botons del lightbox */
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

/* Focus visible per galeria items */
.gallery-item:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* Evitar desbordament horitzontal */
html,
body {
  overflow-x: hidden;
}

main {
  overflow-x: hidden;
}
