/* =========================================
   1. GLOBAL RESET & TYPOGRAPHY
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Moderustic", sans-serif;
    font-weight: 400;
    line-height: 1.6;
    color: #333;
    background: #d9e1e5;
}

/* =========================================
   2. SHARED LAYOUT UTILITIES
   ========================================= */
h1, h2, h3, h4 {
    color: #2d3748;
}

p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    color: #4a5568;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* =========================================
   3. CASE STUDY LAYOUT (.page)
   ========================================= */
.page {
    width: 100%;
    max-width: 8.5in;
    min-height: 11in;
    margin: 20px auto 0.5in auto;
    padding: 0.5in 0.75in;
    background: white;
    page-break-after: always;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.page:last-child {
    page-break-after: avoid;
}

/* =========================================
   4. VIEWER LAYOUT (.container for index.html)
   ========================================= */
.viewer-body {
    padding: 40px 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.viewer-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border-bottom: 3px solid #357b70;
    padding-bottom: 0.75rem;
}

/* =========================================
   5. NAVIGATION & BUTTONS
   ========================================= */
.nav-header {
    text-align: center;
    padding-bottom: 20px;
    padding-top: 20px;
}

.nav-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: #e0b354; /* Gold */
    color: #2b2b2b;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease;
}

.nav-btn:hover {
    opacity: 0.8;
    cursor: pointer;
}

/* Project Links in Viewer */
.project-link {
    display: block;
    padding: 20px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #357b70; /* Teal */
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
}

.project-link:hover {
    transform: translateY(-3px);
    opacity: 0.8;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.viewer-nav {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #edf2f7;
    display: flex;
    justify-content: center;
}

/* =========================================
   6. HERO SECTIONS
   ========================================= */
.hero-container {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-image {
    width: 100%;
    height: 300px;
    background: #357b70;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    border: 3px dashed #e0b354;
    overflow: hidden;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.main-title {
    font-size: 3rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.3rem;
    color: #718096;
    margin-bottom: 2rem;
    font-weight: 300;
}

.project-pitch {
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f7fafc;
    border-radius: 12px;
    border-left: 5px solid #357b70;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    text-align: justify;
}

/* =========================================
   7. GRID & CARDS
   ========================================= */
.project-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem auto;
    padding: 0 1rem;
}

.detail-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-top: 4px solid #357b70;
}

.detail-card h3 {
    color: #357b70;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.detail-card .detail-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: #2d3748;
    margin-bottom: 0.75rem;
}

.detail-card p, .detail-card li {
    font-size: 0.9rem;
    color: #4a5568;
    list-style: none;
    padding: 0;
}

/* =========================================
   8. CONTENT HEADINGS & SECTIONS
   ========================================= */
h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 2rem 0 1.5rem 0;
    border-bottom: 3px solid #357b70;
    padding-bottom: 0.75rem;
}

h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #4a5568;
    margin: 2rem 0 1rem 0;
    position: relative;
    padding-left: 1rem;
}

h3::before {
    content: "";
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 100%;
    background: #357b70;
    border-radius: 2px;
}

.challenge-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    page-break-inside: avoid;
}

.visual-proof {
    margin: 1.5rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.visual-proof h4 {
    font-size: 1rem;
    color: #357b70;
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================
   9. IMAGES & VISUALS
   ========================================= */
.side-by-side-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.code-comparison {
    width: 100%;
}

.code-comparison h4 {
    text-align: center;
    color: #357b70;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.code-placeholder {
    background: #1a202c;
    color: #e2e8f0;
    height: 280px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #357b70;
    overflow: hidden;
    padding: 0.5rem;
    position: relative;
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
}

.code-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.image-placeholder {
    width: 100%;
    min-height: 250px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    overflow: hidden;
}

.image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.ui-screenshots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.final-solution {
    background: #f7fafc;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #357b70;
    margin: 2rem 0;
}

.gif-placeholder {
    width: 100%;
    height: 450px;
    background: white;
    border: 2px solid #357b70;
    border-radius: 12px;
    display: block;
    margin: 1rem 0;
    padding: 10px;
    overflow: hidden;
}

.gif-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* =========================================
   10. LEARNINGS & CTA
   ========================================= */
.learnings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
    page-break-inside: avoid;
}

.learning-box {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 5px solid #357b70;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.learning-box h4 {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 1rem;
    font-weight: 600;
}

.future-steps-list {
    margin: 1rem auto;
    padding-left: 0;
    list-style: none;
    max-width: 80%;
    text-align: center;
}

.future-steps-list li {
    padding: 0.5rem 0;
    color: #4a5568;
}

.future-steps-list li::before {
    content: "→ ";
    color: #357b70;
    font-weight: bold;
}

.cta-section {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    background: #f7fafc;
    border-radius: 12px;
}

.cta-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.cta-button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    opacity: 0.8;
}

.github-button { background-color: #357b70; }
.demo-button { background-color: #e0b354; color: #2b2b2b; }

/* =========================================
   11. MEDIA QUERIES & PRINT
   ========================================= */
@media screen and (max-width: 768px) {
    .page {
        margin: 0;
        padding: 1.5rem;
        width: 100%;
        min-height: 100vh;
        box-shadow: none;
    }
    .main-title { font-size: 2rem !important; }
    .side-by-side-container,
    .ui-screenshots,
    .learnings-grid,
    .project-details-grid {
        grid-template-columns: 1fr !important;
    }
    .gif-placeholder {
        height: auto !important;
        min-height: 300px;
    }
}

@media print {
    .nav-header { display: none; }
    body { background: white; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .page { width: 100%; max-width: none; min-height: 0; margin: 0; padding: 0.5in 0.6in; page-break-after: always; box-shadow: none; border: none; }
    .page:last-child { page-break-after: avoid; }
    
    .side-by-side-container { display: block !important; }
    
    .code-comparison {
        page-break-inside: avoid; break-inside: avoid-page;
        page-break-before: always; page-break-after: always;
        margin: 0; padding: 0.15in 0 0;
    }
    .code-comparison:first-child { page-break-before: auto; }
    
    .code-comparison h4 {
        page-break-inside: avoid; break-inside: avoid-page;
        margin: 0 0 0.15in 0; text-align: center; font-size: 1.2rem;
    }
    
    .code-placeholder {
        width: 100% !important; height: 8in !important; max-height: 8.5in !important;
        border: none !important; padding: 0 !important; margin: 0 !important;
        display: flex !important; align-items: center !important; justify-content: center !important;
        page-break-inside: avoid; break-inside: avoid-page;
    }
    .code-placeholder img {
        width: 100% !important; height: 100% !important; object-fit: contain !important;
        position: static !important; max-width: 100% !important; max-height: 100% !important;
    }
    
    .challenge-section, .visual-proof, .ui-screenshots, .image-placeholder,
    .final-solution, .learnings-grid, .learning-box {
        page-break-inside: avoid; break-inside: avoid-page;
    }

    /* Fallback for GIFs in print */
    .gif-placeholder img[src*="MEETAPP"] { content: url('./MEETAPP_WORKING_ON_PHONE.png'); }
    .gif-placeholder img[src*="CHATAPP"] { content: url('./CHATAPP_WORKING_ON_PHONE.png'); }
    .gif-placeholder img[src*="RECIPEAPP"] { content: url('./RECIPEAPP_WORKING_ON_PHONE.png'); }
    .gif-placeholder img[src*="MOVIEMOBS"] { content: url('img/MOVIEMOBS/APP_WORKING_ON_PHONE.png'); }
}