/* =============================================
   Modern & Beautiful Gorgans Lab Website
   ============================================= */

/* ===== Color Palette & Variables ===== */
:root {
    --primary-dark: #0f172a;
    --primary-light: #1e293b;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Skip-to-content link (visible on focus for keyboard navigation) */
.skip-link {
    position: absolute;
    left: 1rem;
    top: 1rem;
    transform: translateY(-140%);
    opacity: 0;
    background: var(--accent-blue);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transition: transform 200ms ease, opacity 160ms ease;
    pointer-events: none;
}

.skip-link:focus {
    transform: translateY(0);
    opacity: 1;
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    pointer-events: auto;
}

/* Ensure high-contrast / forced-visible modes still show it */
@media (forced-colors: active) {
    .skip-link { transform: none; opacity: 1; left: 0.5rem; top: 0.5rem; }
} 

html {
    scroll-behavior: smooth;
    /* leave room for fixed navbar when scrolling to anchors */
    scroll-padding-top: 88px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1a1f3a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
} 

/* ===== Scroll-snap: full-viewport sections (desktop & fine-pointer devices) ===== */
@media (min-width: 700px) and (pointer: fine) {
    /* Enable smooth snap on large, precise-pointer devices only */
    html, body {
        height: 100%;
        scroll-snap-type: y proximity;
    }
    
    /* Disable scroll-snap during async content loading to prevent scroll-to-bottom */
    body.loading-content,
    body.loading-content html {
        scroll-snap-type: none !important;
    }

    /* Make each semantic section fill the viewport and align content vertically */
    section, .hero, .projects-section, .footer {
        min-height: 100vh;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    /* Blog section needs dynamic height based on content */
    .blog-section {
        min-height: auto;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        display: block;
    }

    /* Ensure in-page anchor scrolling accounts for fixed navbar */
    section { scroll-margin-top: calc(var(--nav-height, 80px) + 8px); }

    /* Center the main inner containers vertically without changing their internal layout */
    .blog-section .blog-container,
    .projects-section .projects-container,
    .footer .footer-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 100%;
    }

    /* Gentle background/transform transition between sections */
    section { transition: background-color 420ms cubic-bezier(.22,.9,.37,1), transform 420ms ease; }
}

/* Respect reduced-motion and small/coarse devices: disable CSS snap */
@media (prefers-reduced-motion: reduce), (max-width: 699px), (pointer: coarse) {
    html, body { scroll-behavior: smooth; scroll-snap-type: none; }
    section, .hero, .projects-section, .footer { min-height: auto; scroll-snap-align: none; }
    .blog-section { scroll-snap-align: none; }
}

/* ===== Navigation Bar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    z-index: 99999 !important;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:active {
    color: var(--accent-cyan);
    transform: translateY(1px);
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.1));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.theme-toggle:hover {
    background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(139,92,246,0.2));
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(59,130,246,0.2);
    transform: translateY(-2px);
}

.theme-toggle:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.theme-toggle:active {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(59,130,246,0.15);
}

.theme-icon {
    font-size: 1.2em;
    line-height: 1;
    pointer-events: none;
}

.theme-label {
    font-size: 0.85rem;
    pointer-events: none;
}

/* Subtle transient hint for theme toggle (auto-hides after ~5s) */
.theme-toggle[data-hint-visible]::after {
    content: 'Try Matrix';
    display: inline-block;
    margin-left: 0.6rem;
    background: rgba(0,0,0,0.65);
    color: var(--accent-green, #9ef08a);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 280ms ease, transform 300ms cubic-bezier(.2,.9,.2,1);
}

.theme-toggle[data-hint-visible].hint-shown::after {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle[data-hint-visible]::after { transition: none !important; transform: none !important; }
}

/* First-load theme preview: REMOVED (animation caused viewport/layout issues).

   If you want a subtle, non-animated hint near the theme toggle, enable the
   `data-theme-hint` attribute on the toggle and uncomment the CSS below.
*/

/*
body[data-theme-hint] .theme-toggle::after {
  content: 'Matrix theme available';
  display: inline-block;
  margin-left: .6rem;
  color: var(--muted);
  font-size: 12px;
  opacity: 0.9;
}
*/

/* Fixed position variant for sub-pages without navbar */
.theme-toggle-fixed {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Matrix theme active state */
body.theme-matrix .theme-toggle {
    background: rgba(0, 255, 0, 0.1);
    border-color: rgba(0, 255, 0, 0.4);
    color: #00ff00;
}

body.theme-matrix .theme-toggle:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

/* Hamburger Toggle Button - Hidden on desktop, shown on mobile */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 99999;
    gap: 5px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger to X animation */
.nav-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Matrix theme hamburger */
body.theme-matrix .hamburger-line {
    background: #00ff00;
    box-shadow: 0 0 4px rgba(0, 255, 0, 0.5);
}

@media (max-width: 768px) {
    .theme-toggle .theme-label {
        display: none;
    }
    
    .theme-toggle {
        padding: 0.5rem;
        min-width: 44px;
        justify-content: center;
    }
    
    .theme-toggle-fixed {
        top: 1rem;
        right: 1rem;
    }
    
    /* Mobile Navigation */
    .nav-toggle {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        flex-direction: column;
        background: var(--primary-dark);
        padding: 2rem;
        gap: 1.5rem;
        align-items: center;
        justify-content: center;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 99998;
    }
    
    .nav-links.active {
        transform: translateX(0);
    }
    
    .nav-link {
        font-size: 1.25rem;
        padding: 0.75rem 1rem;
        width: 100%;
        text-align: center;
        border-radius: 8px;
        transition: background 0.3s ease, color 0.3s ease;
    }
    
    .nav-link:hover {
        background: rgba(59, 130, 246, 0.1);
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    /* Prevent body scroll when menu is open */
    body.nav-open {
        overflow: hidden;
    }
}

/* ===== Hero Section ===== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 80px;
    padding-bottom: 60px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    align-items: center;
    width: 100%;
}

.hero-text h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, #60a5fa, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInDown 0.8s ease-out;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.cta-button {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    width: fit-content;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 35px rgba(59, 130, 246, 0.4);
}

.cta-button:active {
    transform: translateY(-1px);
}

.hero-visual {
    position: relative;
    height: 400px;
    animation: fadeInRight 0.8s ease-out 0.2s both;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.8), rgba(139, 92, 246, 0.4));
    filter: blur(40px);
}

.shape-1 {
    width: 200px;
    height: 200px;
    top: 20%;
    right: 10%;
    animation: float 6s ease-in-out infinite;
}

.shape-2 {
    width: 300px;
    height: 300px;
    bottom: 10%;
    left: 5%;
    animation: float 8s ease-in-out infinite 1s;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.6), rgba(6, 182, 212, 0.3));
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 30%;
    animation: float 7s ease-in-out infinite 2s;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.7), rgba(59, 130, 246, 0.3));
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -30px); }
    50% { transform: translate(-20px, 20px); }
    75% { transform: translate(40px, 10px); }
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    animation: bounce 2s ease-in-out infinite;
}

.scroll-text {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.scroll-arrow {
    display: block;
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        padding: 0 1.5rem;
        gap: 2rem;
    }

    .hero-visual {
        height: 250px;
    }

    .hero-text h1 {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .floating-shape {
        filter: blur(30px);
    }
}

/* ===== Projects Section ===== */
.projects-section {
    padding: 80px 2rem;
    background: linear-gradient(180deg, var(--primary-dark) 0%, #1a1f3a 100%);
    border-top: 1px solid rgba(51, 65, 85, 0.2);
}

.projects-container {
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInUp 0.8s ease-out;
}

.section-header h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #60a5fa, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    animation: fadeInUp 1s ease-out 0.2s both;
}

@media (min-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);  /* Max 3 columns on large screens */
    }
}

/* ===== Project Cards ===== */
.project-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(30, 41, 59, 0.5));
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    height: 100%;
    min-height: 380px;  /* Ensure uniform minimum height */
    position: relative;
    backdrop-filter: blur(10px);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
    z-index: 0;
}

.project-card:hover::before {
    opacity: 1;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

.project-image {
    flex-shrink: 0;
    height: 220px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.project-card:hover .project-title {
    color: #60a5fa;
}

.project-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    flex-grow: 1;
    line-height: 1.5;
}

/* Tag container for uniform alignment */
.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
    align-items: center;
}

    /* Generic tag used across projects and repos */
    .project-tag {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 0.5rem 1rem;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.06));
        border: 1px solid rgba(59, 130, 246, 0.18);
        color: #9ec8ff;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 6px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        width: fit-content;
        transition: all 0.25s ease;
    }

    .project-tag .tag-icon {
        margin-right: 2px;
    }

    /* Repository-specific tweaks (language, stars, provider) */
    .project-card .project-tag {
        background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(14,165,233,0.03));
        border-color: rgba(99,102,241,0.12);
        color: #9ec8ff;
        font-weight: 700;
        transition: all 0.3s ease;
    }

    .project-card:hover .project-tag {
        background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(14,165,233,0.06));
        border-color: rgba(99,102,241,0.25);
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(99,102,241,0.15);
    }

    .project-card .project-title span {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-weight: 600;
    }

    /* Tag icon + text */
    .tag-icon {
        width: 16px;
        height: 16px;
        display: inline-block;
        vertical-align: middle;
        margin-right: 8px;
        flex: 0 0 16px;
    }
    
    /* Hide the default angle-bracket icon completely */
    .tag-icon[viewBox="0 0 16 16"] path[d^="M6.5"] {
        display: none;
    }
    
    .tag-icon[viewBox="0 0 16 16"]:has(path[d^="M6.5"]):has(path[d^="M9.5"]) {
        width: 0 !important;
        margin: 0 !important;
        display: none !important;
    }

    .tag-text {
        vertical-align: middle;
        display: inline-block;
        line-height: 1;
    }

    .blog-tag { display: inline-flex; align-items: center; gap: 8px; padding: 0.45rem 0.7rem; border-radius: 6px; background: rgba(139,92,246,0.06); border: 1px solid rgba(139,92,246,0.08); color: #c7b5ff; font-weight:600; }

    /* Provider badge — unified (size, shape, alignment) */
    :root {
        --badge-height: 28px;
        --badge-icon-size: 18px;
        --badge-gap: 0.5rem;
        --badge-font-size: 0.78rem;
    }

    .provider-badge {
        /* visual: pill by default, but keep compact height for consistency */
        display: inline-flex;
        align-items: center;
        gap: var(--badge-gap);
        height: var(--badge-height);
        min-width: var(--badge-height);
        padding: 0 .6rem;
        box-sizing: border-box;
        border-radius: 999px;
        background: rgba(99,102,241,0.06);
        border: 1px solid rgba(99,102,241,0.12);
        color: #9ec8ff;
        font-size: var(--badge-font-size);
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        vertical-align: middle;
        transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
    }

    /* Keep icon strictly square and consistent across providers */
    .provider-badge .tag-icon,
    .provider-badge img {
        width: var(--badge-icon-size);
        height: var(--badge-icon-size);
        flex: 0 0 var(--badge-icon-size);
        aspect-ratio: 1 / 1;
        object-fit: contain;
        display: inline-block;
        border-radius: 4px;
    }

    .provider-badge .tag-text {
        display: inline-block;
        transform-origin: center;
    }

    /* Ensure provider badge SVGs are never hidden by broader tag-icon rules */
    .provider-badge svg.tag-icon[viewBox="0 0 16 16"],
    .provider-badge svg.tag-icon {
        display: inline-block !important;
        visibility: visible !important;
        width: var(--badge-icon-size) !important;
        height: var(--badge-icon-size) !important;
        margin-right: 0.5rem !important;
        vertical-align: middle !important;
    }

    .provider-badge .tag-icon path {
        fill: currentColor !important;
        display: inline !important;
    }

    /* Card-scoped rules: anchor provider badges to the end of the tag row */
    .project-tags,
    .blog-tags {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .project-card .provider-badge,
    .blog-card .provider-badge,
    .repo-card .provider-badge {
        margin-left: auto;    /* push to the far side of the tag row */
        order: 99;            /* ensure it appears after other tags */
        align-self: center;
        box-shadow: none;
        flex: 0 0 auto;
    }

    /* High-specificity fallback: force anchoring when other rules try to override */
    .project-card > .project-info .project-tags > .provider-badge,
    .project-card .project-tags > .provider-badge,
    .blog-card .blog-tags > .provider-badge {
        order: 999 !important;
        margin-left: auto !important;
        flex: 0 0 auto !important;
        align-self: center !important;
    }

    /* Press/hover affordances */
    .provider-badge:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59,130,246,0.06); }
    .provider-badge:active { transform: translateY(0); box-shadow: 0 4px 10px rgba(59,130,246,0.04); }

    /* Responsiveness — hide text on small screens but keep icon visible */
    @media (max-width:520px) {
        .provider-badge { padding: 0 .45rem; height: 26px; min-width: 26px; flex: 0 0 auto; }
        .provider-badge .tag-text { display: none; }
        .provider-badge .tag-icon { width: 16px; height: 16px; flex: 0 0 16px; }

        /* When the tag row wraps on small screens, force the provider badge
           onto its own row and right-align it so placement is consistent */
        .project-tags .provider-badge,
        .blog-tags .provider-badge {
            order: 99;               /* ensure it appears last */
            flex-basis: 100%;        /* take full row when wrapping */
            display: flex;
            justify-content: flex-end; /* right-align within the row */
            margin-left: 0;         /* reset any inline auto margins */
            align-self: center;
            padding-right: 0.6rem;
        }
    }

    /* Project source hint (hostname) */
    .project-source {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 0.45rem 0.7rem;
        background: rgba(59, 130, 246, 0.06);
        border: 1px solid rgba(59, 130, 246, 0.1);
        color: #7eb8ff;
        font-size: 0.75rem;
        font-weight: 500;
        border-radius: 6px;
        text-transform: lowercase;
    }

    .project-card:hover .project-tag {
        background: rgba(99,102,241,0.12);
        border-color: rgba(99,102,241,0.28);
        box-shadow: 0 8px 30px rgba(99,102,241,0.08);
        transform: translateY(-1px);
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .project-image {
        height: 180px;
    }

/* ===== Blog Section ===== */
.blog-section {
    padding: 80px 2rem 60px 2rem;
    background: var(--primary-dark);
    border-top: 1px solid rgba(51, 65, 85, 0.3);
    display: block;
}

.blog-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 3rem 1rem;
}

.blog-grid {
    display: block;
    margin-bottom: 0;
    padding-bottom: 1rem;
    animation: fadeInUp 1s ease-out 0.2s both;
}

/* ===== Blog Cards ===== */
.blog-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(30, 41, 59, 0.5));
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    height: 100%;
    position: relative;
    backdrop-filter: blur(10px);
}

.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 12px;
    z-index: 0;
}

.blog-card:hover::before {
    opacity: 1;
}

.blog-card:hover {
    transform: translateY(-8px);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.15);
}

/* Blog card hero image (visual parity with project cards) */
.blog-image {
    height: 220px;
    background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(139,92,246,0.04));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.blog-image[data-no-image="true"] img {
    object-fit: contain;
    max-width: 80%;
    max-height: 80%;
}
.blog-card:hover .blog-image img { transform: scale(1.03); }

.blog-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.blog-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-read-time {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #a78bfa;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.blog-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
    line-height: 1.3;
}

.blog-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-card:hover .blog-title,
.blog-card:hover .blog-title a {
    color: #a78bfa;
}

.blog-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    flex-grow: 1;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.blog-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.blog-tag {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
}

/* Two-tier blog layout */
.blog-hero-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.blog-older-section { 
    padding-top: 2rem;
    margin-top: 1rem;
}
.blog-older-section .section-header { margin-bottom: 1.5rem; }
.blog-older-section .section-header h3 { 
    font-size: 1.5rem; 
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.blog-older-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    align-items: start;
}

/* Small preview card */
.blog-card--small { 
    display: flex; 
    flex-direction: column;
    gap: 0;
    padding: 0;
    align-items: stretch; 
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(30, 41, 59, 0.5));
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 10px; 
    overflow: hidden;
    opacity: 0; 
    transform: translateY(8px); 
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}
.blog-card--small::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.08));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}
.blog-card--small:hover::before {
    opacity: 1;
}
.blog-card--small:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 12px 24px rgba(139, 92, 246, 0.12);
}
.blog-card--small.is-visible { opacity: 1; transform: none; }
.blog-card--small .blog-image,
.blog-image--small { 
    width: 100%; 
    height: 140px; 
    flex: 0 0 140px; 
    border-radius: 0;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(139,92,246,0.04));
}
.blog-card--small .blog-image img,
.blog-card--small .blog-post-image--small,
.blog-image--small img { 
    width: 100% !important; 
    height: 140px !important;
    min-width: 100% !important;
    object-fit: cover !important; 
    object-position: center !important;
    display: block !important; 
    transition: transform 0.3s ease; 
}
.blog-card--small:hover .blog-image img { transform: scale(1.05); }
.blog-card--small .blog-content { padding: 1rem; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 0.5rem; flex-grow: 1; }
.blog-card--small .blog-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-primary); line-height: 1.3; transition: color 0.3s ease; }
.blog-card--small:hover .blog-title { color: #a78bfa; }
.blog-card--small .blog-excerpt--small { display:block; font-size:0.85rem; color:var(--text-secondary); margin:0 0 0.5rem 0; line-height:1.4; max-height:3.3em; overflow:hidden; flex-grow: 1; }
.blog-card--small .blog-meta { display:flex; gap:0.5rem; align-items:center; font-size:0.75rem; color:var(--text-secondary); margin-top: auto; }

/* Load-more controls */
.load-more-wrap { display:flex; gap:1rem; align-items:center; justify-content:center; margin-top:1rem; }
.btn-load-more { display:inline-flex; align-items:center; gap:0.6rem; background:linear-gradient(180deg,var(--accent-blue),#2563eb); color:#fff; border:0; padding:0.55rem 1rem; border-radius:999px; font-weight:700; cursor:pointer; box-shadow:0 8px 20px rgba(37,99,235,0.12); transition:transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease; }
.btn-load-more:active { transform: translateY(1px) scale(0.998); }
.btn-load-more:focus { outline: 3px solid rgba(99,102,241,0.18); outline-offset: 3px; }
.btn-load-more[disabled] { opacity:0.7; cursor:progress; box-shadow:none; }
.btn-load-more .btn-count { opacity:0.9; font-weight:600; font-size:0.9rem; color:rgba(255,255,255,0.92); }
.load-more-info { color:var(--text-secondary); font-size:0.9rem; }
.load-more-spinner { width:16px; height:16px; border:2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius:50%; display:inline-block; animation: spin 900ms linear infinite; opacity:0; transform:scale(0.92); transition:opacity 180ms ease, transform 180ms ease; }
.btn-load-more.is-loading .load-more-spinner { opacity:1; transform:scale(1); }

@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive adjustments */
@media (max-width: 1200px) {
    .blog-older-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .blog-older-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .blog-hero-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .blog-older-grid { grid-template-columns: 1fr; }
    .blog-card--small .blog-image { height: 160px; }
    .load-more-wrap { justify-content: flex-start; gap:0.6rem; }
    .btn-load-more { padding: 0.5rem 0.85rem; }
}

/* Utility */
.sr-only { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

.blog-card:hover .blog-tag {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.5);
}

/* Blog Loader */
.blog-loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.blog-loader p {
    font-size: 1rem;
}

/* Dev-visible inline warning when static blog JSON contains placeholders */
.blog-placeholder-warning {
    background: linear-gradient(90deg, rgba(250,204,21,0.06), rgba(99,102,241,0.02));
    border: 1px solid rgba(250,204,21,0.12);
    color: var(--muted);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}
.blog-placeholder-warning .btn-link {
    background: none;
    border: none;
    color: var(--accent-purple, #a78bfa);
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
    margin-left: 8px;
}
.blog-placeholder-warning .btn-link[disabled] { opacity: 0.5; cursor: default; }

/* ===== Skeleton Loading States for Better UX ===== */
.skeleton-card {
    background: linear-gradient(135deg, rgba(30,41,59,0.8), rgba(15,23,42,0.8));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    padding: 0;
    min-height: 380px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-image {
    height: 220px;
    background: linear-gradient(90deg, 
        rgba(51, 65, 85, 0.3) 0%, 
        rgba(71, 85, 105, 0.4) 50%, 
        rgba(51, 65, 85, 0.3) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-content {
    padding: 1.5rem;
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, 
        rgba(51, 65, 85, 0.3) 0%, 
        rgba(71, 85, 105, 0.4) 50%, 
        rgba(51, 65, 85, 0.3) 100%
    );
    background-size: 200% 100%;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line.title {
    width: 80%;
    height: 20px;
    margin-bottom: 1rem;
}

.skeleton-line.subtitle {
    width: 60%;
    height: 14px;
}

.skeleton-line.text {
    width: 100%;
}

.skeleton-line.text:last-child {
    width: 70%;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Blog CTA */
.blog-cta {
    display: flex;
    justify-content: center;
    padding-top: 4rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .blog-section {
        padding: 60px 1rem;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .blog-title {
        font-size: 1.15rem;
    }

    .blog-content {
        padding: 1.5rem;
    }
}

/* ===== Footer ===== */
.footer {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), #0f172a);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    padding: 4rem 2rem 2rem;
    color: var(--text-secondary);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-content h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #60a5fa, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-content > p:first-of-type {
    margin-bottom: 2rem;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.footer-links {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

/* Footer / legend instances inherit unified provider-badge styles but can tweak color */
.provider-badge {
    /* colors in footer/legend are intentionally subtle; size/shape inherited from the unified rule */
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.03);
    color: var(--text-secondary);
}

.provider-badge .tag-icon { opacity: 0.95; }

.icon-legend {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.icon-legend-toggle {
    background: transparent;
    border: 1px solid rgba(99,102,241,0.18);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.icon-legend-toggle:hover {
    background: rgba(99,102,241,0.08);
    border-color: rgba(99,102,241,0.3);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(99,102,241,0.15);
}

.icon-legend-toggle:active {
    background: rgba(99,102,241,0.12);
    transform: translateY(1px);
}

.icon-legend-panel {
    margin-top: 1rem;
    max-width: 780px;
    width: 100%;
    background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(14,165,233,0.02));
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.icon-legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    align-items: center;
}

.icon-legend-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: var(--text-secondary);
}

.icon-legend-label { font-weight: 600; color: var(--text-primary); }
.icon-legend-note { margin-top: .5rem; font-size: .9rem; color: var(--text-secondary); }

@media print {
    .icon-legend-toggle { display: none; }
    .icon-legend-panel { display: block !important; box-shadow: none; border: none; }
}

.footer-link {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #60a5fa, #06b6d4);
    transition: width 0.3s ease;
}

.footer-link:hover {
    color: #06b6d4;
}

.footer-link:hover::after {
    width: 100%;
}

.footer-link:active {
    color: #3b82f6;
    transform: translateY(1px);
}

.footer-credit {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-top: 2rem;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
}

@media (max-width: 768px) {
    .footer {
        padding: 2rem 1rem;
    }

    .footer-links {
        gap: 1rem;
    }

    .footer-content h2 {
        font-size: 1.5rem;
    }

    .projects-section {
        padding: 60px 1rem;
    }

    .tools-section {
        padding: 60px 1rem;
    }
}

/* ===== Accessibility & Performance ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Enhanced Animations & Micro-interactions ===== */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 30px rgba(139, 92, 246, 0.5); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Loading skeleton animation */
.blog-loader > .spinner {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Enhanced button hover effects */
.cta-button {
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.cta-button:hover::before {
    left: 100%;
}

/* Image loading placeholder animation */
img {
    animation: slideUp 0.4s ease-out;
}

/* Enhanced card hover with depth */
.project-card, .blog-card {
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.project-card:hover, .blog-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.2);
}

.project-card:active, .blog-card:active {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.15);
}

/* Desktop: absolutely anchor provider badge to the lower-right of the card
   — guarantees identical visual placement across cards regardless of tag wrapping */
@media (min-width: 640px) {
    .project-card, .blog-card, .repo-card { position: relative; }

    /* High-specificity anchored class — deterministic placement */
    .project-card .provider-badge--anchored,
    .blog-card .provider-badge--anchored,
    .repo-card .provider-badge--anchored {
        position: absolute !important;
        right: 1rem !important;
        bottom: 1.05rem !important;
        margin-left: 0 !important;
        transform: translateY(0) !important;
        box-shadow: 0 6px 18px rgba(59,130,246,0.06) !important;
        background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(99,102,241,0.03)) !important;
    }

    /* fallback selector for non-anchored badges (best-effort) */
    .project-card .provider-badge, .blog-card .provider-badge, .repo-card .provider-badge {
        /* keep as a fallback only — anchored class is authoritative */
    }

    /* ensure tag row doesn't extend under the absolute badge */
    .project-card .project-tags, .blog-card .blog-tags { padding-right: 6.5rem; }
}

/* Mobile: keep in-flow, right-aligned row (existing responsive behavior remains) */
@media (max-width: 639px) {
    .project-card .project-tags, .blog-card .blog-tags { padding-right: 0.5rem; }
    .project-card .provider-badge, .blog-card .provider-badge { position: static; flex-basis: 100%; justify-content: flex-end; }
}

/* Floating animation on hover for project images */
.project-image img {
    transition: transform 0.4s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.1) rotate(2deg);
}

/* Enhanced tag chip animation */
.blog-tag {
    position: relative;
    transition: all 0.2s ease;
}

.blog-tag:hover {
    transform: translateY(-2px);
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

/* Improved focus states for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

/* Smooth transition for navbar */
.navbar {
    transition: all 0.3s ease;
}

/* Scroll-triggered animations helper */
.fade-in {
    animation: slideUp 0.6s ease-out forwards;
}

/* Respects user's motion preference */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Tools Section ===== */
.tools-section {
    padding: 80px 2rem;
    background: linear-gradient(180deg, #1a1f3a 0%, var(--primary-dark) 100%);
    border-top: 1px solid rgba(51, 65, 85, 0.2);
}

.tools-container {
    max-width: 1400px;
    margin: 0 auto;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    animation: fadeInUp 1s ease-out 0.2s both;
}

.tools-loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.tool-card {
    display: block;
    padding: 1.5rem;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(51, 65, 85, 0.3);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa, #06b6d4);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.tool-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tool-card:hover .tool-title {
    color: #60a5fa;
}

.tool-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.tool-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tool-category {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border-radius: 20px;
    font-weight: 500;
}

.tool-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(250, 204, 21, 0.15);
    color: #facc15;
    border-radius: 20px;
    font-weight: 500;
}

/* Tool Card with Image Variant */
.tool-card--with-image {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.tool-card--with-image .tool-content {
    padding: 1.5rem;
}

.tool-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}

.tool-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-image img {
    transform: scale(1.05);
}

.tool-body-preview {
    font-size: 0.85rem;
    color: var(--text-tertiary, #94a3b8);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border-radius: 20px;
    font-weight: 500;
}

.tool-cta {
    display: block;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
    font-size: 0.875rem;
    font-weight: 600;
    color: #60a5fa;
    transition: color 0.3s ease;
}

.tool-card:hover .tool-cta {
    color: #93c5fd;
}

/* ===== Page & Blog Post Styles ===== */
.page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 120px; /* Account for fixed navbar + extra spacing */
    animation: fadeInUp 0.8s ease-out;
}

.page.blog-post {
    max-width: 800px;
}

.page .section-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.page .section-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.blog-date {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.blog-date::before {
    content: "📅";
}

.page .blog-image {
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.page .blog-image img {
    width: 100%;
    height: auto;
    display: block;
}

.page-content {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1.0625rem;
}

.page-content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.page-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.5rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.page-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem;
}

.page-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem;
}

.page-content ul,
.page-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
    color: var(--text-secondary);
}

.page-content li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.page-content a {
    color: #60a5fa;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.page-content a:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}

.page-content strong,
.page-content b {
    color: var(--text-primary);
    font-weight: 600;
}

.page-content em,
.page-content i {
    font-style: italic;
    color: var(--text-secondary);
}

.page-content code {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
}

.page-content pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    box-shadow: var(--shadow-md);
}

.page-content pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.page-content blockquote {
    border-left: 4px solid #a78bfa;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-secondary);
    background: rgba(167, 139, 250, 0.05);
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem auto;
    display: block;
    box-shadow: var(--shadow-md);
}

.page-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2.5rem 0;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    overflow-x: auto;
    display: block;
}

.page-content table th,
.page-content table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.page-content table th {
    background: rgba(96, 165, 250, 0.1);
    color: var(--text-primary);
    font-weight: 600;
}

.page-content table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.1);
}

/* Project Links Section */
.project-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.project-link svg {
    flex-shrink: 0;
}

.project-link--repo {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(30, 41, 59, 0.6));
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
}

.project-link--repo:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.1));
    border-color: rgba(96, 165, 250, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(96, 165, 250, 0.15);
}

.project-link--demo {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}

.project-link--demo:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(139, 92, 246, 0.15));
    border-color: rgba(139, 92, 246, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15);
}

/* Mobile optimization for page content */
@media (max-width: 768px) {
    .page {
        padding: 1.5rem;
        padding-top: 100px; /* Adjust for mobile navbar height */
    }
    
    .page .section-header h1 {
        font-size: 1.75rem;
    }
    
    .page-content {
        font-size: 1rem;
    }
    
    .page-content h2 {
        font-size: 1.5rem;
    }
    
    .page-content h3 {
        font-size: 1.25rem;
    }
    
    .page-content pre {
        padding: 1rem;
        font-size: 0.85rem;
    }
}

/* Tool Meta Header (for tool detail pages using blog-post layout) */
.tool-meta-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1rem;
}

.tool-meta-header .tool-category {
    font-size: 0.875rem;
    padding: 0.35rem 1rem;
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border-radius: 20px;
    font-weight: 500;
}

.tool-meta-header .tool-type {
    font-size: 0.875rem;
    padding: 0.35rem 1rem;
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border-radius: 20px;
    font-weight: 500;
}

/* Tool Actions (CTA button for tool detail pages) */
.tool-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.tool-actions .cta-button {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(167, 139, 250, 0.3);
}

.tool-actions .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(167, 139, 250, 0.4);
}

/* Project actions with multiple buttons */
.project-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.project-actions .cta-button--secondary {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(30, 41, 59, 0.7));
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.15);
}

.project-actions .cta-button--secondary:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.1));
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow: 0 8px 25px rgba(96, 165, 250, 0.25);
}

@media (min-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .tools-section {
        padding: 60px 1rem;
    }
}

/* ===== Print Styles ===== */
@media print {
    .navbar,
    .scroll-indicator {
        display: none;
    }

    .projects-grid {
        grid-template-columns: 1fr 1fr;
    }
}
/* Featured Blog Posts Section */
.featured-blog-section {
    margin-bottom: 4rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.featured-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.featured-grid--1 {
    grid-template-columns: 1fr;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.featured-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.featured-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.featured-grid--multi {
    grid-template-columns: repeat(3, 1fr);
}

.featured-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.8));
    border: 1px solid rgba(139, 92, 246, 0.2);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.2), 0 0 0 1px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
}

.featured-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-card:hover .featured-image img {
    transform: scale(1.05);
}

.featured-image--placeholder {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
}

.featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(15, 23, 42, 0.9) 100%);
}

.featured-content {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fbbf24;
    width: fit-content;
}

.featured-badge svg {
    color: #fbbf24;
}

.featured-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    color: #f1f5f9;
    margin: 0;
}

.featured-card:hover .featured-title {
    color: #a78bfa;
}

.featured-excerpt {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #94a3b8;
    margin: 0;
}

.featured-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #64748b;
}

.featured-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
}

@media (max-width: 1024px) {
    .featured-grid--3,
    .featured-grid--multi {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .featured-grid--2,
    .featured-grid--3,
    .featured-grid--multi {
        grid-template-columns: 1fr;
    }

    .featured-blog-section {
        margin-bottom: 2rem;
        padding-bottom: 2rem;
    }

    .featured-title {
        font-size: 1.05rem;
    }
}
