/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Karla', sans-serif;
    background-color: #D8DDE2;
    color: #2A3038;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Viewport and Main Layout */
.viewport {
    width: 100%;
    min-height: 100vh;
    background-color: #D8DDE2;
    padding: 40px 24px;
    animation: viewportFade 0.4s ease-out forwards;
}

@keyframes viewportFade {
    from {
        background-color: #D8DDE2;
    }
    to {
        background-color: #D8DDE2;
    }
}

/* Search Bar - Neomorphic Entry Animation */
.search-container {
    max-width: 720px;
    margin: 0 auto 48px;
    position: relative;
    animation: searchExtrudeIn 0.6s ease-out 0.4s backwards;
}

@keyframes searchExtrudeIn {
    from {
        opacity: 0;
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        box-shadow:
            6px 6px 12px rgba(0, 0, 0, 0.1),
            -6px -6px 12px rgba(255, 255, 255, 0.7);
        transform: translateY(0);
    }
}

.search-bar {
    width: 100%;
    padding: 16px 20px 16px 48px;
    border: none;
    border-radius: 12px;
    background-color: #D8DDE2;
    color: #2A3038;
    font-family: 'Karla', sans-serif;
    font-size: 16px;
    box-shadow:
        6px 6px 12px rgba(0, 0, 0, 0.1),
        -6px -6px 12px rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.search-bar:focus {
    outline: none;
    box-shadow:
        8px 8px 16px rgba(0, 0, 0, 0.15),
        -8px -8px 16px rgba(255, 255, 255, 0.7);
}

.search-bar::placeholder {
    color: #5A6A78;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #5A6A78;
    stroke-width: 2;
}

/* Content Column */
.content-column {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* Neomorphic Card Styling */
.content-card {
    background-color: #D8DDE2;
    border-radius: 16px;
    padding: 32px;
    box-shadow:
        8px 8px 16px rgba(0, 0, 0, 0.1),
        -8px -8px 16px rgba(255, 255, 255, 0.7);
    animation: cardRiseIn 0.6s ease-out backwards;
    position: relative;
    overflow: hidden;
}

/* Staggered card entry animations */
.featured-article { animation-delay: 0.9s; }
.node-graph-container { animation-delay: 1.1s; }
.article-card:nth-of-type(1) { animation-delay: 1.3s; }
.article-card:nth-of-type(2) { animation-delay: 1.5s; }
.article-card:nth-of-type(3) { animation-delay: 1.7s; }
.article-card:nth-of-type(4) { animation-delay: 1.9s; }
.interactive-section { animation-delay: 2.1s; }
.footer-section { animation-delay: 2.3s; }

@keyframes cardRiseIn {
    from {
        opacity: 0;
        transform: translateY(20px);
        box-shadow:
            0 0 0 rgba(0, 0, 0, 0),
            0 0 0 rgba(255, 255, 255, 0.7);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        box-shadow:
            8px 8px 16px rgba(0, 0, 0, 0.1),
            -8px -8px 16px rgba(255, 255, 255, 0.7);
    }
}

/* Card Header */
.card-header {
    margin-bottom: 20px;
}

/* Typography - Display */
.section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2A3038;
    margin: 0;
    line-height: 1.1;
}

.article-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #2A3038;
    margin: 0 0 16px 0;
    line-height: 1.1;
}

/* Typography - Body */
.article-excerpt,
.article-body,
.section-description {
    font-family: 'Karla', sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: #3A4248;
    margin: 0 0 16px 0;
}

.article-excerpt {
    font-size: 15px;
    font-weight: 400;
    color: #5A6A78;
}

.info-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #2A3038;
    margin: 0 0 12px 0;
}

.info-content {
    font-family: 'Karla', sans-serif;
    font-size: 16px;
    color: #3A4248;
    line-height: 1.8;
}

.footer-meta {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: #5A6A78;
    margin-top: 16px;
}

/* Code and Technical Data */
code, .code-text {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.9rem;
    color: #5A6A78;
    background-color: rgba(90, 106, 120, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Article Meta Tags */
.article-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.meta-tag {
    display: inline-block;
    padding: 6px 12px;
    background-color: #C0C4C8;
    color: #2A3038;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Circuit Line Decorations */
.circuit-line-left {
    position: absolute;
    left: 0;
    top: 40px;
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #B8BCC0 0%, #B8BCC0 50%, transparent 100%);
}

.circuit-line-left::before,
.circuit-line-left::after {
    content: '';
    position: absolute;
    background-color: #B8BCC0;
}

.circuit-line-left::before {
    width: 20px;
    height: 3px;
    top: 0;
    left: 0;
}

.circuit-line-left::after {
    width: 20px;
    height: 3px;
    bottom: 0;
    left: 0;
}

/* Node Graph Visualization */
.node-graph {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 24px 0;
}

.node {
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.08)) drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.4));
    transition: all 0.3s ease;
}

.node:hover {
    filter: drop-shadow(5px 5px 10px rgba(0, 0, 0, 0.12)) drop-shadow(-5px -5px 10px rgba(255, 255, 255, 0.6));
}

.center-node {
    animation: centerNodePulse 2s ease-in-out infinite;
    fill: #4A7A8A;
}

@keyframes centerNodePulse {
    0%, 100% {
        r: 8;
        filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.08)) drop-shadow(-3px -3px 6px rgba(255, 255, 255, 0.4));
    }
    50% {
        r: 10;
        filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.1)) drop-shadow(-4px -4px 8px rgba(255, 255, 255, 0.5));
    }
}

.connection-line {
    opacity: 0.7;
    animation: lineFlow 3s ease-in-out infinite;
}

@keyframes lineFlow {
    0% {
        stroke-dasharray: 400;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 400;
        stroke-dashoffset: -200;
    }
    100% {
        stroke-dasharray: 400;
        stroke-dashoffset: -400;
    }
}

.flow-dot {
    animation: dataFlowMove 4s linear infinite;
}

@keyframes dataFlowMove {
    0% {
        cx: 50;
        cy: 100;
    }
    20% {
        cx: 100;
        cy: 100;
    }
    40% {
        cx: 200;
        cy: 100;
    }
    60% {
        cx: 300;
        cy: 100;
    }
    80% {
        cx: 350;
        cy: 100;
    }
    100% {
        cx: 350;
        cy: 100;
    }
}

/* Featured Article Styling */
.featured-article article {
    margin-top: 16px;
}

/* Articles Section */
.articles-section {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.articles-section > .section-title {
    margin-bottom: 24px;
    animation: titleFadeIn 0.6s ease-out 1.2s backwards;
}

@keyframes titleFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Article Card */
.article-card {
    padding: 32px;
}

.article-card article {
    margin: 0;
}

/* Interactive Section - Material Buttons */
.material-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.material-btn {
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    background-color: #D8DDE2;
    color: #2A3038;
    font-family: 'Karla', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        4px 4px 8px rgba(0, 0, 0, 0.1),
        -4px -4px 8px rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.material-btn:hover {
    box-shadow:
        6px 6px 12px rgba(0, 0, 0, 0.12),
        -6px -6px 12px rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
}

.material-btn.active {
    background-color: #7AB0B8;
    color: #F0F4F8;
    box-shadow:
        inset 4px 4px 8px rgba(0, 0, 0, 0.15),
        inset -4px -4px 8px rgba(255, 255, 255, 0.3);
}

/* Material Info */
.material-info {
    padding: 20px;
    border-radius: 10px;
    background-color: #F0F4F8;
    border-left: 4px solid #7AB0B8;
    animation: infoFadeIn 0.4s ease-out forwards;
}

@keyframes infoFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer Section */
.footer-section {
    margin-top: 64px;
    text-align: center;
    opacity: 0.9;
}

.footer-section p {
    margin-bottom: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .viewport {
        padding: 24px 16px;
    }

    .content-column {
        gap: 32px;
    }

    .content-card {
        padding: 24px;
        border-radius: 12px;
    }

    .section-title {
        font-size: clamp(2rem, 5vw, 3rem);
    }

    .article-title {
        font-size: clamp(1.4rem, 4vw, 2rem);
    }

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

@media (max-width: 480px) {
    .viewport {
        padding: 16px 12px;
    }

    .search-container {
        margin-bottom: 32px;
    }

    .content-card {
        padding: 20px;
        border-radius: 12px;
        box-shadow:
            4px 4px 8px rgba(0, 0, 0, 0.1),
            -4px -4px 8px rgba(255, 255, 255, 0.7);
    }

    .section-title {
        font-size: clamp(1.6rem, 4vw, 2.2rem);
    }

    .article-title {
        font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    }

    .material-buttons {
        grid-template-columns: 1fr;
    }

    .article-excerpt,
    .article-body,
    .section-description {
        font-size: 15px;
    }
}
