/* ==========================================================================
   Design Tokens — CSS Custom Properties
   ========================================================================== */

:root {
    /* Background */
    --bg-primary: #202124;
    --bg-card: #292a2d;
    --bg-secondary: #303134;

    /* Text */
    --text-primary: #e8eaed;
    --text-heading: #ffffff;
    --text-muted: #9aa0a6;
    --text-subtle: #bdc1c6;
    --text-link: #e8eaed;
    --text-link-hover: #aecbfa;
    --text-placeholder: #9aa0a6;

    /* Borders */
    --border-color: #3c4043;
    --border-subtle: #3c4043;

    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);

    /* Code */
    --code-bg: #292a2d;
    --code-text: #e8eaed;

    /* Accents */
    --accent-blue: #8ab4f8;
    --accent-teal: #4dd0e1;
    --accent-gold: #f1c40f;
    --accent-green: #2ecc71;

    /* Table */
    --table-stripe: rgba(255, 255, 255, 0.03);
}

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

body {
    font-family: "Roboto Condensed", Arial, sans-serif;
    background-color: var(--bg-primary);
    font-size: 16px;
    line-height: 1.5em;
    color: var(--text-primary);
    font-weight: 300;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}



h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: normal;
    color: var(--text-heading);
    margin-bottom: 5px;
}

h1 {
    margin-bottom: 10px;
    font-size: 25px;
}

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

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

hr {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid transparent;
}

/* ==========================================================================
   Preload — Disable transitions on initial load
   ========================================================================== */

.preload * {
    transition: none !important;
}

/* ==========================================================================
   Layout — Grid
   ========================================================================== */

.col-sm-3 {
    margin-top: 50px;
    font-size: 11px;
    color: var(--text-primary);
}

.col-sm-3 strong {
    font-size: 16px;
    color: var(--text-heading);
    font-weight: normal;
}

.col-sm-3 img#about {
    border-radius: 50%;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
}

.col-sm-9 {
    margin-top: 50px;
}

/* ==========================================================================
   Sidebar — Sticky Container
   ========================================================================== */

@media (min-width: 1024px) {
    .sidebar__sticky {
        position: fixed;
        max-width: 225px;
    }
}

/* ==========================================================================
   Profile Card
   ========================================================================== */

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.profile-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.profile-card__home-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.profile-card .author-name,
.profile-card .profile-card__about {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.profile-card .author-name {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.profile-card__about {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 10px;
}

.profile-card a:hover {
    text-decoration: none !important;
}

.profile-card .avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 15px;
    object-fit: cover;
}

/* ==========================================================================
   Social Links
   ========================================================================== */

.social {
    display: block;
    margin-top: 20px;
    position: relative;
    z-index: 3;
}

.social__list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.social__item {
    display: block;
    margin-bottom: 8px;
}

.social__link {
    font-size: 16px;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    width: 100%;
    padding: 5px 0;
}

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

.social__icon {
    margin-right: 10px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.social__label {
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 400;
    margin-left: 5px;
    line-height: 1;
}

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

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

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

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.posts-grid .post-card:nth-child(odd):hover {
    transform: translateY(-5px) rotate(-1.5deg) scale(1.02);
}

.posts-grid .post-card:nth-child(even):hover {
    transform: translateY(-5px) rotate(1.5deg) scale(1.02);
}

.post-card__content {
    display: flex;
    flex-direction: column;
    padding: 12px;
    text-decoration: none !important;
    color: inherit;
    height: 100%;
}

.post-card .post-card__title a::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.post-card__title {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
    flex-grow: 1;
    line-height: 1.3;
}

.post-card__title a {
    color: inherit;
    text-decoration: none;
}

.post-card__categories {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.post-card__meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
}

/* ==========================================================================
   Category Badge (shared between post cards and post detail)
   ========================================================================== */

.category-badge {
    font-size: 11px;
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 600;
    pointer-events: auto;
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   Category Archive — Button List
   ========================================================================== */

.category-buttons {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-buttons--archive {
    margin-bottom: 20px;
}

.category-button {
    display: inline-block;
    margin-right: 5px;
    margin-bottom: 5px;
}

.btn-default {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.btn-default:hover {
    background-color: var(--bg-secondary);
    color: var(--text-heading);
    border-color: var(--text-muted);
}

.btn-default.active {
    background-color: var(--text-heading) !important;
    color: var(--bg-primary) !important;
    border-color: var(--text-heading) !important;
    pointer-events: none;
}

/* ==========================================================================
   Post Detail — Meta & Content
   ========================================================================== */

.post-detail__meta {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.post-detail__meta .time {
    font-size: 1.25rem;
    color: var(--text-placeholder);
    font-weight: 500;
}

.post-detail__meta .categories {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
}

span.time,
span.categories {
    color: var(--text-subtle);
    margin-bottom: 5px;
    font-size: 12px;
}

.post-content {
    border-top: 1px solid var(--border-color);
    margin-top: 5px;
    padding-top: 5px;
}

.post-content pre {
    background: var(--code-bg);
    padding: 10px;
    color: var(--code-text);
    overflow-x: auto;
    font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid transparent;
}

.post-content .highlight {
    background: var(--code-bg);
}

.post-content img {
    max-width: 100%;
}

.post-content table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.post-content th,
.post-content td {
    padding: 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.post-content th {
    background-color: var(--bg-secondary);
    color: var(--text-heading);
    font-weight: 600;
}

.post-content tr:nth-child(even) {
    background-color: var(--table-stripe);
}

/* ==========================================================================
   Post Reading Shell
   ========================================================================== */

.post-reading-shell {
    position: relative;
}

/* ==========================================================================
   Related Posts
   ========================================================================== */

.related-posts {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Post Navigation (prev/next)
   ========================================================================== */

.post-navigation {
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 30px 0;
}

.post-navigation a {
    display: inline-block;
    width: auto;
    float: none;
    margin: 0;
    max-width: 48%;
}

.post-navigation__next {
    text-align: right;
    margin-left: auto;
}

.post-navigation__prev {
    text-align: left;
    margin-right: auto;
}

/* ==========================================================================
   UI Components — Cards & Badges
   ========================================================================== */

.nav-card {
    display: inline-block;
    padding: 10px 15px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-placeholder);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    color: var(--text-heading);
    text-decoration: none;
}

.date-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-placeholder);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.date-card i {
    color: var(--text-placeholder);
}

/* ==========================================================================
   Disqus Comments
   ========================================================================== */

.disqus-comments {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 10000;
    pointer-events: none;
}

.reading-progress__bar {
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-teal) 100%);
    box-shadow: 0 0 12px rgba(138, 180, 248, 0.45);
}

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

.site-footer {
    border-top: 1px solid var(--border-subtle);
    width: 100%;
    margin-top: 10px;
    margin-bottom: 3em;
    padding-top: 10px;
    color: var(--text-subtle);
    font-size: 16px;
    bottom: 0;
    padding-bottom: 10px;
    text-align: center;
}

/* ==========================================================================
   Mobile Home Icon (shown on inner pages in mobile)
   ========================================================================== */

.mobile-home-icon {
    display: none !important;
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */

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

    .col-sm-3 {
        margin-top: 30px;
    }

    body.page .sidebar__sticky,
    body.page .col-sm-3,
    .profile-card__about {
        display: none !important;
        margin-top: 0;
    }

    .social__list {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .social__item {
        margin-bottom: 0;
        display: inline-block;
    }

    .social__link {
        padding: 5px;
        justify-content: center;
        width: auto;
    }

    .social__label {
        display: none !important;
    }

    .social__icon {
        font-size: 18px !important;
        margin-right: 0 !important;
    }

    body.page .mobile-home-icon {
        display: block !important;
        position: absolute;
        top: 20px;
        left: 20px;
        z-index: 9999;
        color: var(--text-heading);
        font-family: "Roboto Condensed", Arial, sans-serif;
        font-size: 20px;
        font-weight: normal;
        background: transparent;
        width: auto;
        height: auto;
        padding: 0;
        line-height: normal;
        text-align: left;
        border-radius: 0;
        box-shadow: none;
        text-decoration: none;
        border: none;
        text-shadow: none;
    }

    body.page .mobile-home-icon:hover,
    body.page .mobile-home-icon:active {
        color: #ddd;
        background: transparent;
    }
}
