.portfolio {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    z-index: 10;
}

.portfolio-content {
    width: min(1200px, 70dvw);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr; /* single column layout */
    row-gap: 2rem;
    align-items: start;
    padding: 0;
    box-sizing: border-box;
}

.project-card {
    background: rgba(0,0,0,0.5);
    border: 1px solid white;
    border-radius: 12px;
    padding: 1rem;
    padding-bottom: 0.9rem; /* ensure space for the button when it's in-flow */
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow .28s cubic-bezier(.2,.9,.25,1), transform .28s cubic-bezier(.2,.9,.25,1), background .18s ease;
    overflow: visible;
    will-change: transform, box-shadow;
}

/* expanded visual state (no column spanning needed) */
.project-card.expanded {
    background: rgba(0,0,0,0.78);
}

/* details panel: smooth downward reveal using max-height */
.details-panel {
    overflow: hidden;
    width: 100%;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height .44s cubic-bezier(.22,.9,.25,1), opacity .32s ease, transform .32s ease;
    padding-top: 0;
    margin-top: 0;
}

/* visible state */
.project-card.expanded .details-panel {
    max-height: 1600px; /* large safety cap; script sets exact height for smoother animation */
    opacity: 1;
    transform: translateY(0);
    padding-top: 0.85rem;
    margin-top: 0.85rem;
}

.details-panel ul {
    margin: 0;
    padding: 1rem 4rem;
}

.summary figure{
    text-align: center;
    float: right;
    margin: 0; 
    padding: 0;
    width: min(300px, 25dvw);
    border-radius: 12px;
}

.project-gallery figure{
    text-align: center;
    float: right;
    margin: 0; 
    padding: 0;
}

.project-gallery figure img {
    border-radius: 12px;
    border: 1px solid white;
}

figcaption {
    margin: 10px 0;
    font-style: italic;
    font-size: 0.75rem;
    font-weight: 500;
}

.notebook {
    float: right;
}

.notebook a{
    margin-left: 1rem;
}

/* gallery inside details; images won't be cut off (contain) */
.project-gallery {
    display: grid;
    row-gap: 1rem;
    column-gap: 1.5rem;
    grid-template-columns: repeat(2, 1fr);
    margin: 1rem 1rem;
    align-items: start;
    transition: opacity .32s ease, transform .32s ease;
}

.project-gallery img {
    border-radius: 12px;
}

@media (min-width: 900px) {
    .project-gallery { grid-template-columns: repeat(3, 1fr); }
}

/* thumbnails avoid cropping and preserve full image */
.project-gallery .gallery-thumb {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    background: rgba(0,0,0,0.06);
}

.details-btn {
    position: static;
    align-self: flex-end;
    margin: 0.5rem 0;
    background: linear-gradient(135deg, rgba(80,160,255,0.12), rgba(40,110,255,0.16));
    border: 1px solid rgba(80,140,255,0.28);
    color: white;
    padding: .65rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    box-shadow: 0 6px 18px rgba(40,110,255,0.10), 0 2px 6px rgba(0,0,0,0.35);
    transition:
        transform .20s cubic-bezier(.2,.9,.25,1),
        box-shadow .20s ease,
        background .20s ease,
        color .12s ease;
    z-index: 30;
}

/* hover / focus styles to make it pop */
.details-btn:hover,
.details-btn:focus {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(40,110,255,0.18), 0 6px 18px rgba(0,0,0,0.45);
    background: linear-gradient(135deg, rgba(80,160,255,0.18), rgba(30,95,255,0.26));
    outline: none;
}

/* active (pressed) feedback */
.details-btn:active {
    transform: translateY(-1px) scale(.997);
    box-shadow: 0 10px 22px rgba(40,110,255,0.14);
}

/* visible focus ring for keyboard users */
.details-btn:focus-visible {
    outline: 3px solid rgba(40,110,255,0.18);
    outline-offset: 3px;
}

/* arrow styling kept but color adjusted for visibility */
.details-btn::after {
    content: '\25BC';
    display: inline-block;
    transition:
        transform .20s cubic-bezier(.2,.9,.25,1),
        box-shadow .20s ease,
        background .20s ease,
        color .12s ease;
    color: white;
}

.details-btn::after:hover,
.details-btn::after:focus {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(40,110,255,0.18), 0 6px 18px rgba(0,0,0,0.45);
    background: linear-gradient(135deg, rgba(80,160,255,0.18), rgba(30,95,255,0.26));
    outline: none;
}

.project-card.expanded .details-btn::after {
    transform: rotate(180deg);
    color: white;
}

/* responsive */
@media (max-width: 900px) {
    .details-btn {
        right: auto;
        bottom: auto;
        align-self: flex-end;
        margin-top: 0.5rem;
    }
}

