/* Sion908 Blog - Premium KINTO Style Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* =========================================
   1. CSS Variables (Light & Dark Themes)
   ========================================= */
:root {
    --primary-color: #3b82f6;      /* Modern Blue */
    --primary-light: rgba(59, 130, 246, 0.1); /* Very subtle blue bg */
    --secondary-color: #ec4899;    /* Pinkish accent */
    --visited-color: #7c3aed;      /* Violet 600 for visited links */
    --text-primary: #1e293b;       /* Slate 800 */
    --text-secondary: #475569;     /* Slate 600 */
    --text-muted: #64748b;         /* Slate 500 */
    
    --bg-body: #f8fafc;            /* Slate 50 */
    --bg-header: rgba(255, 255, 255, 0.85);
    --bg-card: #ffffff;
    --bg-footer: #0f172a;          /* Slate 900 */
    
    --border-color: #e2e8f0;       /* Slate 200 */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --transition-speed: 0.25s;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'HackGen', monospace;
}

[data-theme='dark'] {
    --text-primary: #f8fafc;       /* Slate 50 */
    --text-secondary: #cbd5e1;     /* Slate 300 */
    --text-muted: #94a3b8;         /* Slate 400 */
    
    --bg-body: #0f172a;            /* Slate 900 */
    --bg-header: rgba(15, 23, 42, 0.85);
    --bg-card: #1e293b;            /* Slate 800 */
    --bg-footer: #020617;          /* Slate 950 */
    
    --border-color: #334155;       /* Slate 700 */
    
    --primary-color: #60a5fa;      /* Blue 400 */
    --primary-light: rgba(96, 165, 250, 0.15);
    --secondary-color: #f472b6;    /* Pink 400 */
    --visited-color: #c084fc;      /* Purple 400 for visited links */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* =========================================
   2. Base Styles & Resets
   ========================================= */
html {
    scroll-behavior: smooth;
    transition: background-color var(--transition-speed) ease;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-body) !important;
    line-height: 1.7;
    font-size: 16px;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease, filter var(--transition-speed) ease;
}
a:visited {
    color: var(--visited-color);
}
a:hover {
    filter: brightness(1.2);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading) !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background-color: transparent !important;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

code, pre {
    font-family: var(--font-mono) !important;
}

/* Hide Unnecessary Sphinx Elements */
.sphinxsidebar, .sidebar, .related {
    display: none !important;
}
div.document, div.bodywrapper, div.body {
    background: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
}

/* =========================================
   3. Layout Structure
   ========================================= */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    box-sizing: border-box;
}

.main-wrapper {
    flex: 1;
    padding: 3rem 0 5rem 0;
}

.content-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 3rem;
    align-items: start;
}

/* Premium Card Style (Content Box) */
.premium-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-speed) ease;
}
.premium-card:hover {
    box-shadow: var(--shadow-md);
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .content-container {
        grid-template-columns: 1fr;
    }
    .sidebar-toc {
        display: none; /* Hide TOC on mobile/tablet */
    }
    .premium-card {
        padding: 2rem 1.5rem;
    }
}

/* =========================================
   4. Header Styles
   ========================================= */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed) ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 5rem; /* 80px */
}

.site-logo h2 {
    margin: 0;
    font-size: 1.5rem !important;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.site-logo:hover {
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}
.nav-link i {
    font-size: 1rem;
}
.nav-link:hover {
    color: var(--primary-color) !important;
    text-decoration: none;
}

.theme-toggle {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}
.theme-toggle:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: rotate(15deg);
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
[data-theme='dark'] .theme-toggle .icon-moon { display: none; }

@media (max-width: 768px) {
    .nav-links span {
        display: none; /* Hide text, show only icons on mobile */
    }
}

/* =========================================
   5. Sidebar TOC Styles
   ========================================= */
.sidebar-toc {
    position: sticky;
    top: 7rem; /* Below header */
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}
.sidebar-toc::-webkit-scrollbar {
    width: 6px;
}
.sidebar-toc::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.toc-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.toc-header {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-content ul {
    list-style: none;
    padding-left: 1rem;
    margin: 0;
}
.toc-content > ul {
    padding-left: 0;
}
.toc-content li {
    margin-bottom: 0.5rem;
}
.toc-content a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s ease;
    text-decoration: none;
}
.toc-content a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* =========================================
   6. Footer Styles
   ========================================= */
.site-footer {
    background-color: var(--bg-footer);
    color: #94a3b8; /* Slate 400 */
    padding: 3rem 0;
    margin-top: auto;
}

.footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}
.footer-links a {
    color: #cbd5e1; /* Slate 300 */
    font-weight: 500;
}
.footer-links a:hover {
    color: #ffffff;
}

.footer-social {
    display: flex;
    gap: 1.5rem;
    font-size: 1.5rem;
}
.footer-social a {
    color: #94a3b8;
}
.footer-social a:hover {
    color: #ffffff;
    transform: translateY(-2px);
}

.footer-copy {
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* =========================================
   7. Typography & Content Rendering (Markdown/RST)
   ========================================= */
.main-content h1 {
    font-size: 2.5rem !important;
    margin-top: 0;
    padding: 0 !important;
    border: none !important;
}
.main-content h2 { 
    font-size: 1.8rem !important; 
    padding: 0 0 0.5rem 0 !important; 
    border-bottom: 2px solid var(--border-color) !important; 
}
.main-content h3 { 
    font-size: 1.5rem !important;
    padding: 0 !important;
    border: none !important;
}
.main-content p {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}
.main-content ul, .main-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.main-content li {
    margin-bottom: 0.5rem;
}
.main-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin: 1.5rem 0;
}

/* Admonitions (Note, Warning, etc) */
div.admonition, div.warning, div.note {
    background-color: var(--bg-body) !important;
    border: none !important;
    border-left: 4px solid var(--primary-color) !important;
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    padding: 1.2rem 1.5rem !important;
    margin-bottom: 2rem !important;
    box-shadow: var(--shadow-sm) !important;
}

div.warning {
    border-left-color: #eab308 !important; /* Yellow-500 for warning */
}

div.admonition p.admonition-title {
    font-weight: 700 !important;
    margin-bottom: 0.5rem !important;
    background-color: transparent !important;
    color: var(--primary-color) !important;
    padding: 0 !important;
    border: none !important;
}

div.warning p.admonition-title {
    color: #eab308 !important;
}

div.admonition p.last {
    margin-bottom: 0 !important;
}

/* Code Blocks */
div.highlight {
    background: #f1f5f9 !important; /* Slate 100 for light mode syntax contrast */
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
div.highlight pre {
    padding: 1rem 1.5rem;
    color: inherit !important;
    background: transparent !important;
    overflow-x: auto;
}

/* Inline Code */
code.literal, .literal {
    background: var(--border-color); /* Slate 200 light, Slate 700 dark */
    color: var(--secondary-color);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-muted);
    font-style: italic;
}

/* Tables */
table.docutils {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}
table.docutils th {
    background: var(--bg-body);
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}
table.docutils td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
}

/* =========================================
   8. Ablog Specifics & Components
   ========================================= */
/* Hero Section in index.rst */
.main-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
@media (min-width: 768px) {
    .main-sections {
        grid-template-columns: 1fr 1fr;
    }
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--primary-color);
}
.profile-header i { font-size: 2.5rem; }

.services-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.service-item {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.btn-outline, .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-outline {
    border: 1px solid var(--primary-color);
    color: var(--primary-color) !important;
}
.btn-outline:hover {
    background: var(--primary-color);
    color: white !important;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary-color);
    color: white !important;
}

.activity-list {
    list-style: none;
    padding: 0;
}
.activity-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}
.activity-list li:last-child {
    border-bottom: none;
}
.activity-list li strong {
    color: var(--primary-color);
}

ul.ablog-post-list {
    list-style: none;
    padding-left: 0;
}
ul.ablog-post-list li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}
ul.ablog-post-list li p.ablog-post-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}
ul.ablog-post-list li p.ablog-post-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Category & Tag Pills */
ul.ablog-post-info {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

ul.ablog-post-info li {
    display: inline-flex;
    align-items: center;
}

ul.ablog-post-info a.reference.internal {
    background: var(--primary-light);
    color: var(--primary-color) !important;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
}

ul.ablog-post-info a.reference.internal:hover {
    background: var(--primary-color);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* =========================================
   9. Dark Mode Premium Refinements & Pygments
   ========================================= */

/* Text Selection */
::selection {
    background: var(--primary-color);
    color: #ffffff;
}
::-moz-selection {
    background: var(--primary-color);
    color: #ffffff;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 5px;
    border: 2px solid var(--bg-body);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Dark Mode Pygments (Syntax Highlighting) Overrides */
[data-theme='dark'] div.highlight {
    background: #0f172a !important; /* Slate 900 */
    border-color: #334155;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
[data-theme='dark'] div.highlight pre {
    color: #e2e8f0 !important;
}

[data-theme='dark'] .highlight .k, [data-theme='dark'] .highlight .kc, [data-theme='dark'] .highlight .kd, [data-theme='dark'] .highlight .kn, [data-theme='dark'] .highlight .kp, [data-theme='dark'] .highlight .kr {
    color: #c678dd !important; /* Purple */
}
[data-theme='dark'] .highlight .s, [data-theme='dark'] .highlight .s2, [data-theme='dark'] .highlight .sa, [data-theme='dark'] .highlight .sb, [data-theme='dark'] .highlight .sc, [data-theme='dark'] .highlight .dl, [data-theme='dark'] .highlight .sd, [data-theme='dark'] .highlight .s1 {
    color: #98c379 !important; /* Green */
}
[data-theme='dark'] .highlight .nc, [data-theme='dark'] .highlight .nf, [data-theme='dark'] .highlight .nx {
    color: #61afef !important; /* Blue */
}
[data-theme='dark'] .highlight .c, [data-theme='dark'] .highlight .c1, [data-theme='dark'] .highlight .cm, [data-theme='dark'] .highlight .ch {
    color: #7f848e !important; /* Gray */
}
[data-theme='dark'] .highlight .o, [data-theme='dark'] .highlight .ow {
    color: #56b6c2 !important; /* Cyan */
}
[data-theme='dark'] .highlight .nd {
    color: #e5c07b !important; /* Yellow */
}
[data-theme='dark'] .highlight .m, [data-theme='dark'] .highlight .mf, [data-theme='dark'] .highlight .mh, [data-theme='dark'] .highlight .mi, [data-theme='dark'] .highlight .mo {
    color: #d19a66 !important; /* Orange/Numbers */
}
