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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.8;
    color: #1a1a1a;
    background-color: #eeebe1;
    overflow-x: hidden;
}

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

/* ── Scroll-Reveal Animations ── */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(32px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Initial load animations for above-the-fold */
.contact-links {
    animation: fadeIn 0.6s ease both;
}

.header {
    animation: fadeUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.1s;
}

/* Scroll-triggered reveal */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children on reveal */
.reveal.visible .service-item,
.reveal.visible .tech-category,
.reveal.visible .essay-card {
    opacity: 0;
    animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal.visible .service-item:nth-child(1),
.reveal.visible .tech-category:nth-child(1),
.reveal.visible .essay-card:nth-child(1) { animation-delay: 0.05s; }
.reveal.visible .service-item:nth-child(2),
.reveal.visible .tech-category:nth-child(2),
.reveal.visible .essay-card:nth-child(2) { animation-delay: 0.1s; }
.reveal.visible .service-item:nth-child(3),
.reveal.visible .tech-category:nth-child(3),
.reveal.visible .essay-card:nth-child(3) { animation-delay: 0.15s; }
.reveal.visible .tech-category:nth-child(4),
.reveal.visible .essay-card:nth-child(4) { animation-delay: 0.2s; }
.reveal.visible .tech-category:nth-child(5),
.reveal.visible .essay-card:nth-child(5) { animation-delay: 0.25s; }
.reveal.visible .essay-card:nth-child(6) { animation-delay: 0.3s; }
.reveal.visible .essay-card:nth-child(7) { animation-delay: 0.33s; }
.reveal.visible .essay-card:nth-child(8) { animation-delay: 0.36s; }
.reveal.visible .essay-card:nth-child(9) { animation-delay: 0.39s; }
.reveal.visible .essay-card:nth-child(10) { animation-delay: 0.42s; }
.reveal.visible .essay-card:nth-child(11) { animation-delay: 0.45s; }

/* ── Contact Links ── */
.contact-links {
    margin-bottom: 60px;
    font-size: 0.95em;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.contact-links a {
    color: #1a1a1a;
    text-decoration: none;
    padding: 6px 16px;
    border: 1px solid transparent;
    border-radius: 100px;
    transition: all 0.3s ease;
}

.contact-links a:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

/* ── Header Section ── */
.header {
    margin-bottom: 100px;
}

.header-subtitle {
    font-size: 0.95em;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

h1 {
    font-size: 3.8em;
    font-weight: 600;
    margin-bottom: 28px;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.intro {
    font-size: 1.15em;
    line-height: 1.8;
    margin-bottom: 10px;
    font-weight: 400;
    color: #3a3a3a;
    max-width: 100%;
}

.cv-link {
    display: inline-block;
    margin-top: 30px;
    margin-right: 12px;
    padding: 16px 36px;
    background-color: #1a1a1a;
    color: #fff;
    text-decoration: none;
    border-radius: 100px;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    font-size: 0.95em;
    font-weight: 500;
    position: relative;
}

.cv-link:hover {
    background-color: #333;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(26, 26, 26, 0.2);
}

.cv-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(26, 26, 26, 0.15);
}

/* ── Stats Strip ── */

/* ── Section Headings ── */
.section-heading {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 40px;
}

.section-heading h2 {
    font-size: 2em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-heading-line {
    flex-grow: 1;
    height: 1px;
    background-color: rgba(26, 26, 26, 0.12);
}

/* ── Services Section ── */
.services {
    margin-bottom: 100px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.service-item {
    padding: 36px 32px;
    border: 1px solid rgba(26, 26, 26, 0.08);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.35);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.service-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1a1a1a 0%, rgba(26, 26, 26, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.service-item:hover::before {
    opacity: 1;
}

.service-item:hover {
    background-color: rgba(255, 255, 255, 0.7);
    border-color: rgba(26, 26, 26, 0.12);
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(26, 26, 26, 0.08);
}

.service-item h3 {
    font-size: 1.15em;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.service-item p {
    font-size: 0.95em;
    line-height: 1.7;
    color: #555;
}

/* ── Testimonials Section ── */
.testimonials {
    margin-bottom: 100px;
}

.testimonial-item {
    margin-bottom: 35px;
}

.testimonial-text {
    font-size: 1.05em;
    line-height: 1.7;
    color: #2a2a2a;
    margin-bottom: 10px;
    font-style: italic;
}

.testimonial-author {
    font-size: 0.95em;
    color: #666;
}

/* ── Tech Stack ── */
.tech-stack {
    margin-bottom: 100px;
}

.tech-category {
    margin-bottom: 28px;
}

.tech-category-label {
    font-size: 0.82em;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 12px;
}

.tech-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-pill {
    padding: 8px 18px;
    font-size: 0.9em;
    font-weight: 450;
    color: #1a1a1a;
    background-color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(26, 26, 26, 0.1);
    border-radius: 100px;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: default;
}

.tech-pill:hover {
    background-color: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(26, 26, 26, 0.12);
}

/* ── Essays ── */
.essays {
    margin-bottom: 100px;
}

.essay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.essay-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px 26px;
    border: 1px solid rgba(26, 26, 26, 0.08);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    min-height: 170px;
    position: relative;
    overflow: hidden;
}

.essay-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1a1a1a 0%, rgba(26, 26, 26, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.essay-card:hover {
    background-color: rgba(255, 255, 255, 0.65);
    border-color: rgba(26, 26, 26, 0.12);
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(26, 26, 26, 0.08);
}

.essay-card-tag {
    display: inline-block;
    font-size: 0.72em;
    font-weight: 600;
    color: #fff;
    background-color: #1a1a1a;
    padding: 3px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    align-self: flex-start;
}

.essay-card-title {
    font-size: 1.08em;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
    flex-grow: 1;
}

.essay-card-read {
    margin-top: 20px;
    font-size: 0.88em;
    font-weight: 500;
    color: #666;
    transition: color 0.3s ease;
}

.essay-card-read::after {
    content: " \2192";
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.essay-card:hover .essay-card-read {
    color: #1a1a1a;
}

.essay-card:hover .essay-card-read::after {
    transform: translateX(5px);
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 80px 0 40px 0;
    margin-top: 100px;
    border-top: 1px solid rgba(26, 26, 26, 0.1);
    animation: fadeIn 0.6s ease both;
    animation-delay: 0.3s;
}

.footer a {
    color: #1a1a1a;
    text-decoration: none;
    margin: 0 20px;
    font-size: 0.95em;
    transition: color 0.3s ease;
    opacity: 0.5;
}

.footer a:hover {
    opacity: 1;
}

/* ── Legal Content Pages ── */
.legal-content {
    max-width: 800px;
    margin-bottom: 100px;
}

.legal-content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 50px;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.legal-content h3 {
    font-size: 1.2em;
    font-weight: 500;
    margin-top: 30px;
    margin-bottom: 15px;
}

.legal-content p {
    font-size: 1em;
    line-height: 1.7;
    color: #2a2a2a;
    margin-bottom: 20px;
}

.legal-content ul {
    margin: 20px 0 20px 30px;
    line-height: 1.7;
}

.legal-content li {
    margin-bottom: 10px;
}

.legal-content a {
    color: #1a1a1a;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.legal-content a:hover {
    color: #666;
}

/* ── Essay Content Pages ── */
.essay-content {
    max-width: 800px;
    margin-bottom: 100px;
}

.essay-meta {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 40px;
}

.essay-content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 50px;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.essay-content h3 {
    font-size: 1.2em;
    font-weight: 500;
    margin-top: 30px;
    margin-bottom: 15px;
}

.essay-content p {
    font-size: 1em;
    line-height: 1.8;
    color: #2a2a2a;
    margin-bottom: 20px;
}

.essay-content ul,
.essay-content ol {
    margin: 20px 0 20px 30px;
    line-height: 1.8;
}

.essay-content li {
    margin-bottom: 10px;
}

.essay-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.essay-content pre {
    background-color: #0d1117;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 20px 0;
}

.essay-content pre code {
    background-color: transparent;
    padding: 0;
    color: #e6edf3;
}

.essay-content blockquote {
    border-left: 3px solid #1a1a1a;
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #4a4a4a;
}

.essay-content img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 4px;
}

.essay-content a {
    color: #1a1a1a;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.essay-content a:hover {
    color: #666;
}

.essay-content strong {
    font-weight: 600;
}

.back-link {
    display: inline-block;
    margin-top: 40px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.95em;
    transition: all 0.25s ease;
}

.back-link:hover {
    color: #666;
    transform: translateX(-3px);
}

.back-link:before {
    content: "\2190 ";
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .container {
        padding: 60px 20px;
    }

    h1 {
        font-size: 2.4em;
    }

    .intro {
        font-size: 1em;
    }

    .contact-links {
        gap: 4px;
    }

    .contact-links a {
        padding: 6px 12px;
        font-size: 0.9em;
    }


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

    .service-item:hover {
        transform: none;
        box-shadow: none;
    }

    .cv-link:hover {
        transform: none;
        box-shadow: none;
    }

    .footer a {
        display: block;
        margin: 10px 0;
    }

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

    .essay-card:hover {
        transform: none;
        box-shadow: none;
    }

    .tech-pill:hover {
        transform: none;
        box-shadow: none;
        background-color: rgba(255, 255, 255, 0.4);
        color: #1a1a1a;
        border-color: rgba(26, 26, 26, 0.1);
    }

    .section-heading h2 {
        font-size: 1.6em;
    }
}
