/* =========================================
   PROJECTS GRID
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 3rem;
    position: relative;
}

.project-tile {
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-tile:not(.expanding):not(.expanded):hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.project-tile img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

/* =========================================
   TILE CONTENT & ANIMATION STATES
   ========================================= */
.project-tile.expanding img,
.project-tile.collapsing img {
    margin: 0 auto;
    transition: width 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                height 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                margin 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.project-tile.expanded img {
    margin: 0 auto;
}

.tile-content {
    padding: 1.5rem 3rem;
    position: relative;
    text-align: center;
    min-height: 180px;
}

.brief {
    position: relative;
}

.brief h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.brief p {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.full {
    position: absolute;
    left: 3rem;
    right: 3rem;
    opacity: 0;
    pointer-events: none;
}

.full h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.full p {
    color: var(--text);
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto;
}

.full .paragraph-1 {
    opacity: 1;
    transition: opacity 0.8s ease;
}

.full .paragraph-2 {
    margin-top: 1.5rem;
    opacity: 0 !important;
    transition: opacity 0.8s ease;
}

.full .paragraph-2.visible {
    opacity: 1 !important;
}

.full .paragraph-3 {
    margin-top: 1.5rem;
	margin-bottom: 2rem;
    opacity: 0 !important;
    transition: opacity 1s ease;
}

.full .paragraph-3.visible {
    opacity: 1 !important;
}

.project-tile.expanding .brief,
.project-tile.collapsing .brief,
.project-tile.expanded .brief {
    display: none;
}

.project-tile.expanding .full,
.project-tile.collapsing .full,
.project-tile.expanded .full {
    opacity: 1;
    pointer-events: auto;
}

.project-tile:not(.expanding):not(.expanded):not(.collapsing) .full {
    display: none;
}

.project-tile.expanding .full .paragraph-1,
.project-tile.expanded .full .paragraph-1 {
    opacity: 1;
}

.project-tile.collapsing .full .paragraph-1 {
    opacity: 0;
}

.project-tile.expanding,
.project-tile.collapsing,
.project-tile.expanded {
    position: fixed;
    z-index: 10000;
    margin: 0;
    overflow-y: auto;
}

.project-tile.collapsing {
    overflow: hidden !important;
}

.project-tile.expanding,
.project-tile.collapsing {
    transition: top 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                left 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                width 0.8s cubic-bezier(0.4, 0.0, 0.2, 1),
                height 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.project-tile.expanded {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

body.tile-expanded {
    overflow: hidden;
}

.project-tile.expanded .tile-content {
    padding-bottom: 4rem;
}

/* =========================================
   CLOSE BUTTON
   ========================================= */
.close-btn {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    z-index: 10001;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    padding: 0;
}

.close-btn svg {
    width: 100%;
    height: 100%;
}

.close-btn .close-circle {
    stroke: #2c5f7d;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    transform-origin: center;
}

.project-tile.expanded .close-btn .close-circle {
    stroke-dashoffset: 0;
}

.close-btn .close-x {
    stroke: #2c5f7d;
    stroke-width: 2;
    fill: none;
    opacity: 1;
    transform-origin: center;
    transition: transform 0.3s ease;
}

.project-tile:not(.expanded) .close-btn .close-x {
    opacity: 0;
}

.project-tile.expanding .close-btn,
.project-tile.expanded .close-btn {
    opacity: 1;
    visibility: visible;
}

.project-tile.expanded .close-btn .close-circle {
    animation: drawCircle 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

.project-tile.expanded .close-btn .close-x {
    animation: rotateAroundCircle 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

@keyframes drawCircle {
    from { stroke-dashoffset: 157; }
    to { stroke-dashoffset: 0; }
}

@keyframes rotateAroundCircle {
    0% { opacity: 0; transform: rotate(0deg); }
    10% { opacity: 1; }
    100% { opacity: 1; transform: rotate(360deg); }
}

.close-btn:hover .close-circle {
    stroke: #c0392b;
    stroke-width: 3;
}

.close-btn:hover .close-x {
    stroke: #c0392b;
    stroke-width: 3;
    transform: rotate(360deg) scale(1.1);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 767px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .tile-content {
        padding: 1.5rem 2rem;
    }
    
    .full {
        left: 2rem;
        right: 2rem;
    }
}