/* --- Main Content Page Stylesheet --- */

/*
 * Inlined Google Fonts to break render-blocking request chain.
 * This improves LCP by allowing the browser to discover font files immediately.
*/
/* latin-ext */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/lora/v32/0QIvMX1D_JOuMwf7I-NP.woff2) format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/lora/v32/0QIvMX1D_JOuMwf7I-vP.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* ... (other font weights and styles would go here) ... */



/* 
 * 1. THEME & BASE STYLES
 * A light, editorial theme with a warm, blurred background image.
 * Typography uses a modern sans-serif for headings and a classic serif for body text.
*/
:root {
    --bg-content: rgba(253, 250, 246, 0.92); /* Softer, slightly transparent off-white */
    --border-muted: #e9ecef;
    --text-body: #5a6268;        /* Soft Greyish Black */
    --text-heading: #343a40;     /* Darker Greyish Black */
    --accent-primary: #008080;  /* Deep Teal */
    --accent-green: #28a745;
    --code-bg: #f8f9fa;
    --code-text: #343a40;
}

body {
    font-family: 'Lora', serif;
    /* Placeholder background image from unsplash.com for a warm, blurred effect */
    background-image: url('https://images.unsplash.com/photo-1554189097-90d836021d44?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--text-body);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 
 * 2. HEADER & NAVIGATION
 * A sticky header that appears on scroll, containing the logo and a "Back" button.
*/
header#main-header {
    width: 100%;
    z-index: 50;
    padding: 1rem 2rem;    
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

header#main-header.is-scrolled {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-heading);
    text-decoration: none;
}

.logo span {
    color: var(--accent-primary);
}

.back-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-body);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-muted);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.back-link:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.page-nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* Prevent wrapping on desktop */
    justify-content: flex-end; /* Align nav items to the right */
    gap: 2rem;
}

.page-nav a {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-body);
    text-decoration: none;
    transition: color 0.2s ease;
}

.page-nav a:hover {
    color: var(--accent-primary);
}
/* 
 * 3. MAIN CONTENT AREA
 * The central, scrollable container for the article content, covering ~85% of the viewport width.
*/
main.container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 4rem 2rem;
}

main article {
    background-color: var(--bg-content);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); /* For Safari */
    padding: 3rem 5rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 1100px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    main.container {
        padding: 2rem 1rem;
    }
    main article {
        padding: 2rem 1.5rem;
    }
}

/* 
 * 4. TYPOGRAPHY & CONTENT STYLING
 * Styles for headings, text, lists, tables, and code blocks.
*/
p {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
}

h1, h2, h3, h4 {
    font-family: 'Poppins', sans-serif;
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    font-size: 2.75rem;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-muted);
    padding-bottom: 0.75rem;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
}

h3 {
     font-size: 1.5rem;
     color: var(--accent-primary);
     margin-top: 2.5rem;
     margin-bottom: 1rem;
}

strong, b {
    color: var(--accent-primary);
    font-weight: 600;
}

code {
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

pre {
    background-color: var(--code-bg);
    border: 1px solid var(--border-muted);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    position: relative;
}

pre code {
    padding: 0;
    background: none;
    color: var(--text-body);
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: var(--border-muted);
    color: var(--text-body);
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    opacity: 1;
    background-color: var(--accent-primary);
    color: white;
}

.copy-btn-success {
    background-color: var(--accent-green);
    color: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

th, td {
    border: 1px solid var(--border-muted);
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background-color: var(--code-bg);
    color: var(--text-heading);
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: var(--code-bg);
}

ul, ol {
    list-style: none;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

li {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 1.5rem;
}

ul li::before {
    content: '■';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-size: 0.5rem;
    line-height: 1.7;
    top: 0.25rem;
}

ol li {
    counter-increment: item;
}

ol li::before {
    content: counter(item);
    position: absolute;
    left: -0.5rem;
    color: var(--accent-primary);
    font-size: 1rem;
    font-weight: bold;
    text-align: right;
    width: 1.25rem;
}

.work-cited li {
    word-break: break-all;
}

.hero-section {
    padding: 4rem 2rem;
    margin-bottom: 3rem;
    text-align: center;
    background-color: transparent;
    border: 1px solid var(--border-muted);
    border-radius: 8px;
    background-size: cover;
    background-position: center;
}

.hero-section h1 {
    color: var(--text-heading);
}

.hero-section p {
    color: var(--text-body);
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem; /* Reduce heading size on mobile */
    }
    .hero-section p {
        font-size: 1.1rem; /* Adjust paragraph size on mobile */
    }
}
/* 
 * 5. ANIMATIONS
 * Smooth fade-in and slide-up effect for content sections.
*/
.scroll-reveal {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.5, 0, 0, 1), transform 0.8s cubic-bezier(0.5, 0, 0, 1);
    transform: translateY(40px);
}
.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0px);
}

/* 
 * 7. MOBILE NAVIGATION
*/
.mobile-nav-toggle {
    display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
    header#main-header {
        padding: 1rem 1.5rem;
        /* Ensure header content is not pushed out */
        flex-wrap: nowrap; 
    }

    /* Revert grid for mobile to a simpler flex layout */
    .page-nav {
        position: fixed;
        inset: 0 0 0 15%; /* Make the mobile nav wider (85% of screen) */
        flex-direction: column;
        padding: min(20vh, 10rem) 2rem;
        background: rgba(253, 250, 246, 0.9); /* Use a slightly transparent version of --bg-content */
        backdrop-filter: blur(1rem);
        -webkit-backdrop-filter: blur(1rem);
        transform: translateX(100%);
        transition: transform 350ms ease-out, box-shadow 0.3s ease;
        align-items: flex-start;
        justify-content: flex-start; /* Align to top on mobile */
        gap: 1.5rem;
        z-index: 900;
    }

    .page-nav[data-visible="true"] {
        transform: translateX(0%);
    }
    .page-nav .back-link:hover {
        background: none;
    }

    .mobile-nav-toggle {
        display: block;
        position: relative;
        width: 1.5rem;
        height: 1.5rem;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1000;
        grid-column: 3 / 4; /* Place in the last grid column */
    }

    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--text-heading);
        position: absolute;
        left: 0;
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    }

    .hamburger-line:nth-child(1) { top: 2px; }
    .hamburger-line:nth-child(2) { top: 10px; }
    .hamburger-line:nth-child(3) { top: 18px; }

    .mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) { opacity: 0; }
    .mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* 
 * 6. PROJECT CARD STYLES
*/
.project-card {
    display: block;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
}

.project-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-card-content {
    padding: 1.5rem;
}

.project-card-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.project-card-desc {
    color: var(--text-body);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.project-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-card-tags span {
    background-color: var(--code-bg);
    color: var(--accent-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

/*
 * 8. BOTTOM NAVIGATION
*/
.bottom-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-muted);
}

.bottom-nav a {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-body);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-muted);
    border-radius: 8px;
    transition: all 0.3s ease;
    max-width: 48%;
}

.bottom-nav a:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.bottom-nav .nav-label {
    font-size: 0.8rem;
    opacity: 0.7;
    display: block;
}

.bottom-nav .nav-title {
    font-size: 1.1rem;
    display: block;
}

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

/* --- CONSOLIDATED STYLES --- */

/* 
 * Styles for sub-pages (articles, who-am-i, etc.)
 * Previously inline in multiple HTML files.
*/
.sub-page-body {
    background-color: #e9ecef; /* Light grey background for sub-pages */
    /* Revert flex centering to allow normal document flow and scrolling */
    display: block;
    height: auto;
    overflow-y: auto;
    padding: 0; /* Reset body padding */
}

.sub-page-body main.container {
    /* Add vertical margin and center horizontally */
    margin: 3rem auto;
    
    /* Apply visual styles to make it a distinct box */
    background-color: #F5F1EC; /* var(--bg-container) */
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem 4rem;

    /* Explicitly un-scale the container */
    transform: none !important;
}

@media (max-width: 768px) {
    .sub-page-body main.container {
        margin: 1.5rem auto;
        padding: 1.5rem;
    }
}

/* Unique style from who-am-i.html */
.welcome-note {
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    text-align: center;
}
.welcome-note p {
    margin-bottom: 0;
}

/* 
 * Styles for index.html homepage
 * Previously inline in index.html
*/
.index-body {
    font-family: 'Lora', serif;
    background-color: #f8f9fa; /* Light bluish-grey */
    color: var(--text-body);
    display: block;
    min-height: 100vh;
    overflow-y: auto;
    padding: 2rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1rem 0;
    margin-bottom: 2rem;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.site-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    color: var(--text-heading);
    margin: 0;
}

.site-header p {
    font-size: 1.1rem;
    max-width: 60ch;
    color: var(--text-body);
}

.main-nav {
    display: flex;
    gap: 1.5rem;
    z-index: 20;
}

.main-nav a {
    font-family: 'Poppins', sans-serif;
    text-decoration: none;
    color: var(--text-body);
    font-weight: 600;
    transition: color 0.2s ease;
}

.main-nav a:hover {
    color: var(--accent-primary);
}

.content-grid-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background-color: #ffffff; /* Keep content cards white for contrast */
    border-radius: 12px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-item {
    text-decoration: none;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-5px);
}

.grid-item__content {
    position: relative; /* For overlay positioning */
    background-color: var(--bg-tile);
    border: 1px solid var(--border-tile);
    border-radius: 12px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    overflow: hidden; /* To keep rounded corners on overlay */
    z-index: 1;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.grid-item:hover .grid-item__content {
    box-shadow: 0 15px 35px rgba(44, 62, 80, 0.15);
}

.grid-item__content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(44, 62, 80, 0.6); /* Dark Slate Blue overlay */
    z-index: -1;
    transition: background-color 0.3s ease;
}

.grid-item:hover .grid-item__content::before {
    background-color: rgba(0, 128, 128, 0.7); /* Teal overlay on hover */
}

.grid-item__content h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: #FFFFFF; /* Change heading to white for readability on image */
    text-shadow: 0 1px 3px rgba(0,0,0,0.4); /* Add shadow for readability */
    margin-top: 0;
    transition: color 0.3s ease;
}

@media (max-width: 768px) {
    .index-body {
        padding: 1rem;
        overflow-y: auto; /* Ensure scrolling is enabled on mobile */
    }
    .site-header {
        flex-direction: column; /* Stack header items vertically */
        gap: 1rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    .content-grid-container {
        padding: 2rem 1rem;
    }
    .content-grid {
        /* Switch to a single column on mobile for better readability */
        grid-template-columns: 1fr;
    }
    .grid-item__content {
        height: 180px;
    }
}

/* Styles for the horizontal 'Who Am I' item */
.horizontal-item {
    text-decoration: none;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.horizontal-item:hover {
    transform: translateY(-5px);
}

.horizontal-item__content {
    position: relative;
    background-color: var(--bg-tile);
    border: 1px solid var(--border-tile);
    border-radius: 12px;
    height: 200px; /* Adjust height as needed */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.horizontal-item:hover .horizontal-item__content {
    box-shadow: 0 15px 35px rgba(44, 62, 80, 0.15);
}

.horizontal-item__content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(44, 62, 80, 0.6);
    z-index: -1;
    transition: background-color 0.3s ease;
}
.horizontal-item:hover .horizontal-item__content::before {
    background-color: rgba(0, 128, 128, 0.7);
}
.horizontal-item__content h3 {
    font-size: 2rem; /* Larger font for the bigger block */
}