/* ==========================================================================
   Subaud Theme - Dark Minimalist Theme for Ghost
   ========================================================================== */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    /* Dark theme colors */
    --background: hsl(240 10% 3.9%);
    --foreground: hsl(0 0% 98%);
    --card: hsl(240 10% 3.9%);
    --card-foreground: hsl(0 0% 98%);
    --primary: hsl(0 0% 98%);
    --primary-foreground: hsl(240 5.9% 10%);
    --secondary: hsl(240 3.7% 15.9%);
    --secondary-foreground: hsl(0 0% 98%);
    --muted: hsl(240 3.7% 15.9%);
    --muted-foreground: hsl(240 5% 64.9%);
    --accent: hsl(240 3.7% 15.9%);
    --accent-foreground: hsl(0 0% 98%);
    --border: hsl(240 3.7% 15.9%);
    --input: hsl(240 3.7% 15.9%);
    
    /* Spacing */
    --container-max-width: 56rem;
    --spacing-unit: 1rem;
    
    /* Typography */
    --font-sans: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* CRITICAL: Prevents layout shift when navigating between pages
       DO NOT REMOVE - fixes header jump issue when scrollbar appears/disappears
       This reserves space for the scrollbar even when not needed */
    scrollbar-gutter: stable;
}

body {
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
    /* Ensure consistent minimum height to minimize scrollbar changes */
    min-height: 60vh;
}

/* ==========================================================================
   Container
   ========================================================================== */

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

@media (min-width: 768px) {
    .container {
        padding: 0 calc(var(--spacing-unit) * 1.5);
    }
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    color: var(--primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* ==========================================================================
   Site Header
   ========================================================================== */

.site-header {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--background);
    z-index: 100;
}

.site-nav-wrapper {
    padding: 1rem 2rem;
}

.site-nav {
    max-width: 72rem; /* Wider than content for better spread */
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 1280px) {
    .site-nav {
        max-width: 80rem; /* Even wider on large screens */
    }
}

.site-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

.site-logo:hover {
    text-decoration: none;
    opacity: 0.9;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav li a {
    color: var(--muted-foreground);
    transition: color 0.2s;
    font-size: 0.95rem;
}

.nav li a:hover,
.nav li.nav-current a {
    color: var(--primary);
}

.search-toggle {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
    text-decoration: none;
}

.search-toggle:hover {
    color: var(--primary);
}

/* ==========================================================================
   Page Header
   ========================================================================== */

.page-header {
    padding: 3rem 0 2rem;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-description {
    color: var(--muted-foreground);
    font-size: 1.125rem;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ==========================================================================
   Posts Grid
   ========================================================================== */

.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 2rem 0;
}

/* ==========================================================================
   Post Card
   ========================================================================== */

.post-card {
    position: relative;
    transition: transform 0.2s;
}

.post-card:hover {
    transform: translateX(4px);
}

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

.post-card-content {
    display: flex;
    gap: 1rem;
}

.post-card-image {
    flex-shrink: 0;
    width: 160px;
    height: 120px;
    overflow: hidden;
    border-radius: 0.5rem;
    background: var(--muted);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-body {
    flex: 1;
    min-width: 0;
}

.post-card-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.post-card-excerpt {
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.meta-separator {
    color: var(--muted-foreground);
}

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

.tag {
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

/* ==========================================================================
   Single Post
   ========================================================================== */

.post-full {
    padding: 3rem 0;
}

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

.post-category {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.post-title {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

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

.post-tags .tag {
    padding: 0.25rem 0.75rem;
    background: var(--muted);
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.post-feature-image {
    margin: 2rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    max-height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
}

.post-feature-image img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
}

.post-feature-image figcaption {
    padding: 0.5rem;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* ==========================================================================
   Post Content
   ========================================================================== */

.post-content-wrapper {
    /* Use full container width */
}

/* Ghost Editor Required Classes */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: auto calc(50% - 50vw);
    transform: translateX(calc(50vw - 50%));
}

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

.post-content {
    font-size: 1.0625rem;
    line-height: 1.75;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin: 2rem 0 1rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

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

.post-content pre {
    background: var(--muted);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--muted);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

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

.post-content blockquote {
    border-left: 4px solid var(--border);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--muted-foreground);
}

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

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

/* ==========================================================================
   Post Footer
   ========================================================================== */

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.author-card {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--muted);
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

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

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

.author-bio {
    color: var(--muted-foreground);
}

.share-buttons {
    margin: 2rem 0;
}

.share-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
}

.share-links {
    display: flex;
    gap: 1rem;
}

.share-links a,
.share-links button {
    padding: 0.5rem 1rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.2s;
}

.share-links a:hover,
.share-links button:hover {
    background: var(--accent);
}

/* ==========================================================================
   Resume Page
   ========================================================================== */

.resume-container {
    max-width: 48rem;
    margin: 0 auto;
}

.resume-rfc {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--foreground);
}

.rfc-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 2rem;
}

.rfc-header p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.rfc-left {
    text-align: left;
}

.rfc-right {
    text-align: right;
}

.rfc-title {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem 0;
}

.rfc-title h1 {
    font-size: 1.25rem;
    font-weight: normal;
    margin: 0;
}

.rfc-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.rfc-contact p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.rfc-contact a {
    color: var(--primary);
    text-decoration: none;
}

.rfc-contact a:hover {
    text-decoration: underline;
}

.rfc-contact-left {
    text-align: left;
}

.rfc-contact-right {
    text-align: right;
}

.rfc-section {
    margin: 2rem 0;
}

.rfc-section h2 {
    font-size: 1.125rem;
    font-weight: bold;
    margin: 2rem 0 1rem 0;
}

.rfc-section h3 {
    font-size: 1rem;
    font-weight: bold;
    margin: 1.5rem 0 0.75rem 0;
}

.rfc-indent {
    padding-left: 2rem;
    margin: 1rem 0;
}

.rfc-content {
    font-family: var(--font-mono);
    line-height: 1.6;
}

.rfc-content h2 {
    font-size: 1.125rem;
    font-weight: bold;
    margin: 2rem 0 1rem 0;
}

.rfc-content h3 {
    font-size: 1rem;
    font-weight: bold;
    margin: 1.5rem 0 0.75rem 0;
}

.rfc-content p {
    margin: 1rem 0;
    white-space: normal;
}

.rfc-content ul,
.rfc-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.rfc-content li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.rfc-content strong {
    font-weight: bold;
    color: var(--primary);
}

.rfc-content em {
    font-style: italic;
}

.rfc-content a {
    color: var(--primary);
    text-decoration: none;
}

.rfc-content a:hover {
    text-decoration: underline;
}

.rfc-footer {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.rfc-footer span:nth-child(2) {
    text-align: center;
}

.rfc-footer span:last-child {
    text-align: right;
}

.rfc-page-break {
    page-break-before: always;
    margin: 3rem 0;
    position: relative;
}

/* RFC Page styling */
.rfc-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 4rem;
}

.rfc-page-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    font-size: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--muted-foreground);
}

.rfc-page-header span:nth-child(2) {
    text-align: center;
}

.rfc-page-header span:last-child {
    text-align: right;
}

/* Authentic RFC text formatting */
.rfc-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-line;
    max-width: 72ch; /* RFC standard 72 character width */
    margin: 0 auto;
}

.rfc-section-number {
    font-weight: bold;
}

/* Table of Contents styling */
.rfc-toc {
    margin: 2rem 0;
    padding-left: 0;
}

.rfc-toc-item {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.rfc-toc-dots {
    flex: 1;
    border-bottom: 1px dotted var(--muted-foreground);
    margin: 0 0.5rem;
    position: relative;
    top: -0.25rem;
}

/* Print styles for RFC Resume */
@media print {
    .rfc-page-break {
        page-break-before: always;
        break-before: page;
    }
    
    .rfc-page {
        min-height: 100vh;
        page-break-inside: avoid;
    }
    
    .rfc-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
    }
    
    .site-header,
    .site-footer,
    .nav-menu,
    .search-toggle {
        display: none !important;
    }
    
    .resume-rfc {
        font-size: 11pt;
        line-height: 1.5;
        color: black;
    }
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-profile {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.profile-image {
    flex-shrink: 0;
}

.profile-image img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-text {
    flex: 1;
    font-size: 1.125rem;
    line-height: 1.8;
}

/* ==========================================================================
   Site Footer
   ========================================================================== */

.site-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

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

.footer-section {
    color: var(--muted-foreground);
}

.footer-disclaimer {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--muted-foreground);
    transition: color 0.2s;
}

.social-links a:hover {
    color: var(--primary);
}

/* ==========================================================================
   Search Modal
   ========================================================================== */

.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.search-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-content {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.search-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 2rem;
    cursor: pointer;
}

#search-input {
    width: 100%;
    padding: 0.75rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    color: var(--foreground);
    font-size: 1rem;
}

#search-results {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    background: var(--muted);
    border-radius: 0.25rem;
    color: var(--foreground);
}

.pagination .page-number.current {
    background: var(--accent);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .post-card-content {
        flex-direction: column;
    }
    
    .post-card-image {
        width: 100%;
        height: 200px;
    }
    
    .rfc-header,
    .rfc-contact,
    .rfc-footer {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .rfc-right,
    .rfc-contact-right {
        text-align: left;
    }
    
    .about-profile {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ==========================================================================
   Code Blocks & Syntax Highlighting
   ========================================================================== */

/* Code block wrapper for positioning */
div.code-toolbar {
    position: relative;
    margin: 2rem 0;
}

/* Main code block styling */
pre[class*="language-"] {
    background: linear-gradient(135deg, hsl(240 10% 4%) 0%, hsl(240 10% 6%) 100%) !important;
    border: 1px solid hsl(240 5% 15%);
    border-radius: 0.75rem;
    padding: 1.75rem !important;
    margin: 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    font-size: 0.85rem;
    line-height: 1.6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
    max-width: 100%;
}

div.code-toolbar:hover pre[class*="language-"] {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

code[class*="language-"] {
    background: none !important;
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
    text-shadow: none !important;
    display: block;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    hyphens: none;
}

/* Inline code */
:not(pre) > code {
    background: hsl(240 5% 15%);
    color: var(--foreground);
    padding: 0.2em 0.4em;
    border-radius: 0.375rem;
    font-size: 0.875em;
    font-family: 'Fira Code', 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
    border: 1px solid hsl(240 5% 20%);
}

/* Prism toolbar positioning */
div.code-toolbar > .toolbar {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    z-index: 10;
}

/* Copy button styling */
div.code-toolbar > .toolbar > .toolbar-item > button {
    appearance: none;
    background: hsl(240 5% 15%) !important;
    color: transparent !important;
    padding: 0.5rem !important;
    width: auto !important;
    height: auto !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border-radius: 0.5rem !important;
    border: 1px solid hsl(240 5% 20%) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0 !important;
    position: relative;
    overflow: hidden;
}

/* Hide the default text */
div.code-toolbar > .toolbar > .toolbar-item > button > span {
    display: none !important;
}

/* Add copy icon using after pseudo-element */
div.code-toolbar > .toolbar > .toolbar-item > button::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Copied state - show checkmark */
div.code-toolbar > .toolbar > .toolbar-item > button[data-copy-state="copy-success"]::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    animation: checkmark 0.3s ease;
}

@keyframes checkmark {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Copy button hover state */
div.code-toolbar > .toolbar > .toolbar-item > button:hover {
    background: hsl(240 5% 18%) !important;
    border-color: hsl(240 5% 25%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Language label */
div.code-toolbar > .toolbar > .toolbar-item > span {
    background: hsl(240 5% 15%) !important;
    color: hsl(240 5% 65%) !important;
    padding: 0.375rem 0.625rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.75rem !important;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid hsl(240 5% 20%) !important;
    line-height: 1;
}

/* Match braces plugin */
.token.punctuation.brace-hover,
.token.punctuation.brace-selected {
    outline: 1px dashed hsl(240 5% 40%);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

/* Custom scrollbar for code blocks */
pre[class*="language-"]::-webkit-scrollbar {
    height: 8px;
}

pre[class*="language-"]::-webkit-scrollbar-track {
    background: hsl(240 5% 10%);
    border-radius: 4px;
}

pre[class*="language-"]::-webkit-scrollbar-thumb {
    background: hsl(240 5% 25%);
    border-radius: 4px;
}

pre[class*="language-"]::-webkit-scrollbar-thumb:hover {
    background: hsl(240 5% 35%);
}

/* Token color adjustments for better contrast */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #999 !important;
}

.token.string,
.token.attr-value {
    color: #98c379 !important;
}

.token.keyword,
.token.control,
.token.directive,
.token.unit {
    color: #c678dd !important;
}

.token.function,
.token.class-name {
    color: #61afef !important;
}

.token.number,
.token.boolean,
.token.constant {
    color: #d19a66 !important;
}

.token.operator,
.token.punctuation {
    color: #abb2bf !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    div.code-toolbar {
        margin: 1.5rem -1rem;
    }
    
    pre[class*="language-"] {
        padding: 1.25rem !important;
        font-size: 0.8rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    div.code-toolbar > .toolbar {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    div.code-toolbar > .toolbar > .toolbar-item > button {
        min-width: 36px !important;
        min-height: 36px !important;
    }
    
    div.code-toolbar > .toolbar > .toolbar-item > span {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.no-posts {
    text-align: center;
    padding: 4rem 0;
    color: var(--muted-foreground);
}

.hidden {
    display: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Mermaid Diagrams
   -------------------------------------------------------------------------- */

.mermaid {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 0.75rem;
    margin: 2rem 0;
    overflow-x: auto;
    border: 1px solid hsl(240 5% 15%);
    display: flex;
    justify-content: center;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Tags/Categories Page
   ========================================================================== */

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

.tag-box {
    display: block;
    padding: 1.5rem;
    background: var(--card-background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tag-box:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tag-box-content {
    position: relative;
    z-index: 1;
}

.tag-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--foreground);
}

.tag-count {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.tag-description {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0.5rem 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tag-image {
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    opacity: 0.1;
    z-index: 0;
}

.tag-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-tags {
    text-align: center;
    padding: 4rem 0;
    color: var(--muted-foreground);
}

@media (max-width: 768px) {
    .tags-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================================================
   Feed Page Styles
   ======================================================================== */

.page-feed {
    min-height: 100vh;
}

.feed-info {
    max-width: 800px;
    margin: 0 auto;
}

.feed-info h2 {
    color: var(--foreground);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.feed-info h3 {
    color: var(--foreground);
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.feed-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    margin: 2rem 0;
}

.feed-link-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.feed-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--background);
    border: 2px solid var(--primary);
    border-radius: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.feed-link:hover {
    background: var(--primary);
    color: var(--primary-foreground);
}

.feed-icon {
    flex-shrink: 0;
}

.copy-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

.copy-button.copied {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
}


.button-primary {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: white;
    color: var(--primary);
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.feed-readers,
.feed-format {
    margin: 2rem 0;
}

.reader-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.reader-list li {
    padding: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.reader-list a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.reader-list a:hover {
    text-decoration: underline;
}

.feed-format ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.feed-format li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.feed-format li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ========================================================================
   Signup Page Styles
   ======================================================================== */

.page-signup {
    min-height: 100vh;
}

.page-signup .page-description {
    color: var(--muted-foreground);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Already member section */
.already-member {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    max-width: 600px;
    margin: 2rem auto;
}

.already-member h2 {
    color: var(--foreground);
    margin-bottom: 1rem;
}

.member-status {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    margin: 1rem 0;
}

.member-status.free {
    background: var(--muted);
    color: var(--muted-foreground);
}

.member-status.premium {
    background: var(--primary);
    color: var(--primary-foreground);
}

.member-actions {
    margin-top: 2rem;
}

/* Signup cards grid */
.signup-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 3rem;
    margin: 4rem 0;
    align-items: stretch;
}

.signup-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 1rem;
    padding: 3rem 2.5rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.signup-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.premium-tier {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--card) 0%, rgba(187, 134, 252, 0.08) 100%);
    position: relative;
    overflow: hidden;
}

.premium-tier::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.tier-badge {
    position: absolute;
    top: -14px;
    right: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--primary-foreground);
    padding: 0.375rem 1.25rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 10px rgba(187, 134, 252, 0.3);
}

.free-tier .tier-badge {
    background: var(--muted);
    color: var(--muted-foreground);
}

.signup-card h3 {
    color: var(--foreground);
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
}

.tier-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tier-price .price {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.tier-price .period {
    color: var(--muted-foreground);
    font-size: 1rem;
}

.tier-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.tier-benefits li {
    padding: 0.75rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: var(--foreground);
    line-height: 1.5;
}

.tier-benefits li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.tier-benefits li strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* Signup forms */
.signup-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.signup-form input {
    padding: 0.875rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--foreground);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.signup-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.1);
}

.signup-form input::placeholder {
    color: var(--muted-foreground);
}

.signup-form .button-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.signup-form .button-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.button-premium {
    display: inline-block;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.025em;
}

.button-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(187, 134, 252, 0.4);
}

.button-secondary {
    background: var(--muted);
    color: var(--foreground);
}

.button-secondary:hover {
    background: var(--muted-foreground);
}

.tier-note {
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-top: 1rem;
}

.form-message {
    color: var(--destructive);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Newsletter section */
.newsletter-only {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 2rem;
    margin: 3rem 0;
    text-align: center;
}

.newsletter-only h3 {
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 500px;
    margin: 1.5rem auto 0;
}

.newsletter-form input {
    flex: 1;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--foreground);
}

/* Sign in prompt */
.signin-prompt {
    text-align: center;
    margin: 2rem 0;
    color: var(--muted-foreground);
}

.signin-prompt a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.signin-prompt a:hover {
    text-decoration: underline;
}

/* Success message */
.signup-success {
    background: #22c55e;
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    text-align: center;
    transition: opacity 0.3s ease;
}

.signup-success p {
    margin: 0;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .signup-options {
        grid-template-columns: 1fr;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .tier-price .price {
        font-size: 2rem;
    }
}

/* ========================================================================
   Ghost Portal Customization
   ======================================================================== */

/* Portal trigger button styling */
.gh-portal-triggerbtn-container {
    display: none; /* Hide default floating trigger */
}

/* Navigation Portal Links */
.nav-signup {
    background: var(--primary);
    color: var(--primary-foreground) !important;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.nav-signup:hover {
    background: var(--primary-foreground);
    color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.3);
}

/* Portal iframe customization via CSS variables */
:root {
    --portal-primary: var(--primary);
    --portal-text: var(--foreground);
    --portal-background: var(--background);
}

/* Override Portal popup styles when it loads */
iframe#ghost-portal-root {
    color-scheme: dark !important;
}

/* Custom portal button in navigation */
[data-portal="signup"],
[data-portal="signin"],
[data-portal="account"] {
    cursor: pointer;
    user-select: none;
}

/* Member account menu styling */
.member-menu {
    position: relative;
    display: inline-block;
}

.member-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.2s ease;
}

.member-menu-trigger:hover {
    background: var(--muted);
    border-color: var(--primary);
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Style for signup/signin links in content */
a[href="#/portal/signup"],
a[href="#/portal/signin"],
a[href^="#/portal/account"] {
    color: var(--primary);
    text-decoration: underline;
    transition: all 0.2s ease;
}

a[href="#/portal/signup"]:hover,
a[href="#/portal/signin"]:hover,
a[href^="#/portal/account"]:hover {
    color: var(--primary-dark);
}

/* Portal loading animation */
.portal-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: var(--card);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.portal-loading::after {
    content: "Loading membership portal...";
    color: var(--foreground);
    font-size: 0.875rem;
    display: block;
    margin-top: 1rem;
    text-align: center;
}

