/* --- BASE STYLES --- */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #000000;
    margin: 0;
    padding: 0 10px; /* Adjusted to 0 top/bottom to allow sticky header to touch top */
    line-height: 1.6;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* --- INDIC FONT STACKS (SERIF) --- */
[lang="ta"] {
    font-family: 'Noto Serif Tamil', 'Tamil MN', serif;
    font-size: 0.93em;
}

[lang="hi"], [lang="mr"] {
    font-family: 'Noto Serif Devanagari', 'Devanagari Sangam MN', 'Mangal', serif;          
}

/* Specifically for Latin characters/numbers on Indian language pages */
.latin-text {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Optional: adjust size if the sans-serif looks too large next to the serif */
    font-size: 0.95em;
}

.latin-text-in-tamil {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.02em;
}

/* LINK COLOR: #0077CC (Recommended) */
a { color: #0077CC; text-decoration: none; }
a:hover { text-decoration: underline; }

/* HEADER & RAINBOW LINES */
header {
    margin-bottom: 30px;
}

/* The Rainbow Line */
.rainbow-line {
    height: 4px;
    border: none;
    background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    margin: 15px 0;
}

/* --- NEW STICKY HEADER CONTAINER --- */
.site-header {
    /* Keeps the header pinned to the top of the browser window during scroll */
    position: -webkit-sticky; 
    position: sticky;
    top: 0;
    /* Prevents page content from showing through the header background */
    background-color: #ffffff; 
    /* Ensures the header stays visually 'above' images and bio text */
    z-index: 1000;            
    width: 100%;
    margin-bottom: 20px;
}

/* --- HEADER TOP BAR (NAME & ICON) --- */
.header-top {
    /* Uses Flexbox to align name on the left and hamburger on the right */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

/* --- BRANDING (NAME ON LEFT) --- */
.header-name {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    font-family: system-ui, -apple-system, sans-serif;
}

.header-name a {
    color: #333;
    text-decoration: none;
    font-size: 1em; /* Ensures it inherits the 1.4em from parent, without compounding */
}

/* --- HAMBURGER MENU TOGGLE --- */
/* This checkbox is hidden; it tracks if the menu is 'open' or 'closed' */
#menu-toggle {
    display: none;
}

/* Styles the 3-line symbol as a clickable button */
.menu-icon {
    font-size: 28px;
    cursor: pointer;
    user-select: none;
    padding: 5px;
}

/* --- NAVIGATION & ANCHORS --- */
[id] {
    scroll-margin-top: 80px;
}

/* --- THE PUSH-DOWN NAVIGATION LIST --- */
.main-nav {
    /* Positions the dropdown list directly underneath the top bar */
    position: absolute;
    top: 100%; 
    left: 0;
    right: 0;
    width: 100%;
    background: #ffffff;
    /* Hidden by default; only shows when toggled */
    display: none;
    border-bottom: 1px solid #eee;
    /* Adds depth to the dropdown when it overlaps page content */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
}

/* --- THE TOGGLE LOGIC --- */
/* When the hidden checkbox is checked, the menu list becomes visible */
#menu-toggle:checked ~ .main-nav {
    display: block;
}

/* --- DROPDOWN LINK STYLING --- */
.main-nav ul {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    /* Stacks the links vertically in the dropdown */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.main-nav li a {
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
    color: #0077CC; /* Consistent academic blue */
}

/* --- VISUAL DIVIDERS --- */
.rainbow-line {
    height: 4px;
    border: none;
    background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    /* Sits tightly under the name bar */
    margin: 0;
}

/* --- PROFILE SECTION (CENTERS PHOTO WHEN STACKED) --- */
.profile-container {
    display: flex;
    flex-wrap: wrap; /* Allows photo to wrap under text on narrow screens */
    justify-content: center; /* Centers items when they wrap */
    gap: 40px;
    margin-bottom: 30px;
    max-width: 85%; 
    margin-left: auto;
    margin-right: auto; 
}

.contact-info { 
    flex: 1; 
    min-width: 320px; /* Prevents address from getting too narrow */
}

.profile-photo {
    flex: 0 0 auto;
}

.profile-photo img {
    max-width: 200px;
    height: auto;
    display: block; /* Removes bottom spacing gap */
}

/* --- KEEPING YOUR EXISTING COMPACT CONTENT RULES --- */
.compact-content p {
    margin-top: 5px;
    margin-bottom: 5px;
}

.compact-content ol, .compact-content ul {
    line-height: 1.4;
    padding-left: 25px; 
    margin-top: 5px;
    margin-bottom: 5px;
}

.compact-content ol li, .compact-content ul li {
    margin-bottom: 2px;
}

/* --- KEEPING YOUR EXISTING IMAGE WRAPPING RULES --- */
.inline-photo-right {
    float: right;
    margin-left: 25px;
    margin-bottom: 15px;
    max-width: 350px;
}

.inline-photo-right img { width: 100%; height: auto; display: block; }
.inline-photo-right figcaption { font-size: 0.8em; color: #555; text-align: center; }

/* --- MOBILE RESPONSIVENESS TWEAKS --- */
@media (max-width: 600px) {
    .inline-photo-right { float: none; margin: 20px auto; max-width: 90%; }
    .profile-container { max-width: 95%; }

    /* --- RESPONSIVE TABLE STACKING --- */
    .fullwidth tr {
        display: block;
        margin-bottom: 15px; 
    }

    .fullwidth td {
        display: block;
        width: 100% !important; 
        padding: 0 5px; 
        box-sizing: border-box; 
    }

    /* Style the first cell (Date/Topic) to look like a label */
    .fullwidth td:first-child {
        color: #000;
        margin-bottom: 0;
    }
}