/* =========================================
   CORE STYLES & VARIABLES
   ========================================= */

:root {
    /* Mad Men inspired: Warm greens, brass/gold accents, cream text */
    --bg: #243828;
    --text: #f0f2e6;

    /* Warmer, vintage greens — lifted */
    --green-dark: #35573c;
    --green-mid: #5e8a63;
    --green-light: #8fbe93;

    /* Accents: Brass/Gold and Warm Chartreuse */
    --accent: #d4ae62;
    /* Antique Brass */
    --accent-bright: #bdd04e;
    /* Vintage Lime/Olive */

    /* Sketch lines with warmer tone */
    --sketch: rgba(240, 242, 230, 0.12);
    --sketch-accent: rgba(212, 174, 98, 0.20);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
}

/* Vignette Overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.15) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Grain Texture */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* =========================================
   TECH SKETCH ELEMENTS
   ========================================= */

.tech-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    animation: fadeIn 2s ease 3.5s forwards;
    overflow: hidden;
}

.tech-layer svg {
    position: absolute;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    will-change: transform;
    transition: transform 0.3s ease-out;
}

/* Stroke draw-in animation for SVG paths */
.tech-layer svg path,
.tech-layer svg rect,
.tech-layer svg circle,
.tech-layer svg ellipse {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: drawIn 3s ease forwards;
}

.tech-layer svg .circuit path { animation-delay: 4.0s; }
.tech-layer svg .circuit circle { animation-delay: 4.2s; }

@keyframes drawIn {
    to {
        stroke-dashoffset: 0;
    }
}

/* Sketch Positioning & Animations */
.circuit {
    right: 5%;
    bottom: 8%;
    width: min(30vw, 280px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4s forwards, pulse 8s ease-in-out 5.5s infinite;
    transform-origin: center center;
}

.code-sketch {
    left: 5%;
    top: 12%;
    width: min(20vw, 200px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.3s forwards, pulse 6s ease-in-out 5.8s infinite;
    transform-origin: left top;
}

.terminal {
    left: 8%;
    bottom: 15%;
    width: min(18vw, 180px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.5s forwards, pulse 7s ease-in-out 6s infinite;
    transform-origin: left bottom;
}

.geo-pattern {
    right: 8%;
    top: 15%;
    width: min(15vw, 150px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.2s forwards, pulse 9s ease-in-out 5.7s infinite;
    transform-origin: right top;
}

.sequence {
    right: 3%;
    top: 45%;
    width: min(22vw, 200px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.6s forwards, pulse 10s ease-in-out 6.1s infinite;
    transform-origin: right center;
}

.api-flow {
    left: 25%;
    top: 8%;
    width: min(18vw, 170px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.4s forwards, pulse 7.5s ease-in-out 5.9s infinite;
    transform-origin: center top;
}

.database {
    left: 35%;
    bottom: 5%;
    width: min(16vw, 160px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.7s forwards, pulse 8.5s ease-in-out 6.2s infinite;
    transform-origin: center bottom;
}

.git-flow {
    left: 2%;
    top: 40%;
    width: min(14vw, 140px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.8s forwards, pulse 11s ease-in-out 6.3s infinite;
    transform-origin: left center;
}

.cloud-arch {
    right: 25%;
    top: 5%;
    width: min(17vw, 165px);
    opacity: 0;
    animation: fadeIn 1.5s ease 4.9s forwards, pulse 9.5s ease-in-out 6.4s infinite;
    transform-origin: right top;
}

/* =========================================
   INTRO ANIMATION
   ========================================= */

.intro {
    position: fixed;
    inset: 0;
    z-index: 200;
    /* Dark charcoal/black background to make the green/gold bars pop */
    background: linear-gradient(135deg, #1a1a1a 0%, #050505 100%);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    animation: slideUp 0.8s cubic-bezier(0.7, 0, 0.3, 1) 2.8s forwards;
}

.bar {
    position: relative;
    transform: translateY(100%);
}

.bar1 {
    width: 14vw;
    height: 110vh;
    background: var(--green-mid);
    animation: rise 1s ease 0.1s forwards;
}

.bar2 {
    width: 11vw;
    height: 85vh;
    background: var(--green-dark);
    animation: rise 1s ease 0.25s forwards;
}

.bar3 {
    width: 18vw;
    height: 100vh;
    background: #142619;
    animation: rise 1s ease 0.4s forwards;
}

.bar4 {
    width: 12vw;
    height: 75vh;
    background: var(--green-light);
    animation: rise 1s ease 0.2s forwards;
}

.bar5 {
    width: 15vw;
    height: 120vh;
    background: var(--accent);
    animation: rise 1s ease 0.35s forwards;
}

.flash {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 10;
}

.flash span {
    flex: 1;
    background: var(--accent);
    transform: scaleY(0);
    animation: flash 0.35s ease 2.4s forwards;
}

.flash span:nth-child(odd) {
    transform-origin: top;
}

.flash span:nth-child(even) {
    transform-origin: bottom;
}

/* =========================================
   MAIN CONTENT
   ========================================= */

.content.articles-feed {
    position: relative;
    z-index: 10;
    max-width: 650px;
    margin: 8rem auto 6rem auto;
    width: 90%;
    opacity: 0;
    animation: fadeIn 1s ease 3s forwards;
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header / Identity */
h1 {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 15;
    font-family: 'Oswald', sans-serif;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    line-height: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: fadeInName 2s ease 4.5s forwards;
    display: flex;
    flex-direction: column;
}

.first {
    display: block;
    color: rgba(240, 242, 230, 0.4);
    font-weight: 400;
}

.last {
    display: block;
    color: var(--accent);
    opacity: 0.8;
    font-weight: 700;
    margin-top: -0.15em;
    animation: glowPulse 3s ease-in-out infinite;
}

.location {
    position: fixed;
    top: 6.5rem;
    left: 2rem;
    z-index: 15;
    font-family: 'Roboto Mono', monospace;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-size: clamp(0.65rem, 1.8vw, 0.85rem);
    color: var(--green-mid);
    opacity: 0;
    animation: fadeIn 1s ease 3.8s forwards;
}

.location::before {
    content: '> ';
    color: var(--accent);
}

/* Navigation Links */
.site-footer {
    position: fixed;
    bottom: 2rem;
    right: 2.5rem;
    z-index: 15;
    opacity: 0;
    animation: fadeIn 1s ease 4s forwards;
}

.site-footer nav {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

.link {
    font-family: 'Oswald', sans-serif;
    font-size: clamp(0.85rem, 2vw, 1rem);
    text-decoration: none;
    color: rgba(240, 242, 230, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.3s ease;
    opacity: 0;
    position: relative;
    animation: fadeIn 0.6s ease forwards;
}

.link::before {
    content: '//';
    margin-right: 0.5rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.link:hover::before {
    opacity: 1;
}

.link:nth-child(1) {
    animation-delay: 4.0s;
}

.link:nth-child(2) {
    animation-delay: 4.15s;
}

.link:hover {
    color: var(--text);
}

.link-fosap:hover {
    color: var(--green-light);
}

.link-contact:hover {
    color: var(--accent-bright);
}

/* Accent Line */
.accent-line {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--green-dark), var(--accent), var(--green-light), transparent);
    opacity: 0.2;
    z-index: 10;
}

/* Article Cards */
.article-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 1.4rem 1.6rem;
    border-radius: 8px;
    border: 1px solid rgba(197, 160, 89, 0.15);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    /* initial state for staggering (optional if running on page load cleanly) */
    opacity: 0;
    animation: feedSlideUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Stagger animations for first few cards naturally */
.article-card:nth-child(1) {
    animation-delay: 3.2s;
}

.article-card:nth-child(2) {
    animation-delay: 3.35s;
}

.article-card:nth-child(3) {
    animation-delay: 3.5s;
}

.article-card:nth-child(4) {
    animation-delay: 3.65s;
}

.article-card:nth-child(5) {
    animation-delay: 3.8s;
}

.article-card:nth-child(n+6) {
    animation-delay: 3.9s;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--green-light));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(197, 160, 89, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

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

.article-date {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.8;
    margin-bottom: 0.6rem;
}

.article-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
    opacity: 0.9;
    margin-bottom: 0.6rem;
    transition: opacity 0.3s ease;
}

.article-card:hover .article-title {
    opacity: 1;
}

.article-excerpt {
    font-family: 'Roboto', sans-serif;
    font-size: 0.88rem;
    font-weight: 300;
    line-height: 1.6;
    color: rgba(240, 242, 230, 0.6);
    margin-bottom: 0.8rem;
}

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

.article-reactions,
.article-comments {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: rgba(240, 242, 230, 0.4);
}

.article-reactions::before {
    content: '♦ ';
    color: var(--accent);
    opacity: 0.6;
}

.article-comments::before {
    content: '◊ ';
    color: var(--green-light);
    opacity: 0.6;
}

@keyframes feedSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   ANIMATIONS
   ========================================= */

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes rise {
    to {
        transform: translateY(0);
    }
}

@keyframes slideUp {
    to {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }
}

@keyframes flash {

    0%,
    100% {
        transform: scaleY(0);
    }

    50% {
        transform: scaleY(1);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        text-shadow: 0 0 5px rgba(197, 160, 89, 0.2);
    }

    50% {
        text-shadow: 0 0 15px rgba(197, 160, 89, 0.6), 0 0 25px rgba(173, 191, 69, 0.3);
    }
}

@keyframes fadeInName {
    to {
        opacity: 1;
    }
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

@media (max-width: 768px) {
    body {
        padding: 1.5rem 1rem;
        justify-content: center;
    }

    .content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-top: 4rem;
    }

    h1 {
        top: 1rem;
        left: 1rem;
        font-size: clamp(1rem, 4vw, 1.3rem);
    }

    .location {
        margin-bottom: 2.5rem;
        text-align: center;
    }

    nav {
        gap: 1.1rem;
        width: 100%;
        align-items: center;
    }

    .link {
        font-size: 0.95rem;
        letter-spacing: 0.12em;
        text-align: center;
    }

    /* Sketch adjustments for mobile */
    .code-sketch,
    .geo-pattern,
    .sequence,
    .api-flow,
    .database,
    .git-flow,
    .cloud-arch {
        display: none;
    }

    .site-footer {
        position: static;
        margin-top: 3rem;
        padding-bottom: 2rem;
        text-align: center;
    }

    .site-footer nav {
        align-items: center;
    }

    .circuit {
        right: 5%;
        bottom: 8%;
        width: 40vw;
        max-width: 140px;
    }

    .terminal {
        left: 5%;
        bottom: 8%;
        width: 35vw;
        max-width: 120px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}