@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Serif:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');

/* --- DESIGN SYSTEM & CSS VARIABLES --- */
:root {
    --font-title: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'IBM Plex Serif', Georgia, serif;

    /* Corporate Branding: Turquoise, Gray, Black, White */
    --bg-dark: #070a13;
    --bg-surface: #0f1424;
    --bg-card: #151d32;
    --bg-card-hover: #1b2641;
    --border-color: #202d4b;
    --border-hover: #00f2fe;

    --text-color: #cbd5e1;
    --text-muted: #64748b;
    --text-light: #f8fafc;
    --text-dark: #070a13;

    --accent-teal: #00f2fe;
    --accent-teal-rgb: 0, 242, 254;
    --accent-teal-dark: #0d9488;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --glow-shadow: 0 0 20px rgba(0, 242, 254, 0.25);
}

/* --- RESET & BASIC STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* Abstract Fiber-Optic Grid Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(rgba(0, 242, 254, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 254, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.02) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
    animation: pulseGlow 15s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

a {
    color: var(--accent-teal);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--text-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-title);
    color: var(--text-light);
    font-weight: 700;
    line-height: 1.3;
}

p {
    margin-bottom: 1.25rem;
}

/* --- SITE HEADER --- */
.site-header {
    background-color: rgba(7, 10, 19, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition-smooth);
    padding: 1.2rem 0;
}

.site-header.scrolled {
    padding: 0.8rem 0;
    background-color: rgba(7, 10, 19, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.site-logo span {
    color: var(--accent-teal);
}

.site-logo i {
    color: var(--accent-teal);
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.6));
}

.site-nav {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 30px;
}

.nav-link {
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
    padding: 5px 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-teal);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-teal);
    transition: var(--transition-smooth);
    box-shadow: var(--glow-shadow);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--text-light);
    margin-bottom: 5px;
    transition: var(--transition-smooth);
}

.nav-toggle span:last-child {
    margin-bottom: 0;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- HERO SECTION --- */
.hero-section {
    padding: 6rem 0 4rem 0;
    text-align: center;
    position: relative;
}

.hero-subtitle {
    color: var(--accent-teal);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
    display: inline-block;
    background: rgba(0, 242, 254, 0.07);
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid rgba(0, 242, 254, 0.15);
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 800px;
    margin: 0.5rem auto 0 auto;
    font-weight: 400;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-light) 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 750px;
    margin: 0 auto 2.5rem auto;
}

/* Search bar on main index */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 18px 30px;
    padding-left: 60px;
    color: var(--text-light);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-smooth);
    box-shadow: var(--card-shadow);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.15);
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 25px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: var(--transition-smooth);
}

.search-input:focus + .search-icon {
    color: var(--accent-teal);
}

/* Category Filter Tabs */
.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.cat-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px 24px;
    border-radius: 30px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.cat-btn:hover {
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

.cat-btn.active {
    background-color: var(--accent-teal);
    border-color: var(--accent-teal);
    color: var(--text-dark);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}

/* --- ARTICLES GRID SECTION --- */
.articles-section {
    padding: 4rem 0 6rem 0;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

/* Card Glowing Fiber optic effect on hover */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-teal), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.card:hover::before {
    transform: translateX(100%);
}

.card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 242, 254, 0.1);
}

.card-badge {
    display: inline-block;
    width: max-content;
    align-self: flex-start;
    background: rgba(0, 242, 254, 0.08);
    color: var(--accent-teal);
    border: 1px solid rgba(0, 242, 254, 0.2);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
}

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

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.4;
    transition: var(--transition-smooth);
}

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

.card-desc {
    color: var(--text-color);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    opacity: 0.85;
}

.card-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.read-more {
    font-weight: 700;
    color: var(--accent-teal);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.read-more i {
    transition: var(--transition-smooth);
}

.card:hover .read-more i {
    transform: translateX(5px);
}

/* No results state */
#no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

#no-results i {
    font-size: 3rem;
    color: var(--accent-teal);
    margin-bottom: 1rem;
}

/* --- INDIVIDUAL ARTICLE TEMPLATE --- */
.reading-progress-container {
    position: fixed;
    top: 60px; /* Aligns with header scroll state */
    left: 0;
    width: 100%;
    height: 4px;
    background-color: transparent;
    z-index: 999;
}

.reading-progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent-teal), #0072ff);
    box-shadow: var(--glow-shadow);
    transition: width 0.1s ease-out;
}

.article-main {
    padding: 4rem 0 6rem 0;
}

.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

.article-main-content, .article-sidebar {
    min-width: 0;
}

/* Left Content Area */
.article-header {
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.article-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.article-meta-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta-info i {
    color: var(--accent-teal);
}

.article-title-main {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.article-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.article-tag {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Article Content Typography & Styling */
.article-content {
    font-size: 1.1rem;
    color: #e2e8f0;
    line-height: 1.8;
}

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

.article-content h2 {
    font-size: 1.8rem;
    margin: 3rem 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.article-content h2::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 2px;
    background-color: var(--accent-teal);
}

.article-content h3 {
    font-size: 1.4rem;
    margin: 2.5rem 0 1rem 0;
}

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

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

.article-content blockquote {
    background-color: var(--bg-surface);
    border-left: 4px solid var(--accent-teal);
    padding: 20px 30px;
    margin: 2rem 0;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: var(--text-light);
}

/* Tables in Article */
.table-responsive {
    overflow-x: auto;
    margin: 2.5rem 0;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.comparison-table th {
    background-color: rgba(0, 242, 254, 0.05);
    color: var(--text-light);
    font-family: var(--font-title);
    font-weight: 700;
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-color);
}

.comparison-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Footnotes rendering */
.footnotes-sep {
    margin: 4rem 0 2rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

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

.footnotes h4 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.footnotes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footnote-item {
    position: relative;
    padding-left: 25px;
}

.footnote-num {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: var(--accent-teal);
}

.footnote-content {
    color: var(--text-color);
    opacity: 0.85;
}

.footnote-backref {
    color: var(--accent-teal);
    font-weight: 700;
    margin-left: 6px;
}

/* Editorial Recommendation Box */
.recommendation-box {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.05) 0%, rgba(30, 41, 59, 0.1) 100%);
    border: 1px solid rgba(0, 242, 254, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin: 2.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rec-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-teal);
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rec-link {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rec-link:hover {
    color: var(--accent-teal);
}

/* --- SIDEBAR AND WIDGETS --- */
.article-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar-widget {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--card-shadow);
}

.widget-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-title i {
    color: var(--accent-teal);
}

/* Table of Contents Widget */
.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toc-item {
    font-size: 0.9rem;
}

.toc-link {
    color: var(--text-muted);
    display: block;
    padding: 3px 0;
    border-left: 2px solid transparent;
    padding-left: 12px;
    transition: var(--transition-smooth);
}

.toc-link:hover, .toc-link.active {
    color: var(--accent-teal);
    border-left-color: var(--accent-teal);
    padding-left: 15px;
}

/* Read Next Cards (Sidebar / Bottom) */
.read-next-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-bottom: 15px;
    transition: var(--transition-smooth);
}

.read-next-card:last-child {
    margin-bottom: 0;
}

.read-next-card:hover {
    border-color: var(--accent-teal);
    transform: translateX(5px);
}

.read-next-badge {
    font-size: 0.7rem;
    color: var(--accent-teal);
    text-transform: uppercase;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 8px;
}

.read-next-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
    color: var(--text-light);
}

.read-next-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
}

/* --- SITE FOOTER --- */
.site-footer {
    background-color: #04060b;
    border-top: 1px solid var(--border-color);
    padding: 5rem 0 3rem 0;
    color: var(--text-muted);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1.1fr 1.1fr;
    gap: 35px;
    margin-bottom: 4rem;
}

.footer-brand h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--text-light);
}

.footer-brand h2 span {
    color: var(--accent-teal);
}

.footer-brand p {
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 450px;
}

.footer-title {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--accent-teal);
}

.footer-links-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links-list a {
    color: var(--text-muted);
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-links-list a:hover {
    color: var(--accent-teal);
    transform: translateX(4px);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 0.9rem;
}

/* --- CODE BLOCKS & ASCII DIAGRAMS --- */
pre {
    background: #0f1424;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    max-width: 100%;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #00f2fe;
    background: transparent;
    padding: 0;
}

p code, li code {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-teal);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    border: 1px solid rgba(0, 242, 254, 0.15);
}

pre::-webkit-scrollbar {
    height: 8px;
}
pre::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 0 0 12px 12px;
}
pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
pre::-webkit-scrollbar-thumb:hover {
    background: var(--accent-teal);
}

/* --- RESPONSIVE TABLES --- */
table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

th, td {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    text-align: left;
}

th {
    background-color: rgba(0, 242, 254, 0.05);
    color: var(--accent-teal);
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

/* --- RELATED GRID HEIGHT FIXES --- */
.read-next-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.read-next-grid .read-next-card {
    margin-bottom: 0;
}

/* --- RESPONSIBLE DESIGN --- */
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        margin-top: 30px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .site-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: rgba(15, 20, 36, 0.98);
        border-bottom: 1px solid var(--border-color);
        padding: 30px;
        gap: 20px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
    }

    .site-nav.active {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
}
