/* Base styles remain the same */
:root {
    --main-font: -apple-system, BlinkMacSystemFont, "Roboto", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --main-color: #222;
    --background-color: #eaebed;
    --link-color: darkblue;
    --content-width: 47rem;
    --mobile-padding: 1rem;
}

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

body {
    background-color: var(--background-color);
    color: var(--main-color);
    font-family: var(--main-font);
    font-size: 15px;
    line-height: 1.45;
    padding: 0;
    margin: 0;
}

/* Layout */
.container {
    max-width: var(--content-width);
    padding: var(--mobile-padding);
    margin: 0 auto;
    width: 100%;
}

/* Header styles */
#header {
    background-color: var(--background-color);
    padding: 50px var(--mobile-padding) 10px;
    text-align: left;
}

/* Profile image styling */
.profile-image {
    float: right;
    margin-left: 20px;
    margin-bottom: 20px;
    max-width: 240px;
    width: auto;
    height: auto;
}

/* Text elements */
h1 {
    font-size: 35px;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5em;
    margin: 0.83em 0;
    font-weight: bold;
}

p {
    margin: 1em 0;
}

/* Paper sections */
.paper-section {
    margin-bottom: 2rem;
}

details {
    margin: 1rem 0;
}

summary {
    cursor: pointer;
    padding: 0.5rem;
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    /* Adjust header for mobile */
    #header {
        padding: 20px var(--mobile-padding);
    }
    
    /* Make headshot smaller on mobile */
    .profile-image {
        float: none;
        display: block;
        margin: 0 auto 20px;
        max-width: 180px;
    }
    
    /* Adjust text size for better mobile reading */
    h1 {
        font-size: 28px;
        text-align: center;
    }
    
    /* Make the tab class more mobile-friendly */
    .tab {
        margin-left: 20px;
    }
    
    /* Adjust details/summary spacing */
    details {
        margin: 0.5rem 0;
    }
    
    summary {
        padding: 0.5rem 0;
    }
}

/* Extra small devices */
@media screen and (max-width: 480px) {
    /* Further reduce padding */
    :root {
        --mobile-padding: 0.75rem;
    }
    
    /* Stack all content vertically */
    .container {
        padding: var(--mobile-padding);
    }
    
    /* Make text more readable on very small screens */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 24px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        width: 100%;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

section.text {
    max-width: 47rem;
    margin: 0 auto;  /* This centers the content */
    padding: 0 1rem; /* This adds space on the left and right */
}

/* Also make sure the existing container class has these properties */
.container {
    max-width: 47rem;
    margin: 0 auto;
    padding: 0 1rem;
    width: auto; /* This ensures it doesn't stretch unnecessarily */
}

/* Adjust the header to match */
#header {
    background-color: #eaebed;
    padding-top: 50px;
    padding-bottom: 10px;
    width: 100%;
}

/* Make sure all content sections respect the margins */
.position-list,
.papers-list,
.policy-notes,
.discussion-papers,
.other-projects {
    margin: 0 auto;
    width: 100%;
}

/* Add a specific override for larger screens */
@media screen and (min-width: 768px) {
    .profile-image {
        width: 240px; /* Fixed width on larger screens */
    }
    
    /* Adjust container width for desktop if needed */
    .container, section.text {
        padding: 0 2rem; /* Slightly larger padding on desktop */
    }
}

/* BibTeX styling */
.bibtex-content {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    overflow-x: auto;
    white-space: pre-wrap;
    margin: 10px 0;
    max-height: 200px;
    overflow-y: auto;
}

.copy-button {
    background: #4a6fa5;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    margin-top: 5px;
}

.copy-button:hover {
    background: #3a5f95;
}

/* Make the details/summary more visually appealing */
details {
    margin: 0.5rem 0;
}

summary {
    cursor: pointer;
    padding: 0.5rem 0; /* Keep vertical padding but remove horizontal */
    background-color: transparent; /* Remove background color */
    border-radius: 0;
}

summary:hover {
    background-color: transparent; /* Remove hover background color */
    text-decoration: underline; /* Optional: add underline on hover for feedback */
}

/* Add this to your style.css file */

/* Make all containers have consistent width and alignment */
.container {
  max-width: 47rem;
  margin: 0 auto;
  padding: 0 1rem;
  width: auto;
}

/* Ensure consistent spacing between sections */
#header, section.text {
  width: 100%;
}

/* Remove any extra padding that may cause misalignment */
#header h1, #header h2, 
#header p, section.text h2 {
  padding-left: 0;
  margin-left: 0;
}

/* Make sure all content sections have consistent margins */
.position-list,
.papers-list,
.policy-notes,
.discussion-papers,
.other-projects,
.profile-header {
  margin: 0;
  width: 100%;
}

/* Ensure proper nesting of containers */
section.text .container {
  padding: 0;
}

/* Maintain mobile responsiveness */
@media screen and (min-width: 768px) {
  .container {
    padding: 0 1rem;
  }
}

/* Reset container styles to ensure consistent alignment */
.container {
  max-width: 47rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  box-sizing: border-box;
}

/* Remove any extra padding or margin that might cause misalignment */
#header .container,
section.text .container {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Force all headings to align properly */
h1, h2, h3, p {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* Make sure nested containers don't double up on padding */
section.text {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Override any responsive adjustments that might affect alignment */
@media screen and (min-width: 768px) {
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Debug outline - uncomment to see container boundaries */
/*
.container {
  border: 1px solid red;
}
#header, section.text {
  border: 1px solid blue;
}
*/

/* Reset and standardize container styles across the entire site */
.container {
  max-width: 60rem; /* Wider content area */
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
  box-sizing: border-box;
}

/* Ensure the text section container matches exactly */
section.text {
  padding: 0 !important;
  max-width: none !important; /* Remove any max-width on the section itself */
  margin: 0 !important;
}

section.text .container {
  max-width: 60rem; /* Match the header container */
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Standardize section margins and paddings */
.position-list,
.papers-list,
.policy-notes,
.discussion-papers,
.other-projects {
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
}

/* Fix heading and paragraph margin/padding to prevent misalignment */
h1, h2, h3, h4, h5, h6, p {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* Responsive adaptations */
@media screen and (max-width: 768px) {
  .container, section.text .container {
    max-width: 100%;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Debugging - uncomment to see container boundaries */
/*
.container {
  border: 1px solid red;
}
section.text {
  border: 1px solid blue;
}
section.text .container {
  border: 1px solid green;
}
*/