/* PASTE AT VERY TOP OF STYLE.CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@600;700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600&display=swap');

/* style.css - Improved Version */
:root {
    --bg-color: #ffffff; 
    --text-color: #222222; /* Slightly softer black */
    --accent-color: #0066cc; 
    --meta-color: #888888;
    --code-bg: #f6f6f6;
--font-body: 'IBM Plex Serif', serif;
    --font-heading: 'IBM Plex Serif', serif;
    /* --- UPDATED SIZING FOR BETTER FLOW --- */
    --body-size: 17px;   /* Increased from 15px */
    --line-height: 1.8;  /* Increased from 1.6 for more "air" */
    --max-width: 740px;  /* Widened to prevent cramping */
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: var(--body-size);
    line-height: var(--line-height);
    padding: 0 1.5rem; /* Increased side padding for mobile safety */
    -webkit-font-smoothing: antialiased;
}

/* LAYOUT */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-top: 5rem;    /* More space at top */
    padding-bottom: 8rem; /* More space at bottom */
}

/* HEADER */
header {
    margin-bottom: 3.5rem;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 2rem;
}

.site-nav { margin-bottom: 2.5rem; font-size: 14px; font-weight: 600; }
.site-nav a { text-decoration: none; color: var(--text-color); }
.site-nav a:hover { color: var(--accent-color); }

h1 { 
    font-size: 2rem; /* Larger title */
    letter-spacing: -0.5px; 
    margin-bottom: 0.75rem; 
    font-weight: 700; 
    line-height: 1.2;
}
.meta { font-size: 14px; color: var(--meta-color); font-family: 'SF Mono', monospace; }

/* --- CONTENT TYPOGRAPHY --- */
article p { 
    margin-bottom: 1.8rem; 
    /* THIS FIXES THE ORPHANS (Single words on lines) */
    text-wrap: pretty; 
}

article h2 { 
    font-size: 1.4rem; 
    margin-top: 3.5rem; 
    margin-bottom: 1.2rem; 
    font-weight: 600; 
    letter-spacing: -0.3px;
    color: #111;
}

article h3 {
    font-size: 1.15rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

article a { 
    color: var(--accent-color); 
    text-decoration: underline; 
    text-underline-offset: 3px;
    
    /* This forces long links to break onto the next line */
    overflow-wrap: break-word; 
    word-break: break-word; 
}

blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1.5rem;
    margin: 2.5rem 0;
    color: #444;
    font-style: italic;
    font-size: 1.1rem; /* Slightly larger quote text */
}

/* LISTS (Fixed alignment) */
article ul, article ol {
    margin-top: 0;
    margin-bottom: 1.8rem; 
    padding-left: 1.5rem; 
    margin-left: 0.5rem; 
}
article li {
    margin-bottom: 0.75rem; 
    padding-left: 0.5rem; 
}

/* IMAGES */
figure { margin: 3rem 0; }
img {
    max-width: 100%; height: auto; border-radius: 6px;
    display: block; border: 1px solid #f0f0f0;
}
figcaption { margin-top: 1rem; font-size: 13px; color: var(--meta-color); text-align: center; }

/* FOOTER */
footer {
    margin-top: 5rem; padding-top: 2rem; border-top: 1px solid #eaeaea;
    font-size: 14px; color: var(--meta-color); display: flex; justify-content: space-between;
}

/* --- NEW LAYOUT: SIDEBAR + CONTENT --- */

/* The outer wrapper that holds both columns */
.page-wrapper {
    max-width: 1100px; /* Wider to fit sidebar + text */
    margin: 0 auto;
    padding: 4rem 2rem;
    display: grid;
    grid-template-columns: 240px 1fr; /* 240px Sidebar | Remaining space for Text */
    gap: 4rem; /* Space between sidebar and text */
}

/* The actual text column */
.main-content {
    max-width: 740px; /* Your preferred text width */
    min-width: 0; /* Prevents grid blowout */
}

/* --- SIDEBAR STYLING --- */
aside.sidebar {
    position: relative;
}

.toc-container {
    position: sticky;
    top: 4rem;
    font-family: var(--font-heading);
    
    /* --- NEW SCROLLING RULES --- */
    max-height: calc(100vh - 6rem); /* Height of screen minus top spacing */
    overflow-y: auto; /* Adds a scrollbar if list is too long */
    
    /* Make scrollbar very subtle */
    scrollbar-width: thin;
    scrollbar-color: #eaeaea transparent;
}

/* Chrome/Safari Scrollbar Styling (Clean & Minimal) */
.toc-container::-webkit-scrollbar {
    width: 3px;
}
.toc-container::-webkit-scrollbar-thumb {
    background-color: #eaeaea;
    border-radius: 4px;
}

.toc-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--meta-color);
    margin-bottom: 1rem;
    font-weight: 700;
}

#table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid #eee;
}

#table-of-contents li {
    margin: 0;
    padding: 0;
}

#table-of-contents a {
    display: block;
    text-decoration: none;
    font-size: 13px;
    color: #999; /* Inactive color */
    padding: 6px 0 6px 1.5rem; /* Indent */
    border-left: 2px solid transparent; /* Invisible border for highlighting */
    margin-left: -1px; /* Align border with grey line */
    transition: all 0.2s ease;
    line-height: 1.4;
    overflow-wrap: break-word; /* Prevents overflow */
}

#table-of-contents a:hover {
    color: var(--accent-color);
}

/* Active State (controlled by JS) */
#table-of-contents a.active {
    color: var(--accent-color);
    border-left: 2px solid var(--accent-color);
    font-weight: 600;
}

/* Indent H3s to look like sub-bullets */
#table-of-contents li.h3 a {
    padding-left: 2.5rem;
    font-size: 12px;
}

/* --- MOBILE RESPONSIVENESS --- */
/* If screen is smaller than 1000px, hide sidebar and center text */
@media (max-width: 1000px) {
    .page-wrapper {
        display: block; /* Remove grid */
        padding: 4rem 1.5rem;
    }
    
    aside.sidebar {
        display: none; /* Hide TOC on mobile/tablet */
    }
    
    .main-content {
        margin: 0 auto; /* Center the text */
    }
}

/* --- HOMEPAGE / PORTFOLIO STYLES --- */

/* 1. The Post List Item */
.post-item {
    margin-bottom: 3.5rem;
    display: block;
    text-decoration: none; /* Removes default link underline */
    group: transition; 
}

/* 2. Post Date (Styled like the sidebar headers) */
.post-date {
    font-family: var(--font-heading);
    font-size: 13px;
    color: var(--meta-color);
    margin-bottom: 0.5rem;
    display: block;
}

/* 3. Post Title (Large & Clickable) */
.post-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    transition: color 0.2s ease;
    line-height: 1.3;
}

.post-item:hover .post-title {
    color: var(--accent-color); /* Highlight title on hover */
}

/* 4. Post Excerpt (Optional short description) */
.post-excerpt {
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
    max-width: 600px;
}

/* 5. Profile / Bio Section (Left Sidebar) */
.profile-section {
    position: sticky;
    top: 4rem;
}

.profile-name {
    font-size: 1.8rem; /* Adjusted for impact */
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    
    /* This closes the gap between the two lines */
    line-height: 1.1; 
}

/* This forces 'Portfolio' to its own line */
.title-break {
    display: block;
    margin-top: 4px; /* Optional: adds a tiny bit of breathing room if needed */
}

.profile-bio {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.link-btn {
    font-size: 0.95rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid #ddd;
    padding-bottom: 2px;
    width: fit-content;
    transition: all 0.2s;
}

.link-btn:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* MOBILE FIX: Ensure sidebar shows on homepage */
@media (max-width: 1000px) {
    .homepage .sidebar {
        display: block !important; /* Force show sidebar on mobile */
        margin-bottom: 4rem;
        border-bottom: 1px solid #eee;
        padding-bottom: 2rem;
    }
    .profile-section {
        position: static; /* Remove sticky on mobile */
    }
}

/* --- HOMEPAGE PHOTO SHOWCASE --- */

/* The outer container */
.photo-showcase {
    margin-bottom: 3rem;
    position: relative;
}

/* Section label, similar to "Selected Writing" */
.showcase-label {
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--meta-color);
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

/* The scrolling area */
.showcase-scroller {
    display: flex;
    gap: 1rem; /* Space between photos */
    overflow-x: auto; /* Enables side scrolling */
    padding-bottom: 1rem; /* Breathing room at bottom */
    
    /* Optional: Snaps photos into place when scrolling stops */
    scroll-snap-type: x mandatory; 
    
    /* Hides the default scrollbar for a cleaner look */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.showcase-scroller::-webkit-scrollbar { 
    display: none; /* Chrome/Safari */
}

/* Individual photo container */
.showcase-item {
    flex: 0 0 auto; /* Don't shrink the photos */
    width: 280px;   /* Fixed width for uniformity */
    margin: 0;      /* Override default figure margin */
    scroll-snap-align: start; /* For snapping */
}

/* The images themselves */
.showcase-item img {
    width: 100%;
    height: 200px; /* Fixed height ensures neat alignment */
    object-fit: cover; /* Crops image nicely to fill the box */
    border-radius: 6px;
    border: 1px solid #eee;
    transition: transform 0.2s ease;
}

/* Subtle hover effect */
.showcase-item img:hover {
    transform: translateY(-3px);
}

/* --- SLEEK SPOTIFY STRIP --- */

.spotify-strip {
    /* Layout & Size */
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.2rem 1.5rem;
    margin-top: 5rem; /* Space from last article */
    
    /* Visuals */
    background-color: #fafafa; /* Very light grey to separate from background */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none; /* Removes default underline */
    color: var(--text-color);
    
    /* Animation */
    transition: all 0.2s ease;
}

/* 1. The Play Icon Area */
.spotify-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--meta-color);
    transition: color 0.2s ease;
}

/* 2. The Text Area */
.spotify-text {
    flex-grow: 1; /* Pushes the arrow to the far right */
}

.spotify-label {
    /* Matches your existing "Visual Notes" / date style */
    font-family: var(--font-heading);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--meta-color);
    margin-bottom: 4px;
    font-weight: 700;
}

.spotify-title {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

/* 3. The Arrow */
.spotify-arrow {
    font-size: 1.2rem;
    color: #ccc;
    transition: transform 0.2s ease, color 0.2s ease;
}

/* --- HOVER EFFECTS --- */

.spotify-strip:hover {
    background-color: #fff;
    border-color: #1DB954; /* Spotify Green Border */
    transform: translateY(-2px); /* Subtle lift */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.spotify-strip:hover .spotify-icon-container {
    color: #1DB954; /* Icon turns green */
    fill: rgba(29, 185, 84, 0.1); /* Subtle fill inside circle */
}

.spotify-strip:hover .spotify-arrow {
    color: #1DB954;
    transform: translateX(3px) translateY(-3px); /* Moves up-right */
}

/* --- MOBILE: Force Spotify Green State --- */
@media (max-width: 1000px) {
    .spotify-strip {
        /* Force the white background and green border */
        background-color: #ffffff;
        border-color: #1DB954;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }

    /* Force the icon to be green with the subtle fill */
    .spotify-strip .spotify-icon-container {
        color: #1DB954;
        fill: rgba(29, 185, 84, 0.1);
    }

    /* Force the arrow to be green */
    .spotify-strip .spotify-arrow {
        color: #1DB954;
    }
}