/* ==========================================
   TRIDEV LABS — projects.css
   Matches agency.css warm design system
   ========================================== */

/* --- RESET & BASE --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:          #1a1a1a;
    --bg-card:     #242424;
    --bg-hover:    #2c2c2c;
    --surface:     #2a2a2a;
    --border:      rgba(255, 255, 255, 0.07);
    --border-hover:rgba(255, 255, 255, 0.14);
    --text:        #f0ece4;
    --text-muted:  #a09a8e;
    --text-dim:    #6b665c;
    --accent:      #d4a853;
    --accent-soft: rgba(212, 168, 83, 0.12);
    --radius:      12px;
    --radius-lg:   18px;
    --transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --mono:        'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

body:not(.loaded) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 28px;
}

/* --- CURSOR GLOW --- */
.cursor-glow {
    position: fixed;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.04), transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s;
}
@media (max-width: 768px) { .cursor-glow { display: none; } }

/* --- LOADER --- */
.loader {
    position: fixed; inset: 0; z-index: 10000;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loader.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loader-bar {
    width: 80px; height: 2px;
    background: var(--surface); border-radius: 4px; overflow: hidden; position: relative;
}
.loader-bar::after {
    content: ''; position: absolute; top: 0; left: -50%;
    width: 50%; height: 100%;
    background: var(--accent); border-radius: 4px;
    animation: loaderSlide 1s ease-in-out infinite;
}
@keyframes loaderSlide { 0% { left: -50%; } 100% { left: 100%; } }
.loader-text { font-size: 0.72rem; font-weight: 500; color: var(--text-dim); letter-spacing: 2px; text-transform: uppercase; }

/* --- ANIMATIONS --- */
.anim-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--delay, 0s);
}
.anim-reveal.revealed { opacity: 1; transform: translateY(0); }

/* --- NAVIGATION --- */
.nav {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000; padding: 18px 0;
    transition: all 0.3s ease;
}
.nav.scrolled {
    padding: 10px 0;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1100px; margin: 0 auto; padding: 0 28px;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
    font-family: var(--mono); font-weight: 700; font-size: 1.1rem;
    color: var(--text); transition: var(--transition);
}
.nav-logo:hover { color: var(--accent); }
.logo-bracket { color: var(--accent); }

.nav-links { display: flex; list-style: none; gap: 4px; }
.nav-link {
    padding: 8px 14px; font-size: 0.88rem; font-weight: 500;
    color: var(--text-muted); border-radius: 8px;
    transition: var(--transition); position: relative;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after {
    content: ''; position: absolute; bottom: 4px; left: 50%;
    transform: translateX(-50%); width: 4px; height: 4px;
    border-radius: 50%; background: var(--accent);
}
.nav-cta {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 18px; font-size: 0.82rem; font-weight: 600;
    color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; transition: var(--transition);
}
.nav-cta:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- PAGE HERO --- */
.page-hero {
    position: relative;
    min-height: 72vh;
    display: flex; align-items: center;
    padding: 130px 0 70px;
    overflow: hidden;
}

.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 20%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 20%, transparent 100%);
}
.hero-gradient {
    position: absolute; top: -20%; left: 50%; transform: translateX(-50%);
    width: 700px; height: 500px;
    background: radial-gradient(ellipse, rgba(212, 168, 83, 0.06) 0%, transparent 65%);
    animation: heroGlow 10s ease-in-out infinite alternate;
}
@keyframes heroGlow {
    0%   { opacity: 0.5; transform: translateX(-50%) scale(1); }
    100% { opacity: 0.8; transform: translateX(-50%) scale(1.05); }
}

.page-hero-content { position: relative; z-index: 1; max-width: 640px; }

.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 16px; font-size: 0.78rem; font-weight: 500;
    color: var(--accent); border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 100px; background: var(--accent-soft); margin-bottom: 24px;
}
.badge-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
    animation: dotPulse 2.5s ease-in-out infinite;
}
@keyframes dotPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.8); } }

.page-hero-title {
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    font-weight: 800; letter-spacing: -1.5px; line-height: 1.15;
    margin-bottom: 18px;
}
.page-hero-sub {
    font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 36px; max-width: 520px;
}
.text-gradient {
    color: var(--accent);
    background: none;
    -webkit-text-fill-color: var(--accent);
}

/* Stats row */
.page-hero-stats { display: flex; align-items: center; gap: 36px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.stat-number {
    font-size: 1.8rem; font-weight: 800; font-family: var(--mono);
    color: var(--accent);
}
.stat-label { font-size: 0.78rem; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* Scroll indicator */
.scroll-indicator {
    position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.scroll-indicator span { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 2px; }
.scroll-line { width: 1px; height: 50px; background: var(--border); position: relative; overflow: hidden; }
.scroll-line::after {
    content: ''; position: absolute; top: -100%; left: 0; width: 100%; height: 40%;
    background: var(--accent); animation: scrollDown 2.5s ease-in-out infinite;
}
@keyframes scrollDown { 0% { top: -40%; } 100% { top: 100%; } }

/* --- SECTIONS --- */
.section { padding: 90px 0; position: relative; }

.section-label {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 0.75rem; font-weight: 600; color: var(--accent);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 16px;
}
.label-line { width: 24px; height: 2px; background: var(--accent); border-radius: 2px; }

.section-heading {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; margin-bottom: 42px;
}

/* --- TOOL CARDS --- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex; flex-direction: column; gap: 12px;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.tool-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 2px; height: 0; background: var(--accent);
    border-radius: 0 2px 2px 0; transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.tool-card:hover::before { height: 100%; }
.tool-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 18px 48px rgba(0,0,0,0.2);
}

.tool-card-header { display: flex; align-items: center; justify-content: space-between; }

.tool-icon {
    width: 44px; height: 44px; border-radius: 10px;
    background: var(--accent-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 1rem;
    transition: var(--transition);
}
.tool-icon--web  { background: rgba(130, 180, 140, 0.1); color: #7ab87a; }
.tool-icon--cli  { background: rgba(200, 170, 120, 0.1); color: #c8aa78; }
.tool-icon--game { background: rgba(200, 140, 130, 0.1); color: #d4a07a; }

.tool-card:hover .tool-icon { background: var(--accent); color: var(--bg); }
.tool-card:hover .tool-icon--web  { background: #7ab87a; color: var(--bg); }
.tool-card:hover .tool-icon--cli  { background: #c8aa78; color: var(--bg); }
.tool-card:hover .tool-icon--game { background: #d4a07a; color: var(--bg); }

.tool-tag {
    font-size: 0.7rem; font-weight: 600; padding: 4px 10px;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid rgba(212, 168, 83, 0.2); border-radius: 100px;
}

.tool-card h3 { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.2px; }
.tool-card p  { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; flex: 1; }

.tool-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.tool-meta span {
    font-size: 0.72rem; font-weight: 500;
    padding: 3px 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 5px;
    color: var(--text-dim); transition: var(--transition);
}
.tool-card:hover .tool-meta span { border-color: rgba(212, 168, 83, 0.25); color: var(--accent); }

.tool-link {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.85rem; font-weight: 600; color: var(--accent);
    margin-top: 4px; transition: var(--transition);
}
.tool-link:hover { gap: 12px; }
.tool-link--download { color: var(--accent); }
.tool-link--download:hover { opacity: 0.8; }

/* --- SNIPPETS SECTION --- */
.snippets-section {
    background: rgba(212, 168, 83, 0.015);
    border-top: 1px solid rgba(212, 168, 83, 0.06);
}

.snippets-sub {
    font-size: 0.95rem; color: var(--text-muted); margin-bottom: 32px; max-width: 520px;
}

/* Filters */
.snippet-filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }
.filters-row { display: flex; gap: 6px; flex-wrap: wrap; }

.filter-btn {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    padding: 7px 16px; border-radius: 8px;
    cursor: pointer; font-size: 0.82rem; font-weight: 600;
    font-family: inherit;
    transition: var(--transition); user-select: none;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.filter-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Favorites toggle */
.favorite-toggle { display: flex; align-items: center; gap: 10px; }
#favoritesToggle {
    appearance: none; -webkit-appearance: none;
    width: 40px; height: 20px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; cursor: pointer; position: relative; transition: var(--transition); outline: none;
}
#favoritesToggle:checked { background: var(--accent); border-color: var(--accent); }
#favoritesToggle::before {
    content: ''; position: absolute;
    width: 16px; height: 16px; border-radius: 8px;
    background: var(--text); top: 2px; left: 2px; transition: var(--transition);
}
#favoritesToggle:checked::before { left: 22px; background: var(--bg); }
.favorite-toggle label { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: var(--transition); }
#favoritesToggle:checked + label { color: var(--accent); }

/* Snippet grid */
.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.snippet-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex; flex-direction: column;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.snippet-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(0,0,0,0.18);
}

.snippet-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.snippet-header h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.2px; }

.header-right { display: flex; align-items: center; gap: 8px; }

.language-tag {
    font-size: 0.7rem; font-weight: 600; padding: 3px 9px;
    background: var(--accent-soft); color: var(--accent);
    border: 1px solid rgba(212, 168, 83, 0.2); border-radius: 5px;
}

.favorite-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 1rem; padding: 4px; transition: var(--transition);
    display: flex; align-items: center;
}
.favorite-btn:hover { color: #d4a853; transform: scale(1.15); }
.favorite-btn.favorited { color: #d4a853; }

.snippet-description {
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    padding: 10px 14px; margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem; line-height: 1.55; flex-shrink: 0;
}
.snippet-description p { margin: 4px 0; color: var(--text-muted); }
.snippet-description strong { color: var(--text); }

.snippet-body {
    flex: 1;
    overflow: auto;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.25);
    padding: 14px;
    scrollbar-color: var(--accent) rgba(0,0,0,0.2);
    scrollbar-width: thin;
    max-height: 220px;
}
.snippet-body::-webkit-scrollbar { width: 5px; height: 5px; }
.snippet-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 5px; }
.snippet-body::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 5px; }

.snippet-code {
    font-family: var(--mono); font-size: 0.78rem;
    color: #b5ce82; margin: 0; padding: 0;
    line-height: 1.55; white-space: pre; display: block;
}

.copy-btn {
    background: var(--accent); border: none; color: var(--bg);
    padding: 9px 14px; border-radius: var(--radius);
    cursor: pointer; font-size: 0.82rem; font-weight: 600; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: var(--transition); flex-shrink: 0;
}
.copy-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212, 168, 83, 0.25); }
.copy-btn.copied { background: #56b550; }

/* --- PAGINATION --- */
.pagination {
    display: flex; flex-direction: column;
    align-items: center; gap: 10px;
    margin-top: 52px;
}
.pagination-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pagination-btn {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-muted); padding: 7px 13px; border-radius: 8px;
    cursor: pointer; font-family: inherit; font-weight: 600; font-size: 0.85rem;
    transition: var(--transition); min-width: 38px;
}
.pagination-btn:hover { border-color: var(--accent); color: var(--accent); }
.pagination-btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.pagination-info { font-size: 0.78rem; color: var(--text-dim); font-family: var(--mono); letter-spacing: 0.5px; }

/* --- FOOTER --- */
.footer { border-top: 1px solid var(--border); padding: 42px 0 28px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.footer-brand p { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }
.footer-links { display: flex; gap: 12px; }
.footer-links a {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-muted); font-size: 0.95rem; transition: var(--transition);
}
.footer-links a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; }
.footer-bottom p { font-size: 0.78rem; color: var(--text-dim); }

/* --- RESPONSIVE --- */
@media (max-width: 960px) {
    .tools-grid { grid-template-columns: 1fr 1fr; }
    .snippets-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .container { padding: 0 20px; }
    .section { padding: 64px 0; }
    .page-hero { padding: 110px 0 52px; min-height: auto; }
    .page-hero-title { font-size: clamp(1.8rem, 8vw, 2.6rem); }
    .page-hero-stats { gap: 18px; }
    .stat-number { font-size: 1.5rem; }
    .tools-grid { grid-template-columns: 1fr; }
    .filters-row { gap: 5px; }
    .filter-btn { padding: 6px 12px; font-size: 0.78rem; }
    .hero-actions { flex-direction: column; align-items: flex-start; }
    .footer-inner { flex-direction: column; gap: 16px; text-align: center; }

    /* Nav mobile */
    .nav-links {
        display: none; position: fixed; inset: 0; top: 0;
        background: rgba(26, 26, 26, 0.97); backdrop-filter: blur(16px);
        flex-direction: column; align-items: center; justify-content: center;
        gap: 8px; z-index: 999;
    }
    .nav-links.open { display: flex; }
    .nav-link { font-size: 1.3rem; padding: 14px 28px; }
    .nav-cta { display: none; }
    .nav-toggle { display: flex; z-index: 1001; }
    .scroll-indicator { display: none; }
}
