/* ===================================
   ENHANCED MEDIEVAL SCROLL DESIGN - AUTHENTIC PARCHMENT
   =================================== */

/* Medieval fonts imported in main styles.css */

/* Project Container */
.projects-grid {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Enhanced Medieval Parchment Scroll */
.dev-project {
    position: relative;
    background:
        /* Stronger parchment texture with more contrast */
        linear-gradient(45deg,
            #f8f0d8 0%, #f4e4bc 15%, #f9f1e4 35%,
            #f2e2b8 50%, #f4e4bc 65%, #f9f1e4 85%, #f8f0d8 100%),
        /* Enhanced parchment texture pattern */
        radial-gradient(circle at 20% 30%, rgba(139,69,19,0.12) 1px, transparent 2px),
        radial-gradient(circle at 70% 60%, rgba(160,82,45,0.08) 1px, transparent 2px),
        radial-gradient(circle at 40% 80%, rgba(139,69,19,0.06) 1.2px, transparent 2px),
        /* Age spots and texture */
        radial-gradient(ellipse at 15% 20%, rgba(139,69,19,0.04) 8px, transparent 12px),
        radial-gradient(ellipse at 85% 70%, rgba(160,82,45,0.03) 6px, transparent 10px),
        radial-gradient(ellipse at 60% 40%, rgba(139,69,19,0.02) 10px, transparent 15px);

    border: 4px solid #8b4513;
    border-radius: 25px;
    padding: 40px;
    margin: 0 auto 60px auto;
    width: fit-content;
    max-width: 95%;
    box-sizing: border-box;

    /* Enhanced scroll shadow effects - stronger rolled edges */
    box-shadow:
        /* Deep inset shadows at top/bottom for rolled edges */
        inset 0 15px 25px -8px rgba(139,69,19,0.25),
        inset 0 -15px 25px -8px rgba(139,69,19,0.25),
        /* Side rolled shadows */
        inset 8px 0 15px -8px rgba(139,69,19,0.15),
        inset -8px 0 15px -8px rgba(139,69,19,0.15),
        /* External drop shadow */
        0 15px 35px rgba(0,0,0,0.25),
        0 5px 15px rgba(139,69,19,0.2);

    /* Aged parchment edges using clip-path */
    clip-path: polygon(
        2% 0%, 98% 1%, 99% 15%,
        100% 30%, 98% 45%, 100% 60%,
        99% 75%, 98% 88%, 100% 100%,
        85% 99%, 70% 100%, 55% 98%,
        40% 100%, 25% 99%, 10% 100%,
        0% 85%, 1% 70%, 0% 55%,
        2% 40%, 0% 25%, 1% 10%
    );

    /* Unfurling perspective effect */
    transform: perspective(1200px) rotateX(2deg) rotateY(0deg);
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    cursor: pointer;
    overflow: visible;
}

/* Unfurling hover animation */
.dev-project:hover {
    transform: perspective(1200px) rotateX(0deg) rotateY(0deg) scale(1.02);
    box-shadow:
        /* Enhanced rolled edges on hover */
        inset 0 20px 30px -10px rgba(139,69,19,0.3),
        inset 0 -20px 30px -10px rgba(139,69,19,0.3),
        inset 12px 0 20px -10px rgba(139,69,19,0.2),
        inset -12px 0 20px -10px rgba(139,69,19,0.2),
        /* Stronger drop shadow when unfurling */
        0 25px 50px rgba(0,0,0,0.3),
        0 10px 25px rgba(139,69,19,0.25);
}

/* Enhanced 3D Wooden Dowels */
.dev-project::before,
.dev-project::after {
    content: '';
    position: absolute;
    left: 30px;
    right: 30px;
    height: 20px;
    z-index: 3;
    border-radius: 10px;

    /* Enhanced wood grain gradient */
    background:
        /* Wood grain lines */
        linear-gradient(90deg,
            transparent 0%, rgba(101,67,33,0.3) 2%, transparent 4%,
            transparent 8%, rgba(101,67,33,0.2) 12%, transparent 16%,
            transparent 25%, rgba(101,67,33,0.4) 28%, transparent 32%,
            transparent 45%, rgba(101,67,33,0.3) 48%, transparent 52%,
            transparent 65%, rgba(101,67,33,0.2) 68%, transparent 72%,
            transparent 85%, rgba(101,67,33,0.3) 88%, transparent 92%),
        /* Base wood gradient */
        linear-gradient(90deg,
            #654321 0%, #8b4513 15%, #a0522d 30%,
            #cd853f 50%, #a0522d 70%, #8b4513 85%, #654321 100%);

    /* Strong 3D shadows */
    box-shadow:
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.2),
        inset 0 -2px 0 rgba(0,0,0,0.2),
        0 0 0 1px rgba(139,69,19,0.3);
}

.dev-project::before {
    top: -10px;
    /* Slightly angled for more realism */
    transform: rotate(-0.5deg);
}

.dev-project::after {
    bottom: -10px;
    transform: rotate(0.5deg);
}

/* Scroll Content Container */
.scroll-content {
    position: relative;
    z-index: 2;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Project Layout */
.project-main {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    margin-bottom: 25px;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Screenshot with parchment frame */
.project-screenshot {
    width: 100%;
    height: 180px;
    border: 4px solid #8b4513;
    border-radius: 12px;
    overflow: hidden;
    cursor: zoom-in;
    position: relative;

    /* Parchment frame shadow */
    box-shadow:
        inset 0 0 10px rgba(139,69,19,0.3),
        0 4px 8px rgba(0,0,0,0.2);
}

.project-screenshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-screenshot:hover img {
    transform: scale(1.08);
}

/* Typography with medieval styling */
.project-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #2d1810;
    margin: 0 0 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 1px 1px 2px rgba(139,69,19,0.2);
}

.project-tagline {
    font-family: 'Crimson Text', serif;
    font-size: 1.2rem;
    color: #5d4037;
    font-style: italic;
    margin: 0 0 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

/* Tech Stack Preview */
.tech-stack-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.stack-label {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: #8b4513;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Enhanced Tech Badges */
.tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.tech-badge {
    background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
    color: #2d1810;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    border: 2px solid #b8941f;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(139,69,19,0.2);
    transition: all 0.3s ease;
}

.tech-badge:hover {
    background: linear-gradient(135deg, #ffd700 0%, #d4af37 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(139,69,19,0.3);
}

/* Project Actions */
.project-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* Enhanced Medieval Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cinzel', serif;
    border: 2px solid transparent;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, #2d5016 0%, #3d6b1f 100%);
    color: #f4e4bc;
    border-color: #2d5016;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #1f3610 0%, #2d5016 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(45,80,22,0.3);
}

/* ENHANCED Technical Details Button - NOW CLEARLY VISIBLE */
.project-toggle {
    background: linear-gradient(135deg, #f4e4bc 0%, #f9f1e4 100%);
    color: #2d1810;
    border: 3px solid #8b4513;
    font-weight: 700;
    position: relative;
    overflow: hidden;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.5);
    box-shadow:
        0 4px 8px rgba(139,69,19,0.2),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

.project-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.4), transparent);
    transition: left 0.6s ease;
}

.project-toggle:hover {
    background: linear-gradient(135deg, #d4af37 0%, #f4e4bc 100%);
    color: #2d1810;
    transform: translateY(-2px);
    box-shadow:
        0 6px 15px rgba(139,69,19,0.3),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

.project-toggle:hover::before {
    left: 100%;
}

.toggle-arrow-btn {
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: 6px;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Arrow rotation when expanded */
.dev-project.expanded .toggle-arrow-btn {
    transform: rotate(180deg);
}

/* Enhanced visual feedback for expanded state */
.dev-project.expanded .project-toggle {
    background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
    color: #2d1810;
    border-color: #8b4513;
    box-shadow:
        0 2px 4px rgba(139,69,19,0.4),
        inset 0 2px 4px rgba(0,0,0,0.1);
}

.dev-project.expanded .toggle-text::after {
    content: ' (Click to collapse)';
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 400;
}

/* CONTINUOUS SCROLL EFFECT - Expanded Details */
.project-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    margin-top: 0;
    padding-top: 0;
    position: relative;
}

.project-details.project-details-open {
    max-height: none;
    opacity: 1;
    overflow: visible;
    margin-top: 35px;
    padding: 35px 40px 40px;

    /* Continue the parchment background */
    background: inherit;

    /* Stronger separation line */
    border-top: 4px solid #8b4513;

    /* Continue the aged edges effect */
    clip-path: polygon(
        0% 0%, 100% 2%, 99% 15%,
        100% 30%, 98% 45%, 100% 60%,
        99% 75%, 98% 88%, 100% 100%,
        85% 99%, 70% 100%, 55% 98%,
        40% 100%, 25% 99%, 10% 100%,
        0% 85%, 1% 70%, 0% 55%,
        2% 40%, 0% 25%, 1% 10%
    );
}

/* Enhanced section divider */
.project-details.project-details-open::before {
    content: '↓ Technical Details Unfurled ↓';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f4e4bc 0%, #f9f1e4 100%);
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: #2d1810;
    border: 3px solid #8b4513;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(139,69,19,0.2);
}

/* Add bottom wooden dowel for expanded content */
.project-details.project-details-open::after {
    content: '';
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: -15px;
    height: 18px;
    z-index: 3;
    border-radius: 9px;

    /* Same enhanced wood grain as top dowels */
    background:
        linear-gradient(90deg,
            transparent 0%, rgba(101,67,33,0.3) 2%, transparent 4%,
            transparent 8%, rgba(101,67,33,0.2) 12%, transparent 16%,
            transparent 25%, rgba(101,67,33,0.4) 28%, transparent 32%,
            transparent 45%, rgba(101,67,33,0.3) 48%, transparent 52%,
            transparent 65%, rgba(101,67,33,0.2) 68%, transparent 72%,
            transparent 85%, rgba(101,67,33,0.3) 88%, transparent 92%),
        linear-gradient(90deg,
            #654321 0%, #8b4513 15%, #a0522d 30%,
            #cd853f 50%, #a0522d 70%, #8b4513 85%, #654321 100%);

    box-shadow:
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.2),
        inset 0 -2px 0 rgba(0,0,0,0.2);

    transform: rotate(-0.3deg);
}

/* Technical Content Sections */
.tech-sections {
    max-width: 100%;
    overflow-x: hidden;
    display: grid;
    gap: 30px;
    box-sizing: border-box;
    width: 100%;
}

.tech-section {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    border: 2px solid rgba(139,69,19,0.2);
}

.tech-section h4 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: #2d1810;
    margin: 0 0 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    text-shadow: 1px 1px 2px rgba(139,69,19,0.1);
}

.tech-content {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #3d2817;
    /* Enhanced text wrapping without hyphens */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    white-space: normal;
}

.tech-content p,
.tech-content li,
.tech-content div,
.tech-content span {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
    white-space: normal;
}

.tech-content ul,
.tech-content ol {
    padding-left: 25px;
    max-width: 100%;
    margin: 15px 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

.tech-content strong {
    color: #8b4513;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Force break on long words/URLs without hyphens */
.tech-content * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .projects-grid {
        padding: 0 15px;
    }

    .dev-project {
        padding: 25px;
        margin-bottom: 40px;
        /* Remove 3D effects on mobile for better performance */
        transform: none;
        max-width: 100%;
    }

    .dev-project:hover {
        transform: scale(1.01);
    }

    .dev-project::before,
    .dev-project::after {
        left: 20px;
        right: 20px;
        height: 16px;
        border-radius: 8px;
    }

    .dev-project::before { top: -8px; }
    .dev-project::after { bottom: -8px; }

    .project-main {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }

    .project-screenshot {
        max-width: 100%;
        height: 180px;
        margin: 0 auto;
    }

    .project-title {
        font-size: 1.6rem;
    }

    .project-tagline {
        font-size: 1.1rem;
    }

    .tech-stack-preview {
        justify-content: center;
    }

    .tech-badges {
        justify-content: center;
    }

    .project-actions {
        justify-content: center;
        flex-direction: column;
        gap: 12px;
    }

    .btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .project-toggle {
        font-size: 0.95rem;
        padding: 12px 20px;
        order: -1; /* Put technical details button first on mobile */
    }

    .tech-section h4 {
        font-size: 1.3rem;
        text-align: left;
    }

    .tech-content {
        font-size: 1rem;
        text-align: left;
        /* Enhanced mobile text wrapping */
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: calc(100vw - 80px);
    }

    .tech-content ul {
        padding-left: 20px;
        max-width: calc(100vw - 100px);
    }

    .tech-content p,
    .tech-content li,
    .tech-content div {
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    .dev-project.expanded .toggle-text::after {
        content: ' (Tap to collapse)';
        font-size: 0.75rem;
    }

    .project-details.project-details-open {
        padding: 25px;
    }

    .project-details.project-details-open::after {
        left: 20px;
        right: 20px;
        bottom: -12px;
        height: 14px;
    }
}

/* Smaller mobile screens */
@media (max-width: 480px) {
    .projects-grid {
        padding: 0 10px;
    }

    .dev-project {
        padding: 20px;
        margin-bottom: 35px;
    }

    .dev-project::before,
    .dev-project::after {
        left: 15px;
        right: 15px;
        height: 14px;
        border-radius: 7px;
    }

    .dev-project::before { top: -7px; }
    .dev-project::after { bottom: -7px; }

    .project-title {
        font-size: 1.4rem;
    }

    .project-tagline {
        font-size: 1rem;
    }

    .project-screenshot {
        height: 160px;
    }

    .tech-badge {
        font-size: 0.8rem;
        padding: 5px 12px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .project-toggle {
        font-size: 0.85rem;
        padding: 10px 16px;
    }

    .tech-content {
        font-size: 0.95rem;
        max-width: calc(100vw - 60px);
    }

    .tech-content ul {
        padding-left: 18px;
        max-width: calc(100vw - 75px);
    }

    .tech-content p,
    .tech-content li,
    .tech-content div,
    .tech-content strong {
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }

    .dev-project.expanded .toggle-text::after {
        content: '';
    }

    .project-details.project-details-open::before {
        font-size: 0.8rem;
        padding: 4px 12px;
        top: -12px;
    }

    .project-details.project-details-open::after {
        left: 15px;
        right: 15px;
        bottom: -10px;
        height: 12px;
    }

    .project-details.project-details-open {
        padding: 20px;
    }
}