/* ===================================================================
   CSS Variables for Theme
   =================================================================== */
:root {
    --bg-color: #fafafa;
    --text-color: #1a1a1a;
    --text-secondary: #666;
    --link-color: #1a1a1a;
    --link-hover: #000;
    --nav-bg: #f5f5f5;
    --nav-hover: #e8e8e8;
    --card-hover: #f5f5f5;
    --border-color: #e5e5e5;
    --shadow: rgba(0, 0, 0, 0.05);
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --font-logo: 'Cinzel', serif;
    
    --transition: 0.2s ease-in-out;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e5e5e5;
    --text-secondary: #a0a0a0;
    --link-color: #e5e5e5;
    --link-hover: #fff;
    --nav-bg: #252525;
    --nav-hover: #2f2f2f;
    --card-hover: #252525;
    --border-color: #333;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* ===================================================================
   Base Styles
   =================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   Typography
   =================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--link-hover);
}

/* ===================================================================
   Container
   =================================================================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===================================================================
   Header & Logo
   =================================================================== */
.site-header {
    padding-top: 2rem;
    margin-bottom: 3rem;
}

.site-logo {
    text-align: center;
    margin-bottom: 1rem;
}

.logo-link {
    font-family: var(--font-logo);
    font-size: 2rem;
    font-weight: 700;
    font-optical-sizing: auto;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: opacity var(--transition);
}

.logo-link:hover {
    opacity: 0.7;
}

.header-social-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.header-social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: background-color var(--transition);
    color: var(--text-color);
}

.header-social-links a:hover {
    background-color: var(--nav-hover);
}

/* ===================================================================
   Navigation
   =================================================================== */
.site-nav {
    padding: 1rem 0;
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 1rem;
}

/* Estilos para o helper {{navigation}} do Ghost */
.nav-list a {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color var(--transition);
    color: var(--text-color);
    text-decoration: none;
}

.nav-list a:hover,
.nav-list .nav-current a {
    background-color: var(--nav-hover);
}

/* Mantém compatibilidade com classes antigas */
.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--nav-hover);
}

.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color var(--transition);
    color: var(--text-color);
    position: absolute;
    right: 2rem;
}

.theme-toggle:hover {
    background-color: var(--nav-hover);
}

.theme-icon {
    width: 20px;
    height: 20px;
}

.sun-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

/* ===================================================================
   Highlight Box
   =================================================================== */
.highlight-box {
    background-color: #dfe6ed;
    border-radius: 0;
    padding: 2.5rem 3rem;
    margin-bottom: 4rem;
    transition: background-color var(--transition);
}

[data-theme="dark"] .highlight-box {
    background-color: #252525;
}

.highlight-box-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #000000;
}

[data-theme="dark"] .highlight-box-title {
    color: var(--text-color);
}

.highlight-box-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #1a1a1a;
    text-align: justify;
}

[data-theme="dark"] .highlight-box-content {
    color: var(--text-color);
}

.highlight-box-content p {
    margin: 0;
    text-align: justify;
}

.highlight-box-content p + p {
    margin-top: 1rem;
}

/* ===================================================================
   Books Section (Destaques)
   =================================================================== */
.books-section {
    margin-bottom: 4rem;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.book-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
}

.book-card:hover {
    transform: translateY(-8px);
}

.book-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 1rem;
    background-color: var(--nav-bg);
    transition: box-shadow var(--transition);
}

.book-card:hover .book-cover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .book-card:hover .book-cover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--nav-bg) 0%, var(--card-hover) 100%);
}

.book-cover-text {
    padding: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    line-height: 1.3;
}

.book-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    line-height: 1.4;
    margin: 0;
    transition: color var(--transition);
}

.book-card:hover .book-title {
    color: var(--link-hover);
}

/* ===================================================================
   Posts Section
   =================================================================== */
.posts-section,
.year-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.year-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.posts-list,
.year-posts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-card,
.post-item {
    border-radius: 8px;
}

.post-card-link,
.post-link {
    display: block;
    padding: 1rem;
    border-radius: 8px;
}

.post-card-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.post-card-title,
.post-item-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    text-decoration: none;
    transition: text-decoration var(--transition);
    flex: 1;
    min-width: 0;
}

.post-card-reading-time {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    opacity: 0.7;
    white-space: nowrap;
    flex-shrink: 0;
}

.post-card-link:hover .post-card-title,
.post-link:hover .post-item-title {
    text-decoration: underline;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.post-card-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all var(--transition);
    text-decoration: none;
}

.post-card-link:hover .post-card-tag {
    color: var(--text-color);
    border-color: var(--text-color);
    background-color: var(--nav-hover);
}

.no-posts {
    color: var(--text-secondary);
    font-style: italic;
}

/* ===================================================================
   Archive Page
   =================================================================== */
.archive-header {
    margin-bottom: 3rem;
}

.archive-title {
    font-size: 2.5rem;
    font-weight: 800;
}

.posts-by-year {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* ===================================================================
   Book Card (para posts com #livro)
   =================================================================== */
.book-card-header {
    display: flex;
    gap: 3rem;
    margin-bottom: 4rem;
    padding: 3rem;
    background-color: var(--nav-bg);
    border-radius: 12px;
    align-items: flex-start;
}

.book-card-cover {
    flex-shrink: 0;
    width: 200px;
}

.book-card-cover img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
}

.book-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.book-card-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0;
    color: var(--text-color);
}

.book-card-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.book-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background-color: var(--text-color);
    color: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition);
    align-self: flex-start;
}

.book-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
    background-color: #2563eb;
    color: #ffffff;
}

.book-card-link svg {
    flex-shrink: 0;
}

/* ===================================================================
   Post Full
   =================================================================== */
.post-full {
    margin-bottom: 4rem;
}

.post-header {
    margin-bottom: 3rem;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.separator {
    opacity: 0.5;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    color: var(--text-secondary);
}

.tag:hover {
    color: var(--link-hover);
}

/* Ocultar tags que começam com hash- */
.tag-list .tag[class*="tag-hash-"] {
    display: none !important;
}

.post-feature-image {
    margin-bottom: 3rem;
    border-radius: 12px;
    overflow: hidden;
}

.post-feature-image img {
    width: 100%;
    height: auto;
    display: block;
}

.hide-featured-image {
    display: none !important;
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.post-content h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

.post-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
}

.post-content pre {
    background-color: var(--nav-bg);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background-color: var(--nav-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

/* ===================================================================
   Author Card
   =================================================================== */
.post-author {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.author-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    flex: 1;
}

.author-name {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.author-bio {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===================================================================
   Related Posts
   =================================================================== */
.related-posts {
    padding: 3rem 0;
    background-color: var(--nav-bg);
    margin-top: 4rem;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* ===================================================================
   Page
   =================================================================== */
.page {
    margin-bottom: 4rem;
}

.page-header {
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
}

.page-feature-image {
    margin-bottom: 3rem;
    border-radius: 12px;
    overflow: hidden;
}

.page-feature-image img {
    width: 100%;
    height: auto;
    display: block;
}

.page-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

/* ===================================================================
   Footer
   =================================================================== */
.site-footer {
    margin-top: 6rem;
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-text {
    margin-bottom: 0.5rem;
}

.footer-powered {
    margin-bottom: 0;
}

.footer-powered a {
    color: var(--text-secondary);
    text-decoration: underline;
}

.footer-powered a:hover {
    color: var(--link-hover);
}

/* ===================================================================
   Responsive
   =================================================================== */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container,
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .theme-toggle {
        right: 1.5rem;
    }
    
    .logo-link {
        font-size: 1.75rem;
    }
    
    .header-social-links a {
        width: 32px;
        height: 32px;
    }
    
    .nav-list {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.95rem;
    }
    
    .highlight-box {
        padding: 2rem 1.5rem;
        margin-bottom: 3rem;
    }
    
    .highlight-box-title {
        font-size: 1.75rem;
        margin-bottom: 1.25rem;
    }
    
    .highlight-box-content {
        font-size: 1rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1.25rem;
    }
    
    .book-title {
        font-size: 0.875rem;
    }
    
    .book-card-header {
        flex-direction: column;
        gap: 2rem;
        padding: 2rem;
    }
    
    .book-card-cover {
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .book-card-info {
        align-items: center;
        text-align: center;
    }
    
    .book-card-title {
        font-size: 1.5rem;
    }
    
    .book-card-link {
        align-self: center;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .author-card {
        flex-direction: column;
    }
    
    .author-avatar {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .logo-link {
        font-size: 1.5rem;
    }
    
    .header-social-links a {
        width: 30px;
        height: 30px;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 1rem;
    }
    
    .book-title {
        font-size: 0.8rem;
    }
    
    .post-title,
    .page-title,
    .archive-title {
        font-size: 1.75rem;
    }
    
    .post-card-reading-time {
        font-size: 0.7rem;
    }
}

/* ===================================================================
   Koenig Editor Content Styles
   =================================================================== */

/* Wide width for images and embeds */
.kg-width-wide {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 1200px;
}

/* Full width for images and embeds */
.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Image card */
.kg-image-card {
    margin: 2rem 0;
}

.kg-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Gallery card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    margin: 2rem 0;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Bookmark card */
.kg-bookmark-card {
    width: 100%;
    margin: 2rem 0;
}

.kg-bookmark-container {
    display: flex;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.kg-bookmark-container:hover {
    box-shadow: 0 4px 12px var(--shadow);
}

.kg-bookmark-content {
    flex: 1;
    padding: 1.5rem;
}

.kg-bookmark-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.kg-bookmark-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

.kg-bookmark-thumbnail {
    min-width: 200px;
    max-width: 200px;
}

.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Embed card */
.kg-embed-card {
    margin: 2rem 0;
}

.kg-embed-card iframe {
    width: 100%;
    border-radius: 8px;
}

/* Code card */
.kg-code-card {
    margin: 2rem 0;
}

.kg-code-card pre {
    margin: 0;
}

/* Callout card */
.kg-callout-card {
    padding: 1.5rem;
    border-radius: 8px;
    background-color: var(--nav-bg);
    border-left: 4px solid var(--text-color);
    margin: 2rem 0;
}

.kg-callout-emoji {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

/* Toggle card */
.kg-toggle-card {
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.kg-toggle-heading {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.kg-toggle-content {
    margin-top: 1rem;
}

/* Product card */
.kg-product-card {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.kg-product-card-image {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.kg-product-card-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.kg-product-card-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.kg-product-card-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--text-color);
    color: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

/* Video card */
.kg-video-card {
    margin: 2rem 0;
}

.kg-video-card video {
    width: 100%;
    border-radius: 8px;
}

/* Audio card */
.kg-audio-card {
    margin: 2rem 0;
}

.kg-audio-card audio {
    width: 100%;
}

/* File card */
.kg-file-card {
    margin: 2rem 0;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kg-file-card-icon {
    width: 48px;
    height: 48px;
}

.kg-file-card-contents {
    flex: 1;
}

.kg-file-card-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.kg-file-card-caption {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Button card */
.kg-button-card {
    margin: 2rem 0;
    text-align: center;
}

.kg-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--text-color);
    color: var(--bg-color);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform var(--transition);
}

.kg-btn:hover {
    transform: translateY(-2px);
}

/* Header card */
.kg-header-card {
    margin: 3rem 0;
    text-align: center;
}

.kg-header-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* Responsive adjustments for Koenig cards */
@media (max-width: 768px) {
    .kg-width-wide,
    .kg-width-full {
        width: 100%;
        left: 0;
        margin-left: 0;
        margin-right: 0;
    }
    
    .kg-bookmark-container {
        flex-direction: column;
    }
    
    .kg-bookmark-thumbnail {
        min-width: 100%;
        max-width: 100%;
        max-height: 200px;
    }
    
    .kg-gallery-row {
        flex-direction: column;
    }
}

/* ===================================================================
   Utilities
   =================================================================== */
.site-main {
    min-height: calc(100vh - 400px);
}

::selection {
    background-color: var(--text-color);
    color: var(--bg-color);
}

