/* ─────────────────────────────────────────────────────────────────
   reading-ux.css — Mejoras de lectura para análisis de amvelazquez.com
   1. Barra de progreso de lectura
   2. Botón flotante "volver arriba"
   3. Anchor links en headings
   4. Print stylesheet
   6. Sección de compartir
   ────────────────────────────────────────────────────────────────── */


/* ── 1. BARRA DE PROGRESO ─────────────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: transparent;
  z-index: 200;
  pointer-events: none;
}
.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7dd3fc 0%, #1d4e7a 100%);
  transition: width .12s ease-out;
  box-shadow: 0 0 8px rgba(125,211,252,0.6);
}


/* ── 2. BOTÓN VOLVER ARRIBA ───────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  background: #1a3a5c;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s, background .15s;
  pointer-events: none;
  z-index: 150;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 1.2rem;
  line-height: 1;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover { background: #15314e; }
.back-to-top:focus-visible {
  outline: 2px solid #1d4e7a;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  .back-to-top {
    bottom: 1rem; right: 1rem;
    width: 2.5rem; height: 2.5rem;
    font-size: 1.1rem;
  }
}


/* ── 3. ANCHOR LINKS EN HEADINGS ──────────────────────────────── */
.anchor-link {
  display: inline-block;
  margin-left: .35em;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  font-size: .65em;
  color: #1d4e7a;
  opacity: 0;
  text-decoration: none;
  transition: opacity .15s, color .15s;
  cursor: pointer;
  vertical-align: middle;
  user-select: none;
  letter-spacing: 0;
}
.section-title:hover .anchor-link,
h2:hover > .anchor-link,
.anchor-link:focus-visible {
  opacity: .55;
}
.anchor-link:hover {
  opacity: 1 !important;
  color: #1d4e7a;
}
.anchor-link.copied {
  opacity: 1 !important;
  color: #16a34a;
}
@media (hover: none) {
  /* Mobile: siempre visible */
  .anchor-link { opacity: .35; }
}


/* ── 6. SECCIÓN DE COMPARTIR ─────────────────────────────────── */
.share-section {
  margin: 2.5rem 0 .5rem;
  padding: 1.25rem 1.5rem;
  background: #f7f3ed;
  border: 1px solid #e3dbd0;
  border-radius: .85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}
.share-section-text {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: .92rem;
  color: #18120a;
  font-weight: 600;
  margin: 0;
}
.share-buttons {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: .8rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid #e3dbd0;
  color: #4a3f35;
  padding: .5rem .9rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
  line-height: 1;
}
.share-btn:hover {
  background: #f7f3ed;
  border-color: #1d4e7a;
  color: #1d4e7a;
  transform: translateY(-1px);
}
.share-btn:focus-visible {
  outline: 2px solid #1d4e7a;
  outline-offset: 3px;
}
.share-btn.copied {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}


/* ── 4. PRINT STYLESHEET ──────────────────────────────────────── */
@media print {

  /* Ocultar elementos no esenciales */
  .site-nav,
  .nav-bar,
  .article-nav,
  .stats-row,
  .skip-link,
  .reading-progress,
  .back-to-top,
  .anchor-link,
  .anav-mobile-btn,
  .anav-mobile-menu,
  .anav-desktop,
  .related-grid,
  #relacionados,
  .bio-wrap,
  footer,
  .cta-volver,
  .contact-pill,
  .share-section,
  audio, video,
  iframe,
  script {
    display: none !important;
  }

  /* Abrir todos los acordeones para impresión */
  .accordion-body {
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
  }
  .accordion-icon { display: none !important; }
  .accordion-btn {
    cursor: default !important;
    background: transparent !important;
    padding: .3rem 0 !important;
    pointer-events: none !important;
    border-bottom: 1pt solid #ccc !important;
  }
  .accordion-item {
    border: none !important;
    margin-bottom: .4cm !important;
    page-break-inside: avoid;
  }
  .accordion-inner {
    padding: .4rem 0 0 !important;
  }

  /* Layout & tipografía */
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.55;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  main, .article-body {
    max-width: 100% !important;
    padding: 0 1cm !important;
    margin: 0 !important;
  }
  .page-header {
    background: #fff !important;
    color: #000 !important;
    padding: 0 1cm 1cm !important;
    border-bottom: 2pt solid #000 !important;
    margin-bottom: .8cm;
  }
  .page-header::before { display: none !important; }
  .page-header h1 {
    color: #000 !important;
    font-size: 22pt !important;
    line-height: 1.15;
    margin: 0 0 .3cm;
  }
  .page-header p {
    color: #333 !important;
    font-size: 11pt;
  }
  .article-section {
    page-break-inside: avoid;
    border: none !important;
    padding: .3cm 0 !important;
    scroll-margin-top: 0 !important;
  }
  .section-title {
    color: #000 !important;
    page-break-after: avoid;
    font-size: 14pt !important;
    margin: .5cm 0 .25cm;
  }
  .section-number {
    color: #555 !important;
    font-size: 8pt !important;
  }
  .section-intro {
    color: #444 !important;
    border-left: 2pt solid #ccc !important;
  }
  h1, h2, h3 { page-break-after: avoid; }
  p { orphans: 3; widows: 3; }

  /* Boxes y badges siguen siendo legibles */
  .summary-list,
  .highlight-box,
  .valoracion-block,
  .actor-card,
  .comp-card,
  .hallazgo-card {
    page-break-inside: avoid;
    background: #fff !important;
    border: 1pt solid #aaa !important;
    color: #000 !important;
  }
  .highlight-box, .valoracion-block {
    border-left: 3pt solid #555 !important;
  }
  .summary-list { border-left: 3pt solid #555 !important; }

  /* Hallazgo cards (oscuras) → invertir para print */
  .hallazgo-card {
    background: #fff !important;
    color: #000 !important;
    border-left: 3pt solid #888 !important;
    font-style: italic;
  }

  /* Veredictos en blanco y negro */
  .veredicto {
    border: 1pt solid #000 !important;
    background: #fff !important;
    color: #000 !important;
    font-weight: 700;
  }

  /* Enlaces */
  a {
    color: #000 !important;
    text-decoration: underline;
  }
  a[href^="http"]:not([href*="amvelazquez.com"]):after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #555;
    word-break: break-all;
    font-weight: normal;
  }

  /* Footer impreso */
  body::after {
    content: "Fuente: amvelazquez.com — Análisis publicado por Ariel Martín Velázquez · Impreso desde el sitio";
    display: block;
    margin: 1.2cm 1cm 0;
    padding-top: .5cm;
    border-top: 1pt solid #aaa;
    font-size: 8pt;
    color: #666;
    font-style: italic;
    text-align: center;
  }
}
