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

:root {
    --bg-primary: #352e38;
    --bg-secondary: #242027;
    --bg-card: #243447;
    --text-primary: #ddd4d4;
    --text-secondary: #9ca3af;
    --accent: #3b82f6;
    --border: #374151;
    --bg-inline-code: #e29090;
    --bg-code: #1e1e2f;
    --cert-hex: #000000;
}

[data-theme="light"] {
    --bg-primary: #F5F5F0;
    --bg-secondary: #E6D8C3;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent: #3b82f6;
    --border: #e5e7eb;
    --bg-inline-code: #6f3b46;
    --bg-code: #dfdfe7;
    --cert-hex: #333;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    overflow: hidden;
}

.handle {
    opacity: 0.7;
    background: linear-gradient(90deg, 
        #ff0080, 
        #ff8c00, 
        #40e0d0, 
        #9b59b6,
        #ff0080
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow-flow 5s linear infinite;
}

@keyframes rainbow-flow {
    0% {
        background-position: 200% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.sidebar {
    width: 15%;
    min-width: 200px;
    max-width: 500px;
    background-color: var(--bg-secondary);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: ew-resize;
    background-color: transparent;
    transition: background-color 0.2s;
}

.resize-handle:hover {
    background-color: var(--accent);
}

.resize-handle::after {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 20px;
    height: 100%;
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    /* letter-spacing: 0.05em; */
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

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

.social-links a {
    color: var(--text-primary);
    font-size: 1.5rem;
    transition: color 0.3s;
}

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

.footer {
    margin-top: auto;
    padding-top: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    position: relative;
}

.navbar {
    background-color: var(--bg-secondary);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* border-bottom: 1px solid var(--border); */
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.nav-links a {
    padding: 0.5rem;
    position: relative;
    z-index: 1;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        #ff0080, 
        #ff8c00, 
        #40e0d0, 
        #9b59b6,
        #ff0080
    );
    background-size: 200% 100%;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: -1;
}

.nav-links a:hover::before {
    opacity: 0.2;
    animation: rainbow-flow 2s linear infinite;
}

.nav-right {
    display: flex;
    margin-left: auto;
    align-items: center;
    gap: 1rem;
}

.lang-selector {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s;
}

.theme-toggle:hover {
    background: var(--bg-card);
}

.main-container {
    position: relative;
    padding: 2rem;
}

.post-card {
    overflow: hidden;
    margin-bottom: 2rem;
    transition: transform 0.3s, border-color 0.3s;
    border-left: 2px solid var(--text-primary);
    position: relative;
}

.post-content a {
  color: var(--inline-code);
}

/* .post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    width: 2px;
    height: 0;
    background: linear-gradient(180deg, 
        #ff0080, 
        #ff8c00, 
        #40e0d0, 
        #9b59b6,
        #ff0080
    );
    background-size: 100% 400%;
    transition: height 0.4s ease;
    animation: gradient-flow 5s ease infinite;
} */

@keyframes gradient-flow {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 0% 100%;
    }
    100% {
        background-position: 0% 0%;
    }
}

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

.post-card:hover::before {
    height: 100%;
}

.post-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        #ff0080, 
        #ff8c00, 
        #40e0d0, 
        #9b59b6,
        #ff0080
    );
    background-size: 400% 100%;
    transition: width 0.4s ease 0.2s;
    animation: gradient-flow-horizontal 5s ease infinite;
}

@keyframes gradient-flow-horizontal {
    0% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 0%;
    }
    100% {
        background-position: 0% 0%;
    }
}

.post-card:hover::after {
    width: 100%;
}

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-content {
    padding: 1rem;
}

.post-title {
    position: relative;
    overflow: visible;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    /* color: var(--text-primary); */

    background: var(--text-primary);
    background-size: 300% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.post-title.washing {
    background: linear-gradient(90deg,
        #ff0080 0%,
        #ff8c00 12%,
        #40e0d0 24%,
        #9b59b6 36%,
        #ff0080 48%,
        white 50%,
        white 100%
    );
    background-size: 200% 100%;
    background-position: 0% 0%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-flow-horizontal 1.5s ease;
}

@keyframes gradient-flow-horizontal {
    0% {
        background-position: 100% 0%;
    }
    100% {
        background-position: 0% 0%;
    }
}

.post-title.flashing {
    background: linear-gradient(90deg, 
        #ff0080,
        #ff8c00, 
        #40e0d0,
        #9b59b6,
        #ff0080,
        #ff8c00, 
        #40e0d0,
        #9b59b6,
        #ff0080
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow-text-flow 5s ease infinite;
}
@keyframes rainbow-text-flow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.post-title.unwashing {
    background-position: 100% 0%;
    transition: background-position 1s ease;
}

.post-href {
    text-decoration: none;
}

/* .post-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    background: linear-gradient(90deg, 
        #ff0080,
        #ff0080,
        #ff8c00, 
        #40e0d0,
        #9b59b6
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: width 0.8s ease;
    z-index: 2;
} */

/* .post-card:hover .post-title::after {
    width: 100%;
    animation: rainbow-text-flow 2s ease infinite 0.6s;
} */

/* .post-card:hover .post-title::before {
    width: 100%;
} */

/* .post-title::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 1;
    transition: width 0.8s ease;
} */

@keyframes rainbow-text-flow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.post-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.post-meta {
    margin-top: 0.75rem;
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.tag {
    color: var(--accent);
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* CODE BLOCKS */

/* typing effect */
@media (max-width: 900px) {
    .site-title {
        display: none;
    }
}

@media (min-width: 901px) and (max-width: 1024px) {
    .site-title {
        display: initial;
    }
}

@media (min-width: 1025px) and (max-width: 1150px) {
    .site-title {
        display: none;
    }
}

@media (min-width: 1151px) {
    .site-title {
        display: initial;
    }
}
/* typing effect end */

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s;
        width: 280px;
    }

    .sidebar.active {
        left: 0;
    }

    .hamburger {
        display: block;
    }

    .main-content {
        width: 100%;
    }

    .nav-links {
        gap: 1rem;
        margin-left: 2rem;
        font-size: 0.875rem;
    }

    .navbar {
        padding: 1rem;
    }

    .main-container {
        padding: 1rem;
        /* height: auto; */
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .overlay.active {
        display: block;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-secondary) var(--bg-secondary);
}

/* Scrollbar for specific elements (optional) */
.main-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff0080, #ff8c00, #40e0d0, #9b59b6);
}

.toc-sidebar::-webkit-scrollbar {
    width: 8px;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 10px;
}