/* ===================================
   Bloom Impact Financing Blog CSS
   Bento Box Design System
   =================================== */

/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@600;700;800&display=swap');

/* CSS Variables */
:root {
    --primary-green: #299b8e;
    --primary-green-dark: #237a70;
    --primary-green-light: #3fb5a8;
    --primary-lighter: #e6f5f3;
    --secondary-yellow: #f7b801;
    --secondary-yellow-light: #ffd43b;
    --secondary-orange: #d8a442;
    --text-dark: #293340;
    --text-gray: #6b7280;
    --text-light: #9ca3af;
    --bg-light: #f9fafb;
    --bg-lighter: #ffffff;
    --border-light: #e5e7eb;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-dark);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 2rem;
}

h2 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    margin-top: 4rem;
    margin-bottom: 2rem;
    padding-top: 1rem;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

p {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

/* Container */
.article-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Bento Box Components */
.bento-box {
    background: var(--bg-lighter);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    margin: 3rem 0;
    transition: all 0.3s ease;
}

.bento-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* Assessment CTA - Hero Section */
.assessment-cta {
    background: linear-gradient(135deg, var(--bg-lighter) 0%, var(--primary-lighter) 100%);
    border-radius: var(--radius-xl);
    padding: 3rem;
    margin: 3rem 0;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary-green-light);
    text-align: center;
}

.assessment-cta .lead {
    font-size: 1.35rem;
    color: var(--text-gray);
    margin-bottom: 2rem;
}

/* Button Styles - Fixed */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: var(--primary-green);
    color: white !important;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}

.button span {
    position: relative;
    z-index: 2;
    color: white;
}

.button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--primary-green-dark);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: 1;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    color: white !important;
}

.button:hover::before {
    width: 300px;
    height: 300px;
}

.button:hover span {
    color: white;
}

/* Final CTA */
.final-cta {
    background: linear-gradient(135deg, var(--secondary-yellow-light) 0%, var(--bg-lighter) 100%);
    border: 2px solid var(--secondary-yellow);
    border-radius: var(--radius-xl);
    padding: 3rem;
    margin: 4rem 0 3rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.final-cta h3 {
    color: var(--text-dark);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.final-cta p {
    margin-bottom: 1.5rem;
}

.final-cta .button {
    font-size: 1.125rem;
    padding: 1rem 2.5rem;
    background: var(--secondary-orange);
    margin-top: 1rem;
}

.final-cta .button:hover {
    background: var(--secondary-yellow);
}

.final-cta .button:hover span {
    color: var(--text-dark);
}

/* Lists */
ul, ol {
    margin-bottom: 2rem;
    padding-left: 2rem;
}

ul li, ol li {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-gray);
}

/* Strong text */
strong {
    font-weight: 600;
    color: var(--text-dark);
}

/* Superscript for references */
sup {
    font-size: 0.75rem;
    color: var(--primary-green);
    font-weight: 600;
}

/* Content Dropdown */
.content-dropdown {
    margin: 3rem 0;
    background: var(--bg-lighter);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.dropdown-trigger {
    width: 100%;
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    padding: 1.25rem 1.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-lg);
}

.dropdown-trigger:hover {
    background: var(--primary-lighter);
    border-color: var(--primary-green);
}

.dropdown-trigger::after {
    content: '▼';
    font-size: 0.875rem;
    transition: transform 0.3s ease;
    color: var(--primary-green);
}

.dropdown-trigger.active {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dropdown-trigger.active::after {
    transform: rotate(180deg);
}

.dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-lighter);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.dropdown-content.open {
    max-height: 1000px;
}

.dropdown-inner {
    padding: 2rem;
}

.dropdown-inner h4 {
    color: var(--primary-green-dark);
    margin-bottom: 1rem;
}

/* Links */
a {
    color: var(--primary-green);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-green-dark);
    text-decoration: underline;
}

/* Citation Links */
.citation-link {
    color: var(--primary-green);
    font-weight: 600;
    text-decoration: none;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.citation-link:hover {
    background: var(--primary-lighter);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted var(--primary-green);
    cursor: help;
    color: var(--primary-green-dark);
    font-weight: 600;
}

.tooltip::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-dark);
    color: white;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 250px;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.tooltip::before {
    content: "";
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-dark);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.tooltip:hover::after,
.tooltip:hover::before,
.tooltip:focus::after,
.tooltip:focus::before,
.tooltip.tooltip-active::after,
.tooltip.tooltip-active::before {
    opacity: 1;
    visibility: visible;
}

/* Reference anchors */
#ref1, #ref2, #ref3 {
    scroll-margin-top: 2rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: background-color 0.3s ease;
}

#ref1:target, #ref2:target, #ref3:target {
    background-color: var(--primary-lighter);
    animation: highlight 2s ease-out;
}

@keyframes highlight {
    0% { background-color: var(--secondary-yellow-light); }
    100% { background-color: var(--primary-lighter); }
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: var(--bg-lighter);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    background: var(--primary-lighter);
    font-weight: 600;
    color: var(--primary-green-dark);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-light);
}

/* Author Note */
.author-note {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    font-size: 1rem;
    color: var(--text-gray);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .article-container {
        padding: 2rem 1rem;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    h2 {
        font-size: 1.75rem;
        margin-top: 3rem;
        margin-bottom: 1.5rem;
    }
    
    .bento-box,
    .assessment-cta,
    .final-cta {
        padding: 2rem;
        margin: 2rem 0;
    }
    
    .button {
        width: 100%;
        text-align: center;
        padding: 1rem;
    }
    
    table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
        min-width: 120px;
    }
    
    .dropdown-content.open {
        max-height: 1500px;
    }
}

@media (max-width: 480px) {
    .article-container {
        padding: 1.5rem 0.75rem;
    }
    
    .bento-box,
    .assessment-cta,
    .final-cta {
        padding: 1.5rem;
    }
    
    p {
        font-size: 1rem;
    }
    
    .assessment-cta .lead {
        font-size: 1.125rem;
    }
    
    th, td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
        min-width: 100px;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    .dropdown-trigger {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .dropdown-inner {
        padding: 1.5rem;
    }
    
    .dropdown-content.open {
        max-height: 2000px;
    }
    
    /* Mobile tooltip adjustments */
    .tooltip::after {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        width: auto;
        z-index: 10000;
    }
    
    .tooltip::before {
        display: none;
    }
    
    .citation-link {
        padding: 0.25rem 0.4rem;
        font-size: 0.85rem;
        display: inline-block;
        margin: 0 0.1rem;
    }
}

/* Focus States for Accessibility */
a:focus,
button:focus,
.button:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}