/*
Theme Name: Angelone Child
Template: neoocular
Description: Child theme Ottica Angelone — Performance + UX Blog Patch v4
Version: 1.0.4
*/

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  --ao-navy:       #1a2340;
  --ao-navy-light: #2b3a5c;
  --ao-gold:       #c8973a;
  --ao-gold-light: #e8b96a;
  --ao-cream:      #faf8f4;
  --ao-white:      #ffffff;
  --ao-gray-100:   #f4f2ee;
  --ao-gray-200:   #e8e5df;
  --ao-gray-400:   #a09a90;
  --ao-gray-600:   #6b6560;
  --ao-text:       #1e1b17;
  --ao-radius:     10px;
  --ao-radius-lg:  18px;
  --ao-shadow-sm:  0 2px 8px rgba(26,35,64,.07);
  --ao-shadow-md:  0 6px 24px rgba(26,35,64,.12);
  --ao-font-body:  'Georgia', 'Times New Roman', serif;
  --ao-font-ui:    'system-ui', -apple-system, sans-serif;
  --ao-max-prose:  700px;
  --ao-transition: 0.22s cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   2. FIX CRITICO: NeoOcular usa inline-block sul singolo post
   Questo causa lo spazio bianco enorme a destra dell'articolo.
   ============================================================ */
.single-post .qodef-blog.qodef--single,
.single-post article.qodef-blog-item,
.single-post .qodef-blog-item .qodef-e-inner {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  vertical-align: unset !important;
}

/* ============================================================
   3. TIPOGRAFIA EDITORIALE — selettori NeoOcular reali
   ============================================================ */
.single-post .qodef-e-text {
  font-family: var(--ao-font-body);
  font-size: 18px;
  line-height: 1.78;
  color: var(--ao-text);
  -webkit-font-smoothing: antialiased;
}

/* H1 titolo post */
.single-post .qodef-m-title,
.single-post .entry-title {
  font-family: var(--ao-font-ui);
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ao-navy);
  letter-spacing: -0.02em;
  margin-bottom: 0.5em;
}

/* H2 dentro articolo */
.single-post .qodef-e-text h2 {
  font-family: var(--ao-font-ui);
  font-size: clamp(19px, 2.4vw, 27px);
  font-weight: 700;
  color: var(--ao-navy);
  margin-top: 2.6em;
  margin-bottom: 0.65em;
  padding-bottom: 0.4em;
  border-bottom: 2.5px solid var(--ao-gold);
  letter-spacing: -0.01em;
}

/* H3 dentro articolo */
.single-post .qodef-e-text h3 {
  font-family: var(--ao-font-ui);
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 600;
  color: var(--ao-navy-light);
  margin-top: 1.8em;
  margin-bottom: 0.45em;
}

/* Paragrafi */
.single-post .qodef-e-text p {
  margin-bottom: 1.4em;
  max-width: var(--ao-max-prose);
}

/* Strong */
.single-post .qodef-e-text strong {
  color: var(--ao-navy);
  font-weight: 700;
}

/* Liste */
.single-post .qodef-e-text ul {
  list-style: none;
  padding-left: 0;
}

.single-post .qodef-e-text ul li {
  padding: 3px 0 3px 22px;
  position: relative;
  margin-bottom: 0.5em;
  max-width: var(--ao-max-prose);
}

.single-post .qodef-e-text ul li::before {
  content: '';
  position: absolute;
  left: 0; top: 12px;
  width: 6px; height: 6px;
  background: var(--ao-gold);
  border-radius: 50%;
}

.single-post .qodef-e-text ol li {
  margin-bottom: 0.5em;
  max-width: var(--ao-max-prose);
  padding-left: 4px;
}

/* ============================================================
   4. IMMAGINE FEATURED — NeoOcular: .qodef-e-image
   ============================================================ */
.single-post .qodef-e-image {
  display: block;
  width: 100%;
  margin-bottom: 2rem;
  border-radius: var(--ao-radius-lg);
  overflow: hidden;
}

.single-post .qodef-e-image img {
  width: 100%;
  height: auto !important;
  aspect-ratio: unset !important;
  display: block;
  object-fit: unset !important;
}

/* ============================================================
   5. META INFO — data, categoria, tempo lettura
   ============================================================ */
.single-post .qodef-post-info,
.single-post .qodef-e-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 20px;
  font-family: var(--ao-font-ui);
  font-size: 13px;
  color: var(--ao-gray-600);
}

.single-post .qodef-post-info a,
.single-post .qodef-e-info a {
  color: var(--ao-gold);
  text-decoration: none;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  background: rgba(200,151,58,.1);
  border-radius: 20px;
  transition: background var(--ao-transition);
}

.single-post .qodef-post-info a:hover {
  background: rgba(200,151,58,.2);
}

.ao-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--ao-font-ui);
  font-size: 12px;
  color: var(--ao-gray-600);
  font-weight: 500;
}

/* ============================================================
   6. TABLE OF CONTENTS
   ============================================================ */
.ao-toc {
  background: var(--ao-cream);
  border: 1.5px solid var(--ao-gray-200);
  border-left: 4px solid var(--ao-gold);
  border-radius: 0 var(--ao-radius) var(--ao-radius) 0;
  padding: 18px 22px;
  margin: 2em 0 2.2em;
  max-width: var(--ao-max-prose);
  font-family: var(--ao-font-ui);
}

.ao-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.ao-toc-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--ao-navy);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0;
}

.ao-toc-toggle {
  width: 20px; height: 20px;
  background: var(--ao-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ao-toc-toggle svg {
  width: 9px; height: 9px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: transform var(--ao-transition);
}

.ao-toc.collapsed .ao-toc-toggle svg { transform: rotate(-90deg); }

.ao-toc-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  max-height: 600px;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
}

.ao-toc.collapsed .ao-toc-list {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.ao-toc-list li { margin: 0; padding: 0; }
.ao-toc-list li::before { display: none !important; }

.ao-toc-list a {
  display: block;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ao-navy-light);
  text-decoration: none;
  transition: color var(--ao-transition), padding-left var(--ao-transition);
}

.ao-toc-list a:hover,
.ao-toc-list a.ao-toc-active {
  color: var(--ao-gold);
  padding-left: 5px;
}

.ao-toc-list a.ao-toc-active { font-weight: 700; }

.ao-toc-list .ao-toc-h3 a {
  font-size: 13px;
  font-weight: 400;
  color: var(--ao-gray-600);
  padding-left: 14px;
}

/* ============================================================
   7. KEY POINTS BOX
   ============================================================ */
.ao-key-points {
  background: var(--ao-navy);
  color: var(--ao-white);
  border-radius: var(--ao-radius-lg);
  padding: 22px 26px;
  margin: 1.4em 0 2em;
  max-width: var(--ao-max-prose);
  position: relative;
  overflow: hidden;
}

.ao-key-points::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(200,151,58,.13);
  pointer-events: none;
}

.ao-key-points-title {
  font-family: var(--ao-font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ao-gold-light);
  margin: 0 0 10px;
}

.ao-key-points ul {
  margin: 0; padding: 0; list-style: none;
}

.ao-key-points ul li {
  padding: 3px 0 3px 18px;
  position: relative;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255,255,255,.92);
  max-width: 100%;
}

.ao-key-points ul li::before {
  content: '';
  position: absolute;
  left: 0; top: 11px;
  width: 6px; height: 6px;
  background: var(--ao-gold);
  border-radius: 50%;
}

/* ============================================================
   8. CTA BOX
   ============================================================ */
.ao-cta-box {
  background: var(--ao-cream);
  border: 1.5px solid var(--ao-gray-200);
  border-radius: var(--ao-radius-lg);
  padding: 24px 28px;
  margin: 2.6em 0;
  max-width: var(--ao-max-prose);
  text-align: center;
}

.ao-cta-box p {
  font-family: var(--ao-font-ui) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  color: var(--ao-navy) !important;
  margin-bottom: 14px !important;
  max-width: 100% !important;
}

.ao-cta-btn {
  display: inline-block;
  background: var(--ao-navy);
  color: #fff !important;
  font-family: var(--ao-font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 12px 24px;
  border-radius: 50px;
  text-decoration: none !important;
  transition: background var(--ao-transition), transform var(--ao-transition);
}

.ao-cta-btn:hover {
  background: var(--ao-gold);
  transform: translateY(-2px);
}

/* ============================================================
   9. PROGRESS BAR DI LETTURA
   ============================================================ */
.ao-progress-bar {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: var(--ao-gold);
  z-index: 99999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

/* ============================================================
   10. ANIMAZIONI SCROLL REVEAL
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .single-post .qodef-e-text h2,
  .single-post .qodef-e-text h3,
  .single-post .qodef-e-text > p,
  .single-post .qodef-e-text > ul,
  .ao-key-points,
  .ao-cta-box {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s ease;
  }

  .single-post .qodef-e-text h2.ao-visible,
  .single-post .qodef-e-text h3.ao-visible,
  .single-post .qodef-e-text > p.ao-visible,
  .single-post .qodef-e-text > ul.ao-visible,
  .ao-key-points.ao-visible,
  .ao-cta-box.ao-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   11. ARCHIVIO BLOG — CARD GRID (selettori NeoOcular)
   ============================================================ */
.blog .qodef-blog-list-holder,
.archive .qodef-blog-list-holder {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  align-items: start;
}

/* Fix inline-block anche sulle card archivio */
.blog .qodef-blog.qodef--list article,
.archive .qodef-blog.qodef--list article,
.blog .qodef-grid-inner article,
.archive .qodef-grid-inner article {
  display: flex !important;
  flex-direction: column;
  background: var(--ao-white);
  border: 1px solid var(--ao-gray-200);
  border-radius: var(--ao-radius-lg);
  overflow: hidden;
  box-shadow: var(--ao-shadow-sm);
  transition: box-shadow var(--ao-transition), transform var(--ao-transition);
  height: 100%;
}

.blog .qodef-grid-inner article:hover,
.archive .qodef-grid-inner article:hover {
  box-shadow: var(--ao-shadow-md);
  transform: translateY(-4px);
}

/* Immagine card blog — aspect-ratio SOLO qui */
.blog .qodef-e-image,
.archive .qodef-e-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  flex-shrink: 0;
}

.blog .qodef-e-image img,
.archive .qodef-e-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.blog article:hover .qodef-e-image img,
.archive article:hover .qodef-e-image img {
  transform: scale(1.04);
}

/* Contenuto card */
.blog article .qodef-e-content,
.archive article .qodef-e-content {
  padding: 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Titolo card */
.blog article .qodef-e-title,
.archive article .qodef-e-title {
  font-family: var(--ao-font-ui);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ao-navy);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.blog article .qodef-e-title a,
.archive article .qodef-e-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ao-transition);
}

.blog article .qodef-e-title a:hover,
.archive article .qodef-e-title a:hover {
  color: var(--ao-gold);
}

/* Excerpt card */
.blog article .qodef-e-excerpt,
.archive article .qodef-e-excerpt {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ao-gray-600);
  font-family: var(--ao-font-ui);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Link "Leggi tutto" */
.blog article .qodef-m-btn,
.archive article .qodef-m-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ao-gray-200);
  font-family: var(--ao-font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--ao-navy);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color var(--ao-transition), gap var(--ao-transition);
}

.blog article .qodef-m-btn:hover,
.archive article .qodef-m-btn:hover {
  color: var(--ao-gold);
  gap: 8px;
}

/* ============================================================
   12. RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .single-post .qodef-e-text { font-size: 17px; }
  .single-post .qodef-e-text h2 { font-size: 20px; margin-top: 1.8em; }
  .ao-key-points, .ao-cta-box { padding: 18px 20px; }
  .blog .qodef-blog-list-holder,
  .archive .qodef-blog-list-holder { grid-template-columns: 1fr; gap: 16px; }
}

/* ============================================================
   13. UTILITY
   ============================================================ */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
