:root {
  --bg:#0b1020;
  --card:#111835;
  --text:#e7eaf6;
  --muted:#a6b0d6;
  --accent:#7aa2f7;
  --accent-2:#9ece6a;
  --border:#223059;
  --transition: #2a3f6b;
}
* { box-sizing:border-box; }
html,body { 
  height:100%; 
  margin:0; 
  overflow-x: auto;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: #0b1020;
  color: var(--text);
  line-height:1.6;
  position: relative;
  min-height: 100vh;
}

/* Background images overlay */
.bg-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 1400px;
  height: 80%;
  max-height: 800px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.08;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
  gap: 0;
}
.bg-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: blur(2px);
}

.container {
  position: relative;
  z-index: 1;
  padding: 20px;
  min-height: 100vh;
}

/* Layout a griglia */
.timeline-container {
  position: relative;
  padding: 40px 0 20px 0;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 30px 0;
  text-align: center;
  text-shadow: 0 0 10px rgba(122,162,247,0.5);
}

.section-title.first {
  margin-top: -45px;
  margin-bottom: 30px;
  position: relative;
}

.gallery-btn {
  position: absolute;
  top: 0;
  right: 0;
  padding: 10px 20px;
  background: rgba(122,162,247,0.15);
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.gallery-btn:hover {
  background: rgba(122,162,247,0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(122,162,247,0.3);
}

/* Galleria overlay */
.gallery-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 16, 32, 0.95);
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 20px;
}

.gallery-overlay.active {
  display: block;
}

.gallery-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(122,162,247,0.2);
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.gallery-close:hover {
  background: rgba(122,162,247,0.3);
  transform: rotate(90deg);
}

.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 60px;
}

.gallery-title {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 40px;
  text-shadow: 0 0 10px rgba(122,162,247,0.5);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.gallery-item {
  background: rgba(17, 24, 53, 0.8);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

.timeline-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 30px;
  position: relative;
}

.timeline-row.second {
  grid-template-columns: repeat(4, 1fr);
}

.timeline-item {
  position: relative;
}

.timeline-year {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  text-shadow: 0 0 10px rgba(122,162,247,0.5);
  margin-left: auto;
}

.timeline-card {
  background: rgba(17, 24, 53, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.timeline-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(122,162,247,0.3);
}


.card-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-header-left {
  flex: 1;
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  color: white;
  margin: 0;
}

.card-subtitle {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  margin: 4px 0 0 0;
}

.card-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.8;
}

.card-info {
  font-size: 14px;
  line-height: 1.4;
}

.card-info p {
  margin: 4px 0;
}

strong { 
  color: var(--accent-2); 
}


/* Sezione maestro dentro le card */
.master-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.master-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
}

.master-photo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}

.master-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

.master-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
  margin-top: 12px;
}

.master-list.show {
  display: grid;
}

.master-list li {
  margin: 2px 0;
  padding-left: 16px;
  position: relative;
}

.master-list li::before {
  content: "•";
  color: var(--accent);
  font-weight: bold;
  position: absolute;
  left: 0;
}



/* Media queries per mobile */
@media (max-width: 1024px) {
  .timeline-row.first {
    grid-template-columns: repeat(2, 1fr);
  }
  .timeline-row.second {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 20px 10px;
  }

  .timeline-row {
    grid-template-columns: 1fr !important;
    gap: 30px;
  }

  .timeline-year {
    font-size: 20px;
  }

  .timeline-card {
    padding: 20px;
  }

  .card-title {
    font-size: 18px;
  }

  .section-title {
    font-size: 24px;
  }

  .bg-overlay {
    width: 95%;
    height: 70%;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr;
  }

  .master-list {
    grid-template-columns: 1fr;
  }
}
