:root {
    --bg-primary:      #0d0d0d;
    --bg-secondary:    #111111;
    --bg-card:         #181818;
    --bg-elevated:     #1e1e1e;
    --bg-glass:        rgba(24, 24, 24, 0.72);
    --bg-terminal:     #0a0a0a;
    --border:          rgba(255, 255, 255, 0.07);
    --border-soft:     rgba(255, 255, 255, 0.10);
    --border-hover:    rgba(255, 255, 255, 0.18);
    --border-accent:   rgba(59, 130, 246, 0.35);
    --text-primary:    #f0f0f0;
    --text-secondary:  #a3a3a3;
    --text-muted:      #5a5a5a;
    --accent:          #3b82f6;
    --accent-bright:   #60a5fa;
    --accent-glow:     rgba(59, 130, 246, 0.15);
    --accent-glow-md:  rgba(59, 130, 246, 0.25);
    /* Lang colors */
    --js-color:      #f7df1e;
    --js-bg:         rgba(247, 223, 30, 0.1);
    --node-color:    #68a063;
    --node-bg:       rgba(104, 160, 99, 0.1);
    --py-color:      #3572A5;
    --py-bg:         rgba(53, 114, 165, 0.12);
    --css-color:     #563d7c;
    --css-bg:        rgba(86, 61, 124, 0.12);
    --react-color:   #61dafb;
    --react-bg:      rgba(97, 218, 251, 0.08);

    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   22px;
    --radius-full: 9999px;

    --transition-fast:   150ms ease;
    --transition-base:   220ms ease;
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    --shadow-md:    0 4px 16px rgba(0,0,0,0.5);
    --shadow-glow:  0 0 40px rgba(59, 130, 246, 0.12);

    --nav-h: 64px;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-h);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a    { color: inherit; text-decoration: none; }
ul   { list-style: none; }
img  { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ------------------------------------------------
   ANIMATIONS
------------------------------------------------ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 0.9; }
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--nav-h);
    background: rgba(13, 13, 13, 0.65);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-bottom: 1px solid var(--border-soft);
    transition: background var(--transition-base), box-shadow var(--transition-base);
}
.navbar.scrolled {
    background: rgba(13, 13, 13, 0.92);
    box-shadow: 0 1px 24px rgba(0,0,0,0.6);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    user-select: none;
}
.nav-logo-icon {
    color: var(--accent);
    font-size: 22px;
    font-variation-settings: 'FILL' 0, 'wght' 300;
}
.nav-logo-text { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.logo-lex    { color: var(--text-primary); }
.logo-snipet { color: var(--accent-bright); }

.nav-menu { display: flex; align-items: center; gap: 4px; }

.nav-link {
    position: relative;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 1.5px;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link:hover::after, .nav-link.active::after { width: 60%; }

.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 32px;
    padding: 4px;
    cursor: pointer;
}
.burger-line {
    display: block;
    width: 100%; height: 1.5px;
    background: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: transform var(--transition-smooth), opacity var(--transition-fast);
}
.burger.open .burger-line:nth-child(1) { transform: translateY(6.5px) rotate(45deg); background: var(--text-primary); }
.burger.open .burger-line:nth-child(2) { opacity: 0; }
.burger.open .burger-line:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); background: var(--text-primary); }

.mobile-menu {
    display: none;
    flex-direction: column;
    background: rgba(15, 15, 15, 0.97);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 12px 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.mobile-menu.open { max-height: 300px; }

.mobile-link {
    padding: 11px 28px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast), padding-left var(--transition-base);
    border-left: 2px solid transparent;
}
.mobile-link:hover, .mobile-link.active {
    color: var(--text-primary);
    padding-left: 36px;
    border-left-color: var(--accent);
}

.snippet-main {
    padding-top: var(--nav-h);
}

.page-header {
    position: relative;
    padding: 64px 0 48px;
    text-align: center;
    overflow: hidden;
}

.header-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, black 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, black 20%, transparent 80%);
}
.bg-glow {
    position: absolute;
    top: -60px; left: 50%;
    transform: translateX(-50%);
    width: 500px; height: 300px;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
    filter: blur(40px);
    animation: pulse-glow 5s ease-in-out infinite;
}

.header-content {
    position: relative;
    z-index: 1;
    animation: fadeUp 0.5s ease both;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    font-size: 11px;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}
.header-badge .material-symbols-outlined {
    font-size: 14px;
    color: var(--accent);
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

.page-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 14px;
}
.title-lex    { color: var(--text-primary); }
.title-snipet { color: var(--accent-bright); }
.title-icon {
    display: inline;
    font-size: 0.6em;
    color: var(--accent);
    vertical-align: middle;
    font-variation-settings: 'FILL' 0, 'wght' 200;
    margin-left: 8px;
    position: relative;
    top: -2px;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.7;
}

.search-section {
    padding: 0 0 48px;
}

.terminal-search-wrap {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    background: var(--bg-terminal);
    overflow: hidden;
    box-shadow: 0 4px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}
.terminal-search-wrap:focus-within {
    border-color: var(--border-accent);
    box-shadow: 0 4px 32px rgba(0,0,0,0.5), 0 0 24px rgba(59, 130, 246, 0.12);
}

/* Toolbar */
.terminal-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}
.dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.terminal-label {
    margin-left: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* Input row */
.terminal-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.terminal-icons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.t-icon {
    font-size: 16px;
    color: var(--text-muted);
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

.terminal-prompt {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    flex-shrink: 0;
    user-select: none;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
    caret-color: var(--accent);
    letter-spacing: 0.01em;
}
.terminal-input::placeholder {
    color: var(--text-muted);
}

.terminal-input:focus::placeholder { opacity: 0; }

.search-btn {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.search-btn:hover {
    background: rgba(59, 130, 246, 0.22);
    transform: scale(1.06);
}
.search-btn:active { transform: scale(0.96); }
.search-btn .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent-bright);
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

/* Filter tags */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
}

.filter-tag {
    padding: 5px 13px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.02em;
}
.filter-tag:hover {
    color: var(--text-secondary);
    border-color: var(--border-soft);
}
.filter-tag.active {
    color: var(--accent-bright);
    border-color: var(--border-accent);
    background: rgba(59, 130, 246, 0.08);
}

.cards-section {
    padding: 0 0 80px;
}

.result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.result-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.view-controls {
    display: flex;
    gap: 4px;
}
.view-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.view-btn .material-symbols-outlined {
    font-size: 17px;
    color: var(--text-muted);
    font-variation-settings: 'FILL' 0, 'wght' 300;
}
.view-btn:hover, .view-btn.active {
    border-color: var(--border-accent);
    background: rgba(59, 130, 246, 0.08);
}
.view-btn.active .material-symbols-outlined,
.view-btn:hover .material-symbols-outlined {
    color: var(--accent-bright);
}


/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    transition: grid-template-columns var(--transition-smooth);
}
.cards-grid.view-list {
    grid-template-columns: 1fr;
}

/* Individual card */
.snippet-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    transition:
        border-color var(--transition-smooth),
        transform var(--transition-smooth),
        box-shadow var(--transition-smooth),
        opacity var(--transition-smooth);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.4s ease both;
}
.snippet-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-glow-md), transparent);
    opacity: 0;
    transition: opacity var(--transition-smooth);
}
.snippet-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), var(--shadow-glow);
}
.snippet-card:hover::after { opacity: 1; }

.snippet-card.hidden {
    display: none;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-lang-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    border: 1px solid;
}
.card-lang-badge .material-symbols-outlined {
    font-size: 13px;
    font-variation-settings: 'FILL' 0, 'wght' 400;
}

.card-lang-badge.javascript {
    color: var(--js-color);
    background: var(--js-bg);
    border-color: rgba(247, 223, 30, 0.2);
}
.card-lang-badge.nodejs {
    color: var(--node-color);
    background: var(--node-bg);
    border-color: rgba(104, 160, 99, 0.2);
}
.card-lang-badge.python {
    color: #5b9bd5;
    background: rgba(91, 155, 213, 0.1);
    border-color: rgba(91, 155, 213, 0.2);
}
.card-lang-badge.css {
    color: #c792ea;
    background: rgba(199, 146, 234, 0.08);
    border-color: rgba(199, 146, 234, 0.2);
}
.card-lang-badge.react {
    color: var(--react-color);
    background: var(--react-bg);
    border-color: rgba(97, 218, 251, 0.2);
}

.card-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
    flex: 1;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tag {
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    letter-spacing: 0.02em;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.meta-icon {
    font-size: 14px;
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

.card-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--accent-bright);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid var(--border-accent);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}
.card-btn:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: var(--accent);
    transform: translateX(2px);
}
.card-btn .material-symbols-outlined {
    font-size: 14px;
    font-variation-settings: 'FILL' 0, 'wght' 300;
}

.empty-state {
    text-align: center;
    padding: 80px 24px;
}
.empty-icon {
    font-size: 48px;
    color: var(--text-muted);
    display: block;
    margin: 0 auto 16px;
    font-variation-settings: 'FILL' 0, 'wght' 200;
}
.empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.empty-desc {
    font-size: 14px;
    color: var(--text-muted);
}


/* ------------------------------------------------
   FOOTER
------------------------------------------------ */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    background: var(--bg-secondary);
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-copy {
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    :root { --nav-h: 58px; }

    .nav-menu  { display: none; }
    .burger    { display: flex; }
    .mobile-menu { display: flex; }

    .page-header { padding: 48px 0 36px; }
    .search-section { padding: 0 0 36px; }

    .terminal-input-row { flex-wrap: wrap; gap: 8px; }
    .terminal-prompt { display: none; }
    .terminal-icons  { display: none; }

    .cards-grid { grid-template-columns: 1fr; }
    .cards-section { padding: 0 0 56px; }

    .footer-inner { flex-direction: column; text-align: center; }
    .result-meta { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 400px) {
    .filter-tags { gap: 6px; }
    .filter-tag  { padding: 4px 10px; font-size: 11px; }
}
