/* ==================== PORTFOLIO THEME EXTENSIONS ==================== */
/* Extra variables needed by portfolio components, layered on top of the
   existing RSI / Space Theme in variables.css without overriding it.      */
:root {
    /* Extended palette (aliased from core where possible) */
    --bg-primary:        var(--background);
    --bg-secondary:      var(--surface);
    --bg-tertiary:       #111820;
    --bg-elevated:       #1a2330;
    --bg-hover:          #1e293b;
    --bg-input:          #0a0e12;

    /* Text aliases */
    --text-primary:      var(--text-main);
    --text-secondary:    var(--text-light);
    --text-muted:        #64748b;

    /* Accent extensions */
    --primary-light:     #38e8ff;
    --secondary-accent:  #8b5cf6;

    /* Border extension */
    --border-light:      #334155;

    /* Typography */
    --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:  'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-base: 1rem;

    /* Layout */
    --header-height: 80px;

    /* Transition helpers */
    --transition-fast:   150ms ease;
    --transition-normal: 250ms ease;
}

/* ==================== HERO SECTION ==================== */
.hero-section {
    text-align: center;
    padding: 4rem 2rem 3rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 220, 255, 0.08) 0%, transparent 50%);
    animation: heroGlow 8s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes heroGlow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(2%, -2%); }
}

.hero-badge {
    display: inline-block;
    background: rgba(0, 220, 255, 0.15);
    border: 1px solid rgba(0, 220, 255, 0.3);
    color: var(--primary-light);
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary-accent) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    max-width: 500px;
    margin: 0 auto;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
}

/* ==================== BUTTONS ==================== */
.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 220, 255, 0.1);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-ghost:hover {
    color: var(--primary);
}

/* ==================== SECTIONS ==================== */
.section-block {
    margin-top: 3rem;
    padding-top: 2rem;
}

.section-header {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.accent-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 220, 255, 0.5);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ==================== FEATURED GRID ==================== */
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 1.5rem;
}

.featured-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.featured-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(0, 220, 255, 0.15);
    transform: translateY(-4px);
}

.featured-card-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.featured-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-card:hover .featured-card-image img {
    transform: scale(1.05);
}

.featured-card-svg-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 50%, rgba(0, 220, 255, 0.06) 0%, transparent 70%);
}

.featured-card:hover .featured-card-svg-wrapper svg {
    transform: scale(1.05);
    transition: transform 0.4s ease;
}

.featured-card-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
}

.featured-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.featured-card-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.featured-card-body .text-light {
    margin-bottom: 0.75rem;
}

.featured-card-body p {
    color: var(--text-secondary);
    line-height: 1.6;
    flex-grow: 1;
}

.featured-card-body .card-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ==================== TAGS ==================== */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tag-live { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.tag-ai { background: rgba(0, 220, 255, 0.2); color: #38e8ff; border: 1px solid rgba(0, 220, 255, 0.3); }
.tag-prod { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-blockchain { background: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.tag-security { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* ==================== TECH TAGS ==================== */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tech-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== ARTICLES GRID ==================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 220, 255, 0.12);
    transform: translateY(-3px);
}

.article-card-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .article-card-image img {
    transform: scale(1.05);
}

.article-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.article-card-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.4;
}

.article-card-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    flex-grow: 1;
}

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

.article-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.article-read-more {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.article-card:hover .article-read-more {
    color: var(--primary-light);
}

/* Horizontal article card */
.article-card-horizontal {
    flex-direction: row;
}

.article-card-horizontal .article-card-image {
    width: 280px;
    height: auto;
    min-height: 200px;
    flex-shrink: 0;
}

/* ==================== CARD NUMBER ==================== */
.card-number {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    opacity: 0.15;
    line-height: 1;
    pointer-events: none;
}

/* ==================== PROJECT SHOWCASE ==================== */
.project-showcase {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.back-nav {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.back-nav:hover {
    color: var(--primary);
}

.showcase-header {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

.showcase-header-content {
    flex: 1;
}

.showcase-header-content h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 0.25rem;
}

.showcase-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.showcase-tagline {
    font-size: 1.15rem;
    color: var(--primary-light);
    font-weight: 600;
    margin-bottom: 1rem;
}

.showcase-description {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.showcase-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.showcase-header-image {
    flex-shrink: 0;
}

.showcase-avatar {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    object-fit: cover;
}

.showcase-icon-large {
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.showcase-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.showcase-section h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* ==================== TECH STACK GRID ==================== */
.tech-stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.tech-stack-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tech-stack-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
}

.tech-stack-value {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ==================== ARCHITECTURE FLOW ==================== */
.architecture-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1.5rem 0;
}

.arch-layer {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 100px;
}

.arch-layer small {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.25rem;
}

.arch-layer-highlight {
    background: rgba(0, 220, 255, 0.15);
    border-color: var(--primary);
    color: var(--primary-light);
}

.arch-arrow {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* ==================== GALLERY ==================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.gallery-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 220, 255, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-caption {
    display: block;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ==================== FEATURES GRID ==================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.feature-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    transition: var(--transition);
}

.feature-item:hover {
    border-color: var(--primary);
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.feature-item h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ==================== ARTICLE PAGE ==================== */
.article-page {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeInUp 0.4s ease-out;
}

.article-content {
    background: transparent;
}

.article-header {
    margin-bottom: 2rem;
}

.article-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    line-height: 1.2;
    margin: 0.75rem 0;
}

.article-subtitle {
    font-size: 1.1rem;
    color: var(--primary-light);
    font-weight: 500;
    margin-bottom: 1rem;
}

.article-author {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.article-hero-image {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.article-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-section {
    margin-bottom: 2.5rem;
}

.article-section h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.article-section h3 {
    font-size: 1.1rem;
    color: var(--primary-light);
    margin: 1.5rem 0 0.75rem;
}

.article-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.article-section blockquote {
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.article-section code {
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--primary-light);
}

/* Article tables */
.article-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.article-section thead {
    background: var(--bg-tertiary);
}

.article-section thead tr {
    border-bottom: 2px solid var(--primary);
    text-align: left;
}

.article-section th {
    padding: 0.75rem;
    color: var(--text-primary);
    text-align: left;
    font-weight: 600;
}

.article-section td {
    padding: 0.75rem;
    color: var(--text-secondary);
}

.article-section tr {
    border-bottom: 1px solid var(--border);
}

.article-section a {
    color: var(--primary);
}

.article-section th a,
.article-section td a {
    color: var(--primary);
}

/* Article lists */
.article-section ul,
.article-section ol {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 0.5rem 0 1rem 1.5rem;
    padding: 0;
}

.article-section ul {
    list-style: disc;
}

.article-section ol {
    list-style: decimal;
}

.article-section li {
    margin-bottom: 0.25rem;
}

/* Article pre/code blocks */
.article-section pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.article-section pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre;
}

/* Table wrapper for horizontal scroll */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Article link sections (appendix) */
.article-section .appendix-links ul {
    line-height: 2;
}

.article-section .appendix-links a {
    color: var(--primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-stats {
        gap: 1.5rem;
    }

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

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

    .showcase-header {
        flex-direction: column;
        padding: 1.25rem;
        gap: 1rem;
    }

    .showcase-header-image {
        order: -1;
        align-self: center;
    }

    .showcase-avatar {
        width: 100px;
        height: 100px;
    }

    .showcase-icon-large {
        width: 80px;
        height: 80px;
    }

    .showcase-icon-large svg {
        width: 50px;
        height: 50px;
    }

    .showcase-section {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .showcase-section h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .showcase-tagline {
        font-size: 1rem;
    }

    .showcase-description {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .showcase-actions {
        flex-direction: column;
    }

    .showcase-actions .btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .tech-stack-item {
        padding: 0.75rem;
    }

    .tech-stack-label {
        font-size: 0.65rem;
    }

    .tech-stack-value {
        font-size: 0.85rem;
    }

    .arch-layer {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        min-width: 80px;
    }

    .feature-item {
        padding: 1rem;
    }

    .feature-item h4 {
        font-size: 0.9rem;
    }

    .feature-item p {
        font-size: 0.85rem;
    }

    .gallery-item img {
        height: 160px;
    }

    .architecture-flow {
        flex-direction: column;
    }

    .arch-arrow {
        transform: rotate(90deg);
    }

    .article-card-horizontal {
        flex-direction: column;
    }

    .article-card-horizontal .article-card-image {
        width: 100%;
        height: 180px;
    }

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

    .tech-stack-grid {
        grid-template-columns: 1fr;
    }

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

/* Extra small screens */
@media (max-width: 400px) {
    .project-showcase {
        padding: 0 0.5rem;
    }

    .showcase-header {
        padding: 1rem;
    }

    .showcase-section {
        padding: 1rem;
    }

    .showcase-actions .btn {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
}
