:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --link-color: #0066cc;
    --link-hover: #004499;
    --nav-shadow: rgba(0, 0, 0, 0.1);
    --code-bg: #f6f8fa;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
    --link-color: #66b3ff;
    --link-hover: #99ccff;
    --nav-shadow: rgba(255, 255, 255, 0.1);
    --code-bg: #2d2d2d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--nav-shadow);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--link-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--link-color);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    margin-left: 1rem;
}

.theme-toggle:hover {
    color: var(--link-color);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    min-height: calc(100vh - 200px);
}

/* Home Page */
.hero {
    padding: 4rem 2rem;
    background-image: url('../assets/images/DSCF8041.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

[data-theme="dark"] .hero::before {
    background-color: rgba(0, 0, 0, 0.6);
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.hero .subtitle {
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.hero .bio {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #ffffff;
    max-width: 1100px;
}

.hero .bio p {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.section {
    margin-top: 3rem;
}

.section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.section-content {
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 1100px;
}

.about-me-container {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    margin-top: 1rem;
}

.about-me-left {
    flex: 1;
    min-width: 0;
}

.about-me-left .section-content {
    max-width: none;
}

.about-me-image {
    flex-shrink: 0;
    width: 400px;
    max-width: 100%;
}

.about-me-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 8px var(--nav-shadow);
}

@media (max-width: 768px) {
    .about-me-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .about-me-image {
        width: 100%;
    }
}

.about-me-left .social-links {
    margin-top: 1.5rem;
}

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

.social-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    background-color: var(--bg-secondary);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.social-link:hover {
    color: var(--link-color);
    background-color: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--nav-shadow);
    border-color: var(--link-color);
}

.social-link svg {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.social-link span {
    font-size: 1rem;
    font-weight: 500;
}

/* Blog List */
.blog-list {
    list-style: none;
}

.blog-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.blog-item:last-child {
    border-bottom: none;
}

.blog-item-content {
    flex: 1;
    min-width: 0;
}

.blog-item-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.blog-item-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-item-title a:hover {
    color: var(--link-color);
}

.blog-item-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.blog-item-meta span {
    margin-right: 1rem;
}

.blog-item-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
}

.blog-item-cover {
    flex-shrink: 0;
    width: auto;
    max-width: 300px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-item-cover img {
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}

.blog-item-cover a:hover img {
    transform: scale(1.05);
}

/* Blog Post Container with Sidebar */
.blog-post-container {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
}

.blog-post {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    max-width: 800px;
}

.post-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px; /* Offset for navbar */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .blog-post-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .post-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
        overflow-y: visible;
    }
    
    .blog-post {
        max-width: 100%;
    }
}

.post-header {
    margin-bottom: 2rem;
}

.post-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.post-meta {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.post-cover {
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
}

.post-cover img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.75rem; }
.post-content h3 { font-size: 1.5rem; }

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

.post-content a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.post-content a:hover {
    border-bottom-color: var(--link-color);
}

.post-content ul,
.post-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

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

.post-content code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.post-content pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

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

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

/* Post Navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.post-navigation-top {
    margin-top: 1rem;
    margin-bottom: 1.25rem;
    padding-top: 0;
    border-top: none;
}

.post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 45%;
}

.post-nav-link:hover {
    border-color: var(--link-color);
    background-color: var(--bg-secondary);
}

.post-nav-prev {
    text-align: left;
}

.post-nav-next {
    text-align: right;
}

.post-nav-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.post-nav-title {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.post-nav-link:hover .post-nav-label {
    color: var(--link-color);
}

.post-content blockquote {
    border-left: 4px solid var(--border-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Table of Contents */
.table-of-contents {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.table-of-contents h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    margin-top: 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

.table-of-contents ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.table-of-contents > ul {
    margin-left: 0;
}

.table-of-contents li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.table-of-contents ul ul {
    margin-left: 1.25rem;
    margin-top: 0.4rem;
}

.table-of-contents a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    display: block;
    padding: 0.2rem 0;
    font-size: 0.9rem;
}

.table-of-contents a:hover {
    color: var(--link-color);
}

/* Nested heading styles in sidebar */
.table-of-contents ul ul a {
    font-size: 0.85rem;
}

.table-of-contents ul ul ul a {
    font-size: 0.8rem;
}

@media (max-width: 1024px) {
    .table-of-contents {
        margin-bottom: 0;
    }
}

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

/* Add scroll offset for fixed navbar */
.post-content h1[id],
.post-content h2[id],
.post-content h3[id],
.post-content h4[id],
.post-content h5[id],
.post-content h6[id] {
    scroll-margin-top: 80px;
}

/* Archive Page */
.archive-list {
    list-style: none;
}

.archive-year {
    margin-top: 3rem;
}

.archive-year:first-child {
    margin-top: 0;
}

.archive-year h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.archive-item {
    padding: 0.75rem 0;
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: 100px;
}

.archive-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.archive-title a:hover {
    color: var(--link-color);
}

/* About Page */
.about-content {
    max-width: 1200px;
}

.about-content h2 {
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.about-content h2:first-child {
    margin-top: 0;
}

.about-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-content a {
    color: var(--link-color);
    text-decoration: none;
}

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

.about-content .date {
    color: #888888;
    font-weight: 400;
}

[data-theme="dark"] .about-content .date {
    color: #999999;
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1.2rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .post-title {
        font-size: 2rem;
    }

    .archive-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .blog-item {
        flex-direction: column;
    }

    .blog-item-cover {
        order: 0;
        width: 100%;
        height: 200px;
        margin-bottom: 1rem;
    }

    .post-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .post-nav-link {
        max-width: 100%;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Error State */
.error {
    text-align: center;
    padding: 2rem;
    color: #d32f2f;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.tag:hover {
    background-color: var(--border-color);
}

/* Baseball Map Styles */
.baseball-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.baseball-map-container {
    margin-top: 2rem;
}

.baseball-posts-section {
    margin-top: 2.5rem;
}

.baseball-posts-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

/* Tour list: year on left (once per year), posts on right, timeline */
.baseball-tour-timeline {
    position: relative;
    padding-left: 4rem;
    margin-top: 1rem;
}

/* Line centered on the dots */
.baseball-tour-timeline::before {
    content: '';
    position: absolute;
    left: calc(1.75rem - 1px);
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--border-color);
    border-radius: 1px;
}

.baseball-year-block {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.baseball-year-block:last-child {
    margin-bottom: 0;
}

.baseball-year-header {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-secondary);
    min-width: 3.5rem;
    flex-shrink: 0;
    position: relative;
    padding-top: 0.15rem;
}

/* Dot centered on the timeline line (4rem padding - 2.25rem = 1.75rem = line center) */
.baseball-year-header::before {
    content: '';
    position: absolute;
    left: -2.25rem;
    top: 0.5em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--link-color);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 1px var(--border-color);
    transform: translateX(-50%);
}

.baseball-year-posts {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.baseball-post-item {
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.baseball-post-link {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text-primary);
    text-decoration: none;
}

.baseball-post-link:hover .baseball-post-title {
    color: var(--link-color);
    text-decoration: underline;
}

.baseball-post-date {
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.baseball-post-title {
    font-weight: 600;
    font-size: 1rem;
}

.baseball-post-desc {
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.45;
}

.baseball-tour-empty {
    color: var(--text-secondary);
    font-style: italic;
}

.baseball-map-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.baseball-map-wrapper > img#baseball-map {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.team-icons-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.team-icon {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: all;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    padding: 5px;
    line-height: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
    z-index: 10;
}

.team-icon:hover {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 20;
}

.team-icon img {
    width: 26px;
    height: 26px;
    display: block;
}

.team-icon.visited {
    opacity: 1;
    filter: none;
}

.team-icon.visited:hover {
    opacity: 1;
}

.team-icon.unvisited {
    opacity: 0.7;
    filter: grayscale(1) brightness(0.55);
}

.team-icon.unvisited:hover {
    opacity: 0.9;
    filter: grayscale(1) brightness(0.75);
}

[data-theme="dark"] .team-icon {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(20, 20, 20, 0.85);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
