:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --accent-primary: #38bdf8;
    --accent-secondary: #818cf8;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.site-header {
    padding: 4rem 0;
    text-align: center;
}

.site-title {
    font-size: 3.5rem;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    margin-bottom: 0.5rem;
    font-weight: 800;
}

.site-description {
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 400;
}

/* Library Controls */
.library-header {
    margin-bottom: 3rem;
}

.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
}

#library-search {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 9999px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#library-search:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 9999px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 600;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 2rem;
    backdrop-filter: blur(5px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.post-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.view-btn {
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Individual Post View */
.post-full-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 0;
}

.post-full-header {
    text-align: center;
    margin-bottom: 4rem;
}

/* Footers */
.site-footer {
    padding: 4rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Ghost Koenig Editor Support */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: 4rem calc(50% - 42.5vw);
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin: 4rem -50vw;
}

.kg-width-full img {
    width: 100%;
}

/* Copy Feature Styles */

.prompt-container {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.prompt-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.copy-btn {
    padding: 0.8rem 2rem;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.copy-btn.primary {
    background: var(--accent-primary);
    color: #000;
}

.copy-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.copy-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

/* Code block specific copy */
pre {
    position: relative;
    padding-top: 2.5rem !important;
    /* Space for the header-style button */
    border-radius: 0.75rem;
    overflow: hidden;
}

.code-block-wrapper {
    position: relative;
    margin-bottom: 2.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0.6;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.code-copy-btn.copied {
    background: #4ade80;
    color: #000;
    border-color: #4ade80;
    opacity: 1;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    background: rgba(56, 189, 248, 0.1);
}

.cat-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1.2rem;
    display: inline-block;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.3));
    transition: transform 0.3s ease;
}

.category-card:hover .cat-icon {
    transform: scale(1.1) rotate(5deg);
}

.cat-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: block;
}

.cat-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}


/* Variable Personalization Styles */
.variable-ui-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.variable-ui-section h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    margin-top: 0;
}

.variable-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.variable-input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.variable-input-group input {
    width: 100%;
    padding: 0.6rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.variable-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.var-highlight {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent-primary);
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Metadata Icons & Bars */
.post-card-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.meta-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.post-full-meta-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

/* Ghost Gallery & Image Styling */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.kg-gallery-image img {
    display: block;
    margin: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.kg-gallery-image img:hover {
    transform: scale(1.02);
    border-color: var(--accent-primary);
}

.kg-image-card figcaption,
.kg-gallery-card figcaption {
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Post hiding for search */
.post-card.hidden {
    display: none;
}