/* Google Fonts: Roboto */

body {
    font-family: 'Roboto', Arial, sans-serif;
    background: #f6f8fa;
    margin: 0;
    color: #222831;
}

/* Main grid wrapper for header and main */
body {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

header {
    display: grid;
    grid-template-rows: 1fr auto;
    width: 100%;
    height: 300px;
    background: url('/img/header_tall.png') center/cover no-repeat;
    transition: height .35s, background-image .35s;
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
}

header.scrolled {
    height: 65px;
    background: url('/img/header_short.png') center/cover no-repeat;
}

.header-spacer {
    height: 320px;
    transition: height .35s;
}

.header-spacer.scrolled {
    height: 100px;
}

/* Nav grid */
nav {
    display: grid;
    grid-template-columns: 1fr minmax(0, 80%) 1fr;
    align-items: end;
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 0;
}

nav ul {
    grid-column: 2;
    display: grid;
    grid-auto-flow: column;
    gap: 0.5rem;
    list-style: none;
    background: rgba(34, 40, 49, 0.93);
    border-radius: 12px 12px 0 0;
    padding: 0 0.5rem;
    margin: 0;
    justify-content: center;
}

nav li {
    height: 100%;
    display: flex;
}

nav ul {
    grid-column: 2;
    display: grid;
    grid-auto-flow: column;
    gap: 0.1rem;
    /* Much less space */
    list-style: none;
    background: rgba(34, 40, 49, 0.93);
    padding: 0 0.3rem;
    /* Less side space */
    margin: 0;
    justify-content: center;
}

nav a {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    color: #fff;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 12px;
    font-weight: 500;
}

/* Selected (active) nav item: grey background, no border */
nav a.active,
nav a:active {
    background: #b0b0b0;
    /* Or #888 for a slightly darker grey */
    color: #222831;
    border: none;
}

/* Optional: For hover state to keep highlight, but not same as active */
nav a:hover:not(.active) {
    background: #8a8a8a;
    color: #1a1a1a;
}

/* Main content grid */
main {
    width: 80%;
    margin: 0 auto;
    display: grid;
    gap: 40px;
}

/* Sections grid */
section {
    /* display: grid;
    grid-auto-rows: min-content; */
    display: block;
    min-height: 500px;
    scroll-margin-top: 120px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
    align-items: start;
    background: #fff;
    padding: 0 20px 20px 20px;
}

section h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: #222831;
    font-weight: 700;
}

.smaller_font {   
    font-size: 0.7rem;
    color: #444a57;
    font-weight: 400;
    line-height: 1.0rem;
}
.medium_font {   
    font-size: 0.9rem;
    color: #444a57;
    font-weight: 400;
    line-height: 1.0rem;
}

h4 { 
    font-size: 1.0rem;
    margin: 0;
    color: #193e77;
    font-weight: 500;
}

.button-ctr {
    background-color: #b0b0b0;
    border: none;
    color: #222831;
    padding: 10px 20px;
    font-size: 12px;
    text-align: center;
    align-content: center;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.button-ctr:hover {
    background-color: #888888;
    color: #ffffff;
}
.button-lft {
    background-color: #b0b0b0;
    width: 20%;
    border: none;
    color: #222831;
    padding: 10px 20px;
    font-size: 12px;
    text-align: centre;
    align-content: left;
    text-decoration: none;
    display:grid;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

.button-lft:hover {
    background-color: #888888;
    color: #ffffff;
}

/* Layout the experience cards */
.experience-entries {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 30px;
}

@media (min-width: 700px) {
    .experience-entries {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1100px) {
    .experience-entries {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Card style for each experience */
.experience-entries {
    display: grid;
    grid-template-columns: 1fr;
    /* always ONE COLUMN */
    gap: 10px;
    margin-top: 18px;
}

.experience-entry {
    background: #f2f4f8;
    border-radius: 8px;
    box-shadow: 0 1px 5px rgba(34, 40, 49, 0.09);
    border: 1px solid #e3e8ef;
    transition: box-shadow 0.2s;
    overflow:scroll;
    position: relative;
}

.experience-header {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 14px 12px 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.experience-header h3 {
    margin: 0 0 0 0;
    font-size: 0.8rem;
    color: #222831;
    font-weight: 700;
}

.experience-role {
    font-size: 0.8rem;
    color: #444a57;
    font-weight: 400;
    margin-left: 12px;
}

.arrow {
    margin-left: auto;
    font-size: 1.1rem;
    color: #b0b0b0;
    transition: transform 0.34s cubic-bezier(.4, 2, .6, 1);
}

/* Collapsible section */
.experience-details {
    font-size: 0.7rem;
    max-height:0;
    overflow: scroll;
    opacity: 0;
    padding: 0 12px;
    transition:
        max-height 0.4s cubic-bezier(.4, 2, .6, 1),
        opacity 0.25s ease;
    background: none;
}

.sub_workplace {
    font-size: 0.7rem;
    color: #28488f;
    font-weight: 700;
}

.experience-entry.open .experience-details {
    max-height: 500px;
    opacity: 1;
    padding-bottom: 12px;
    background: none;
    transition:
        max-height 0.45s cubic-bezier(.4, 2, .6, 1),
        opacity 0.28s ease;
}

.experience-entry.open .arrow {
    transform: rotate(180deg);
    color: #0a1e42;
}

.experience-entry.open {
    box-shadow: 0 6px 20px rgba(34, 40, 49, 0.17);
    z-index: 4;
}

/* Make main and nav responsive */
@media (max-width: 1000px) {
    main {
        width: 96%;
        gap: 28px;
    }

    nav ul {
        font-size: 0.97rem;
    }
}

/* Nav switches to vertical, gap/padding remain compact for nav items here */
@media (max-width: 900px) {
    nav ul {
        grid-auto-flow: row;
        gap: 0;
    }

    nav a {
        padding: 7px 7px;
        /* Make even more compact for smaller screens */
        font-size: 12px;
    }
}

@media (max-width: 700px) {

    .header-spacer,
    .header-spacer.scrolled {
        height: 90px;
    }

    header,
    header.scrolled {
        height: 90px;
    }

    section {
        padding: 36px 0 12px 0;
        font-size: 1rem;
    }

    nav a {
        font-size: 12px;
        padding: 7px 7px;
    }
}