/* ============================================================================
   Festa della Scienza — Production-Ready Stylesheet
   ============================================================================
   Design: Academic, Professional, Modern
   Color Palette: Deep Blue, Clean White, Teal Accents
   ============================================================================ */

/* ============================================================================
   1. RESET & BASE STYLES
   ============================================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  opacity: 0.70;
}

:root {
  /* Color system (light mode defaults) */
  --bg: #f8fafc;
  --text: #000000;
  --muted: #64748b;
  --surface: #ffffff;
  --accent: #10b981;
  --header-bg: linear-gradient(135deg, #047857 0%, #059669 100%);
  --nav-bg: #064e3b;
  --footer-bg: #064e3b;
  --card-bg: #ffffff;
  --success-bg: #15803d;
  --error-bg: #b91c1c;
}

/* Manual toggle class — when present the site uses the dark palette */
.dark-theme {
  --bg: #064e3b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --surface: #0f5f4f;
  --accent: #10b981;
  --header-bg: #042f1f;
  --nav-bg: #042f1f;
  --footer-bg: #042f1f;
  --card-bg: #0f5f4f;
  --success-bg: #15803d;
  --error-bg: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) {
    /* Respect system preference by default */
    --bg: #064e3b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --surface: #0f5f4f;
    --header-bg: #042f1f;
    --nav-bg: #042f1f;
    --footer-bg: #042f1f;
    --card-bg: #0f5f4f;
  }
}

html {
  scroll-behavior: smooth;
  font-size: 120%;
  background-color: var(--bg);
  color-scheme: light dark;
} 

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
} 

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 0.5rem;
} 

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
  color: var(--muted);
} 

/* a {
  color: #1e40af;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: #1e3a8a;
  text-decoration: underline;
} */


img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================================================
   2. HEADER & NAVIGATION
   ============================================================================ */

.site-header {
  background: var(--header-bg);
  color: #fff;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Light-mode header text (improves readability when theme is light) */
:root:not(.dark-theme) .site-header {
  color: var(--text);
}
/* explicit black for title & subtitle in light mode */
:root:not(.dark-theme) .site-header .site-title a,
:root:not(.dark-theme) .site-header .site-tagline {
  color: #ffffff;
}
:root:not(.dark-theme) .site-header .site-title a:hover {
  opacity: 0.95;
}

/* Light-mode navigation links: use dark text for readability */
:root:not(.dark-theme) .nav-link {
  color: var(--text);
  border-bottom-color: transparent;
}
:root:not(.dark-theme) .nav-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
:root:not(.dark-theme) .nav-link.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: rgba(16, 185, 129, 0.04);
}

/* Light-mode footer text only: black (header unchanged) */
/* :root:not(.dark-theme) .site-footer {
  color: #ffffff;
} */

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.brand {
  flex: 1;
}

.site-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
}

.site-title a {
  color: #fff;
  text-decoration: none;
}

.site-logo {
  height: 32px;
  width: auto;
  vertical-align: middle;
  margin-right: 0.5rem;
  display: inline-block;
  color: #ffffff; /* logo always white */
}

.site-title a:hover {
  opacity: 0.9;
}

.site-tagline {
  font-size: 0.95rem;
  opacity: 0.95;
  margin: 0;
  color: #d1fae5;
}

/* Site Navigation */
.site-nav {
  background-color: var(--nav-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  position: sticky;
  top: 0;
  z-index: 1000;
} 

.nav-list {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  list-style: none;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 1rem 1.25rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
} 

.nav-link:visited {
  color: var(--muted);
}

.nav-link:hover {
  color: #fff;
  border-bottom-color: #10b981;
  text-decoration: none;
}

.nav-link.active {
  color: #fff;
  border-bottom-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.nav-link.active:visited {
  color: #fff;
}

/* ============================================================================
   3. MAIN CONTENT & LAYOUT
   ============================================================================ */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.content-section {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--text);
} 

.link-more {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.link-more:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ============================================================================
   4. HERO & CAROUSEL
   ============================================================================ */

.hero {
  margin-bottom: 3rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
}

.carousel-inner {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-slide {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.carousel-slide.active {
  opacity: 1;
  position: relative;
}

.carousel-img {
  width: 100%;
  height: 500px;
  object-fit: cover;
  display: block;
}

.carousel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
  pointer-events: none;
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 2rem;
  max-width: 600px;
  color: #fff;
}

.carousel-caption h2 {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.carousel-caption p {
  color: #e0e7ff;
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  padding: 1rem 1.25rem;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  z-index: 100;
}

.carousel-control:hover {
  background: rgba(0, 0, 0, 0.7);
}

.carousel-control-prev {
  left: 1.5rem;
}

.carousel-control-next {
  right: 1.5rem;
}

.carousel-indicators {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  z-index: 100;
}

.carousel-indicators button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.carousel-indicators button.active {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ============================================================================
   5. NEWS GRID & CARDS
   ============================================================================ */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.news-card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
} 

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.news-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.news-card-link:hover {
  opacity: 1;
}

.news-card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.news-card-body {
  padding: 1.5rem;
}

.news-card-title {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.4;
} 

.news-card-link:hover .news-card-title {
  color: var(--accent);
  opacity: 1;
}

.news-card-excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.5;
} 

.news-card-date {
  display: block;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ============================================================================
   5b. ARTICLE & CONTENT PAGES
   ============================================================================ */

.news-article,
.content-article {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
} 

.news-article h1,
.content-article h1 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--text);
} 

.news-article h2,
.content-article h2 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(226,232,240,0.6);
} 

.news-article h3,
.content-article h3 {
  font-size: 1.15rem;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
} 

.news-article img,
.content-article img {
  width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.article-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
} 

.news-article p,
.content-article p {
  margin-bottom: 1rem;
  line-height: 1.7;
  color: var(--text);
} 

.news-article ul,
.content-article ul,
.news-article ol,
.content-article ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.news-article li,
.content-article li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  color: var(--text);
} 

.news-article a,
.content-article a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 500;
} 

.news-article a:hover,
.content-article a:hover {
  color: #059669;
  opacity: 1;
}

.event-details,
.gallery-section,
.contact-section,
.schedule-section {
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  padding: 1.5rem;
  border-left: 4px solid var(--accent);
  margin: 1.5rem 0;
  border-radius: 4px;
} 

.contact-section {
  border-left-color: auto;
}

.schedule-section {
  border-left-color: var(--accent);
}

.schedule-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.schedule-section tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

.schedule-section td {
  padding: 0.75rem;
  text-align: left;
  color: var(--text);
}

.schedule-section td:first-child {
  font-weight: 600;
  color: var(--text);
  width: 150px;
} 

/* ============================================================================
   6. SIDEBAR & WIDGETS
   ============================================================================ */

.sidebar {
  background: transparent;
  margin-top: 2rem;
}

.widget {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--accent);
} 

.widget-title {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 1rem;
  font-weight: 700;
} 

.events-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.event-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(226,232,240,0.6);
  font-size: 0.95rem;
  color: var(--muted);
} 

.event-item:last-child {
  border-bottom: none;
}

.widget-more {
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.widget-text {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
} 

.gallery-preview {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gallery-preview img {
  width: 100px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gallery-preview img:hover {
  transform: scale(1.05);
}

/* ============================================================================
   7. BUTTONS
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
} 

.btn-primary {
  background: #10b981;
  color: #fff;
}

.btn-primary:hover {
  background: #059669;
  text-decoration: none;
}

.btn-secondary {
  background: #047857;
  color: #fff;
}

.btn-secondary:hover {
  background: #065f46;
}

.btn-tertiary {
  background: var(--surface);
  color: var(--text);
}

.btn-tertiary:hover {
  background: color-mix(in srgb, var(--surface) 88%, black 6%);
} 

/* ============================================================================
   8. FOOTER
   ============================================================================ */

.site-footer {
  background: var(--footer-bg);
  color: #fff;
  padding: 3rem 1.5rem 1.5rem;
  margin-top: 4rem;
  border-top: 1px solid rgba(0,0,0,0.15);
} 

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  color: #fff;
  margin-bottom: 1rem;
} 

.footer-title {
  font-size: 1.05rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: #fff;
  text-decoration: none;
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
} 

.footer-section p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #fff;
} 

.footer-section a {
  color: #fff;
  text-decoration: none;
}

.footer-section a:hover {
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.15);
  font-size: 0.9rem;
  color: #fff;
} 

.footer-bottom p {
  color: #fff;
}

/* ============================================================================
   9. FEEDBACK REGION (Live feedback for user actions)
   ============================================================================ */

.feedback-region {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  max-width: 400px;
  background: var(--footer-bg);
  color: var(--surface);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
} 

.feedback-region.visible {
  opacity: 1;
  pointer-events: auto;
}

.feedback-region.success {
  background: #15803d;
}

.feedback-region.error {
  background: #b91c1c;
}

/* ============================================================================
  10. RESPONSIVE DESIGN
  ============================================================================ */

/* Mobile / off-canvas navigation */
.mobile-nav-toggle {
  display: none;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #fff;
  color: #fff;
  padding: 0.6rem 0.95rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  gap: 0.5rem;
}

.mobile-nav-toggle:hover {
  background: rgba(0, 0, 0, 0.5);
}

.mobile-nav-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* When nav is opened on small screens add a backdrop */
body.nav-open::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1400;
  pointer-events: auto;
}

.site-nav {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.site-nav.open {
  transform: translateY(0);
  opacity: 1;
}



@media (max-width: 1024px) {
  .mobile-nav-toggle { display: inline-flex; }
}

@media (max-width: 768px) {
  /* off-canvas full-height nav */
  .site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    padding-top: 5.25rem;
    transform: translateY(-100%);
    background: linear-gradient(180deg, rgba(4,47,31,0.98), rgba(4,47,31,0.95));
    z-index: 1500;
    overflow-y: auto;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
  }

  .nav-link {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 1rem;
  }

  .site-header .header-container {
    align-items: center;
  }
}

@media (max-width: 1024px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }

  .carousel-img {
    height: 400px;
  }

  .main-content {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 768px) {
  .site-title {
    font-size: 1.5rem;
  }

  .site-tagline {
    font-size: 0.85rem;
  }

  .carousel-img {
    height: 300px;
  }

  .carousel-caption {
    padding: 2rem 1rem;
    max-width: 100%;
  }

  .carousel-caption h2 {
    font-size: 1.5rem;
  }

  .carousel-control {
    width: 50px;
    height: 50px;
    padding: 0.75rem;
  }

  .nav-list {
    flex-wrap: wrap;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .news-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .news-article,
  .content-article {
    padding: 1.5rem 1rem;
  }

  .news-article h1,
  .content-article h1 {
    font-size: 1.75rem;
  }

  .news-article h2,
  .content-article h2 {
    font-size: 1.25rem;
  }

  .schedule-section td:first-child {
    width: 110px;
    font-size: 0.9rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .footer-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .feedback-region {
    right: 1rem;
    max-width: calc(100% - 2rem);
  }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .site-header {
    padding: 1rem;
  }

  .carousel-img {
    height: 250px;
  }

  .carousel-caption {
    padding: 1.5rem 1rem;
  }

  .carousel-caption h2 {
    font-size: 1.25rem;
  }

  .carousel-control-prev {
    left: 0.5rem;
  }

  .carousel-control-next {
    right: 0.5rem;
  }

  .main-content {
    padding: 1rem;
  }

  .news-grid {
    gap: 1rem;
  }

  .widget {
    padding: 1rem;
  }

  .btn {
    width: 100%;
  }
}

/* ============================================================================
   11. PRINT STYLES
   ============================================================================ */

@media print {
  .site-nav,
  .hero,
  .feedback-region {
    display: none;
  }

  body {
    background: #fff;
  }

  .main-content {
    max-width: 100%;
  }
}

/* ============================================================================
  12. ACCESSIBILITY & FOCUS STYLES
  ============================================================================ */

:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-color-scheme: dark) {
  /* Use CSS variables defined near the top — keep this block as a compatibility hook */
  body { background-color: var(--bg); color: var(--text); }
  .news-card, .widget { background: var(--card-bg); }
  .site-header, .site-nav { background-color: var(--header-bg); }
}

/* ============================================================================
   14. GLOBAL TEXT OVERRIDE
   ============================================================================ */

@media screen {
  body,
  body * {
    color: #fff !important;
  }
}


