/* 
  Redazione Multimediale Palmiericrea.it
  Professional Senior Audit & Responsive Overhaul
*/

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

:root {
  --primary: #0ea5e9; 
  --secondary: #0073aa; 
  --accent: #f97316; 
  --bg-dark: #0f172a;
  --bg-darker: #0b1121;
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --sidebar-width: 300px;
  --transition-speed: 0.3s;
  --container-max: 1000px;
  --header-height: 70px;
}

/* --- BASE STYLES --- */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  font-size: 16px; /* Base for rem */
}

body { 
  font-family: 'Outfit', sans-serif; 
  background-color: var(--bg-dark); 
  color: var(--text-white); 
  line-height: 1.6; 
  overflow-x: hidden;
  width: 100%;
}

/* --- SIDEBAR & NAV --- */
nav#sidebar { 
  width: var(--sidebar-width); 
  background: var(--bg-darker); 
  border-right: 1px solid rgba(255,255,255,0.08); 
  padding: 2.5rem 1.5rem; 
  position: fixed; 
  height: 100vh; 
  display: flex; 
  flex-direction: column; 
  z-index: 1000; 
  box-shadow: 10px 0 40px rgba(0,0,0,0.4); 
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

/* Sidebar Overlay for Mobile */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

#sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

#mobile-toggle { 
  display: none; 
  position: fixed; 
  top: 1rem; 
  right: 1rem; /* Switched to right for better thumb reach */
  z-index: 2000; 
  background: var(--primary); 
  color: white; 
  border: none; 
  width: 50px;
  height: 50px;
  border-radius: 12px; 
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
  align-items: center;
  justify-content: center;
}

.nav-link { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  padding: 0.85rem 1rem; 
  border-radius: 12px; 
  color: var(--text-muted); 
  text-decoration: none; 
  font-weight: 700; 
  margin-bottom: 0.5rem; 
  transition: all 0.2s ease; 
  cursor: pointer; 
}

.nav-link:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-link.active { background: white; color: var(--bg-dark); box-shadow: 0 8px 25px rgba(255,255,255,0.15); }

.sub-nav { 
  margin-top: 0.5rem; 
  margin-bottom: 1.5rem; 
  border-left: 2px solid rgba(255,255,255,0.1); 
  margin-left: 1.8rem; 
}

.sub-link { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 0.75rem 1rem; 
  border-radius: 10px; 
  color: #94a3b8; 
  text-decoration: none; 
  font-size: 0.9rem; 
  font-weight: 600; 
  transition: all 0.2s ease; 
}

.sub-link:hover { color: white; background: rgba(255,255,255,0.05); }
.sub-link.active { color: white; background: rgba(14, 165, 233, 0.2); border-left: 3px solid var(--primary); margin-left: -2px; }

/* --- MAIN CONTENT --- */
#main-wrapper { 
  margin-left: var(--sidebar-width); 
  min-height: 100vh; 
  transition: margin var(--transition-speed) ease; 
}

.page-section { 
  display: none; 
  width: 100%; 
  animation: fadeInDown 0.6s cubic-bezier(0.23, 1, 0.32, 1); 
}
.page-section.active { display: block; }

@keyframes fadeInDown { 
  from { opacity: 0; transform: translateY(-10px); } 
  to { opacity: 1; transform: translateY(0); } 
}

/* --- HERO SECTIONS --- */
.hero-home { 
  min-height: 80vh; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  text-align: center; 
  position: relative; 
  padding: 2rem;
}

.hero-small { 
  padding: clamp(6rem, 15vh, 10rem) 2rem clamp(3rem, 10vh, 5rem); 
  text-align: center; 
  background: linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 100%); 
}

.hero-content { 
  max-width: 900px; 
  width: 100%;
}

.hero-content h1 { 
  font-family: 'Playfair Display', serif; 
  font-size: clamp(2.2rem, 8vw, 4.5rem); 
  line-height: 1.1;
  margin: 1.5rem 0; 
  color: #fff; 
  font-weight: 700;
}

.hero-content p { 
  font-size: clamp(0.9rem, 2.5vw, 1.2rem); 
  font-weight: 600; 
  color: var(--primary); 
  text-transform: uppercase; 
  letter-spacing: 3px; 
}

.celebration-badge {
  display: inline-block;
  background: rgba(14, 165, 233, 0.15);
  color: var(--primary);
  padding: 0.6rem 1.5rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

/* --- UTILITIES & LAYOUT --- */
.content-container { 
  max-width: var(--container-max); 
  margin: 0 auto; 
  padding: clamp(2rem, 10vw, 6rem) clamp(1.5rem, 5vw, 2.5rem); 
}

.section-label {
  display: block;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.module-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.2;
  margin-bottom: 2rem;
}

/* --- GRIDS --- */
.theory-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
  gap: 2rem; 
  margin: 4rem 0; 
}

.theory-card { 
  background: rgba(255, 255, 255, 0.03); 
  padding: clamp(1.5rem, 4vw, 3rem); 
  border-radius: clamp(20px, 4vw, 32px); 
  border: 1px solid rgba(255, 255, 255, 0.08); 
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.theory-card:hover { 
  transform: translateY(-5px);
  border-color: rgba(14, 165, 233, 0.3);
  background: rgba(255, 255, 255, 0.05);
}

.theory-card h3, .theory-card h4 { 
  color: var(--primary); 
  font-size: clamp(1.3rem, 3vw, 1.6rem); 
  margin-bottom: 1.2rem; 
  font-family: 'Playfair Display', serif; 
}

.theory-card p { color: var(--text-muted); font-size: 1.05rem; }

/* --- INTERactive AREAs --- */
.interaction-area { 
  background: #ffffff; 
  color: #1e293b; 
  padding: clamp(2rem, 5vw, 4rem) clamp(1.2rem, 4vw, 3rem); 
  border-radius: clamp(24px, 5vw, 48px); 
  margin-top: 3rem;
  box-shadow: 0 30px 60px rgba(0,0,0,0.3);
}

.interaction-area h3 { 
  font-size: clamp(1.4rem, 4vw, 1.8rem); 
  margin-bottom: 1.8rem; 
  border-left: 6px solid var(--primary); 
  padding-left: 1.2rem; 
}

.tour-btn { 
  background: #f1f5f9; 
  border: 2px solid #e2e8f0; 
  padding: 0.9rem 1.4rem; 
  border-radius: 14px; 
  font-weight: 700; 
  cursor: pointer; 
  color: #475569; 
  transition: all 0.2s ease;
  font-size: 0.95rem;
}
.tour-btn:hover { background: #e2e8f0; border-color: #cbd5e1; color: var(--bg-dark); }
.tour-btn:active { transform: scale(0.96); }

/* Inputs Optimized for Touch & Mobile Zoom (Font-size 16px+) */
#login-sim input, #post-title-sim, #post-content-sim { 
  width: 100%;
  background: #f8fafc; 
  border: 2px solid #e2e8f0; 
  border-radius: 12px; 
  padding: 1.1rem; 
  font-size: 1rem; /* Critical for iOS to prevent zoom */
  margin-bottom: 1rem; 
  font-family: inherit;
  transition: border-color 0.2s;
}

#login-sim input:focus, #post-title-sim:focus, #post-content-sim:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.check-item { 
  display: flex; 
  align-items: center; 
  gap: 1.2rem; 
  background: #f8fafc; 
  border: 2px solid #e2e8f0; 
  padding: 1.2rem 1.5rem; 
  border-radius: 18px; 
  margin-bottom: 1rem; 
  cursor: pointer; 
  font-weight: 700; 
  transition: all 0.2s;
}
.check-item:hover { background: #f1f5f9; border-color: #cbd5e1; }
.check-item input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--primary); }

.publish-btn-big { 
  width: 100%; 
  padding: 1.2rem; 
  font-size: clamp(1.1rem, 3vw, 1.4rem); 
  font-weight: 800; 
  border: none; 
  border-radius: 100px; 
  background: #94a3b8; 
  color: white; 
  cursor: not-allowed; 
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  margin-top: 1.5rem; 
}
.publish-btn-big:not([disabled]) { 
  background: var(--secondary); 
  cursor: pointer; 
  box-shadow: 0 10px 30px rgba(0, 115, 170, 0.4); 
}
.publish-btn-big:not([disabled]):active { transform: scale(0.97); }

/* --- MEDIA & IFRAMES --- */
.tutorial-image-container { 
  width: 100%; 
  border-radius: clamp(20px, 4vw, 32px); 
  overflow: hidden; 
  border: 1px solid rgba(255, 255, 255, 0.1); 
  background: var(--bg-darker); 
  margin-bottom: 3rem; 
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.tutorial-image-container img { width: 100%; height: auto; display: block; object-fit: cover; }

.video-container {
  position: relative;
  width: 100%;
  max-width: 315px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* --- CTA BUTTON --- */
.cta-btn {
  background: var(--primary);
  color: white;
  padding: 1.2rem 2.5rem;
  border-radius: 100px;
  border: none;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.3);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.cta-btn:hover { background: #0c91d1; transform: translateY(-3px); box-shadow: 0 15px 40px rgba(14, 165, 233, 0.5); }

/* --- RESPONSIVE BREAKPOINTS --- */

/* Laptops & Small Desktops */
@media (max-width: 1200px) {
  :root { --sidebar-width: 280px; }
  .content-container { max-width: 850px; }
}

/* Tablets (Portrait & Landscape) */
@media (max-width: 1024px) {
  nav#sidebar { 
    transform: translateX(-105%); 
    box-shadow: none; 
    width: 300px;
  }
  nav#sidebar.open { 
    transform: translateX(0); 
    box-shadow: 20px 0 60px rgba(0,0,0,0.8);
  }
  
  #main-wrapper { margin-left: 0; }
  #mobile-toggle { display: flex; }
  
  .hero-home { min-height: 60vh; }
}

/* Large Smartphones */
@media (max-width: 768px) {
  .mission-grid { gap: 2.5rem !important; }
  .hero-content h1 { line-height: 1.2; }
  .interaction-area { margin-top: 2rem; }
  
  #modulo3 .interaction-area > div {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
}

/* Small Smartphones (iPhone SE, etc.) */
@media (max-width: 480px) {
  html { font-size: 15px; }
  .content-container { padding: 3rem 1.2rem; }
  .hero-small { padding-top: 7rem; }
  
  .theory-card { padding: 1.8rem 1.2rem; }
  .interaction-area { padding: 2rem 1rem; border-radius: 20px; }
  
  .tour-btn { width: 100%; margin: 5px 0; text-align: center; }
  
  .sub-nav { margin-left: 1rem; }
  
  .video-container { 
    max-width: 100%; 
    border-radius: 12px;
  }
  
  .cta-btn { width: 100%; justify-content: center; }
}

/* Landscape Mode for Small Devices */
@media (max-height: 500px) and (orientation: landscape) {
  nav#sidebar { padding-top: 1rem; }
  .hero-home { min-height: 100vh; }
  .hero-small { padding-top: 4rem; }
}
