/* Article Page Styles */

/* ============================================================================
   Layout
   ============================================================================ */

.article-page {
    min-height: 100vh;
    padding-top: 80px;
    background: var(--bg-primary);
}

.article-layout {
    display: block;
    max-width: 100%;
    margin: 0;
    padding: 3rem 2rem;
    padding-right: 380px; /* Space for fixed sidebar */
}

/* ============================================================================
   Main Article - Centered
   ============================================================================ */

.article-main {
    max-width: 750px;
    margin: 0 auto;
}

/* Header */
.article-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.article-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.article-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s var(--transition-smooth);
}

.article-breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.article-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.article-date,
.article-reading-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.article-date svg,
.article-reading-time svg {
    opacity: 0.7;
}

.article-category-badge {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 0.35rem 0.875rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.article-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all 0.3s var(--transition-smooth);
}

.article-tag:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: rgba(74, 158, 255, 0.3);
}

/* ============================================================================
   Article Content
   ============================================================================ */

.article-content {
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--text-secondary);
}

.article-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.article-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s var(--transition-smooth);
}

.article-content a:hover {
    border-bottom-color: var(--accent);
}

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

.article-content em {
    font-style: italic;
}

/* Lists */
.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.article-content ul li::marker {
    color: var(--accent);
}

.article-content ol li::marker {
    color: var(--accent);
    font-weight: 600;
}

/* Code */
.article-content code {
    background: var(--bg-tertiary);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

.article-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.article-content pre code {
    background: none;
    color: var(--text-secondary);
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Blockquotes */
.article-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

.article-content th,
.article-content td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.article-content th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-content tr:hover td {
    background: var(--bg-secondary);
}

/* Images */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
}

/* Horizontal Rule */
.article-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 3rem 0;
}

/* ============================================================================
   Interactive Modules
   ============================================================================ */

.article-module {
    margin: 2.5rem 0;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.article-module-placeholder {
    padding: 3rem;
    text-align: center;
}

.module-placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

.module-placeholder-content svg {
    opacity: 0.5;
}

.module-placeholder-content span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================================================
   Editorial block — press-law responsibility + AI disclosure
   ============================================================================ */

.article-editorial {
    margin-top: 3rem;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.article-editorial p { margin: 0; }
.article-editorial p + p { margin-top: 6px; }
.article-editorial strong { color: var(--text-primary); }
.article-editorial-ai {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================================================
   Article Footer
   ============================================================================ */

.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.article-share {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.article-share span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--transition-smooth);
}

.share-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.share-btn.copied {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}

.back-to-blog {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: all 0.3s var(--transition-smooth);
}

.back-to-blog:hover {
    background: var(--accent-glow);
    border-color: rgba(74, 158, 255, 0.3);
    color: var(--accent);
}

.back-to-blog svg {
    transition: transform 0.3s var(--transition-smooth);
}

.back-to-blog:hover svg {
    transform: translateX(-4px);
}

/* ============================================================================
   Sidebar - Fixed Right with Animations
   ============================================================================ */

.article-sidebar {
    position: fixed;
    right: 24px;
    top: 50%;
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 0.5rem;
    z-index: 100;
    /* Use top offset for centering instead of transform */
    margin-top: -200px; /* Will be adjusted by JS for parallax */
    opacity: 1;
    transition: margin-top 0.1s ease-out;
}

.article-sidebar::-webkit-scrollbar {
    width: 4px;
}

.article-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.sidebar-section {
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-slider {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Sidebar Cards */
.sidebar-card {
    display: block;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Subtle glow effect on hover */
.sidebar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(74, 158, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.sidebar-card:hover::before {
    opacity: 1;
}

.sidebar-card:hover {
    border-color: rgba(74, 158, 255, 0.4);
    transform: translateX(6px) scale(1.02);
    box-shadow: 0 8px 30px -10px rgba(74, 158, 255, 0.25),
                0 4px 15px -8px rgba(0, 0, 0, 0.4);
}

.sidebar-card.featured {
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(74, 158, 255, 0.05) 100%);
    border-color: rgba(74, 158, 255, 0.2);
}

.sidebar-card.featured:hover {
    border-color: rgba(74, 158, 255, 0.4);
}

.sidebar-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-card-category {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-card-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
    transition: color 0.3s var(--transition-smooth);
}

.sidebar-card-excerpt {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.sidebar-card:hover .sidebar-card-title {
    color: var(--accent);
}

.sidebar-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1400px) {
    .article-sidebar {
        width: 280px;
    }

    .article-layout {
        padding-right: 320px;
    }
}

@media (max-width: 1100px) {
    /* Hide sidebar on smaller screens, show article full width */
    .article-layout {
        padding: 2rem;
        padding-right: 2rem;
    }

    .article-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .article-page {
        padding-top: 70px;
    }

    .article-layout {
        padding: 1.5rem;
    }

    .article-main {
        max-width: 100%;
    }

    .article-title {
        font-size: 1.75rem;
    }

    .article-meta {
        gap: 1rem;
    }

    .article-content {
        font-size: 1rem;
    }

    .article-content h2 {
        font-size: 1.4rem;
    }

    .article-content h3 {
        font-size: 1.15rem;
    }

    .article-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .article-sidebar {
        display: none;
    }

    .sidebar-slider {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .article-layout {
        padding: 1rem;
    }

    .article-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .article-breadcrumb {
        font-size: 0.8rem;
    }

    .article-title {
        font-size: 1.5rem;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .article-content pre {
        padding: 1rem;
        margin: 1.5rem -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .share-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .share-btn {
        flex: 1;
    }

    .back-to-blog {
        width: 100%;
        justify-content: center;
    }
}

/* ───────────────────────────────────────────────
   Centered article layout (sidebar moved below)
   ─────────────────────────────────────────────── */
.article-page-centered {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.article-main-centered {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

/* Hide legacy sidebar if it ever renders */
.article-sidebar { display: none !important; }

/* More Articles section below the article */
.more-articles {
  max-width: 1100px;
  margin: 60px auto 0;
  padding-top: 40px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.more-articles-heading {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--text, #e8eef5);
}

.more-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

@media (max-width: 640px) {
  .article-page-centered { padding: 24px 16px 40px; }
  .more-articles { padding-top: 28px; margin-top: 40px; }
  .more-articles-heading { font-size: 19px; }
  .more-articles-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ───────────────────────────────────────────────
   Article entrance animations
   ─────────────────────────────────────────────── */

/* Hero/Header smooth intro */
.article-page-centered {
  padding-top: 60px;
}
.article-header {
  opacity: 0;
  transform: translateY(18px);
  animation: articleHeaderIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.05s forwards;
}
.article-header .article-title {
  opacity: 0;
  transform: translateY(12px);
  animation: articleHeaderIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}
.article-header .article-meta,
.article-header .article-tags {
  opacity: 0;
  animation: articleFade 0.5s ease 0.35s forwards;
}

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

/* Article content blocks fade+slide on scroll */
.article-content > p,
.article-content > h2,
.article-content > h3,
.article-content > ul,
.article-content > ol,
.article-content > blockquote,
.article-content > pre,
.article-content > table,
.article-content > img,
.article-content > figure {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.article-content > .revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Headings slightly different motion */
.article-content > h2.revealed,
.article-content > h3.revealed {
  transition-duration: 0.6s;
}

/* More-articles cards reveal on scroll with stagger */
.more-articles .sidebar-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.more-articles.revealed .sidebar-card {
  opacity: 1;
  transform: translateY(0);
}
.more-articles.revealed .sidebar-card:nth-child(1) { transition-delay: 0.05s; }
.more-articles.revealed .sidebar-card:nth-child(2) { transition-delay: 0.15s; }
.more-articles.revealed .sidebar-card:nth-child(3) { transition-delay: 0.25s; }
.more-articles.revealed .sidebar-card:nth-child(4) { transition-delay: 0.35s; }

.more-articles-heading {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.more-articles.revealed .more-articles-heading {
  opacity: 1;
  transform: translateY(0);
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .article-header,
  .article-header .article-title,
  .article-header .article-meta,
  .article-header .article-tags,
  .article-content > *,
  .more-articles .sidebar-card,
  .more-articles-heading {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}

/* Hero image inside article */
.article-hero-image {
  margin: 28px 0 36px;
  opacity: 0;
  transform: translateY(14px);
  animation: articleHeaderIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}
.article-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}
.article-hero-credit {
  font-size: 12px;
  color: var(--text-muted, #7a8ba0);
  margin-top: 10px;
  text-align: right;
  font-style: italic;
}
@media (max-width: 640px) {
  .article-hero-image { margin: 20px 0 28px; }
  .article-hero-image img { border-radius: 10px; }
}
