/* Instagram Section Styles - Iteration 5 (Narrower & Clean Logo) */
.instagram-section {
    padding: 3rem 1rem;
    /* Significantly reduced from 8rem 2rem */
    background-color: #f5f4f2;
    text-align: center;
    overflow: hidden;
    color: #313b41;
    position: relative;
}

/* Container */
.insta-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Area */
.insta-header {
    margin-bottom: 2rem;
    /* Reduced from 4rem */
    position: relative;
    padding: 0 1rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Noble Instagram Logo (Feather Icon Style) */
.insta-logo-svg {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
    fill: none;
    /* No fill for stroke icon */
    stroke: #313b41;
    /* Stroke color */
    stroke-width: 1.5;
    /* Fine stroke */
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.8;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.insta-logo-svg:hover {
    transform: scale(1.1);
    opacity: 1;
}

/* Styling the link wrapping the logo */
.insta-header a:not([class]) {
    display: block;
    margin-top: 1rem;
    /* Reduced space */
    line-height: 0;
    text-decoration: none;
    border-bottom: none;
}

/* Solid Uppercase Title (Like "PORTFOLIO") */
.insta-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.5rem, 8vw, 5rem);
    /* Slightly smaller max size */
    font-weight: 300;
    color: #313b41;
    -webkit-text-stroke: 0;
    opacity: 1;
    margin: 0;
    line-height: 1;
    letter-spacing: 5px;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Fine Line under Title */
.insta-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 1px;
    background-color: #313b41;
    opacity: 0.3;
}

/* Handle below */
.insta-handle {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    /* Slightly smaller */
    color: #8b8b7a;
    text-decoration: none;
    display: inline-block;
    letter-spacing: 2px;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 1rem;
    /* Reduced from 1.5rem */
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

.insta-handle:hover {
    color: #313b41;
}

/* Subtitle */
.insta-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    color: #8b8b7a;
    margin-top: 0.3rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* Grid with Frame Effect */
.insta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 800px;
    /* Reduced from 1000px for "narrower" look */
    margin: 2rem auto 0;
    /* Reduced top margin */
    align-items: center;
    position: relative;
    z-index: 5;
}

/* Fine Frame */
.insta-grid::before {
    content: '';
    position: absolute;
    top: -15px;
    /* Tighter frame */
    left: -15px;
    right: -15px;
    bottom: -15px;
    border: 1px solid rgba(49, 59, 65, 0.15);
    pointer-events: none;
    z-index: -1;
}

.insta-item {
    aspect-ratio: 1/1;
    overflow: hidden;
    position: relative;
}

.insta-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
    display: block;
    filter: grayscale(10%);
}

.insta-item:hover img {
    transform: scale(1.05);
    filter: grayscale(0%);
}

@media (max-width: 768px) {
    .insta-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 items side by side */
        gap: 0.8rem;
        margin-top: 2rem;
        max-width: 100%;
        /* Take full width available */
        padding: 0 0.5rem;
        /* give space for offset borders */
    }

    .insta-title {
        font-size: 2.2rem;
        /* smaller title for mobile */
        letter-spacing: 3px;
    }

    .insta-grid::before {
        display: none;
        /* remove the big bounding box */
    }

    .insta-item {
        overflow: visible;
        /* Need this to show the offset border */
    }

    /* Add the thin offset border behind each image on mobile */
    .insta-item::before {
        content: '';
        position: absolute;
        top: 4px;
        left: 4px;
        width: 100%;
        height: 100%;
        border: 1px solid rgba(49, 59, 65, 0.4);
        z-index: -1;
        /* Behind image */
        pointer-events: none;
    }

    .instagram-section {
        padding: 2.5rem 1rem;
    }
}