/*
Theme Name:  Tema Elegante
Theme URI:   https://example.com
Author:      Il tuo nome
Description: Tema WordPress minimale ed elegante. Header con navbar in overlay, post in evidenza con immagine e titolo sovrapposto, griglia responsive di post.
Version:     1.0
License:     GNU General Public License v2 or later
Text Domain: tema-elegante
*/

/* =========================================================
   CSS CUSTOM PROPERTIES
   ========================================================= */
:root {
  --color-bg:          #F7F5F2;
  --color-surface:     #FFFFFF;
  --color-text:        #1C1C1C;
  --color-text-muted:  #6B6460;
  --color-accent:      #C9A96E;
  --color-accent-dark: #A8854A;
  --color-overlay:     rgba(0, 0, 0, 0.48);
  --color-overlay-light: rgba(0, 0, 0, 0.25);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Jost', Helvetica, Arial, sans-serif;

  --nav-height:   84px;
  --radius:       4px;
  --transition:   0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  2rem;
  --space-lg:  4rem;
  --space-xl:  7rem;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul { list-style: none; }

/* =========================================================
   TYPOGRAPHY
   ========================================================= */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.7rem); }

p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.8;
}

/* =========================================================
   LAYOUT UTILITIES
   ========================================================= */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* =========================================================
   SITE HEADER
   ========================================================= */
.site-header {
  position: relative;
  width: 100%;
  /* Altezza proporzionale a foto panoramiche molto orizzontali.
     clamp: minimo 180px, ideale 22vw, massimo 340px.
     Modifica il valore centrale per adattarti alla tua foto. */
  height: clamp(140px, 15vw, 240px);
  display: flex;
  flex-direction: column;
  background-color: #2A2420; /* fallback colore */
  background-size: cover;
  background-position: left center; /* ancora al bordo superiore della foto */
  background-repeat: no-repeat;
  overflow: hidden;
}

/* Gradiente scuro in basso per leggibilità eventuale testo */
.site-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.30) 0%,
    rgba(0,0,0,0.05) 40%,
    rgba(0,0,0,0.0)  100%
  );
  pointer-events: none;
  z-index: 0;
}

/* =========================================================
   NAVBAR (overlay sull'header)
   ========================================================= */
.site-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  transition: background var(--transition), box-shadow var(--transition);
}

/* Navbar scrollata: aggiunge sfondo */
.site-nav.scrolled {
  position: fixed;
  background: rgba(28, 24, 20, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 24px rgba(0,0,0,0.18);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Logo */
.site-logo a {
  display: flex;
  align-items: center;
}

.site-logo img {
  height: 44px;
  width: auto;
}

.site-logo .logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Menu desktop */
.primary-menu {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.primary-menu li a {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.88);
  padding: 4px 0;
  position: relative;
  transition: color var(--transition);
}

.primary-menu li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width var(--transition);
}

.primary-menu li a:hover {
  color: #ffffff;
}

.primary-menu li a:hover::after,
.primary-menu li.current-menu-item a::after {
  width: 100%;
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  gap: 6px;
  z-index: 200;
}

.nav-toggle span {
  display: block;
  width: 26px;
  height: 1.5px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition), width var(--transition);
  transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
  width: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Menu mobile a tendina */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(20, 17, 14, 0.97);
  backdrop-filter: blur(16px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.mobile-menu.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.mobile-menu li a {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: rgba(255,255,255,0.90);
  letter-spacing: 0.03em;
  transition: color var(--transition);
}

.mobile-menu li a:hover {
  color: var(--color-accent);
}

/* =========================================================
   SITE MAIN
   ========================================================= */
.site-main {
  position: relative;
  padding: var(--space-xl) 0;
  background-color: var(--color-bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* Overlay leggero se c'è immagine di sfondo nel main */
.site-main.has-bg-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(247, 245, 242, 0.88);
  pointer-events: none;
  z-index: 0;
}

.site-main .container {
  position: relative;
  z-index: 1;
}

/* =========================================================
   SEZIONE: POST IN EVIDENZA
   ========================================================= */
.featured-post {
  margin-bottom: var(--space-xl);
}

.featured-post-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.featured-post-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-accent);
  opacity: 0.35;
  max-width: 80px;
}

/* Card immagine grande con titolo sovrapposto */
.featured-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border-radius: var(--radius);
  display: block;
  cursor: pointer;
}

/* Se non c'è immagine in evidenza */
.featured-card.no-image {
  aspect-ratio: auto;
  min-height: 300px;
  background-color: #2A2420;
}

.featured-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.featured-card:hover .featured-card__image {
  transform: scale(1.04);
}

.featured-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.75) 0%,
    rgba(0, 0, 0, 0.30) 45%,
    rgba(0, 0, 0, 0.05) 100%
  );
  z-index: 1;
}

.featured-card__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-lg) var(--space-md);
  z-index: 2;
}

.featured-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 0.75rem;
}

.featured-card__cat {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.featured-card__date {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
}

.featured-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.8rem);
  font-weight: 500;
  color: #ffffff;
  line-height: 1.15;
  max-width: 780px;
  transition: color var(--transition);
}

.featured-card:hover .featured-card__title {
  color: var(--color-accent);
}

/* =========================================================
   SEZIONE: GRIGLIA POSTS
   ========================================================= */
.posts-grid-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.posts-grid-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.2;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/* Responsive breakpoints griglia */
@media (max-width: 1100px) {
  .posts-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .posts-grid { grid-template-columns: 1fr; }
}

/* Post Card */
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  transition: transform var(--transition), box-shadow var(--transition);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

/* Immagine card con titolo sovrapposto */
.post-card__image-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.post-card__image-wrap.no-image {
  background: linear-gradient(135deg, #2A2420 0%, #4A3828 100%);
}

.post-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover .post-card__image {
  transform: scale(1.06);
}

.post-card__image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(0, 0, 0, 0.0) 55%
  );
  z-index: 1;
}

.post-card__title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  font-weight: 500;
  color: #ffffff;
  line-height: 1.25;
  transition: color var(--transition);
}

.post-card:hover .post-card__title {
  color: var(--color-accent);
}

/* Body card: excerpt */
.post-card__body {
  padding: 1rem 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-card__cat {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.post-card__date {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.post-card__excerpt {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Nessun post trovato */
.no-posts {
  text-align: center;
  padding: var(--space-xl) 0;
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-size: 1.5rem;
}

/* =========================================================
   SITE FOOTER
   ========================================================= */
.site-footer {
  position: relative;
  background-color: #1C1917; /* fallback colore */
  background-size: cover;
  background-position: center;
  color: rgba(255,255,255,0.75);
  padding: var(--space-lg) 0;
}

/* Overlay scuro se c'è immagine */
.site-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  pointer-events: none;
  z-index: 0;
}

.footer-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: #ffffff;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.footer-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: var(--space-sm);
}

.footer-menu li a {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  transition: color var(--transition);
}

.footer-menu li a:hover {
  color: var(--color-accent);
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

.footer-copy a {
  color: var(--color-accent);
}

/* =========================================================
   RESPONSIVE GLOBAL
   ========================================================= */
@media (max-width: 768px) {
  :root {
    --nav-height: 70px;
    --space-lg:   3rem;
    --space-xl:   4rem;
  }

  .nav-toggle { display: flex; }
  .primary-menu { display: none; }

  .site-header {
    height: clamp(130px, 28vw, 220px);
  }

  .featured-card {
    aspect-ratio: 4 / 3;
  }

  .featured-card__body {
    padding: var(--space-md) var(--space-sm);
  }
}

@media (max-width: 480px) {
  .featured-card {
    aspect-ratio: 3 / 4;
  }
}

/* =========================================================
   ACCESSIBILITÀ
   ========================================================= */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}
