/* Shared Styles for Subpages */
:root {
    --theme-lace: #FFF6E7;
    --theme-cordovan: #8C2F39;
    --theme-yellow: #FFB703;
    --theme-pink: #C84B6B;
    /* Vibrant Pink from image */
    --text-on-lace: #5D1F26;
    /* Darker Cordovan for text */
}

body {
    background-color: var(--theme-lace);
    color: var(--text-on-lace);
    overflow-x: hidden;
    position: relative;
    font-family: 'DM Sans', sans-serif;
}

/* --- Background Decorations (Floating Shapes) --- */
.bg-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-shape {
    position: absolute;
    opacity: 0.15;
    /* Subtle background */
    filter: blur(40px);
    animation: floatShape 20s infinite ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--theme-pink);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--theme-yellow);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    bottom: 50px;
    left: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: var(--theme-cordovan);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    top: 40%;
    left: 20%;
    opacity: 0.08;
    animation-delay: -10s;
}

@keyframes floatShape {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -50px) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(-5deg);
    }
}

/* Page Header */
.page-header {
    padding: 120px 20px 60px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    /* Larger title */
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--theme-cordovan), var(--theme-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 0px rgba(255, 183, 3, 0.2);
    /* Pop effect */
    position: relative;
    display: inline-block;
}

.page-subtitle {
    font-size: 1.2rem;
    color: rgba(140, 47, 57, 0.85);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Navigation */
.back-nav {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 100;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--theme-cordovan);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.5);
    /* Glass effect */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 25px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(140, 47, 57, 0.05);
}

.back-btn:hover {
    background: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(140, 47, 57, 0.15);
}

/* Tech Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px 100px;
    position: relative;
    z-index: 2;
}

.product-card {
    background: rgba(255, 255, 255, 0.4);
    /* Glassmorphism */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    /* More rounded */
    overflow: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 10px 30px rgba(140, 47, 57, 0.03);
}

.product-card:hover {
    transform: translateY(-12px);
    border-color: var(--theme-yellow);
    box-shadow: 0 20px 50px rgba(140, 47, 57, 0.12);
    background: rgba(255, 255, 255, 0.7);
}

.product-image {
    height: 220px;
    background: linear-gradient(135deg, #FFF0F3, #FFFDE7);
    /* Pink to Yellow tint */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(140, 47, 57, 0.05);
}

.product-image i {
    font-size: 5rem;
    background: linear-gradient(45deg, var(--theme-pink), var(--theme-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.8;
    transform: scale(1);
    transition: transform 0.5s ease;
}

.product-card:hover .product-image i {
    transform: scale(1.1) rotate(5deg);
}

.product-details {
    padding: 35px;
}

.product-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    margin-bottom: 15px;
    color: var(--theme-cordovan);
    font-weight: 700;
}

.product-desc {
    color: rgba(93, 31, 38, 0.8);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.specs-list {
    list-style: none;
    margin-bottom: 25px;
}

.specs-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(93, 31, 38, 0.9);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.specs-list li i {
    color: var(--theme-yellow);
    font-size: 0.8rem;
}

.view-btn {
    display: inline-block;
    color: var(--theme-cordovan);
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    position: relative;
}

.view-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--theme-yellow);
    transition: width 0.3s ease;
}

.view-btn:hover::after {
    width: 100%;
}


/* Skills Layout */
.skills-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 100px;
    position: relative;
    z-index: 2;
}

.skill-category {
    margin-bottom: 70px;
    background: rgba(255, 255, 255, 0.2);
    padding: 40px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.category-title {
    font-size: 2rem;
    margin-bottom: 35px;
    color: var(--theme-cordovan);
    text-align: center;
    position: relative;
    display: inline-block;
    width: 100%;
    border: none;
    padding: 0;
}

.category-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--theme-yellow);
    margin: 15px auto 0;
    border-radius: 2px;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
}

.tech-item {
    background: rgba(255, 255, 255, 0.5);
    padding: 25px 20px;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 10px rgba(140, 47, 57, 0.03);
    position: relative;
    overflow: hidden;
}

.tech-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 183, 3, 0.1), rgba(200, 75, 107, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tech-item:hover {
    transform: translateY(-8px);
    border-color: var(--theme-pink);
    box-shadow: 0 15px 30px rgba(140, 47, 57, 0.1);
}

.tech-item:hover::before {
    opacity: 1;
}

.tech-item i {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: var(--theme-cordovan);
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

.tech-item:hover i {
    color: var(--theme-pink);
}

.tech-item span {
    display: block;
    font-weight: 600;
    color: var(--text-on-lace);
    position: relative;
    z-index: 2;
    font-size: 0.95rem;
}

/* Responsiveness */
@media (max-width: 768px) {
    .page-title {
        font-size: 2.8rem;
    }

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

    .skill-category {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 2.2rem;
    }
}

/* --- Memories Collage (16:9 Single Screen FIXED) --- */

.memories-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    overflow: hidden;
    /* Prevent scrolling */
    background: var(--theme-lace);
    padding: 0;
}

/* Compact Header - Absolute to not take flow space */
.memories-wrapper .page-header {
    position: absolute;
    top: 2vh;
    left: 50%;
    transform: translateX(-50%);
    padding: 0;
    z-index: 10;
    width: 100%;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(255, 246, 231, 1);
}

.memories-wrapper .page-title {
    font-size: clamp(1.5rem, 4vh, 3rem);
    margin: 0;
    color: var(--theme-cordovan);
}

.memories-wrapper .page-subtitle {
    display: none;
}

.memory-collage {
    /* STRICT 16:9 Aspect Ratio */
    aspect-ratio: 16/9;

    /* Logic: Fit width OR height, whichever hits viewport edge first */
    width: 95vw;
    height: auto;
    max-height: 95vh;

    /* If screen is very wide, constrain by height */
    @media (min-aspect-ratio: 16/9) {
        height: 95vh;
        width: auto;
    }

    display: grid;
    /* 8 cols x 5 rows = 40 cells */
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: 4px;

    background: #fff;
    padding: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    box-sizing: border-box;
    margin: auto;
}

.memory-item {
    position: relative;
    overflow: hidden;
    background: #e0e0e0;
    margin: 0;
    width: 100% !important;
    /* Force fit */
    height: 100% !important;
    /* Force fit */
    min-width: 0;
    /* Crucial for Grid blowout prevention */
    min-height: 0;
}

.memory-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(100%) contrast(1.1);
    transition: all 0.3s ease;
}

.memory-item:hover {
    z-index: 100;
    overflow: visible;
    /* Allow pop out */
}

/* Pop-out effect on the IMAGE, not the container, to avoid layout shift issues if possible, 
   OR use transform on container but ensure strict z-indexing */
.memory-item:hover img {
    filter: grayscale(0%) contrast(1.05);
    transform: scale(2);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
    position: relative;
    border: 2px solid #fff;
    border-radius: 4px;
}

/* Text Blocks */
.text-block {
    grid-column: span 1;
    grid-row: span 1;
    background: var(--theme-yellow);
    color: var(--theme-cordovan);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2px;
}

.text-block h3 {
    font-size: clamp(0.6rem, 1.5vh, 1.2rem);
    line-height: 1;
    font-weight: 800;
    margin: 0;
}

.text-block .date {
    font-size: clamp(0.4rem, 1vh, 0.8rem);
}

.quote-block {
    background: var(--theme-cordovan);
    color: var(--theme-lace);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.quote-block p {
    font-size: clamp(0.5rem, 1.2vh, 1rem);
    margin: 0;
    line-height: 1.1;
}

.text-block.vertical h3 {
    font-size: clamp(1rem, 2.5vh, 2rem);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

/* --- Responsiveness --- */

@media (max-width: 768px) {
    .memories-wrapper .page-header {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin-bottom: 5px;
        height: auto;
    }

    .memory-collage {
        width: 100%;
        height: 100%;
        /* Fill screen on mobile */
        aspect-ratio: unset;
        max-height: unset;
        max-width: unset;

        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(8, 1fr);
        gap: 2px;
    }
}