* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Melodrama', serif;
    color: #222;
    background: #d5d1d9cf;
    line-height: 1.6;
}

/* ---------- Navigation ---------- */

nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #d5d1d9cf;
    border-bottom: 1px solid #ddd;
    padding: 18px 0;
}

.nav-links {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
}

nav a {
    color: #555;
    text-decoration: none;
    font-size: 15px;
}

nav a:hover {
    color: #315A78;
}

/* ---------- Layout ---------- */

section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 40px;
}

footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 50px 40px;
    border-top: 1px solid #ddd;
    color: #666;
}

/* ---------- Hero ---------- */

.hero {
    display: flex;
    align-items: center;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    width: 100%;
}

.hero-text {
    flex: 1;
}

.hero h1 {
    font-size: 41px;
    line-height: 1.1;
    margin: 0 0 24px;
    font-weight: 600;
}

.hero p {
    max-width: 700px;
    font-size: 19px;
    color: #555;
}

.hero-photo {
    flex-shrink: 0;
}

.hero-photo img {
    width: 220px;
    height: 220px;
    object-fit: cover;
    object-position: center 40%;
    border-radius: 50%;
}

/* ---------- Typography ---------- */

h2 {
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 10px;
}

h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.tag {
    color: #315A78;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ---------- Academic ---------- */

.academic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 5px;
    margin-top: 9px;
}

.academic-card {
    padding: 13px;
    border: 1px solid #d8dce0;
    border-radius: 8px;
    background: #f1f3f5;
}

.academic-card h3 {
    margin: 10px 0 8px;
    font-size: 21px;
}

.academic-card p {
    color: #555;
    margin: 0;
}

.academic-main {
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.academic-main h3 {
    font-size: 25px;
    font-weight: 700;
    line-height: 1.2;
}

.academic-main p {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* ---------- Horizontal card rows ---------- */

.horizontal-scroll {
    display: flex;
    flex-direction: row;       /* explicit: cards side by side */
    flex-wrap: nowrap;         /* explicit: never wrap to a new line */
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 15px;
    scrollbar-width: thin;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: #c9cdd1;
}

.experience-card,
.project-card {
    flex: 0 0 360px;
    min-height: 250px;
    padding: 30px;
    border: 1px solid #d8dce0;
    border-radius: 8px;
    background: #f1f3f5;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.experience-card:hover,
.experience-card:focus-visible {
    background: #d0c2d3;          /* soft blue tint to match your #315A78 accent */
    border-color: #e3cbe0;
    transform: translateY(-3px);  /* small lift; delete this line if you don't want it */
}

.experience-card {
    cursor: pointer;
}

.experience-card .tag {
    display: block;            /* role on its own line */
}

.experience-card h3 {
    margin: 6px 0 4px;         /* company line, tight under the role */
}

.project-card h3 {
    margin: 14px 0 8px;
    font-size: 21px;
}

.experience-card p,
.project-card p {
    color: #555;
    margin: 0;
}

.card-date {
    display: block;
    font-size: 14px;
    color: #888;
    margin-bottom: 14px;
}

.card-summary {
    font-size: 15px;
    color: #555;
    margin: 0;
}

/* ---------- About me ---------- */

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #d5d1d9cf;
    border: 1px solid #d5d1d9cf;
    border-radius: 10px;
    overflow: hidden;
}

.about-item {
    background: #d5d1d9cf;
    padding: 32px;
    min-height: 180px;
}

.about-item h3 {
    margin: 0 0 10px;
    font-size: 20px;
}

.about-item p {
    color: #555;
    max-width: 500px;
    margin: 0;
}

/* ---------- Pop-up ---------- */

dialog {
    border: 1px solid #dededb;
    border-radius: 8px;
    padding: 22px 40px 40px;
    max-width: 640px;
    width: calc(100% - 40px);
    max-height: 85vh;
    overflow-y: auto;
    margin: auto;
    color: #222;
    font-family: inherit;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.45);
}

dialog h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #888;
    margin: 22px 0 6px;
}

dialog p {
    color: #555;
}

dialog ul {
    padding-left: 20px;
    color: #555;
}

dialog li {
    margin-bottom: 8px;
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #888;
    cursor: pointer;
}

.dialog-close:hover {
    color: #111;
}

#exp-title {
    text-align: center;
    font-size: 1.4rem;
    line-height: 1.3;          /* was 1: wrapped titles were cramped */
    margin: 0 30px 20px;
}

.skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-chips span {
    padding: 6px 14px;
    font-size: 14px;
    color: #315A78;
    background: #fff;
    border: 1px solid #d8dce0;
    border-radius: 999px;
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
    nav {
        padding: 20px;
    }

    nav a {
        margin-left: 12px;
    }

    section {
        padding: 60px 20px;
    }

    .hero-content {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .hero h1 {
        font-size: 40px;
    }

    .hero-photo img {
        width: 180px;
        height: 180px;         /* was 220px: made the photo an oval */
    }

    .academic-grid {
        grid-template-columns: 1fr;
    }

    .academic-main {
        grid-row: auto;
    }

    dialog {
        padding: 22px 24px 30px;
    }
}