/*
Theme Name: Chiara Zaffina
Theme URI: https://chiarazaffina.it
Author: Pietro Pace
Description: Tema duale Clinica/Poetica per Chiara Zaffina
Version: 1.1
Text Domain: chiara-zaffina
*/

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ─── FONT VARS (override da PHP via wp_head) ─── */
:root {
  --font-clinica: 'Inter', sans-serif;
  --font-poetica: 'Playfair Display', serif;
}

/* ─── BODY MODES ─── */
body {
  transition: background 0.8s ease, color 0.8s ease;
  overflow-x: hidden;
}
body.mode-clinica {
  background: #fafafa;
  color: #111;
  font-family: var(--font-clinica);
}
body.mode-poetica {
  background: #f5efe7;
  color: #3d2f24;
  font-family: var(--font-poetica);
}

/* ─── INTRO ─── */
#cz-intro {
  position: fixed; inset: 0;
  background: #0e0e0e; color: #fff;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 1000;
  transition: opacity 0.8s ease;
}
#cz-intro h1 {
  font-family: var(--font-clinica);
  font-size: clamp(32px, 6vw, 56px);
  letter-spacing: -1px; font-weight: 300;
  opacity: 0; transform: translateY(20px);
  animation: fadeUp 1s forwards 0.2s;
}
#cz-intro p {
  margin-top: 16px;
  font-family: var(--font-poetica);
  font-style: italic;
  opacity: 0; transform: translateY(20px);
  animation: fadeUp 1s forwards 0.5s;
}
#cz-enter {
  margin-top: 48px; cursor: pointer;
  font-family: var(--font-clinica);
  font-size: 12px; letter-spacing: 3px; text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 12px 32px; color: #fff; background: transparent;
  transition: border-color 0.3s, background 0.3s;
  opacity: 0; transform: translateY(20px);
  animation: fadeUp 1s forwards 0.9s;
}
#cz-enter:hover { background: rgba(255,255,255,0.08); border-color: #fff; }

/* Logo nell'intro */
.cz-intro-logo {
  width: 120px; height: 120px; object-fit: cover;
  opacity: 0; transform: translateY(20px);
  animation: fadeUp 1s forwards 0.1s;
  margin-bottom: 24px;
}

/* Logo nel footer */
.cz-footer-logo { display: block; }
.cz-footer-logo img {
  width: 56px; height: 56px; object-fit: contain;
  transition: opacity 0.3s; opacity: 0.8;
}
.cz-footer-logo:hover img { opacity: 1; }

/* ─── SPLIT ─── */
#cz-split {
  display: none; position: fixed; inset: 0; z-index: 999;
}
.cz-panel {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: flex 1.2s cubic-bezier(.65,.05,.36,1);
}
.cz-panel:hover { flex: 1.15; }
.cz-panel.left  { background: #fafafa; color: #111; font-family: var(--font-clinica); }
.cz-panel.right { background: #f5efe7; color: #3d2f24; font-family: var(--font-poetica); }
.cz-panel span  { font-size: clamp(18px, 3vw, 28px); letter-spacing: 4px; text-transform: uppercase; }
.cz-panel small { margin-top: 12px; font-size: 14px; opacity: 0.5; }
.cz-panel.left small { font-family: var(--font-poetica); font-style: italic; }
.cz-divider {
  width: 1px; background: #ccc;
  position: absolute; top: 15%; bottom: 15%; left: 50%; pointer-events: none;
}

/* ─── NAVBAR ─── */
#cz-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 20px 40px;
  display: flex; align-items: center; justify-content: space-between;
}
body.mode-clinica #cz-nav {
  border-bottom: 1px solid #eee;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
}
body.mode-poetica #cz-nav {
  border-bottom: 1px solid #ddd7cc;
  background: rgba(245,239,231,0.92);
  backdrop-filter: blur(8px);
}

.cz-logo {
  font-size: 15px; letter-spacing: 2px; text-transform: uppercase;
  text-decoration: none; color: inherit; font-weight: 400;
}
.cz-nav-links { display: flex; gap: 32px; align-items: center; list-style: none; }
.cz-nav-links a {
  text-decoration: none; color: inherit;
  font-size: 13px; letter-spacing: 1px; opacity: 0.7;
  transition: opacity 0.2s;
}
.cz-nav-links a:hover { opacity: 1; }

/* Voci nav condizionali per modalità */
body.mode-clinica .nav-only-poetica { display: none; }
body.mode-poetica .nav-only-clinica { display: none; }

/* ─── TOGGLE ─── */
.cz-toggle { display: flex; gap: 2px; padding: 2px; position: relative; }
.cz-toggle button {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 8px 14px;
  transition: border-color 0.6s ease, color 0.6s ease, opacity 0.6s ease;
  opacity: 0.4;
}
body.mode-clinica .cz-toggle button       { color: #111; border-color: transparent; }
body.mode-clinica .cz-toggle button.active { opacity: 1; border-color: #111; }
body.mode-poetica .cz-toggle button       { color: #3d2f24; border-color: transparent; }
body.mode-poetica .cz-toggle button.active { opacity: 1; border-color: #3d2f24; }

/* ─── HAMBURGER MENU ─── */
.cz-nav-mobile { display: none; align-items: center; gap: 16px; }
.cz-menu-burger {
  display: flex; flex-direction: column; gap: 6px;
  border: none; background: transparent; cursor: pointer;
  padding: 10px; transition: opacity 0.6s ease;
}
.cz-menu-burger span {
  display: block; width: 22px; height: 1px;
  transition: transform 0.7s cubic-bezier(.65,.05,.36,1),
              opacity 0.5s ease,
              width 0.7s cubic-bezier(.65,.05,.36,1);
}
body.mode-clinica .cz-menu-burger span { background: #111; }
body.mode-poetica .cz-menu-burger span { background: #3d2f24; }

/* Hamburger attivo: linee che si fondono in un singolo tratto */
.cz-menu-burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); width: 22px; }
.cz-menu-burger.active span:nth-child(2) { opacity: 0; width: 0; }
.cz-menu-burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 22px; }

/* ─── MOBILE MENU ─── */
.cz-mobile-menu {
  position: fixed; top: 64px; left: 0; right: 0;
  z-index: 99; opacity: 0; transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.4,0,.2,1);
}
body.mode-clinica .cz-mobile-menu {
  background: rgba(250,250,250,0.96);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  backdrop-filter: blur(10px);
}
body.mode-poetica .cz-mobile-menu {
  background: rgba(245,239,231,0.96);
  border-bottom: 1px solid rgba(61,47,36,0.12);
  backdrop-filter: blur(10px);
}
.cz-mobile-menu.open {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}

.cz-mobile-menu-links {
  list-style: none; display: flex; flex-direction: column;
  padding: 16px 24px;
}
.cz-mobile-menu-links li {
  border-bottom: 1px solid;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.cz-mobile-menu.open .cz-mobile-menu-links li {
  opacity: 1;
  transform: translateY(0);
}
.cz-mobile-menu.open .cz-mobile-menu-links li:nth-child(1) { transition-delay: 0.1s; }
.cz-mobile-menu.open .cz-mobile-menu-links li:nth-child(2) { transition-delay: 0.18s; }
.cz-mobile-menu.open .cz-mobile-menu-links li:nth-child(3) { transition-delay: 0.26s; }
.cz-mobile-menu.open .cz-mobile-menu-links li:nth-child(4) { transition-delay: 0.34s; }
.cz-mobile-menu.open .cz-mobile-menu-links li:nth-child(5) { transition-delay: 0.42s; }
body.mode-clinica .cz-mobile-menu-links li { border-color: rgba(0,0,0,0.06); }
body.mode-poetica .cz-mobile-menu-links li { border-color: rgba(61,47,36,0.1); }
.cz-mobile-menu-links li:last-child { border-bottom: none; }
.cz-mobile-menu-links a {
  display: block; padding: 18px 0;
  text-decoration: none; color: inherit;
  font-size: 15px; letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: opacity 0.4s ease, padding-left 0.4s ease;
  opacity: 0.65;
}
.cz-mobile-menu-links a:hover,
.cz-mobile-menu-links a:active {
  opacity: 1;
  padding-left: 6px;
}

/* ─── MAIN ─── */
#cz-main { display: none; }

/* ─── HERO ─── */
.cz-hero { min-height: 100vh; display: flex; align-items: center; padding: 0 40px; max-width: 900px; margin: 0 auto; }
.cz-hero-inner { padding-top: 80px; }
.cz-hero h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 300; line-height: 1.1; }
body.mode-poetica .cz-hero h1 { font-style: italic; }
.cz-hero .cz-subtitle { margin-top: 24px; font-size: clamp(16px, 2vw, 20px); line-height: 1.7; max-width: 540px; opacity: 0.75; }

/* ─── SECTIONS ─── */
.cz-section { max-width: 900px; margin: 0 auto; padding: 100px 40px; border-top: 1px solid; }
body.mode-clinica .cz-section { border-color: #eee; }
body.mode-poetica .cz-section { border-color: #ddd7cc; }
.cz-section h2 { font-size: clamp(22px, 3vw, 32px); font-weight: 400; margin-bottom: 32px; letter-spacing: -0.5px; }
body.mode-poetica .cz-section h2 { font-style: italic; }
.cz-section p { font-size: 17px; line-height: 1.8; max-width: 620px; opacity: 0.85; }
.cz-section p + p { margin-top: 16px; }

/* Sezioni visibili solo per modalità */
body.mode-clinica .cz-only-poetica { display: none !important; }
body.mode-poetica .cz-only-clinica { display: none !important; }

/* Post visibili solo nella modalità corretta */
body.mode-clinica .cz-post-poetica { display: none; }
body.mode-poetica .cz-post-clinica { display: none; }

/* ─── BLOG GRID ─── */
.cz-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 40px; margin-top: 48px; }
.cz-post-card { cursor: pointer; border-bottom: 1px solid; padding-bottom: 32px; }
body.mode-clinica .cz-post-card { border-color: #eee; }
body.mode-poetica .cz-post-card { border-color: #ddd7cc; }
.cz-post-card a { text-decoration: none; color: inherit; }
.cz-post-card .cz-card-cat { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.45; margin-bottom: 10px; display: block; }
.cz-post-card h3 { font-size: 20px; font-weight: 400; line-height: 1.3; margin-bottom: 10px; }
body.mode-poetica .cz-post-card h3 { font-style: italic; }
.cz-post-card .cz-card-excerpt { 
  font-size: 14px; 
  line-height: 1.7; 
  opacity: 0.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.cz-post-card .cz-card-date { font-size: 12px; opacity: 0.4; margin-top: 14px; display: block; }

/* ─── ARTICOLI PUBBLICATI ─── */
.cz-pub-links { display: flex; flex-direction: column; gap: 16px; margin-top: 32px; }
.cz-pub-btn {
  display: flex; align-items: center; gap: 24px;
  text-decoration: none; color: inherit;
  border: 1px solid; padding: 20px 28px;
  transition: all 0.25s;
}
body.mode-clinica .cz-pub-btn { border-color: #ddd; }
body.mode-clinica .cz-pub-btn:hover { border-color: #111; background: #f9f9f9; }
.cz-pub-icon { font-size: 20px; opacity: 0.4; flex-shrink: 0; transition: opacity 0.25s; }
.cz-pub-btn:hover .cz-pub-icon { opacity: 1; }
.cz-pub-info { display: flex; flex-direction: column; gap: 4px; }
.cz-pub-info strong { font-size: 15px; font-weight: 500; }
.cz-pub-info small { font-size: 13px; opacity: 0.5; }

/* ─── BOOK ─── */
.cz-book { display: flex; gap: 48px; align-items: flex-start; margin-top: 48px; }
.cz-book-cover { flex-shrink: 0; width: 140px; height: 200px; background: #0e0e0e; display: flex; align-items: center; justify-content: center; }
body.mode-poetica .cz-book-cover { background: #c9b89a; }
.cz-book-cover img { width: 100%; height: 100%; object-fit: cover; }
.cz-book-info h3 { font-size: 24px; font-weight: 400; margin-bottom: 12px; }
body.mode-poetica .cz-book-info h3 { font-style: italic; }
.cz-book-info p { font-size: 15px; line-height: 1.8; opacity: 0.75; }

/* ─── SINGLE ─── */
.cz-single { max-width: 680px; margin: 0 auto; padding: 140px 40px 100px; }
.cz-single h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 400; line-height: 1.2; margin-bottom: 32px; }
body.mode-poetica .cz-single h1 { font-style: italic; }
.cz-single .cz-post-meta { font-size: 12px; letter-spacing: 1px; opacity: 0.4; margin-bottom: 48px; text-transform: uppercase; display: block; }
.cz-single .cz-post-content { font-size: 18px; line-height: 1.9; }
.cz-single .cz-post-content p { margin-bottom: 1.5em; }
.cz-single .cz-post-content h2 { font-size: 22px; margin: 2em 0 0.8em; font-weight: 400; }

/* ─── SOCIAL ICONS ─── */
.cz-socials {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 32px;
}
.cz-socials a {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  padding: 14px 0;
  font-size: 15px;
  letter-spacing: 0.5px;
  opacity: 0.75;
  transition: opacity 0.5s ease, padding-left 0.5s ease;
  border-bottom: 1px solid;
}
body.mode-clinica .cz-socials a { border-color: rgba(0,0,0,0.06); }
body.mode-poetica .cz-socials a { border-color: rgba(61,47,36,0.1); }
.cz-socials a:hover {
  opacity: 1;
  padding-left: 6px;
}
.cz-socials svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* ─── FADE ─── */
.cz-fade { opacity: 0; transform: translateY(20px); transition: opacity 1.1s cubic-bezier(.4,0,.2,1), transform 1.1s cubic-bezier(.4,0,.2,1); }
.cz-fade.visible { opacity: 1; transform: translateY(0); }

/* ─── FOOTER ─── */
#cz-footer {
  max-width: 900px; margin: 0 auto; padding: 48px 40px;
  border-top: 1px solid; font-size: 13px; opacity: 0.45;
  display: flex; justify-content: space-between; align-items: center;
}
body.mode-clinica #cz-footer { border-color: #eee; }
body.mode-poetica #cz-footer { border-color: #ddd7cc; }

/* ─── RESPONSIVE ─── */
@media(max-width: 768px) {
  #cz-nav { padding: 14px 20px; }
  .cz-nav-links { display: none; }
  .cz-toggle-desktop { display: none !important; }
  .cz-nav-mobile { display: flex; }

  /* Punto 5 — toggle C/P più facile da toccare */
  .cz-toggle button { padding: 10px 14px; font-size: 12px; }

  /* Punto 3 — meno padding verticale nelle sezioni */
  .cz-section { padding-top: 64px; padding-bottom: 64px; }
  .cz-hero { min-height: 90vh; }

  /* Punto 2 — font più piccolo in modalità poetica */
  body.mode-poetica .cz-section p { font-size: 15px; }
  body.mode-poetica .cz-card-excerpt { font-size: 15px; }

  /* Punto 4 — più respiro tra le card */
  .cz-posts { gap: 32px; margin-top: 32px; }
  .cz-post-card { padding-bottom: 24px; }
  .cz-post-card h3 { font-size: 18px; }
}

/* Su desktop, nascondi il toggle mobile */
@media(min-width: 769px) {
  .cz-toggle-mobile { display: none !important; }
  .cz-nav-mobile { display: none !important; }
}

@media(max-width: 640px) {
  .cz-hero, .cz-section { padding-left: 20px; padding-right: 20px; }
  .cz-book { flex-direction: column; }
  #cz-footer { flex-direction: column; gap: 8px; text-align: center; }
}

@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
