﻿/* ==========================================================================
   NotedPace - Article Reading Experience Styles
   Reading progress, sticky TOC, typography, callouts, author box, comments
   ========================================================================== */

/* Article page uses a wider canvas than the global container so the prose
   has room to breathe on desktop while staying centred and readable. */
.main-content > article > .container {
  max-width: 1400px;
}

/* Reading Progress Bar */
.reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 999;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-brand);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.7);
  transition: width 0.1s linear;
}

/* Article Hero Header */
.article-header {
  padding: 3rem 0 2rem;
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.article-header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.article-page-title {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.article-page-subtitle {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 780px;
}

.article-author-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.article-author-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-highlight);
  object-fit: cover;
}

.article-author-details {
  text-align: left;
}

.article-author-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.article-date-row {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Main Featured Image */
.article-featured-media {
  max-width: 1160px;
  margin: 1.5rem auto 3.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.article-featured-img {
  width: 100%;
  max-height: 580px;
  object-fit: cover;
}

/* Article Reading Layout (Sticky TOC + Content) */
.article-layout-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 56px;
  gap: 2.75rem;
  max-width: 1320px;
  margin: 0 auto;
  position: relative;
}

/* Left Sidebar - Table of Contents */
.article-sidebar-left {
  position: relative;
}

.sticky-toc {
  position: sticky;
  top: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(12px);
}

.toc-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toc-item a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: block;
  padding: 0.2rem 0 0.2rem 0.5rem;
  border-left: 2px solid transparent;
  transition: all var(--transition-fast);
}

.toc-item a:hover, .toc-item.active a {
  color: var(--accent-purple);
  border-left-color: var(--accent-purple);
  padding-left: 0.75rem;
}

.toc-item.h3-item {
  margin-left: 0.75rem;
  font-size: 0.825rem;
}

/* Middle - Rich Article Content Typography */
.article-prose {
  font-size: 1.15rem;
  line-height: 1.85;
  color: #cbd5e1;
  overflow-wrap: break-word;
}

.article-prose .lead {
  font-size: 1.35rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-weight: 400;
  margin-bottom: 2rem;
}

.article-prose h2 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.75rem 0 1.25rem;
  scroll-margin-top: 100px;
  position: relative;
}

.article-prose h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 1rem;
  scroll-margin-top: 100px;
}

.article-prose p {
  margin-bottom: 1.65rem;
}

.article-prose strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-prose em {
  font-style: italic;
  color: #e2e8f0;
}

.article-prose ul, .article-prose ol {
  margin: 1.5rem 0 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.article-prose ul {
  list-style: disc;
}

.article-prose ol {
  list-style: decimal;
}

.article-prose li {
  padding-left: 0.35rem;
}

/* Luxury Blockquotes */
.article-quote {
  margin: 2.5rem 0;
  padding: 1.75rem 2rem;
  background: var(--bg-card);
  border-left: 4px solid var(--accent-purple);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.article-quote p {
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.article-quote cite {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: normal;
  font-weight: 600;
}

/* Callout Box */
.article-callout {
  display: flex;
  gap: 1.25rem;
  margin: 2.25rem 0;
  padding: 1.5rem;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
}

.callout-icon {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.callout-body h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #c4b5fd;
  margin-bottom: 0.4rem;
}

.callout-body p {
  font-size: 0.95rem;
  margin-bottom: 0;
  color: #cbd5e1;
}

/* Tags in Article Bottom */
.article-tags-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.article-tag-item {
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.article-tag-item:hover {
  background: var(--accent-purple);
  color: #ffffff;
}

/* Right Floating Action / Share Bar */
.article-share-bar {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  height: fit-content;
}

.share-action-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.share-action-btn:hover {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-purple);
}

.share-action-btn.active {
  background: var(--accent-purple);
  color: #ffffff;
}

/* Author Bio Card Bottom */
.author-bio-card {
  margin: 3.5rem 0;
  padding: 2.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.author-bio-avatar {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--border-highlight);
  flex-shrink: 0;
}

.author-bio-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.author-bio-info .author-bio-role {
  font-size: 0.85rem;
  color: var(--accent-purple);
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.author-bio-info p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Previous & Next Article Navigation */
.article-pagination-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 3.5rem 0;
}

.nav-article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all var(--transition-normal);
}

.nav-article-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.nav-article-label {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-article-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Comments Section */
.comments-section {
  margin: 4rem 0 2rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-subtle);
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.comments-count-badge {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.comment-form {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.comment-input, .comment-textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 0.925rem;
}

.comment-textarea {
  min-height: 110px;
  resize: vertical;
}

.comment-input:focus, .comment-textarea:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.comment-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  gap: 1.25rem;
}

.comment-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

.comment-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.comment-author-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.comment-date {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Back to Top Floating Button */
.back-to-top-btn {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: var(--accent-purple);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-purple);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: all var(--transition-normal);
}

.back-to-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

/* ==========================================================================
   Desktop reading layout — keep the full three-column article layout on all
   desktop widths (including common laptop widths affected by display scaling)
   so single posts never fall back to the narrow mobile column.
   ========================================================================== */
@media (min-width: 901px) {
  .article-layout-grid {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 56px;
    gap: 2.75rem;
    max-width: 1320px;
    margin: 0 auto;
  }
  .article-sidebar-left {
    display: block;
  }
  .article-share-bar {
    position: sticky;
    top: 120px;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 0;
  }
  .article-header {
    max-width: 1000px;
  }
  .article-page-title {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
  }
  .article-featured-media {
    max-width: 1160px;
  }
  .article-pagination-nav {
    grid-template-columns: 1fr 1fr;
  }
  .author-bio-card {
    flex-direction: row;
    text-align: left;
    padding: 2.25rem;
  }
  .comment-form-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Wide desktop: give the prose a comfortable, wider reading measure */
@media (min-width: 1200px) {
  .article-layout-grid {
    gap: 3rem;
    max-width: 1360px;
  }
  .article-prose {
    font-size: 1.16rem;
    line-height: 1.9;
  }
}

/* Articles with no h2/h3 headings have their TOC sidebar removed by
   article-page.js. Swap in a centred, spacer-left layout so the prose keeps a
   comfortable reading measure (and lines up with the article header) instead
   of being squeezed into the 240px TOC slot or stretched edge-to-edge. */
@media (min-width: 901px) {
  .article-layout-grid:not(:has(.article-sidebar-left)) {
    grid-template-columns: 56px minmax(0, 1000px) 56px;
    justify-content: center;
  }
  .article-layout-grid:not(:has(.article-sidebar-left)) .article-prose {
    grid-column: 2;
  }
  .article-layout-grid:not(:has(.article-sidebar-left)) .article-share-bar {
    grid-column: 3;
  }
}


/* Responsive Overrides for Article (tablet & below) */
@media (max-width: 900px) {
  .article-layout-grid {
    grid-template-columns: minmax(0, 1fr) 60px;
    gap: 2rem;
  }
  .article-sidebar-left {
    display: none;
  }
}

@media (max-width: 768px) {
  .article-layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .article-share-bar {
    position: static;
    flex-direction: row;
    justify-content: center;
    margin-top: 2rem;
  }
  .article-pagination-nav {
    grid-template-columns: 1fr;
  }
  .author-bio-card {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }
  .comment-form-row {
    grid-template-columns: 1fr;
  }
}