/* Base Styles */
body,
h1,
h2,
h3,
button {
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease-in-out;
}

body {
    line-height: 1.6;
    background-color: #f0f4f8;
    /* Softer background */
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Profile Section */
.profile-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px auto;
    padding: 30px;
    /* Increased padding */
    background: #ffffff;
    /* Changed to white */
    border-radius: 16px;
    /* Increased border radius */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    /* Softer shadow */
    max-width: 1100px;
    /* Slightly narrower */
    gap: 40px;
    /* Increased gap */
}

/* Avatar Styles */
.profile-headshot {
    width: 165px;
    /* Slightly larger */
    height: 165px;
    /* Slightly larger */
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #1e88e5;
    /* Slightly darker blue */
    box-shadow: 0 8px 20px rgba(30, 136, 229, 0.25);
    /* Softer shadow */
    flex-shrink: 0;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.profile-headshot:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 25px rgba(30, 136, 229, 0.4);
}

/* Text Section */
.profile-info {
    flex: 0 1 auto;
    min-width: 0;
    text-align: left;
}

.profile-info h1 {
    font-size: 2.6em;
    color: #1e88e5;
    /* Slightly darker blue */
    margin-bottom: 12px;
    word-break: keep-all;
    overflow-wrap: break-word;
    font-weight: 700;
    position: relative;
    padding-top: 0.7em;
    /* Space for furigana */
    line-height: 1.5;
    letter-spacing: -0.02em;
    /* Tighter letter spacing */
}

.profile-info h2 {
    font-size: 1.25em;
    color: #546e7a;
    /* More sophisticated color */
    margin-bottom: 8px;
    font-weight: 600;
}

.profile-info h3 {
    font-size: 1.05em;
    color: #455a64;
    /* Deeper color */
    font-weight: 500;
}

/* Navigation Styles */
nav {
    display: flex;
    justify-content: center;
    padding: 1.2rem;
    /* Slightly more padding */
    background: linear-gradient(90deg, #1e88e5, #1976d2);
    /* Gradient nav */
    border-radius: 0 0 18px 18px;
    /* Increased radius */
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.2);
}

nav button {
    background-color: rgba(255, 255, 255, 0.95);
    color: #1976d2;
    border: none;
    /* Removed border */
    padding: 10px 22px;
    margin: 0 12px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    /* Added button shadow */
}

nav button:hover {
    background-color: #fff;
    color: #1565c0;
    /* Darker blue on hover */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    /* Slight lift effect */
}

/* Main Content Grid */
main {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    padding: 25px;
    max-width: 100%;
    /* Change from 1100px to 100% or a larger value */
    margin: 0 auto 40px;
}

/* Section Boxes */
section {
    background: #ffffff;
    padding: 28px;
    /* More padding */
    border-radius: 14px;
    /* Softer corners */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    /* Softer shadow */
    text-align: left;
    /* Left aligned text */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-7px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

section h2 {
    font-size: 1.5em;
    color: #1976d2;
    /* More saturated blue */
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1f0fd;
    /* Subtle separator */
    text-align: center;
    /* Center section headers */
}

section p {
    color: #546e7a;
    /* Better text color */
    line-height: 1.7;
    /* Better line height */
    margin-bottom: 0.8em;
}

/* Timeline styles for work history */
.timeline-container {
    position: relative;
    margin-top: 20px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 8px;
    width: 2px;
    background: #e1f5fe;
}

.timeline-item {
    position: relative;
    padding-left: 30px;
    margin-bottom: 24px;
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1e88e5;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e1f5fe;
    z-index: 1;
}

.timeline-content {
    padding: 0 0 10px 0;
}

.job-date {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 0.9em;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.job-title {
    color: #37474f;
    font-size: 1.15em;
    margin-bottom: 8px;
    font-weight: 600;
}

.job-description {
    color: #546e7a;
    font-size: 0.95em;
    margin-bottom: 0;
}

/* Education styles */
.education-container {
    margin-top: 20px;
}

.education-item {
    display: flex;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed #e0e0e0;
}

.education-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.education-icon {
    flex: 0 0 50px;
    height: 50px;
    background-color: #e3f2fd;
    border-radius: 50%;
    margin-right: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* School-specific icons */
.buffalo-icon::after {
    content: '🦬';
    font-size: 1.3em;
}

.sophia-icon::after {
    content: '🇯🇵';
    font-size: 1.3em;
}

.education-content {
    flex: 1;
}

.edu-date {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 0.9em;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.edu-school {
    color: #37474f;
    font-size: 1.15em;
    margin-bottom: 5px;
    font-weight: 600;
}

.edu-degree {
    color: #455a64;
    font-weight: 500;
    margin-bottom: 3px;
}

.edu-location {
    color: #78909c;
    font-size: 0.9em;
    margin-bottom: 3px;
}

.edu-note {
    color: #90a4ae;
    font-size: 0.85em;
    font-style: italic;
    margin-top: 5px;
}

/* Footer styling */
footer {
    text-align: center;
    padding: 20px 0;
    color: #78909c;
    font-size: 0.9em;
    margin-top: auto;
}

/* Dark Theme */
.dark-theme {
    background-color: #121212;
    color: #f5f5f5;
}

.dark-theme .profile-container {
    background: #1e2a3a;
    /* Dark mode profile box */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.dark-theme .profile-headshot {
    border-color: #1e88e5;
    box-shadow: 0 8px 20px rgba(30, 136, 229, 0.25);
}

.dark-theme .profile-info h1 {
    color: #42a5f5;
    /* Lighter blue for dark mode */
}

.dark-theme .profile-info h2 {
    color: #b0bec5;
}

.dark-theme .profile-info h3 {
    color: #90a4ae;
}

.dark-theme nav {
    background: linear-gradient(90deg, #1a237e, #0d47a1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dark-theme nav button {
    background-color: rgba(255, 255, 255, 0.15);
    color: #e3f2fd;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.dark-theme nav button:hover {
    background-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.dark-theme section {
    background: #1e2a3a;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.dark-theme section h2 {
    color: #42a5f5;
    border-bottom: 2px solid #263238;
}

.dark-theme section p {
    color: #b0bec5;
}

.dark-theme footer {
    color: #78909c;
}

/* Dark theme for timeline */
.dark-theme .timeline-container::before {
    background: #263238;
}

.dark-theme .timeline-marker {
    background: #42a5f5;
    border: 2px solid #1e2a3a;
    box-shadow: 0 0 0 2px #263238;
}

.dark-theme .job-date,
.dark-theme .edu-date {
    background: #263238;
    color: #90caf9;
}

.dark-theme .job-title,
.dark-theme .edu-school {
    color: #eceff1;
}

.dark-theme .job-description,
.dark-theme .edu-degree {
    color: #b0bec5;
}

.dark-theme .edu-location {
    color: #78909c;
}

.dark-theme .edu-note {
    color: #607d8b;
}

.dark-theme .education-icon {
    background-color: #263238;
}

.dark-theme .education-item {
    border-bottom-color: #263238;
}

/* Ruby text styling for furigana */
ruby {
    display: inline-block;
    text-align: center;
    line-height: normal;
    margin-right: 0.2em;
    position: relative;
    vertical-align: bottom;
}

rt {
    display: block;
    font-size: 0.5em;
    line-height: 1;
    text-align: center;
    color: inherit;
    font-weight: normal;
    white-space: nowrap;
    position: absolute;
    top: -1.2em;
    left: 0;
    right: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .profile-container {
        flex-direction: column;
        text-align: center;
        padding: 40px 15px 25px;
        /* Adjusted padding */
        width: calc(100% - 40px);
        position: relative;
        margin: 20px auto;
        /* Reduced margin */
    }

    .profile-info {
        text-align: center;
        width: 100%;
        margin-top: -5px;
        /* Adjusted */
    }

    .profile-headshot {
        width: 180px;
        height: 180px;
        margin-top: -30px;
        margin-bottom: 5px;
        /* Small gap */
        z-index: 2;
        box-shadow: 0 10px 25px rgba(30, 136, 229, 0.35);
    }

    .profile-headshot:hover {
        transform: scale(1.05);
    }

    .profile-info h1 {
        font-size: 2em;
        /* Slightly larger */
        padding: 0 10px;
        margin-bottom: 10px;
    }

    .profile-info h2 {
        font-size: 1.2em;
        margin-bottom: 5px;
    }

    main {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 20px;
        padding: 20px 15px;
    }

    nav {
        padding: 1rem;
    }

    nav button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    section {
        padding: 22px;
        /* Reduced padding */
    }

    /* Mobile adjustments for work & education */
    .timeline-item {
        padding-left: 25px;
    }

    .timeline-container::before {
        left: 7px;
    }

    .timeline-marker {
        top: 4px;
        width: 14px;
        height: 14px;
    }

    .job-title,
    .edu-school {
        font-size: 1.05em;
        line-height: 1.4;
    }

    .job-date,
    .edu-date {
        font-size: 0.85em;
        padding: 3px 10px;
    }

    .job-description,
    .edu-degree,
    .edu-location {
        font-size: 0.9em;
    }

    .education-item {
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .education-icon {
        flex: 0 0 40px;
        height: 40px;
        margin-right: 12px;
    }

    .edu-note {
        font-size: 0.8em;
    }
}

/* Update to main grid layout with earlier 2x2 breakpoint */
main {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    padding: 25px;
    max-width: 100%;
    margin: 0 auto 40px;
}

/* Switch to 2x2 much earlier to prevent skinny columns */
@media (max-width: 1400px) {
    main {
        grid-template-columns: repeat(2, 1fr);
        max-width: 95%;
        gap: 25px;
    }

    section {
        padding: 28px;
    }
}

/* Small screens (tablets and phones) */
@media (max-width: 768px) {
    .profile-container {
        flex-direction: column;
        text-align: center;
        padding: 40px 15px 25px;
        width: calc(100% - 40px);
        position: relative;
        margin: 20px auto;
    }

    .profile-info {
        text-align: center;
        width: 100%;
        margin-top: -5px;
    }

    .profile-headshot {
        width: 180px;
        height: 180px;
        margin-top: -30px;
        margin-bottom: 5px;
        z-index: 2;
        box-shadow: 0 10px 25px rgba(30, 136, 229, 0.35);
    }

    .profile-headshot:hover {
        transform: scale(1.05);
    }

    .profile-info h1 {
        font-size: 2em;
        padding: 0 10px;
        margin-bottom: 10px;
    }

    .profile-info h2 {
        font-size: 1.2em;
        margin-bottom: 5px;
    }

    main {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 15px;
        max-width: 100%;
    }

    nav {
        padding: 1rem;
    }

    nav button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    section {
        padding: 22px;
    }

    /* Mobile adjustments for work & education */
    .timeline-item {
        padding-left: 25px;
    }

    .timeline-container::before {
        left: 7px;
    }

    .timeline-marker {
        top: 4px;
        width: 14px;
        height: 14px;
    }

    .job-title,
    .edu-school {
        font-size: 1.05em;
        line-height: 1.4;
    }

    .job-date,
    .edu-date {
        font-size: 0.85em;
        padding: 3px 10px;
    }

    .job-description,
    .edu-degree,
    .edu-location {
        font-size: 0.9em;
    }

    .education-item {
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .education-icon {
        flex: 0 0 40px;
        height: 40px;
        margin-right: 12px;
    }

    .edu-note {
        font-size: 0.8em;
    }
}

/* Extra small screens (smaller phones) */
@media (max-width: 480px) {
    section {
        padding: 18px;
    }

    .profile-headshot {
        width: 150px;
        height: 150px;
    }
}