/**
 * RootLabs — Stili pagine interne (blog, singolo articolo, pagine)
 */

/* ===========================================================
   HERO PAGINE INTERNE (mini-hero con titolo)
   =========================================================== */
.rl-page-hero {
  background: var(--rl-surface);
  border-bottom: 1px solid var(--rl-border-soft);
  padding: calc(70px + var(--rl-sp-8)) var(--rl-sp-3) var(--rl-sp-6);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.rl-page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(0,212,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.rl-page-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: var(--rl-sp-2);
}

.rl-page-hero p {
  font-size: 1.1rem;
  max-width: 600px;
  margin-inline: auto;
}

/* ===========================================================
   LAYOUT BLOG LIST
   =========================================================== */
.rl-blog-list {
  padding-top: var(--rl-sp-6);
  padding-bottom: var(--rl-sp-12);
  background: var(--rl-bg);
}

.rl-blog-list .rl-grid--3 {
  gap: var(--rl-sp-4);
}

/* Paginazione */
.rl-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: var(--rl-sp-6);
}

.rl-pagination a,
.rl-pagination span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--rl-r-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--rl-t-fast) var(--rl-ease);
}

.rl-pagination a {
  background: var(--rl-surface);
  border: 1px solid var(--rl-border-soft);
  color: var(--rl-text-sub);
}

.rl-pagination a:hover {
  border-color: var(--rl-border);
  color: var(--rl-primary);
}

.rl-pagination .current {
  background: var(--rl-primary);
  color: var(--rl-bg);
  border: 1px solid var(--rl-primary);
}

/* ===========================================================
   SINGOLO ARTICOLO
   =========================================================== */
.rl-single {
  padding-top: var(--rl-sp-6);
  padding-bottom: var(--rl-sp-12);
  background: var(--rl-bg);
}

.rl-single__inner {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--rl-sp-6);
  align-items: start;
}

.rl-single__article {
  background: var(--rl-surface);
  border: 1px solid var(--rl-border-soft);
  border-radius: var(--rl-r-lg);
  padding: var(--rl-sp-6);
}

.rl-single__meta {
  display: flex;
  gap: var(--rl-sp-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--rl-sp-4);
  font-size: 0.85rem;
  color: var(--rl-text-muted);
  font-family: 'Roboto Mono', monospace;
}

.rl-single__cat {
  padding: 4px 12px;
  border-radius: var(--rl-r-full);
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--rl-primary);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Contenuto dell'articolo */
.rl-content h2, .rl-content h3, .rl-content h4 {
  margin-top: var(--rl-sp-4);
  margin-bottom: var(--rl-sp-2);
}

.rl-content p {
  margin-bottom: var(--rl-sp-2);
  color: var(--rl-text-sub);
  line-height: 1.8;
}

.rl-content ul, .rl-content ol {
  padding-left: var(--rl-sp-4);
  margin-bottom: var(--rl-sp-2);
}

.rl-content li {
  color: var(--rl-text-sub);
  margin-bottom: 6px;
  line-height: 1.7;
}

.rl-content a {
  color: var(--rl-primary);
  text-decoration: underline;
  text-decoration-color: rgba(0,212,255,0.3);
}

.rl-content a:hover {
  text-decoration-color: var(--rl-primary);
}

.rl-content code {
  background: var(--rl-surface-2);
  border: 1px solid var(--rl-border-soft);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.85em;
  color: var(--rl-primary);
  font-family: 'Roboto Mono', monospace;
}

.rl-content pre {
  background: var(--rl-surface-2);
  border: 1px solid var(--rl-border-soft);
  border-radius: var(--rl-r-md);
  padding: var(--rl-sp-3);
  overflow-x: auto;
  margin-block: var(--rl-sp-3);
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  color: var(--rl-text-sub);
  line-height: 1.7;
}

.rl-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.rl-content blockquote {
  border-left: 3px solid var(--rl-primary);
  padding-left: var(--rl-sp-3);
  margin-block: var(--rl-sp-3);
  font-style: italic;
  color: var(--rl-text-sub);
}

.rl-content img {
  max-width: 100%;
  border-radius: var(--rl-r-md);
  border: 1px solid var(--rl-border-soft);
}

/* Sidebar */
.rl-single__sidebar {
  position: sticky;
  top: calc(70px + var(--rl-sp-3));
  display: flex;
  flex-direction: column;
  gap: var(--rl-sp-3);
}

.rl-sidebar-card {
  background: var(--rl-surface);
  border: 1px solid var(--rl-border-soft);
  border-radius: var(--rl-r-md);
  padding: var(--rl-sp-3);
}

.rl-sidebar-card h4 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rl-text-sub);
  margin-bottom: var(--rl-sp-2);
  padding-bottom: var(--rl-sp-2);
  border-bottom: 1px solid var(--rl-border-soft);
}

.rl-sidebar-post {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-block: 10px;
  border-bottom: 1px solid var(--rl-border-soft);
  text-decoration: none;
}

.rl-sidebar-post:last-child { border-bottom: none; }

.rl-sidebar-post__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--rl-r-sm);
  background: var(--rl-surface-2);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.rl-sidebar-post__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rl-text);
  line-height: 1.4;
  transition: color var(--rl-t-fast) var(--rl-ease);
}

.rl-sidebar-post:hover .rl-sidebar-post__title {
  color: var(--rl-primary);
}

.rl-sidebar-post__date {
  font-size: 0.75rem;
  color: var(--rl-text-muted);
  margin-top: 3px;
  font-family: 'Roboto Mono', monospace;
}

/* ===========================================================
   PAGINA GENERICA
   =========================================================== */
.rl-page-content {
  padding-top: var(--rl-sp-6);
  padding-bottom: var(--rl-sp-12);
  background: var(--rl-bg);
}

.rl-page-content__body {
  background: var(--rl-surface);
  border: 1px solid var(--rl-border-soft);
  border-radius: var(--rl-r-lg);
  padding: var(--rl-sp-6);
  max-width: 800px;
  margin-inline: auto;
}

/* ===========================================================
   OVERFLOW PREVENTION — pagine interne
   =========================================================== */
.rl-content * {
  max-width: 100%;
}

.rl-content pre {
  white-space: pre-wrap;
  word-break: break-all;
}

.rl-content table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===========================================================
   RESPONSIVE PAGINE INTERNE
   =========================================================== */
@media (max-width: 900px) {
  .rl-single__inner {
    grid-template-columns: 1fr;
  }

  .rl-single__sidebar {
    position: static;
    /* Sidebar va DOPO l'articolo su mobile */
    order: 2;
  }

  .rl-single__article {
    order: 1;
  }
}

@media (max-width: 768px) {
  .rl-single__article {
    padding: var(--rl-sp-3);
  }

  /* mini-hero: altezza ridotta */
  .rl-page-hero {
    padding-top: calc(70px + var(--rl-sp-6));
    padding-bottom: var(--rl-sp-4);
  }

  .rl-page-hero h1 {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
  }

  /* Paginazione più compatta */
  .rl-pagination a,
  .rl-pagination span {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .rl-single__article {
    padding: var(--rl-sp-2);
    border-radius: var(--rl-r-md);
  }

  .rl-single__meta {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.78rem;
  }

  /* Prev/next post: colonna su mobile stretto */
  .rl-single__article > div[style*="flex"] {
    flex-direction: column;
  }

  .rl-single__article > div[style*="flex"] .rl-btn {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
  }

  .rl-content h2 { font-size: 1.3rem; }
  .rl-content h3 { font-size: 1.1rem; }

  /* Blog list: 1 colonna garantita su stretto */
  .rl-blog-list .rl-grid--3 {
    grid-template-columns: 1fr;
  }

  .rl-post-card__thumb {
    height: 160px;
  }
}

/* ===========================================================
   SAFE AREA INSETS — pagine interne
   =========================================================== */
@media (max-width: 480px) {
  .rl-single {
    padding-bottom: max(var(--rl-sp-8), env(safe-area-inset-bottom));
  }
}

/* ===========================================================
   PREFERS-REDUCED-MOTION — pagine interne
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  .rl-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .rl-post-card,
  .rl-sidebar-post {
    transition: none !important;
  }
}
