/*
Theme Name: SIPO Theme
Theme URI: https://www.pediatriaospedaliera.it
Author: SIPO - Società Italiana di Pediatria Ospedaliera
Description: Tema ufficiale SIPO — fedele al design Lovable. Font DM Sans + Playfair Display, palette teal/arancione.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: sipo-theme
*/

/* =====================================================
   GOOGLE FONTS — DM Sans + Playfair Display
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Playfair+Display:wght@400;500;600;700&display=swap');

/* =====================================================
   DESIGN TOKENS — from Lovable index.css
   ===================================================== */
:root {
  /* Colors — converted from HSL vars */
  --background:        hsl(0, 0%, 99%);
  --foreground:        hsl(210, 25%, 15%);   /* #1c2b3a */
  --card:              hsl(0, 0%, 100%);
  --card-foreground:   hsl(210, 25%, 15%);
  --primary:           hsl(187, 60%, 38%);   /* teal #279ab5 */
  --primary-foreground:hsl(0, 0%, 100%);
  --secondary:         hsl(20, 80%, 55%);    /* orange #e8732a */
  --secondary-foreground: hsl(0, 0%, 100%);
  --muted:             hsl(200, 20%, 95%);
  --muted-foreground:  hsl(210, 10%, 45%);
  --accent:            hsl(187, 40%, 92%);
  --accent-foreground: hsl(187, 60%, 28%);
  --border:            hsl(210, 15%, 90%);
  --radius:            0.75rem;

  /* Shadows */
  --shadow-card:       0 4px 24px -4px hsla(210, 25%, 15%, 0.08);
  --shadow-card-hover: 0 8px 32px -4px hsla(210, 25%, 15%, 0.14);

  /* Hero overlay — gradient teal dark */
  --hero-overlay: linear-gradient(135deg, hsla(187, 60%, 20%, 0.85) 0%, hsla(187, 50%, 30%, 0.6) 100%);

  /* Layout */
  --container-max: 1400px;
  --container-pad: 2rem;
  --navbar-h: 80px;

  /* Fonts */
  --font-sans:    'DM Sans', system-ui, sans-serif;
  --font-display: 'Playfair Display', serif;
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--foreground);
}

/* =====================================================
   CONTAINER
   ===================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .875rem 1.75rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .2s, opacity .2s, transform .15s;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { opacity: .92; }
.btn-primary   { background: var(--primary);   color: var(--primary-foreground); }
.btn-primary:hover { background: hsl(187,60%,33%); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); box-shadow: 0 4px 12px hsla(20,80%,55%,.3); }
.btn-secondary:hover { background: hsl(20,80%,49%); }
.btn-outline-light {
  background: transparent;
  border: 2px solid rgba(255,255,255,.35);
  color: #fff;
}
.btn-outline-light:hover { background: rgba(255,255,255,.12); }
.btn-sm { padding: .65rem 1.25rem; font-size: .8rem; white-space: nowrap; }

/* =====================================================
   NAVBAR — bg-card/90 backdrop-blur border-b
   ===================================================== */
#site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--navbar-h);
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s;
}
#site-header.scrolled { box-shadow: 0 2px 16px hsla(210,25%,15%,.1); }

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  text-decoration: none;
}
.site-logo img,
.site-logo .custom-logo,
.site-logo-img {
  height: 52px !important;
  width: auto !important;
  max-width: 200px !important;
  max-height: 52px !important;
  display: block;
  object-fit: contain;
}
.site-logo .logo-sipo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
.site-logo .logo-tagline {
  font-size: .7rem;
  color: var(--muted-foreground);
  line-height: 1.3;
  max-width: 130px;
}

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

/* ---- Desktop menu ul/li (WordPress standard) ---- */
.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Top-level items */
.nav-menu > li {
  position: relative;
  list-style: none;
}

.nav-menu > li > a {
  display: block;
  padding: .5rem .9rem;
  font-size: .875rem;
  font-weight: 500;
  color: rgba(28,43,58,.7);
  white-space: nowrap;
  transition: color .2s;
}

.nav-menu > li > a:hover,
.nav-menu > li.current-menu-item > a,
.nav-menu > li.current-menu-ancestor > a {
  color: var(--primary);
}

/* Arrow on items with children */
.nav-menu > li.menu-item-has-children > a::after {
  content: ' \25be';
  font-size: .6rem;
  vertical-align: middle;
}

/* Sub-menu (dropdown) */
.nav-menu .sub-menu {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
  list-style: none;
  margin: 0;
  padding: .25rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 500;
}

.nav-menu li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Dropdown links */
.nav-menu .sub-menu li {
  list-style: none;
  position: relative;
}

.nav-menu .sub-menu li a {
  display: block;
  padding: .55rem 1rem;
  font-size: .875rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  transition: background .15s, color .15s, padding .15s;
  border-left: 3px solid transparent;
}

.nav-menu .sub-menu li a:hover {
  background: var(--muted);
  color: var(--primary);
  border-left-color: var(--primary);
  padding-left: 1.25rem;
}

/* Arrow for nested sub-menus */
.nav-menu .sub-menu li.menu-item-has-children > a::after {
  content: ' \203a';
  float: right;
}

/* Nested sub-menu (level 2) */
.nav-menu .sub-menu .sub-menu {
  top: -.25rem;
  left: 100%;
  transform: translateY(-4px);
}

.nav-menu .sub-menu li:hover > .sub-menu {
  transform: translateY(0);
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  color: var(--foreground);
}

/* Mobile menu */
.mobile-menu {
  display: none;
  background: var(--card);
  border-top: 1px solid var(--border);
  position: absolute;
  top: var(--navbar-h);
  left: 0; right: 0;
  padding: 1rem 0 1.5rem;
  animation: fadeIn .2s ease;
}
.mobile-menu.open { display: block; }
.mobile-nav-menu,
.mobile-nav-menu li { list-style: none; margin: 0; padding: 0; }
.mobile-menu a,
.mobile-nav-menu a {
  display: block;
  padding: .65rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(28,43,58,.8);
  transition: color .2s;
}
.mobile-menu a:hover,
.mobile-menu-list a:hover { color: var(--primary); }
.mobile-menu .mobile-cta {
  margin: .75rem 2rem 0;
  text-align: center;
}

/* =====================================================
   HERO — min-h-[85vh] with real photo + teal overlay
   ===================================================== */
#hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  margin-top: var(--navbar-h);
}
.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--hero-overlay);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 8rem 0 6rem;
  max-width: 680px;
  animation: fadeInUp .6s ease-out both;
}
#hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}
.hero-lead {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255,255,255,.82);
  margin-bottom: 2.5rem;
  max-width: 480px;
  line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; }

/* =====================================================
   MISSION SECTION — py-20 md:py-28 bg-background
   ===================================================== */
#mission {
  padding: 5rem 0 7rem;
  background: var(--background);
}
.mission-header {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 4rem;
}
.section-eyebrow {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: .75rem;
}
.mission-header h2 {
  font-size: clamp(1.9rem, 4vw, 3.125rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
}
.mission-header p {
  font-size: 1.0625rem;
  color: var(--muted-foreground);
  line-height: 1.75;
}

/* Feature cards grid — sm:grid-cols-2 lg:grid-cols-4 */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow .3s;
}
.feature-card:hover { box-shadow: var(--shadow-card-hover); }
.feature-icon {
  width: 3rem; height: 3rem;
  border-radius: calc(var(--radius) - .125rem);
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
  transition: background .2s;
}
.feature-card:hover .feature-icon { background: var(--primary); }
.feature-icon svg { width: 1.5rem; height: 1.5rem; color: var(--accent-foreground); }
.feature-card:hover .feature-icon svg { color: #fff; }
.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: .5rem;
}
.feature-card p {
  font-size: .875rem;
  color: var(--muted-foreground);
  line-height: 1.65;
}

/* =====================================================
   CONGRESS SECTION — py-20 bg-muted/50 grid lg:grid-cols-2
   ===================================================== */
#congress {
  padding: 5rem 0 7rem;
  background: hsl(200, 20%, 95%, .5);
}
.congress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.congress-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.congress-card-bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.congress-card:hover .congress-card-bg { transform: scale(1.05); }
.congress-card-overlay {
  position: relative;
  z-index: 2;
  background: rgba(28,43,58,.60);
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}
.card-eyebrow {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: .75rem;
}
.congress-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 1.875rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
}
.congress-card p {
  font-size: .9375rem;
  color: rgba(255,255,255,.80);
  max-width: 400px;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

/* =====================================================
   FOOTER — bg-foreground (dark)
   ===================================================== */
#site-footer {
  background: var(--foreground);
  padding: 4rem 0 0;
  color: rgba(255,255,255,.7);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 3rem;
}
.footer-brand .logo-sipo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: .75rem;
}
.footer-brand p {
  font-size: .875rem;
  color: rgba(255,255,255,.6);
  line-height: 1.65;
  max-width: 260px;
}
.footer-col-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 1rem;
}
.footer-links li { margin-bottom: .5rem; }
.footer-links a {
  font-size: .875rem;
  color: rgba(255,255,255,.7);
  transition: color .2s;
}
.footer-links a:hover { color: #fff; }
.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .875rem;
  color: rgba(255,255,255,.7);
  margin-bottom: .75rem;
}
.footer-contact-item svg { width: 1rem; height: 1rem; margin-top: .125rem; flex-shrink: 0; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 1.5rem 0;
  text-align: center;
}
.footer-bottom p {
  font-size: .75rem;
  color: rgba(255,255,255,.4);
}

/* =====================================================
   INNER PAGE HERO
   ===================================================== */
.page-hero {
  background: linear-gradient(135deg, hsl(187,60%,22%) 0%, hsl(187,60%,38%) 100%);
  padding: 5rem 0 3rem;
  margin-top: var(--navbar-h);
}
.page-hero h1 { color: #fff; font-size: clamp(1.8rem,4vw,2.75rem); margin-bottom: .75rem; }
.breadcrumb {
  display: flex; align-items: center; gap: .5rem;
  font-size: .875rem; color: rgba(255,255,255,.65);
}
.breadcrumb a { color: rgba(255,255,255,.65); transition: color .2s; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb-sep { color: rgba(255,255,255,.35); }

/* =====================================================
   CONTENT AREA
   ===================================================== */
.content-section { padding: 4rem 0 5rem; }
.content-grid { display: grid; grid-template-columns: 1fr 300px; gap: 3rem; }
.main-content { min-width: 0; }
.main-content h2, .main-content h3 { color: var(--primary); margin: 2rem 0 .75rem; }
.main-content p { color: var(--muted-foreground); line-height: 1.75; margin-bottom: 1rem; }
.sidebar { position: sticky; top: calc(var(--navbar-h) + 1.5rem); align-self: start; }
.sidebar-widget {
  background: var(--muted);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.sidebar-widget h4 {
  font-size: .875rem; font-weight: 700; color: var(--primary);
  margin-bottom: 1rem; padding-bottom: .5rem;
  border-bottom: 2px solid var(--primary);
}

/* =====================================================
   EVENTS ARCHIVE
   ===================================================== */
.events-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}
.event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow .3s, transform .3s;
  display: flex; flex-direction: column;
}
.event-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-3px); }
.event-card-thumb {
  height: 180px;
  overflow: hidden;
  background: var(--accent);
  position: relative;
}
.event-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.event-card:hover .event-card-thumb img { transform: scale(1.05); }
.event-badge {
  position: absolute; top: .75rem; left: .75rem;
  background: var(--primary); color: #fff;
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .2rem .6rem; border-radius: 100px;
}
.event-card-body { padding: 1.25rem 1.5rem; flex: 1; display: flex; flex-direction: column; }
.event-meta { font-size: .8rem; color: var(--muted-foreground); margin-bottom: .5rem; }
.event-card-body h3 { font-size: 1rem; line-height: 1.4; flex: 1; margin-bottom: 1rem; }
.event-card-body h3 a { color: var(--foreground); transition: color .2s; }
.event-card-body h3 a:hover { color: var(--primary); }
.event-card-link {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .875rem; font-weight: 600; color: var(--primary);
  padding-top: 1rem; border-top: 1px solid var(--border);
  margin-top: auto; transition: gap .2s;
}
.event-card-link:hover { gap: .55rem; }

/* =====================================================
   404
   ===================================================== */
.notfound-section {
  min-height: calc(100vh - var(--navbar-h));
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 4rem 1rem;
}
.notfound-section h1 { font-size: 6rem; color: var(--primary); opacity: .3; }
.notfound-section h2 { font-size: 1.75rem; margin: .5rem 0 1rem; }
.notfound-section p { color: var(--muted-foreground); margin-bottom: 2rem; }

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

[data-anim] {
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
[data-anim].visible { opacity: 1; transform: translateY(0); }
[data-anim-delay="1"] { transition-delay: .1s; }
[data-anim-delay="2"] { transition-delay: .2s; }
[data-anim-delay="3"] { transition-delay: .3s; }
[data-anim-delay="4"] { transition-delay: .4s; }

/* =====================================================
   SVG ICONS (inline, replaces lucide-react)
   ===================================================== */
.icon {
  display: inline-block;
  width: 1.5rem; height: 1.5rem;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 1rem; height: 1rem; }

/* =====================================================
   WORDPRESS
   ===================================================== */
.screen-reader-text {
  border:0;clip:rect(1px,1px,1px,1px);clip-path:inset(50%);
  height:1px;margin:-1px;overflow:hidden;padding:0;
  position:absolute;width:1px;word-wrap:normal!important;
}
.alignleft   { float:left; margin:.5rem 1.5rem 1rem 0; }
.alignright  { float:right; margin:.5rem 0 1rem 1.5rem; }
.aligncenter { display:block; margin:1.5rem auto; }
.wp-caption-text { font-size:.875rem; color:var(--muted-foreground); text-align:center; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid   { grid-template-columns: 1fr 1fr; }
  .events-grid   { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 768px) {
  :root { --navbar-h: 64px; }

  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: flex; }

  .congress-grid { grid-template-columns: 1fr; }
  .congress-card-overlay { padding: 2rem 1.5rem; }

  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }

  #hero h1 { font-size: 2.2rem; }
  .hero-content { padding: 5rem 0 4rem; }
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .hero-actions .btn { max-width: 320px; }
}

@media (max-width: 640px) {
  .features-grid { grid-template-columns: 1fr; }
  .events-grid   { grid-template-columns: 1fr; }
}
