/* --- THEME VARIABLES --- */
:root {
    /* Light Mode */
    --background-color: #f4f4f0;
    --text-color: #1a1a1a;
    --secondary-color: #555555;
    --accent-color: #1a1a1a;
    --border-color: #1a1a1a;
    --hover-bg: #e5e5e0;
    --font-main: 'Inter', sans-serif;
}

[data-theme="dark"] {
    /* Dark Mode */
    --background-color: #000000;
    --text-color: #E8E6E3;
    --secondary-color: #9ca3af;
    --accent-color: #4E9F3D;
    --border-color: #333333;
    --hover-bg: #111111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.45;
    font-size: 0.95rem;
    max-width: 800px;
    margin: 0 auto;
    /* Safe area padding for mobile notches */
    padding: 3rem 1.5rem;
    padding-top: calc(3rem + env(safe-area-inset-top));
    transition: background-color 0s, color 0s;
}

/* --- PROGRESS BAR --- */
#progress-container {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 9999;
    background: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Only show progress container if the body has the 'has-progress' class */
body.reading-mode #progress-container {
    opacity: 1;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--accent-color);
    transition: width 0.1s ease-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] #progress-container {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] #progress-container {
    background: rgba(255, 255, 255, 0.05);
}

/* --- HEADER & NAV --- */
header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--text-color);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h1 a {
    text-decoration: none;
    color: inherit;
}

nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    font-size: 1.1rem;
    /* Changed from 0.95rem */
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
}

/* --- THEME TOGGLE --- */
.theme-toggle-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
}

.theme-toggle-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sun {
    display: none;
}

.icon-moon {
    display: block;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

/* --- CONTENT --- */
p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

[data-theme="dark"] a {
    color: var(--accent-color);
}

[data-theme="dark"] nav a {
    color: var(--text-color);
}

[data-theme="dark"] nav a:hover,
[data-theme="dark"] nav a.active {
    color: var(--accent-color);
}

a:hover {
    background-color: var(--hover-bg);
    text-decoration: none;
}

/* --- LISTS --- */
.info-list {
    list-style: none;
    padding: 0;
}

.info-label {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    opacity: 1;
    border-bottom: none;
    display: block;
    width: 100%;
    color: var(--text-color);
    text-transform: none;
}

.info-list li {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    /* Faded line in light mode */
}

[data-theme="dark"] .info-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    /* Faded line in dark mode */
}

.info-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-list span {
    opacity: 0.8;
}

.info-list p:last-of-type {
    margin-bottom: 0;
    /* Remove extra gap in Career section */
}

/* --- BLOG LIST --- */
.blog-intro {
    margin-bottom: 2rem;
    opacity: 0.9;
}

.blog-list {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--text-color);
}

.blog-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
}

.blog-list .blog-item:last-child {
    border-bottom: none;
}

.category-list .category-item:last-child {
    border-bottom: none;
}

.blog-item:hover {
    background-color: var(--hover-bg);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.blog-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.blog-item:hover .blog-title {
    color: var(--accent-color);
}

.blog-date {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-left: 1rem;
}

/* --- FULL POST --- */
article.full-post-view h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
    font-weight: 700;
    color: var(--accent-color);
}

.blog-meta {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    display: block;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    font-size: 0.85rem;
}

.blog-body {
    font-size: 0.95rem;
    line-height: 1.45;
}

.blog-body p {
    margin-bottom: 1.5rem;
}

.blog-back-btn {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
}

.blog-back-btn:hover {
    background-color: var(--hover-bg);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.back-to-top-wrapper {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* --- QUOTES --- */
.quote-block {
    border-left: 3px solid var(--accent-color);
    padding-left: 1.25rem;
    margin: 2rem 0;
    font-style: italic;
}

.quote-author {
    font-style: normal;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    display: block;
    color: var(--secondary-color);
}

.contact-list {
    list-style: none;
}

.contact-list li {
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    nav ul {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .blog-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .blog-date {
        margin-left: 0;
    }
}

/* --- TABS & LISTS STYLES --- */
.lists-intro {
    margin-bottom: 2rem;
    opacity: 0.9;
    padding-bottom: 0;
}

/* Scrollable container for tabs on mobile */
.tabs-nav {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;

    /* STABILITY FIXES */
    position: sticky;
    top: 0;
    /* Keeps bar at the top of the viewport when scrolling */
    background-color: var(--background-color);
    /* Prevents content from bleeding through */
    z-index: 10;
    touch-action: pan-x;
    /* Prevents vertical scroll from shaking the horizontal bar */
}

.tabs-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--secondary-color);
    padding: 0.5rem 0;
    transition: color 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: var(--accent-color);
}

.tab-btn.active {
    color: var(--accent-color);
    font-weight: 700;
}

/* Active tab indicator underline */
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    /* Aligns with border-bottom of container */
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--accent-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

/* List Item Styles for Content */
.library-list {
    list-style: none;
    padding: 0;
}

.library-item {
    margin-bottom: 2rem;
}

.lib-title {
    font-weight: 700;
    font-size: 1.05rem;
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-color);
    text-decoration: none;
}

.lib-title:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.lib-meta {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lib-commentary {
    font-size: 0.95rem;
    opacity: 0.9;
    border-left: 2px solid var(--border-color);
    padding-left: 1rem;
    margin-top: 0.5rem;
}

/* Dark mode green accent for commentary border */
[data-theme="dark"] .lib-commentary {
    border-left-color: var(--accent-color);
}

.empty-state {
    color: var(--secondary-color);
    font-style: italic;
    padding: 2rem 0;
    text-align: center;
    opacity: 0.7;
}

.pdf-tag {
    font-size: 0.75rem;
    border: 1px solid var(--secondary-color);
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* --- CATEGORY LIST (LISTS.HTML MENU) --- */
.category-list {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--text-color);
    /* This is the single line */
}

.category-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.category-item:hover {
    background-color: var(--hover-bg);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.category-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.category-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.category-item:hover .category-title {
    color: var(--accent-color);
}

/* --- INDIVIDUAL LIST PAGE STYLES --- */
.list-page-header {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    /* This keeps them vertically centered */
    justify-content: space-between;
    gap: 0.75rem;
}

.list-page-header .blog-back-btn {
    margin-bottom: 0;
    /* Remove the default margin */
}

.list-page-header h2 {
    font-size: 1.6rem;
    color: var(--accent-color);
    margin: 0;
}

.list-page-header svg {
    width: 24px;
    height: 24px;
    fill: var(--accent-color);
    flex-shrink: 0;
    /* Prevent icon from shrinking */
}

/* Add this new rule for the h3 that comes after */
article h3 {
    margin-bottom: 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
}

@media (max-width: 600px) {
    summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    summary .lib-meta {
        font-size: 0.8rem;
    }

    .rating-badge {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
}

/* --- HEADER PROFILE SECTION --- */
.header-top {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    /* Gap between image and name */
    margin-bottom: 1rem;
}

.profile-pic {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Adjust the H1 so it doesn't have the bottom margin since its wrapper handles it now */
header h1 {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .profile-pic {
        width: 50px;
        height: 50px;
    }

    .header-top {
        gap: 0.75rem;
    }
}