/* ==============================================
   RESEARCH PAGE - ENHANCED & REFACTORED STYLES
   ============================================== */

/* ----------------------------------------------------
   1. Page-Specific Theme Variables & Base Styles
   - Scoped to .research-page to avoid global conflicts.
   ---------------------------------------------------- */
.research-page {
    --secondary-text: #34495e;
    --overview-top-color: #C0A062;
    --bg-light: #FFFFFF;
    --bg-warm-white: #FAF9F7;
    --bg-subtle-gray: #F8F9FA;
    
    /* The body background is now set here */
/*    background-color: var(--bg-warm-white);*/
}

/* -------------------------------------------
   2. Introduction Component
   - These styles only apply inside .research-page
   ------------------------------------------- */

/*.research-page .research-intro {*/
/*    margin: 0 auto;*/
/*    padding: 3rem;*/
/*    max-width: 1200px;*/
/*    background-color: var(--bg-light);*/
/*    border-radius: 16px;*/
/*    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);*/
/*    border-top: 5px solid var(--overview-top-color);*/
/*}*/
/**/
/*.research-page .research-intro h2 {*/
/*    font-family: var(--font-heading);*/
/*    color: var(--primary-text);*/
/*    font-size: 2.5rem;*/
/*    margin-bottom: 1.5rem;*/
/*    font-weight: 700;*/
/*}*/
/**/
/*.research-page .research-intro p {*/
/*    font-family: var(--font-body);*/
/*    font-size: 1.1rem;*/
/*    line-height: 1.8;*/
/*    color: var(--secondary-text);*/
/*}*/

/* ==============================================
   NEW, PREMIUM & NICER RESEARCH INTRO DESIGN
   - A complete replacement for the previous intro styles.
   ============================================== */

/* --- 1. The Main Section Container --- */
.research-page .research-intro {
    /* Two-tone background effect: soft gray spans the full width */
    background-color: var(--bg-subtle-gray);
    padding: 1rem 1rem; /* Generous vertical padding */
    margin: 0;          /* Remove margin to allow full-width background */
    
    /* Reset all old styles */
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* --- 2. The Inner Content Wrapper --- */
/* We add a new div in the HTML for this, or re-purpose an existing one */
.research-intro-content {
    max-width: 1130px; /* Constrains the content, not the background */
    margin: 0 auto;   /* Centers the content within the full-width section */
    position: relative; /* Needed for the decorative line */
}


/* --- 3. The Heading & Decorative Line --- */
.research-page .research-intro h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--dark-bg); /* Use the dark slate for strong contrast */
    margin: 0;
    padding: 0;
    line-height: 1.3;
    /* ADD THIS LINE */
    text-align: center;
}

/* The elegant line decoration */
.research-page .research-intro h2::after {
    content: '';
    display: block;
    width: 340px;
    height: 4px;
    background-color: var(--overview-top-color); /* Your golden accent color */
    margin-top: 1.25rem; /* Space between text and line */
    /* ADD THESE TWO LINES TO CENTER THE LINE UNDER THE HEADING */
    margin-left: auto;
    margin-right: auto;
}


/* --- 4. The Introductory Paragraph --- */
.research-page .research-intro p {
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--secondary-text);
    margin-top: 2rem; /* Space between the decorative line and the paragraph */
    text-align: left; /* Aligned left for better readability */
    
    /* Create a two-column feel on larger screens */
    column-count: 2;
    column-gap: 2.5rem;
}

/* --- 5. Responsive Adjustments --- */
@media (max-width: 768px) {
    /* Stack to a single column on smaller screens */
    .research-page .research-intro p {
        column-count: 1;
    }

    .research-page .research-intro h2 {
        font-size: 2.2rem;
    }
}

/* ----------------------------
   3. Research Theme Sections
   ---------------------------- */
.research-page .research-theme {
    padding: 4rem 0;
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
    opacity: 0;
    transform: translateY(40px);
}

.research-page .research-theme.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.research-page .research-theme:nth-of-type(odd) {
    background-color: var(--bg-subtle-gray);
}
.research-page .research-theme:nth-of-type(even) {
    background-color: var(--bg-light);
}

.research-page .theme-content {
    display: flex;
    align-items: flex-start;
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.research-page .theme-content.reverse {
    flex-direction: row-reverse;
}

.research-page .theme-text {
    flex: 1;
}

.research-page .theme-text h3 {
    font-family: var(--font-heading);
    color: var(--primary-text);
    font-size: 2rem;
    margin-bottom: 1.2rem;
    font-weight: 500;
}

.research-page .theme-text p {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--secondary-text);
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.research-page .theme-visual {
    flex: 1;
    min-width: 0;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.research-page .theme-visual img,
.research-page .research-visual {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

.research-page .theme-visual:hover img {
    transform: scale(1.03);
}

.research-page .caption {
    margin-top: 1rem;
    text-align: center;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
    font-style: italic;
    font-family: var(--font-body);
}

/* --- NEW: Styling for Blockquotes --- */

.research-quote {
    /* Spacing */
    margin: 1.5rem 0 2rem 1.5rem; /* Add space above/below and a left indent */
    
    /* The decorative left border */
    border-left: 4px solid var(--overview-top-color); /* Your golden accent color */
    padding-left: 1.5rem;
    
    /* Typography */
    font-style: italic;
    font-size: 1.1rem; /* Slightly larger than the body text */
    color: #555; /* A softer color to distinguish it */
    line-height: 1.6;
}

/* Optional styling for the quote's author citation */
.research-quote cite {
    display: block; /* Puts the author on a new line */
    margin-top: 0.5rem;
    font-style: normal;
    font-weight: 600;
    text-align: right; /* Aligns the author to the right */
    color: #333;
}


/* ----------------------------
   4. Text Wrapping Layout (Float Override)
   ---------------------------- */
.research-page .theme-content.text-wrap {
  display: block !important;
  overflow: hidden;
}

.research-page .theme-content.text-wrap .theme-visual {
  float: right;
  width: 350px;
  margin-left: 2rem;
  margin-bottom: 1rem;
  margin-top: 1rem;
  shape-margin: 15px;
}

.research-page .theme-content.text-wrap.reverse .theme-visual {
  float: left;
  margin-right: 2rem;
  margin-left: 0;
}

.research-page .theme-content.text-wrap .theme-visual img {
  shape-outside: margin-box;
}

.research-page .research-theme.gw-modeling .theme-content.text-wrap .theme-visual { width: 300px; }
.research-page .research-theme.ns-merger .theme-content.text-wrap .theme-visual { width: 350px; }
.research-page .research-theme.kdisk .theme-content.text-wrap .theme-visual { width: 400px; }

/* ----------------------------
   5. Graphical Flourishes
   ---------------------------- */
.research-page .section-separator {
    height: 1px;
    width: 80px;
    /* Note: --accent-color is correctly inherited from your global stylesheet */
    background: linear-gradient(90deg, var(--accent-color), #ddd);
    margin: 0 auto;
    border: none;
}

/* ----------------------------
   6. Responsive Design
   ---------------------------- */
@media (max-width: 992px) {
    .research-page .theme-content,
    .research-page .theme-content.reverse {
        flex-direction: column;
        gap: 2.5rem;
    }
    
    .research-page .theme-visual {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }

    .research-page .theme-text h3 {
        font-size: 1.8rem;
    }
    
    /* Target the visual container for both normal and reversed layouts */
    .research-page .theme-content.text-wrap .theme-visual,
    .research-page .theme-content.text-wrap.reverse .theme-visual {
        
        /* THIS IS THE KEY FIX: Disable the float */
        float: none;
        
        /* Center the block horizontally */
        margin-left: auto;
        margin-right: auto;

        /* Add some vertical margin for spacing */
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;

        /* Ensure it takes up the full width of the container */
        width: 100%;

        /* Let's cap the max-width so it doesn't look huge on tablets */
        max-width: 500px;

        /* Reset any shape-outside properties */
        shape-outside: none;
    }
}

/*@media (max-width: 768px) {*/
/*    .research-page .research-intro h2 { font-size: 2rem; }*/
/**/
/*    .research-page .theme-content.text-wrap {*/
/*      display: flex !important;*/
/*      flex-direction: column;*/
/*    }*/
/*    .research-page .theme-content.text-wrap .theme-visual,*/
/*    .research-page .theme-content.text-wrap .theme-visual img {*/
/*      float: none;*/
/*      width: 100%;*/
/*      height: auto;*/
/*      margin: 1.5rem 0 !important;*/
/*      shape-outside: none;*/
/*    }*/
/*    */
/*    /* Target the visual container for both normal and reversed layouts */
/*    .research-page .theme-content.text-wrap .theme-visual,*/
/*    .research-page .theme-content.text-wrap.reverse .theme-visual {*/
/*        */
/*        /* THIS IS THE KEY FIX: Disable the float */
/*        float: none;*/
/*        */
/*        /* Center the block horizontally */
/*        margin-left: auto;*/
/*        margin-right: auto;*/
/**/
/*        /* Add some vertical margin for spacing */
/*        margin-top: 1.5rem;*/
/*        margin-bottom: 1.5rem;*/
/**/
/*        /* Ensure it takes up the full width of the container */
/*        width: 100%;*/
/**/
/*        /* Let's cap the max-width so it doesn't look huge on tablets */
/*        max-width: 500px;*/
/**/
/*        /* Reset any shape-outside properties */
/*        shape-outside: none;*/
/*    }*/
/*    */
/*}*/



/* =====================================================================
   IN ai_studio_code_research.css, REPLACE your old @media (max-width: 768px)
   block with this final, corrected version.
   ===================================================================== */

@media (max-width: 768px) {
    .research-page .research-intro h2 { font-size: 2rem; }

    /* --- This is the corrected rule for the text-wrapping sections --- */
    
    /* First, we ensure the main container stacks its children */
    .research-page .theme-content.text-wrap
    .research-page .theme-content.text-wrap.reverse{
      display: flex;
      flex-direction: column;
    }
    
    /* Now, we style the image container directly and definitively */
    .research-page .theme-content.text-wrap .theme-visual{
      /* --- THIS IS THE FIX --- */
      display: block;  /* Treat it as a simple block */
      float: none;     /* CRITICAL: Turn off the float */
      margin: 1.5rem auto; /* Center it horizontally (auto) and add vertical space */
      
      /* --- Sizing --- */
      width: 100%;
      max-width: 500px; /* A sensible max size for mobile */
      
      /* --- Reset any leftover desktop styles --- */
      shape-outside: none;
      margin-left: auto;  /* Explicitly set for centering */
      margin-right: auto; /* Explicitly set for centering */
    }
    
    
    /* ======================================================= */
    /*  ADD THIS NEW, MORE SPECIFIC RULE TO FIX KDISK.PNG    */
    /* ======================================================= */
    .research-page .research-theme.kdisk .theme-content.text-wrap .theme-visual {
        /* Re-apply the centering and width styles with a more specific selector */
        float: none;
        margin: 1.5rem auto;
        width: 100%;
        max-width: 500px;
    }
}


@media (max-width: 576px) {
    .research-page .research-theme {
        padding: 3rem 0;
    }
    
    .research-page .theme-content {
        padding: 0 1.5rem;
    }
    
    .research-page .theme-text h3 { font-size: 1.6rem; }
    .research-page .theme-text p { font-size: 1rem; }
    /* Target the visual container for both normal and reversed layouts */
    .research-page .theme-content.text-wrap .theme-visual,
    .research-page .theme-content.text-wrap.reverse .theme-visual {
        
        /* THIS IS THE KEY FIX: Disable the float */
        float: none;
        
        /* Center the block horizontally */
        margin-left: auto;
        margin-right: auto;

        /* Add some vertical margin for spacing */
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;

        /* Ensure it takes up the full width of the container */
        width: 100%;

        /* Let's cap the max-width so it doesn't look huge on tablets */
        max-width: 500px;

        /* Reset any shape-outside properties */
        shape-outside: none;
    }
}


/* ==============================================
   ADD THIS TO THE END of ai_studio_code_research.css
   - Styles for the clickable image lightbox.
   ============================================== */

/* --- 1. Style the clickable image on the page --- */
.clickable-image {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.clickable-image:hover {
    opacity: 0.8;
}

/* --- 2. The Lightbox Overlay (Hidden by Default) --- */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place on the screen */
    z-index: 2000; /* Sit on top of everything else */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Black background with opacity */
    
    /* Fade-in animation */
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Class added by JavaScript to show the lightbox */
.lightbox.visible {
    display: flex; /* Use flexbox to center the image */
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* --- 3. The Enlarged Image --- */
.lightbox-content {
    display: block;
    margin: auto;
    max-width: 85%;
    max-height: 85%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

/* --- 4. The Close Button --- */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover {
    color: #bbb;
}
