/* ===================================
   Content Library Styles
   Purpose: Styles for Learn content library (articles, categories, filters)
   Created: February 2026
   =================================== */

/* ===================================
   Shared Page Sections
   =================================== */
.library-index-page,
.category-index-page,
.tag-index-page,
.popular-page,
.search-page {
    padding-bottom: 4rem;
}

/* ===================================
   Library Index - Command Center
   =================================== */
.library-index-page {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 14% 8%, rgba(168, 85, 247, 0.12), transparent 28rem),
        radial-gradient(circle at 82% 18%, rgba(69, 244, 255, 0.09), transparent 30rem),
        linear-gradient(180deg, #05050e 0%, #080810 40%, #05050e 100%);
}

.library-index-page::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.38;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 10%, rgba(0, 0, 0, 0.35) 62%, transparent 100%);
}

.library-index-page > * {
    position: relative;
    z-index: 1;
}

.library-hero {
    padding: clamp(2.25rem, 4vw, 3.25rem) 0 clamp(1.5rem, 2.5vw, 2rem);
}

.library-hero-shell {
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(300px, 360px);
    gap: clamp(2rem, 4vw, 4rem);
    align-items: end;
}

.library-kicker,
.library-section-kicker {
    margin: 0 0 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-secondary);
}

.library-hero-title {
    max-width: 10.8ch;
    margin: 0 0 0.9rem;
    font-family: var(--font-display);
    font-size: clamp(3.2rem, 4.35vw, 5.55rem);
    line-height: 0.94;
    letter-spacing: -0.062em;
    background-image: linear-gradient(125deg, #fff 0%, #b7a2ff 42%, #63e8ff 86%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.library-hero-subtitle {
    max-width: 52ch;
    margin: 0 0 1.25rem;
    font-size: clamp(1rem, 1.25vw, 1.16rem);
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.82);
}

.library-search-form,
.search-form-main {
    max-width: 590px;
    margin: 0;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 54px;
    background: rgba(20, 20, 32, 0.88);
    border: 1px solid rgba(168, 85, 247, 0.26);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.search-input-wrapper:focus-within {
    border-color: rgba(69, 244, 255, 0.72);
    box-shadow: 0 0 0 4px rgba(69, 244, 255, 0.11), 0 20px 60px rgba(0, 0, 0, 0.32);
    transform: translateY(-1px);
}

.search-icon {
    flex-shrink: 0;
    margin-left: 1.15rem;
    color: rgba(148, 163, 184, 0.95);
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 0.9rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder {
    color: rgba(148, 163, 184, 0.9);
}

.search-button {
    flex-shrink: 0;
    align-self: stretch;
    padding: 0.9rem 1.7rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #64dfff 100%);
    border: none;
    color: white;
    font-weight: 800;
    font-size: var(--step-0);
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.search-button:hover {
    filter: brightness(1.08);
}

.library-search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.8rem;
    max-width: 590px;
}

.library-search-chips a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0.36rem 0.68rem;
    border: 1px solid rgba(69, 244, 255, 0.18);
    border-radius: 999px;
    background: rgba(69, 244, 255, 0.055);
    color: rgba(211, 246, 255, 0.92);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.library-search-chips a:hover {
    transform: translateY(-2px);
    border-color: rgba(69, 244, 255, 0.5);
    background: rgba(69, 244, 255, 0.12);
}

.library-hero-panel {
    position: relative;
    align-self: center;
    max-width: 360px;
    padding: 0.85rem;
    border: 1px solid rgba(168, 85, 247, 0.28);
    border-radius: 20px;
    background:
        linear-gradient(145deg, rgba(26, 22, 45, 0.9), rgba(13, 18, 33, 0.88)),
        radial-gradient(circle at 80% 12%, rgba(69, 244, 255, 0.18), transparent 14rem);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.library-hero-panel::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    pointer-events: none;
}

.library-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.library-panel-grid div {
    padding: 0.7rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.035);
}

.library-panel-grid span {
    display: block;
    margin-bottom: 0.25rem;
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 1.65vw, 1.65rem);
    font-weight: 800;
    line-height: 1;
    color: white;
}

.library-panel-grid p,
.library-panel-note p {
    margin: 0;
    color: rgba(203, 213, 225, 0.78);
    font-size: 0.72rem;
    line-height: 1.35;
}

.library-panel-note {
    padding: 0.85rem;
    border-radius: 14px;
    background: rgba(5, 5, 14, 0.52);
}

.library-panel-note strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--accent-secondary);
}

.library-paths,
.library-topics,
.library-featured,
.library-latest,
.library-coming-next {
    padding: clamp(2rem, 3.8vw, 3.25rem) 0;
}

.library-section-heading {
    max-width: 720px;
    margin-bottom: 1.15rem;
}

.library-section-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    max-width: none;
}

.library-section-heading .section-title {
    max-width: 16ch;
    margin: 0;
    font-size: clamp(2rem, 3.4vw, 3.3rem);
    line-height: 1;
    letter-spacing: -0.045em;
}

.section-link {
    color: var(--accent-secondary);
    font-weight: 800;
    font-size: var(--step-0);
    text-decoration: none;
    transition: color var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.section-link:hover {
    color: var(--accent-secondary-strong);
    transform: translateX(3px);
}

.learn-path-grid,
.learn-topic-grid {
    display: grid;
    gap: 0.9rem;
}

.learn-path-grid {
    grid-template-columns: repeat(3, 1fr);
}

.learn-path-card,
.learn-topic-card,
.featured-lead-card,
.article-card,
.latest-feed-item,
.library-coming-next-inner {
    position: relative;
    border: 1px solid rgba(168, 85, 247, 0.18);
    background: linear-gradient(145deg, rgba(26, 26, 40, 0.94), rgba(18, 18, 30, 0.94));
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.learn-path-card,
.learn-topic-card {
    display: flex;
    flex-direction: column;
    min-height: 205px;
    padding: 1.2rem;
    border-radius: 18px;
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: transform var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
}

.learn-path-card::before,
.learn-topic-card::before,
.featured-lead-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 85% 10%, rgba(69, 244, 255, 0.12), transparent 12rem);
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.learn-path-card:hover,
.learn-topic-card:hover,
.article-card:hover,
.latest-feed-item:hover {
    transform: translateY(-5px);
    border-color: rgba(69, 244, 255, 0.42);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), 0 0 36px rgba(69, 244, 255, 0.08);
}

.learn-path-card:hover::before,
.learn-topic-card:hover::before,
.featured-lead-card:hover::before {
    opacity: 1;
}

.learn-path-card-primary {
    border-color: rgba(69, 244, 255, 0.42);
    background:
        radial-gradient(circle at 84% 8%, rgba(69, 244, 255, 0.2), transparent 14rem),
        linear-gradient(145deg, rgba(36, 27, 67, 0.96), rgba(16, 24, 43, 0.96));
}

.learn-path-number {
    margin-bottom: 2.25rem;
    font-family: var(--font-mono);
    color: rgba(69, 244, 255, 0.8);
    font-weight: 800;
    letter-spacing: 0.08em;
}

.learn-path-card h3,
.learn-topic-card strong {
    margin: 0 0 0.45rem;
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 1.55vw, 1.55rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
    color: white;
}

.learn-path-card p,
.learn-topic-card p {
    margin: 0 0 1rem;
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.45;
    font-size: 0.9rem;
}

.learn-card-link,
.learn-topic-card > span:last-child {
    margin-top: auto;
    color: var(--accent-secondary);
    font-weight: 800;
    font-size: 0.78rem;
}

.learn-topic-grid {
    grid-template-columns: repeat(4, 1fr);
}

.learn-topic-card {
    min-height: 200px;
}

.learn-topic-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    font-size: 1.45rem;
    font-weight: 800;
}

.learn-topic-icon svg {
    width: 18px;
    height: 18px;
}

.learn-topic-card-red { border-color: rgba(239, 68, 68, 0.28); }
.learn-topic-card-blue { border-color: rgba(59, 130, 246, 0.3); }
.learn-topic-card-purple { border-color: rgba(168, 85, 247, 0.34); }
.learn-topic-card-muted { opacity: 0.72; }

.featured-editorial-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.88fr);
    gap: 1rem;
    align-items: stretch;
}

.featured-lead-card {
    display: flex;
    flex-direction: column;
    min-height: 390px;
    padding: clamp(1.35rem, 2.3vw, 2rem);
    border-color: rgba(69, 244, 255, 0.32);
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(circle at 86% 12%, rgba(69, 244, 255, 0.18), transparent 16rem),
        radial-gradient(circle at 4% 88%, rgba(168, 85, 247, 0.2), transparent 14rem),
        linear-gradient(145deg, rgba(24, 27, 45, 0.98), rgba(11, 13, 23, 0.98));
}

.featured-lead-meta,
.article-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.featured-lead-card h3 {
    max-width: 18ch;
    margin: 2rem 0 0.9rem;
    font-family: var(--font-display);
    font-size: clamp(2rem, 2.65vw, 3.2rem);
    line-height: 1.03;
    letter-spacing: -0.045em;
}

.featured-lead-card h3 a,
.article-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.featured-lead-card h3 a:hover,
.article-card-title a:hover {
    color: var(--accent-secondary);
}

.featured-lead-card p {
    max-width: 62ch;
    margin: 0 0 1rem;
    color: rgba(226, 232, 240, 0.8);
    font-size: 0.98rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-lead-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: auto;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--accent-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.featured-side-list {
    display: grid;
    gap: 1rem;
}

.featured-side-list .article-card {
    min-height: 0;
    border-radius: 20px;
}

.featured-side-list .article-card-content {
    padding: 1.25rem;
}

.featured-side-list .article-card-title {
    margin: 0.8rem 0 0.55rem;
    font-size: clamp(1.1rem, 1.45vw, 1.35rem);
    line-height: 1.14;
}

.featured-side-list .article-card-excerpt {
    -webkit-line-clamp: 2;
    margin-bottom: 0.85rem;
    font-size: 0.92rem;
    line-height: 1.45;
}

.featured-side-list .article-card-footer {
    padding-top: 0.8rem;
}

/* ===================================
   Articles Grid and Article Card
   =================================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.articles-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.articles-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.article-card {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    transition: transform var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
}

.article-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
}

.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-medium);
}

.article-card:hover .article-card-image img {
    transform: scale(1.05);
}

.article-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-card-title {
    font-size: var(--step-1);
    font-weight: 800;
    margin: 0.85rem 0 0.75rem;
    color: var(--text-primary);
    line-height: 1.23;
    letter-spacing: -0.025em;
}

.article-card-excerpt {
    font-size: var(--step-0);
    color: rgba(226, 232, 240, 0.78);
    margin-bottom: 1rem;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.article-date {
    font-size: var(--step--1);
    color: var(--text-muted);
}

.article-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--step--1);
    color: var(--accent-secondary);
    font-weight: 800;
    white-space: nowrap;
}

.icon-clock {
    flex-shrink: 0;
}

.latest-feed {
    display: grid;
    gap: 0.8rem;
}

.latest-feed-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 64px;
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: transform var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
}

.latest-feed-date,
.latest-feed-time {
    color: var(--accent-secondary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.latest-feed-main {
    min-width: 0;
}

.latest-feed-main strong {
    display: block;
    color: white;
    font-size: 0.98rem;
    line-height: 1.25;
    letter-spacing: -0.018em;
}

.latest-feed-main em {
    display: block;
    margin-top: 0.25rem;
    color: rgba(203, 213, 225, 0.72);
    font-style: normal;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 0.9rem;
    line-height: 1.4;
}

.latest-feed-time {
    text-align: right;
}

.library-coming-next {
    padding-top: 1rem;
}

.library-coming-next-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1.15rem 1.25rem;
    border-radius: 20px;
}

.library-coming-next-inner span {
    color: var(--accent-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.library-coming-next-inner p {
    margin: 0;
    color: rgba(226, 232, 240, 0.78);
}

.library-coming-next-inner a {
    color: white;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

/* ===================================
   Category & Difficulty Badges
   =================================== */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Default badge color */
.category-badge {
    background: var(--accent-primary-soft);
    color: var(--accent-primary-strong);
    border: 1px solid var(--accent-primary);
}

/* Category-specific colors */
.category-career {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.category-tutorials,
.category-tutorial {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.category-hack-postmortems,
.category-hack-postmortem {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.category-ctf-solutions,
.category-ctf-solution {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.category-tool-reviews,
.category-tool-review {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.category-security,
.category-guide {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Difficulty badges */
.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.difficulty-icon {
    font-size: 0.8rem;
    line-height: 1;
}

.difficulty-text {
    text-transform: capitalize;
}

.difficulty-beginner {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.difficulty-intermediate {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.difficulty-advanced {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.difficulty-expert {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===================================
   Breadcrumbs
   =================================== */
.breadcrumbs {
    padding: 1.5rem 2rem 0;
    max-width: 1400px;
    margin: 0 auto;
}

.breadcrumbs-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: var(--step--1);
}

.breadcrumb-item {
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--accent-secondary-strong);
}

.breadcrumb-item span[aria-current="page"] {
    color: var(--text-primary);
    font-weight: 600;
}

.breadcrumb-separator {
    padding: 0 0.5rem;
    color: var(--text-muted);
    opacity: 0.5;
    list-style: none;
}

/* ===================================
   Controls & Filters (shared)
   =================================== */
.category-controls,
.tag-controls,
.popular-controls,
.search-controls {
    padding: 1.5rem 0;
}

.controls-form {
    display: flex;
    align-items: center;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-size: var(--step--1);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.control-select {
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: var(--step--1);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.control-select:hover {
    border-color: var(--accent-primary);
}

.control-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

.btn-clear-filters {
    padding: 0.5rem 1rem;
    color: var(--accent-secondary);
    font-size: var(--step--1);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.btn-clear-filters:hover {
    color: var(--accent-secondary-strong);
}

/* ===================================
   Category / Tag Index – Page Headers
   =================================== */
.category-header,
.tag-header {
    padding: 2rem 0 1rem;
}

.category-header-content,
.tag-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tag-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-primary);
}

.tag-title {
    font-family: var(--font-display);
    font-size: var(--step-4);
    background-image: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tag-description {
    font-size: var(--step-1);
    color: var(--text-secondary);
    max-width: 600px;
}

.category-stats,
.tag-stats,
.popular-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--step--1);
    color: var(--text-muted);
}

.stat-icon {
    flex-shrink: 0;
}

.category-articles,
.tag-articles,
.popular-articles {
    padding: 1.5rem 0;
}

/* ===================================
   Article Page Layout
   (styled to match attack-class.html aesthetic)
   =================================== */
.article-page {
    position: relative;
    padding-bottom: 4rem;
}

.article-breadcrumb-wrap {
    margin-bottom: 0;
}

.article-hero {
    position: relative;
    padding: 1.25rem 0 2rem;
}

.article-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 0 0, rgba(124, 58, 237, 0.08) 0%, transparent 55%),
        radial-gradient(circle at 100% 0, rgba(6, 182, 212, 0.06) 0%, transparent 55%);
    pointer-events: none;
}

.article-hero-content {
    position: relative;
    z-index: 1;
    padding: 2rem;
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(30, 30, 46, 0.95) 0%, rgba(18, 18, 28, 0.98) 100%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.article-kicker {
    margin-bottom: 0.875rem;
}

.article-container {
    max-width: 1200px;
}

.article-content-section {
    padding-bottom: 1rem;
}

.article-terminal-frame {
    border: 1px solid rgba(6, 182, 212, 0.08);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(15, 17, 23, 0.99) 0%, rgba(22, 24, 34, 0.97) 100%);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    backdrop-filter: blur(12px);
}

.article-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.75rem;
    background: linear-gradient(90deg, rgba(18, 18, 28, 0.95) 0%, rgba(26, 26, 38, 0.9) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.terminal-dot.red {
    background: linear-gradient(135deg, #ff5f57 0%, #d63031 100%);
    box-shadow: 0 0 8px rgba(255, 95, 87, 0.3);
}

.terminal-dot.yellow {
    background: linear-gradient(135deg, #ffbd2e 0%, #fdcb6e 100%);
    box-shadow: 0 0 8px rgba(255, 189, 46, 0.3);
}

.terminal-dot.green {
    background: linear-gradient(135deg, #28c840 0%, #00b894 100%);
    box-shadow: 0 0 8px rgba(40, 200, 64, 0.3);
}

.terminal-title {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.03em;
    opacity: 0.7;
}

.terminal-status {
    font-family: var(--font-mono);
    font-size: var(--step--2);
    letter-spacing: 0.08em;
    color: var(--accent-secondary);
}

.article-terminal-body {
    padding: 3rem 2.5rem;
}

/* Full-width single column layout (no sidebar) */
.article-layout {
    display: block;
    max-width: 100%;
}

.article-main {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    min-width: 0;
}

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

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

.article-page .article-title {
    font-family: 'Bricolage Grotesque', var(--font-display), sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    color: #f5f5f5;
    text-shadow: 0 0 60px rgba(6, 182, 212, 0.15);
}

.article-page .article-excerpt {
    font-size: 1.0625rem;
    color: #a0a0ad;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-family: 'Lexend', var(--font-body), sans-serif;
}

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

.article-meta-strip {
    padding: 0.75rem 0.875rem;
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 10px;
    background: rgba(30, 30, 46, 0.6);
}

.article-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
}

.article-date-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--step--1);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.article-updated {
    color: var(--text-muted);
}

.article-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Article Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.tag-link {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 6px;
    color: #22d3ee;
    font-size: var(--step--1);
    font-family: var(--font-mono);
    text-decoration: none;
    transition: all 0.25s ease;
}

.tag-link:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: rgba(6, 182, 212, 0.4);
    color: #5eead4;
    transform: translateY(-1px);
}

/* Featured Image */
.article-featured-image {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(6, 182, 212, 0.15);
    aspect-ratio: 16 / 9;
    background: var(--darker-bg);
}

.article-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===================================
   Article Body Content
   (matching attack-class.html aesthetic)
   =================================== */
.article-content {
    font-family: 'Lexend', var(--font-body), sans-serif;
    font-size: 1.125rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    font-feature-settings: 'liga' 1, 'kern' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #d8d8de;
}

.article-content h2 {
    font-family: 'Bricolage Grotesque', var(--font-display), sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #5eead4;
    letter-spacing: -0.02em;
    margin: 5rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #06b6d4, transparent) 1;
    border-left: none;
    padding-left: 0;
    scroll-margin-top: 5rem;
}

.article-content h3 {
    font-family: 'Bricolage Grotesque', var(--font-display), sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #d4a5ff;
    letter-spacing: -0.01em;
    margin: 3.25rem 0 1rem;
    scroll-margin-top: 5rem;
}

.article-content h4 {
    font-family: 'Bricolage Grotesque', var(--font-display), sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #d4a5ff;
    margin: 2rem 0 0.5rem;
    scroll-margin-top: 5rem;
}

.article-content p {
    margin-bottom: 1.85rem;
    font-size: 1.125rem;
    line-height: 1.75;
    font-weight: 400;
    color: #d8d8de;
}

.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-left: 0;
}

.article-content ul {
    list-style: none;
}

.article-content ol {
    counter-reset: item;
    list-style: none;
}

.article-content li {
    position: relative;
    margin-bottom: 0.75rem;
    padding-left: 1.75rem;
    color: #d8d8de;
    line-height: 1.7;
    font-size: 1.125rem;
}

.article-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #06b6d4, #7c3aed);
    border-radius: 2px;
    transform: rotate(45deg);
}

.article-content ol li {
    counter-increment: item;
}

.article-content ol li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.35rem;
    height: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', var(--font-mono), monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--dark-bg);
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}

.article-content ol li.emoji-item::before {
    display: none;
}

.article-content ol li.emoji-item {
    padding-left: 0;
}

.article-content ul li.checkbox-item::before {
    display: none;
}

.article-content ul li.checkbox-item {
    padding-left: 0;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.article-content ul li.checkbox-item p {
    margin: 0;
    flex: 1;
}

.article-content ul li.checkbox-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    min-width: 1.1rem;
    border: 2px solid #06b6d4;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transform: translateY(0.15rem);
    transition: all 0.2s ease;
}

.article-content ul li.checkbox-item input[type="checkbox"]:checked {
    background: #06b6d4;
    border-color: #06b6d4;
}

.article-content ul li.checkbox-item input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--dark-bg);
    font-size: 0.85rem;
    font-weight: 700;
}

.article-content a {
    color: #2dd4bf;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    overflow-wrap: anywhere;
    word-break: break-word;
    transition: all 0.3s ease;
}

.article-content a code {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.article-sources a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-content a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #06b6d4, #7c3aed);
    transition: width 0.3s ease;
}

.article-content a:hover {
    color: #5eead4;
}

.article-content a:hover::after {
    width: 100%;
}

.article-content blockquote {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 2.5rem 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 179, 0, 0.06) 0%, rgba(255, 51, 102, 0.03) 100%);
    border-top: 1px solid rgba(255, 179, 0, 0.15);
    border-right: 1px solid rgba(255, 179, 0, 0.15);
    border-bottom: 1px solid rgba(255, 179, 0, 0.15);
    border-left: 4px solid #ffb300;
    border-radius: 12px;
    font-style: normal;
    line-height: 1.75;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.article-content blockquote:hover {
    border-left-color: #ffcb4a;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.2), 0 0 15px rgba(255, 179, 0, 0.08);
}

.article-content blockquote p {
    margin: 0;
    line-height: 1.75;
}

.article-content blockquote::before {
    content: '';
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 0.35rem;
    background: #ffb300;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M10.29%203.86L1.82%2018a2%200%200%200%201.71%203h16.94a2%200%200%200%201.71-3L13.71%203.86a2%200%200%200-3.42%200z'/%3E%3Cline%20x1='12'%20y1='9'%20x2='12'%20y2='13'/%3E%3Cline%20x1='12'%20y1='17'%20x2='12.01'%20y2='17'/%3E%3C/svg%3E");
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M10.29%203.86L1.82%2018a2%200%200%200%201.71%203h16.94a2%200%200%200%201.71-3L13.71%203.86a2%200%200%200-3.42%200z'/%3E%3Cline%20x1='12'%20y1='9'%20x2='12'%20y2='13'/%3E%3Cline%20x1='12'%20y1='17'%20x2='12.01'%20y2='17'/%3E%3C/svg%3E");
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    filter: drop-shadow(0 0 4px rgba(255, 179, 0, 0.4));
}

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

.article-content strong {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.article-content em {
    color: #c4b5fd;
    font-style: italic;
    letter-spacing: 0.005em;
}

.article-content hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, rgba(6, 182, 212, 0.4) 30%, rgba(124, 58, 237, 0.3) 70%, transparent 95%);
    margin: 2.5rem 0;
    position: relative;
}

.article-content hr::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -3px;
    width: 7px;
    height: 7px;
    background: #06b6d4;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.article-content table {
    width: 100%;
    margin: 2.5rem 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    border: 1px solid rgba(69, 244, 255, 0.22);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.article-content table th {
    padding: 1.15rem 1.4rem;
    background: linear-gradient(135deg, rgba(69, 244, 255, 0.16) 0%, rgba(124, 58, 237, 0.12) 100%);
    border-bottom: 2px solid rgba(69, 244, 255, 0.35);
    color: #06b6d4;
    font-family: 'IBM Plex Mono', var(--font-mono), monospace;
    font-weight: 700;
    text-align: left;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: none;
}

.article-content table th + th {
    border-left: 1px solid rgba(69, 244, 255, 0.18);
}

.article-content table td {
    padding: 1.05rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #e4e4e8;
    transition: background 0.2s ease;
    line-height: 1.55;
    vertical-align: middle;
}

.article-content table td + td {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.article-content table tr:last-child td {
    border-bottom: 0;
}

.article-content table tr:nth-child(even) td {
    background: rgba(69, 244, 255, 0.04);
}

.article-content table tbody tr:hover td {
    background: rgba(69, 244, 255, 0.1);
}

/* Code blocks */
.article-content pre {
    position: relative;
    background: repeating-linear-gradient(0, transparent, transparent 2px, rgba(6, 182, 212, 0.008) 2px, rgba(6, 182, 212, 0.008) 4px),
                linear-gradient(145deg, rgba(14, 14, 22, 0.99) 0%, rgba(20, 20, 30, 0.97) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 0;
    margin: 2.5rem 0;
    overflow: hidden;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.02),
                inset 0 0 80px rgba(6, 182, 212, 0.015);
}

.article-content pre:not(.mermaid)::before {
    content: 'CODE';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1.25rem;
    font-family: 'IBM Plex Mono', var(--font-mono), monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #06b6d4;
    background: linear-gradient(90deg, rgba(18, 18, 28, 0.9) 0%, rgba(14, 14, 22, 0.95) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.article-content pre code {
    display: block;
    padding: 3rem 1.25rem 2rem 1rem;
    overflow-x: auto;
    font-family: 'IBM Plex Mono', var(--font-mono), monospace;
    font-size: 0.88rem;
    line-height: 1.8;
    color: #e8eef5;
    background: transparent;
    border: 0;
    border-radius: 0;
    tab-size: 4;
}

.article-content pre code::-webkit-scrollbar {
    height: 6px;
}

.article-content pre code::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.article-content pre code::-webkit-scrollbar-thumb {
    background: rgba(69, 244, 255, 0.3);
    border-radius: 3px;
}

.article-content pre code::-webkit-scrollbar-thumb:hover {
    background: rgba(69, 244, 255, 0.5);
}

/* Inline code */
.article-content :not(pre) > code {
    font-family: 'IBM Plex Mono', var(--font-mono), monospace;
    font-size: 0.88em;
    font-weight: 500;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding: 0.25em 0.6em;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(124, 58, 237, 0.08) 100%);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 6px;
    color: #22d3ee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.code-copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: var(--step--1);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 10;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.code-copy-btn.copied {
    background: #06b6d4;
    color: var(--dark-bg);
}

/* ===================================
   Article Table of Contents (Floating)
   =================================== */
.article-toc {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: calc((100vw + 1200px) / 2 + 20px);
    width: 220px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem 0;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.article-toc.visible {
    opacity: 1;
    pointer-events: auto;
}

.toc-header {
    font-family: 'IBM Plex Mono', var(--font-mono), monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(6, 182, 212, 0.5);
    padding: 0 0.75rem 0.75rem;
    border-bottom: 1px solid rgba(6, 182, 212, 0.1);
    margin-bottom: 0.5rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin: 0;
    padding: 0;
}

.toc-link {
    display: block;
    padding: 0.35rem 0.75rem;
    font-family: 'Lexend', sans-serif;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #94a3b8;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toc-link:hover {
    color: #e2e8f0;
    border-left-color: rgba(6, 182, 212, 0.3);
}

.toc-link.active {
    color: #5eead4;
    border-left-color: #06b6d4;
    font-weight: 500;
}

.toc-link.toc-h3 {
    padding-left: 1.5rem;
    font-size: 0.68rem;
    color: #64748b;
}

.toc-link.toc-h3:hover {
    color: #94a3b8;
}

.toc-link.toc-h3.active {
    color: #5eead4;
}

.article-toc::-webkit-scrollbar {
    width: 3px;
}

.article-toc::-webkit-scrollbar-track {
    background: transparent;
}

.article-toc::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.2);
    border-radius: 3px;
}

/* Hide TOC on smaller screens where it can't float (need 1200px container + 20px gap + 220px TOC on each side) */
@media (max-width: 1700px) {
    .article-toc {
        display: none;
    }
}

/* ===================================
   Article Footer CTA
   =================================== */
.article-footer {
    margin-top: 3rem;
    padding-top: 2.5rem;
    position: relative;
}

.article-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(69, 244, 255, 0.3), transparent);
}

/* Back-to-category link in article footer */
.article-back-link {
    margin-bottom: 1.5rem;
}

.back-to-category-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--step--1);
    color: #a0a0ad;
    text-decoration: none;
    transition: color 0.2s ease;
}

.back-to-category-link:hover {
    color: #45f4ff;
}

.back-to-category-link svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.back-to-category-link:hover svg {
    transform: translateX(-3px);
}

/* Related articles section */
.related-articles {
    padding: 3rem 0 2rem;
    border-top: 1px solid rgba(69, 244, 255, 0.1);
    margin-top: 1rem;
}

.related-articles-title {
    font-family: 'Bricolage Grotesque', var(--font-display), sans-serif;
    font-size: var(--step-2);
    color: var(--text-primary);
    margin-bottom: 1.75rem;
}

.article-cta {
    text-align: center;
    padding: 2.75rem 2.5rem 2.5rem;
    background: linear-gradient(135deg, rgba(30, 30, 46, 0.8) 0%, rgba(22, 22, 34, 0.9) 100%);
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.cta-title {
    font-family: 'Bricolage Grotesque', var(--font-display), sans-serif;
    font-size: var(--step-2);
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.cta-description {
    font-size: var(--step-0);
    color: #a0a0ad;
    margin-bottom: 1.75rem;
    max-width: 52ch;
    margin-left: auto;
    margin-right: auto;
    font-family: 'Lexend', var(--font-body), sans-serif;
    line-height: 1.6;
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.875rem;
}

/* Shared buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    min-height: 44px;
    background: var(--accent-gradient);
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 35px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    min-height: 44px;
    background: transparent;
    border: 2px solid #06b6d4;
    border-radius: 10px;
    color: #06b6d4;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(69, 244, 255, 0.15);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    border-color: #22d3ee;
    color: #fff;
    box-shadow: 0 0 30px rgba(69, 244, 255, 0.3);
}

/* ===================================
   Popular Page
   =================================== */
.popular-header {
    padding: 2rem 0 1rem;
}

.popular-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.popular-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-primary);
}

h1.popular-title {
    font-family: var(--font-display);
    font-size: var(--step-4);
    background-image: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.popular-description {
    font-size: var(--step-1);
    color: var(--text-secondary);
    max-width: 600px;
}

/* Popular ranked list */
.popular-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.popular-item {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all var(--transition-medium);
}

.popular-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

.popular-rank {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.rank-number {
    font-family: var(--font-display);
    font-size: var(--step-3);
    font-weight: 700;
    color: var(--accent-primary);
    opacity: 0.4;
    transition: opacity 0.4s ease;
}

.rank-number.animated {
    opacity: 1;
}

/* First three ranks get special colors */
.popular-item:nth-child(1) .rank-number { color: #fbbf24; opacity: 1; }
.popular-item:nth-child(2) .rank-number { color: #94a3b8; opacity: 1; }
.popular-item:nth-child(3) .rank-number { color: #cd7f32; opacity: 1; }

.popular-content {
    flex: 1;
    min-width: 0;
}

.popular-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

h2.popular-title {
    font-size: var(--step-1);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

h2.popular-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

h2.popular-title a:hover {
    color: var(--accent-primary);
}

.popular-excerpt {
    font-size: var(--step-0);
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: var(--step--1);
    color: var(--text-muted);
}

.popular-date {
    color: var(--text-muted);
}

.popular-reading-time,
.popular-views {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
}

.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

/* ===================================
   Trending / Related Tags Cloud
   =================================== */
.trending-topics,
.related-tags {
    padding: 3rem 0;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.tag-cloud-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--accent-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tag-cloud-item:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-soft);
    transform: translateY(-2px);
}

.tag-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
}

/* ===================================
   Search Page
   =================================== */
.search-header {
    padding: 2rem 0 1rem;
    text-align: center;
}

.search-title {
    font-family: var(--font-display);
    font-size: var(--step-4);
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.search-query {
    color: var(--accent-primary);
}

.search-stats {
    margin-top: 1rem;
}

.results-count {
    font-size: var(--step-0);
    color: var(--text-secondary);
}

.search-results {
    padding: 1.5rem 0;
}

/* Search result items */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all var(--transition-medium);
}

.result-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.result-title {
    font-size: var(--step-1);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.result-title a:hover {
    color: var(--accent-primary);
}

.result-excerpt {
    font-size: var(--step-0);
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.result-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: var(--step--1);
    color: var(--text-muted);
}

.result-date {
    color: var(--text-muted);
}

.result-reading-time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

/* Search suggestions */
.search-suggestions {
    text-align: center;
    padding: 2rem 0;
}

.suggestions-title {
    font-size: var(--step-2);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.suggestion-item {
    padding: 0.625rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--accent-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.suggestion-item:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-soft);
    transform: translateY(-2px);
}

.popular-categories {
    margin-top: 3rem;
}

.categories-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.category-quick-link {
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.category-quick-link:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-soft);
    transform: translateY(-2px);
}

/* ===================================
   Pagination
   =================================== */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.pagination-list {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-item {
    display: inline-flex;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.5rem 0.875rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--step--1);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination-link:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-soft);
}

.pagination-current {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.pagination-prev,
.pagination-next {
    padding: 0.5rem 1rem;
}

.pagination-ellipsis {
    padding: 0.5rem;
    color: var(--text-muted);
    list-style: none;
}

/* ===================================
   Empty State
   =================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-title {
    font-size: var(--step-2);
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.empty-description {
    font-size: var(--step-0);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===================================
   Back to Top Button
   =================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 22, 34, 0.9);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 10px;
    color: #5eead4;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 90;
    backdrop-filter: blur(8px);
}

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

.back-to-top:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
}

.back-to-top:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

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

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #06b6d4 0%, #7c3aed 50%, #dc2626 100%);
    background-size: 300% 100%;
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.6), 0 0 20px rgba(6, 182, 212, 0.2);
}

/* ===================================
   Accessibility
   =================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.library-search-chips a:focus,
.library-search-chips a:focus-visible,
.learn-path-card:focus,
.learn-path-card:focus-visible,
.learn-topic-card:focus,
.learn-topic-card:focus-visible,
.featured-lead-card a:focus,
.featured-lead-card a:focus-visible,
.latest-feed-item:focus,
.latest-feed-item:focus-visible,
.article-card:focus,
.article-card:focus-visible,
.pagination-link:focus,
.tag-cloud-item:focus,
.suggestion-item:focus,
.category-quick-link:focus,
.tag-link:focus,
.tag-link:focus-visible,
.related-link:focus,
.related-link:focus-visible,
.btn-primary:focus,
.btn-primary:focus-visible,
.btn-secondary:focus,
.btn-secondary:focus-visible,
.article-content a:focus,
.article-content a:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ===================================
   Responsive Breakpoints
   =================================== */

@media (max-width: 1120px) {
    .library-hero-shell {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
        gap: 1.75rem;
    }

    .library-hero-title {
        max-width: 11ch;
    }

    .library-hero-panel {
        max-width: none;
    }

    .learn-path-grid,
    .learn-topic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .learn-path-card,
    .learn-topic-card {
        min-height: 190px;
    }

    .featured-editorial-grid {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
    }

    .featured-side-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .library-hero-shell {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .library-hero-panel {
        display: none;
    }

    .library-section-heading-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .learn-path-grid,
    .featured-editorial-grid {
        grid-template-columns: 1fr;
    }

    .latest-feed-item {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .latest-feed-time {
        grid-column: 2;
        text-align: left;
    }

    .library-coming-next-inner {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .library-hero {
        padding: 2rem 0 1.25rem;
    }

    .library-hero-title {
        font-size: clamp(2.6rem, 9vw, 3.8rem);
        letter-spacing: -0.06em;
    }

    .library-hero-subtitle {
        font-size: 1rem;
    }

    .search-input-wrapper {
        min-height: 56px;
        border-radius: 15px;
    }

    .search-button {
        padding-inline: 1.25rem;
    }

    .library-panel-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .library-hero-panel {
        padding: 0.75rem;
        border-radius: 18px;
    }

    .library-panel-note {
        display: none;
    }

    .library-paths,
    .library-topics,
    .library-featured,
    .library-latest,
    .library-coming-next {
        padding: 1.9rem 0;
    }

    .library-section-heading .section-title {
        font-size: clamp(1.9rem, 7vw, 2.7rem);
    }

    .featured-side-list {
        grid-template-columns: 1fr;
    }

    .featured-lead-card {
        min-height: 0;
    }

    .featured-lead-card h3 {
        font-size: clamp(1.8rem, 7vw, 2.6rem);
    }

    .articles-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .articles-grid-2 {
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .article-hero {
        padding: 0.75rem 0 1.5rem;
    }

    .article-hero-content {
        padding: 1.25rem;
    }

    .article-terminal-body {
        padding: 2rem 1.5rem;
    }

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

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

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

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

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

    .cta-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cta-actions .btn-primary,
    .cta-actions .btn-secondary {
        width: 100%;
    }

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

    .article-footer {
        margin-top: 2.5rem;
        padding-top: 2rem;
    }

    .article-cta {
        padding: 2rem 1.5rem 1.75rem;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
    }

    .popular-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .popular-rank {
        width: auto;
        height: auto;
        justify-content: flex-start;
    }

    .library-featured .section-header,
    .library-latest .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .library-hero {
        padding-top: 1.5rem;
    }

    .library-hero-title {
        font-size: clamp(2.6rem, 12vw, 3.2rem);
    }

    .library-hero-subtitle {
        margin-bottom: 1rem;
        line-height: 1.5;
    }

    .library-search-form {
        width: 100%;
    }

    .search-input-wrapper {
        display: block;
        position: relative;
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .search-icon {
        position: absolute;
        top: 17px;
        left: 0.9rem;
        margin-left: 0;
        z-index: 1;
    }

    .search-input {
        width: 100%;
        padding-left: 3rem;
        background: rgba(20, 20, 32, 0.88);
        border: 1px solid rgba(168, 85, 247, 0.26);
        border-radius: 15px;
    }

    .search-button {
        width: 100%;
        margin-top: 0.65rem;
        min-height: 52px;
        border-radius: 15px;
    }

    .library-search-chips a {
        min-height: 34px;
        font-size: 0.78rem;
    }

    .learn-topic-grid {
        grid-template-columns: 1fr;
    }

    .learn-path-card,
    .learn-topic-card,
    .featured-lead-card,
    .article-card,
    .latest-feed-item,
    .library-coming-next-inner {
        border-radius: 18px;
    }

    .learn-path-card,
    .learn-topic-card {
        min-height: auto;
        padding: 1rem;
    }

    .learn-path-card h3,
    .learn-topic-card strong {
        margin-top: 0;
    }

    .featured-lead-card {
        min-height: 0;
        padding: 1.1rem;
    }

    .featured-lead-card h3 {
        margin-top: 1.25rem;
    }

    .featured-lead-footer {
        flex-direction: column;
        gap: 0.35rem;
    }

    .latest-feed-item {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .latest-feed-time {
        grid-column: 1;
    }

    .latest-feed-main em {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .articles-grid-3,
    .articles-grid-2,
    .articles-grid {
        grid-template-columns: 1fr;
    }

    .article-terminal-header {
        padding: 0.75rem 1rem;
    }

    .terminal-title {
        display: none;
    }

    .article-terminal-body {
        padding: 1.25rem 1rem;
    }

    .article-page .article-title {
        font-size: clamp(1.6rem, 8vw, 2rem);
        line-height: 1.1;
    }

    .article-content {
        font-size: 0.95rem;
        line-height: 1.75;
    }

    .article-content p {
        font-size: 0.95rem;
    }

    .article-content li {
        font-size: 0.95rem;
    }

    .article-content h2 {
        font-size: 1.2rem;
        margin: 2rem 0 1rem;
    }

    .article-content h3 {
        font-size: 1rem;
        margin: 1.75rem 0 0.75rem;
    }

    .article-content pre {
        margin: 1.5rem -0.5rem;
        border-radius: 10px;
    }

    .article-content pre code {
        font-size: 0.7rem;
        padding: 1.25rem 0.75rem;
        padding-top: 2rem;
    }

    .article-content blockquote {
        padding: 1rem;
        margin: 1.5rem 0;
        gap: 0.75rem;
    }

    .search-title {
        font-size: var(--step-3);
    }

}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   RESPONSIVE VIDEO EMBED
   ============================================ */
.content-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    margin: 2rem 0;
    background: rgba(18, 18, 28, 0.9);
    border: 1px solid rgba(124, 58, 237, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.content-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 12px;
}
