/* Same space above the portrait as at its sides */
.about-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 3rem 3rem 2rem;
}

/* Bio */
.about-bio {
    display: grid;
    grid-template-columns: minmax(240px, 480px) minmax(0, 860px);
    gap: clamp(3rem, 6vw, 6rem);
    align-items: center;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border); /* also the line above the first dropdown */
}

.about-portrait {
    margin: 0;
    /* Stays at the top even when the bio is taller than the photo */
    align-self: start;
}

.about-portrait figcaption {
    margin-top: 0.75rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-secondary);
}

.about-portrait img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--border);
}

.bio-text {
    font-size: 1.45rem;
    line-height: 1.75;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.bio-text:last-child {
    margin-bottom: 0;
}

.cv-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin: 0 0 0.5rem;
    max-width: 760px;
}

.cv-tools {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* CV sections: dropdowns (<details>), closed until clicked */
.cv-section {
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 114px; /* clears the sticky header when linked to */
}

/* The whole row is the button, for sections and for each job in Experience */
.cv-summary,
.cv-role-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 0;
    cursor: pointer;
    list-style: none;
    color: var(--text-primary);
    transition: color 0.3s var(--transition);
}

.cv-summary::-webkit-details-marker,
.cv-role-summary::-webkit-details-marker {
    display: none;
}

.cv-summary:hover,
.cv-role-summary:hover,
.cv-role-summary:hover .cv-title {
    color: var(--accent);
}

.cv-summary:focus-visible,
.cv-role-summary:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 4px;
}

/* Thin + on the right, which becomes a – when open. Jobs get a smaller one,
   centred under the section's */
.cv-summary::after,
.cv-role-summary::after {
    --size: 13px;
    content: '';
    flex-shrink: 0;
    width: 13px;
    height: 13px;
    background:
        linear-gradient(currentColor, currentColor) center / var(--size) 1px no-repeat,
        linear-gradient(currentColor, currentColor) center / 1px var(--size) no-repeat;
}

.cv-role-summary::after {
    --size: 9px;
    position: relative;
    top: 1.5px; /* level with the middle of the title's capitals */
}

.cv-section[open] > .cv-summary::after,
.cv-role[open] > .cv-role-summary::after {
    background: linear-gradient(currentColor, currentColor) center / var(--size) 1px no-repeat;
}

.cv-label {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: inherit;
    font-weight: 400;
}

.cv-body {
    padding-bottom: 2rem;
}

.cv-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cv-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 2rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
}

/* The section's own line follows the last item */
.cv-item:last-child {
    border-bottom: none;
}

.cv-body .cv-item:first-child {
    padding-top: 0.5rem;
}

.cv-body .cv-item:last-child {
    padding-bottom: 0;
}

/* Jobs: title, place and dates show; the description opens underneath */
.cv-body .cv-item.cv-role {
    display: block;
    padding: 0;
}

.cv-role-summary {
    align-items: baseline; /* dates and + sit level with the title */
    gap: 1.25rem;
    padding: 1.25rem 0;
}

.cv-role:first-child > .cv-role-summary {
    padding-top: 0.5rem;
}

.cv-role:last-child:not([open]) > .cv-role-summary {
    padding-bottom: 0;
}

.cv-role-summary .cv-title {
    transition: color 0.3s var(--transition);
}

.cv-role-body {
    padding-bottom: 1.5rem;
}

.cv-role:last-child > .cv-role-body {
    padding-bottom: 0;
}

.cv-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cv-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.cv-org {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cv-year {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Skills */
.skills-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem 3rem;
    padding-top: 0.5rem;
}

.skill-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 0.75rem;
}

.skill-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--border);
}

.skill-list li {
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.01em;
}

.skill-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Firm work under each job (filled in by tools/build-site.mjs) */
.cv-role .cv-item-main {
    flex: 1;
    min-width: 0;
}

.cv-work {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    max-width: 960px;
}

.cv-work-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-primary);
}

.cv-work-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    margin-bottom: 0.4rem;
    transition: opacity 0.3s;
}

.cv-work-item:hover img {
    opacity: 0.85;
}

.cv-work-title {
    font-size: 0.85rem;
}

.cv-work-item:hover .cv-work-title {
    color: var(--accent);
}

.cv-work-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 900px) {
    .about-bio {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .about-portrait img {
        aspect-ratio: 4 / 5;
        object-fit: cover;
        object-position: 50% 25%;
    }

    .skills-groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .about-main {
        padding: 1.5rem 1.5rem 4rem;
    }

    .bio-text {
        font-size: 1rem;
    }

    .cv-section {
        scroll-margin-top: 90px;
    }

    .cv-summary {
        padding: 1.25rem 0;
    }

    .cv-work {
        grid-template-columns: repeat(2, 1fr);
    }
}
