/*
Theme Name: Tema-Db
Theme URI: https://example.com/tema-db
Author: Your Name
Description: Tema WordPress ultraleggero, mobile-first, con colori personalizzabili e hero dinamico.
Version: 1.0.0
License: GPL v2 or later
Text Domain: tema-db
*/

/* ========================================
   CSS Variables (sovrascritte dal Customizer)
   ======================================== */
:root {
  --fl-primary: #2563eb;
  --fl-secondary: #0f172a;
  --fl-accent: #f59e0b;
  --fl-bg: #ffffff;
  --fl-surface: #f8fafc;
  --fl-text: #1e293b;
  --fl-text-muted: #64748b;
  --fl-border: #e2e8f0;
  --fl-radius: 0.5rem;
  --fl-shadow: 0 1px 3px rgba(0,0,0,0.1);
  --fl-font: system-ui, -apple-system, sans-serif;
  --fl-font-heading: var(--fl-font);
  --fl-container: 1200px;
  --fl-gap: 1.5rem;
}

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

html { 
  font-size: 100%; 
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--fl-font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fl-text);
  background: var(--fl-bg);
}

img, video, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--fl-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--fl-font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--fl-secondary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

/* ========================================
   Layout
   ======================================== */
.fl-container {
  width: 100%;
  max-width: var(--fl-container);
  margin: 0 auto;
  padding: 0 var(--fl-gap);
}

.fl-section {
  padding: clamp(3rem, 8vw, 6rem) 0;
}

/* ========================================
   Header
   ======================================== */
.fl-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--fl-bg);
  border-bottom: 1px solid var(--fl-border);
  transition: background 0.3s, box-shadow 0.3s;
}

.header-static .fl-header {
  position: relative;
}

.header-transparent .fl-header {
  position: absolute;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom: none;
}

.header-transparent .fl-header .fl-logo a,
.header-transparent .fl-header .fl-nav a {
  color: #fff;
}

.header-transparent .fl-header .fl-menu-toggle span {
  background: #fff;
}

.header-transparent .fl-header.is-scrolled {
  position: fixed;
  background: var(--fl-bg);
  border-bottom: 1px solid var(--fl-border);
}

.header-transparent .fl-header.is-scrolled .fl-logo a,
.header-transparent .fl-header.is-scrolled .fl-nav a {
  color: var(--fl-secondary);
}

.header-transparent .fl-header.is-scrolled .fl-menu-toggle span {
  background: var(--fl-secondary);
}

.fl-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.fl-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fl-secondary);
}

.fl-logo img {
  height: 2.5rem;
  width: auto;
}

/* Navigation */
.fl-nav { display: none; }

.fl-nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.fl-nav a {
  color: var(--fl-text);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.2s;
}

.fl-nav a:hover { color: var(--fl-primary); text-decoration: none; }

/* Mobile Menu Toggle */
.fl-menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.fl-menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--fl-secondary);
  transition: 0.2s;
}

/* Mobile Nav */
.fl-mobile-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--fl-bg);
  border-bottom: 1px solid var(--fl-border);
  padding: var(--fl-gap);
}

.fl-mobile-nav.is-open { display: block; }

.fl-mobile-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fl-mobile-nav a {
  display: block;
  padding: 0.5rem 0;
  color: var(--fl-text);
  font-weight: 500;
}

@media (min-width: 768px) {
  .fl-nav { display: block; }
  .fl-menu-toggle { display: none; }
  .fl-mobile-nav { display: none !important; }
}

/* ========================================
   Hero
   ======================================== */
.fl-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 70vh;
  padding: clamp(4rem, 10vw, 8rem) 0;
  background: var(--fl-surface);
  overflow: hidden;
}

.fl-hero--has-image {
  background-size: cover;
  background-position: center;
  color: #fff;
}

.fl-hero--has-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.7), rgba(0,0,0,0.4));
}

.fl-hero--has-image .fl-hero__content { position: relative; z-index: 1; }
.fl-hero--has-image h1,
.fl-hero--has-image p { color: inherit; }

.fl-hero__content {
  max-width: 640px;
}

.fl-hero__title {
  margin-bottom: 1rem;
}

.fl-hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--fl-text-muted);
  margin-bottom: 2rem;
}

.fl-hero--has-image .fl-hero__subtitle {
  color: rgba(255,255,255,0.85);
}

/* Buttons */
.fl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--fl-radius);
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.fl-btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.fl-btn--primary {
  background: var(--fl-primary);
  color: #fff;
}

.fl-btn--primary:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.fl-btn--outline {
  background: transparent;
  border: 2px solid var(--fl-border);
  color: var(--fl-text);
}

.fl-hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ========================================
   Content
   ======================================== */
.fl-content {
  max-width: 720px;
  margin: 0 auto;
}

.fl-content p { margin-bottom: 1.5rem; }

.fl-content ul, .fl-content ol {
  margin: 0 0 1.5rem 1.5rem;
}

.fl-content blockquote {
  border-left: 4px solid var(--fl-primary);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--fl-text-muted);
}

/* ========================================
   Cards / Posts Grid
   ======================================== */
.fl-grid {
  display: grid;
  gap: var(--fl-gap);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .fl-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .fl-grid { grid-template-columns: repeat(3, 1fr); }
  .fl-grid--blog { grid-template-columns: repeat(var(--fl-blog-columns, 3), 1fr); }
}

/* Blog with Sidebar */
.has-sidebar .fl-blog-wrapper {
  display: grid;
  gap: 3rem;
}

@media (min-width: 1024px) {
  .has-sidebar .fl-blog-wrapper {
    grid-template-columns: 1fr 300px;
  }
  .has-sidebar .fl-grid--blog {
    grid-template-columns: repeat(2, 1fr);
  }
}

.fl-sidebar .widget {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--fl-surface);
  border-radius: var(--fl-radius);
}

.fl-sidebar .widget-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--fl-primary);
}

/* List Layout */
.blog-layout-list .fl-grid {
  display: flex;
  flex-direction: column;
  gap: var(--fl-gap);
}

.blog-layout-list .fl-card {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .blog-layout-list .fl-card {
    grid-template-columns: 280px 1fr;
  }
  
  .blog-layout-list .fl-card__image {
    aspect-ratio: 4/3;
    height: 100%;
  }
}

.blog-layout-list .fl-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.blog-layout-list .fl-card__title {
  font-size: 1.25rem;
}

.blog-layout-list .fl-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fl-card {
  background: var(--fl-bg);
  border: 1px solid var(--fl-border);
  border-radius: var(--fl-radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.fl-card:hover {
  box-shadow: var(--fl-shadow);
  transform: translateY(-2px);
}

.fl-card__image {
  aspect-ratio: 16/9;
  object-fit: cover;
  width: 100%;
}

.fl-card__body {
  padding: 1.25rem;
}

.fl-card__cat {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fl-primary);
  margin-bottom: 0.5rem;
}

.fl-card__title {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.fl-card__excerpt {
  font-size: 0.9375rem;
  color: var(--fl-text-muted);
}

.fl-card__meta {
  font-size: 0.8125rem;
  color: var(--fl-text-muted);
  margin-top: 1rem;
}

/* ========================================
   Footer
   ======================================== */
.fl-footer {
  background: var(--fl-secondary);
  color: rgba(255,255,255,0.7);
  padding: 3rem 0 1.5rem;
}

.fl-footer a { color: rgba(255,255,255,0.9); }

.fl-footer__grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .fl-footer__grid { grid-template-columns: repeat(3, 1fr); }
}

.fl-footer__title {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 1rem;
}

.fl-footer ul { list-style: none; }
.fl-footer li { margin-bottom: 0.5rem; }

.fl-footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  font-size: 0.875rem;
  text-align: center;
}

/* ========================================
   Utilities
   ======================================== */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

.alignwide { max-width: calc(var(--fl-container) + 4rem); margin-left: auto; margin-right: auto; }
.alignfull { width: 100vw; margin-left: calc(50% - 50vw); }

/* ========================================
   Landing Page Template
   ======================================== */
.fl-landing {
  --landing-dark: #0f172a;
  --landing-darker: #020617;
  --landing-light: #f8fafc;
  --landing-muted: #94a3b8;
}

/* Hero */
.landing-hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem var(--fl-gap) 4rem;
  background: linear-gradient(135deg, var(--landing-dark) 0%, var(--landing-darker) 100%);
  color: #fff;
  overflow: hidden;
}

.landing-hero--has-bg {
  background-size: cover;
  background-position: center;
}

.landing-hero--has-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.75), rgba(2, 6, 23, 0.85));
  z-index: 0;
}

.landing-hero__overlay {
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="0.5"/></svg>');
  background-size: 200px;
  opacity: 0.5;
}

.landing-hero__content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.landing-hero__icon {
  width: 140px;
  height: 140px;
  border-radius: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  margin-bottom: 2rem;
}

.landing-hero__title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 800;
  margin: 0 0 1rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.landing-hero__tagline {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 300;
  margin: 0 0 1.5rem;
  color: rgba(255,255,255,0.9);
}

.landing-hero__description {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--landing-muted);
  margin: 0 0 2.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.landing-hero__buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.store-badge {
  transition: transform 0.2s, opacity 0.2s;
  display: block;
}

.store-badge:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* Features - LIGHT SECTION */
.landing-features {
  padding: clamp(4rem, 10vw, 7rem) var(--fl-gap);
  background: var(--landing-light);
  color: var(--landing-dark);
}

.landing-section__title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  text-align: center;
  margin: 0 0 3rem;
  font-weight: 700;
}

.landing-features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.feature-card {
  background: #fff;
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: transform 0.3s, box-shadow 0.3s;
  border: 1px solid rgba(0,0,0,0.05);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.feature-card__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-card h3 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
  color: var(--fl-primary);
}

.feature-card p {
  font-size: 0.9375rem;
  color: var(--landing-muted);
  margin: 0;
  line-height: 1.6;
}

/* Screenshots - DARK SECTION */
.landing-screenshots {
  padding: clamp(4rem, 10vw, 7rem) var(--fl-gap);
  background: var(--landing-dark);
  color: #fff;
}

.landing-screenshots .landing-section__title {
  color: #fff;
}

.landing-screenshots__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.screenshot-item {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  transition: transform 0.3s;
}

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

.screenshot-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* CTA - GRADIENT SECTION */
.landing-cta {
  padding: clamp(4rem, 10vw, 6rem) var(--fl-gap);
  background: linear-gradient(135deg, var(--fl-primary) 0%, #1d4ed8 100%);
  color: #fff;
  text-align: center;
}

.landing-cta h2 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  margin: 0 0 1rem;
  color: #fff;
}

.landing-cta p {
  font-size: 1.125rem;
  margin: 0 0 2rem;
  opacity: 0.9;
}

/* Hide header border on landing */
.page-template-template-landing .fl-header {
  border-bottom: none;
  background: transparent;
}

.page-template-template-landing .fl-header .fl-logo a,
.page-template-template-landing .fl-header .fl-nav a {
  color: #fff;
}

.page-template-template-landing .fl-header .fl-menu-toggle span {
  background: #fff;
}

.page-template-template-landing .fl-header.is-scrolled {
  background: var(--fl-bg);
  border-bottom: 1px solid var(--fl-border);
}

.page-template-template-landing .fl-header.is-scrolled .fl-logo a,
.page-template-template-landing .fl-header.is-scrolled .fl-nav a {
  color: var(--fl-secondary);
}

.page-template-template-landing .fl-header.is-scrolled .fl-menu-toggle span {
  background: var(--fl-secondary);
}
