/* Durham AISI Website Styles */
/* ========================== */

/* Fonts are loaded in layout head via <link>; removed @import to improve performance */

/* CSS Variables for consistent theming */
:root {
    /* New purple palette */
    --color-deep-purple: #39144F;
    --color-bright-purple: #EB80FD;
    --color-light-purple: #E2ACFE;
    --color-lavender: #B8BBFE;
    --color-pure-white: #FFFFFF;

    /* Legacy for compatibility (mapped to purples where sensible) */
    --color-ocean-blue: #6F3FA7; /* mapped to a mid-purple */
    --color-deep-blue: #3E1A59; /* deep purple-leaning */
    --color-teal: #A562E8; /* mapped to bright purple */
    --color-emerald: #D49BFF; /* mapped to light purple */
    --color-sage: #C2B6FF; /* lavender-ish */
    --color-mint: #E6D1FF; /* pale purple */
    --color-warm-blue: #A080FF; /* violet */
    --color-navy: #2B0F40; /* darkest purple */
    
    /* Gradients updated to purple theme */
    --gradient-primary: linear-gradient(135deg, var(--color-bright-purple), var(--color-light-purple));
    --gradient-text: linear-gradient(135deg, var(--color-bright-purple), var(--color-lavender));
    --gradient-hero: linear-gradient(135deg, var(--color-deep-purple) 0%, var(--color-navy) 50%, var(--color-bright-purple) 100%);
    --gradient-bg: linear-gradient(to bottom right, var(--color-deep-purple), var(--color-navy), var(--color-bright-purple));
    
    /* Spacing */
    --section-padding: 5rem 0;
    --container-padding: 0 1.5rem;
    --card-padding: 2rem;
    
    /* Border radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Shadows */
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 20px 40px rgba(14, 74, 92, 0.3);
    
    /* Transitions */
    --transition-default: all 0.3s ease;
    --transition-fast: all 0.2s ease;
}

/* Pulse glow animation for CTA buttons */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 20px rgba(235, 128, 253, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(235, 128, 253, 0.6);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 20px rgba(235, 128, 253, 0.4);
        transform: scale(1);
    }
}

.pulse-glow {
    animation: pulse-glow 2s infinite;
}

.pulse-glow:hover {
    animation-play-state: paused;
}

/* Hero section with fixed background */
.hero-background {
    background-image: url('/images/hero-picture.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Avoid fixed attachment to reduce repaint/jank on some devices */
    background-attachment: scroll;
}

/* Fallback for mobile devices that don't support background-attachment: fixed well */
@media (max-width: 768px) {
    .hero-background {
    background-attachment: scroll;
    }
}

/* Enable fixed background on desktop/laptops for subtle parallax-like effect */
@media (min-width: 1024px), (hover: hover) and (pointer: fine) {
    .hero-background {
        background-attachment: fixed;
        /* Keep focal point stable while scrolling */
        background-position: center top;
    }
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Construction banner styles */
.construction-banner {
    background: linear-gradient(90deg, #dc2626, #b91c1c);
    color: white;
    padding: 12px 0;
    text-align: center;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 60;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.3);
}

@keyframes pulse-red {
    0%, 100% { background: linear-gradient(90deg, #dc2626, #b91c1c); }
    50% { background: linear-gradient(90deg, #ef4444, #dc2626); }
}

.construction-banner .disclaimer {
    font-size: 0.875rem;
    font-weight: normal;
    opacity: 0.9;
    margin-top: 4px;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', sans-serif;
    /* Use site-wide purple gradient background; Tailwind body gradient in layout is compatible */
    background: var(--gradient-bg);
    color: white;
    min-height: 100vh;
    line-height: 1.6;
}

/* Typography */
.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Layout utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--container-padding);
}

.section {
    padding: var(--section-padding);
}

/* Header styles */
.header {
    background: rgba(57, 20, 79, 0.5); /* Darker frosting for better contrast */
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(235, 128, 253, 0.5);
}

.nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

@media (min-width: 1024px) {
    .nav {
        flex-direction: row;
    }
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    text-decoration: none;
    transition: var(--transition-default);
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-brand img {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
}

.nav-brand h1 {
    font-size: 1.875rem;
    font-weight: 700;
}

@media (min-width: 1024px) {
    .nav-brand h1 {
        font-size: 2.25rem;
    }
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    position: relative;
    color: white;
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 500;
    transition: var(--transition-default);
}

.nav-link:hover {
    color: var(--color-bright-purple);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: var(--gradient-primary);
    transition: var(--transition-default);
}

.nav-link:hover::after {
    width: 100%;
}

/* Dropdown styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.dropdown-toggle i {
    transition: var(--transition-default);
}

.dropdown:hover .dropdown-toggle i {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(57, 20, 79, 0.95);
    backdrop-filter: blur(10px);
    min-width: 200px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(235, 128, 253, 0.3);
    box-shadow: var(--shadow-card);
    z-index: 1000;
    overflow: hidden;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.3s ease;
}

.dropdown-content a {
    display: block;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: white;
    transition: var(--transition-default);
    border-bottom: 1px solid rgba(235, 128, 253, 0.2);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: rgba(235, 128, 253, 0.2);
    color: var(--color-bright-purple);
    padding-left: 1.5rem;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Hero section */
.hero {
    padding: 4rem 0 6rem;
    background: var(--gradient-hero);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .hero {
        padding: 6rem 0 8rem;
    }
    
    .hero h2 {
        font-size: 3.75rem;
    }
}

.hero p {
    font-size: 1.25rem;
    max-width: 48rem;
    margin: 0 auto;
    line-height: 1.75;
}

@media (min-width: 768px) {
    .hero p {
        font-size: 1.5rem;
    }
}

/* Card styles */
.card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(235, 128, 253, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--card-padding);
    transition: var(--transition-default);
}

.card:hover {
    /* Disabled expensive transform on hover for performance */
    transform: none;
    box-shadow: none;
}

/* Bounce animation for hoverable cards */
@keyframes hover-bounce {
    /* Disabled */
}

/* Apply bounce on hover to elements marked as card-hover */
.card-hover:hover { animation: none; }

/* Team card helper */
.team-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(20, 184, 166, 0.25);
}

/* Page-specific card helpers */
.program-card,
.research-card,
.info-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: var(--radius-xl);
}

/* Status badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-ongoing {
    background: linear-gradient(135deg, var(--color-bright-purple), var(--color-light-purple));
    color: white;
}
.status-completed {
    background: linear-gradient(135deg, var(--color-lavender), var(--color-light-purple));
    color: white;
}
.status-planning {
    background: linear-gradient(135deg, var(--color-bright-purple), var(--color-ocean-blue));
    color: white;
}

/* Timeline */
.timeline-item { position: relative; padding-left: 2rem; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--color-bright-purple), var(--color-light-purple));
    border-radius: 50%;
}
.timeline-item::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1.25rem;
    width: 2px;
    height: calc(100% - 0.75rem);
    background: linear-gradient(180deg, var(--color-bright-purple), transparent);
}
.timeline-item:last-child::after { display: none; }

/* Grid layouts */
.grid {
    display: grid;
    gap: 2rem;
}

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

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

.grid-cols-3 {
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition-default);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-light-purple), var(--color-lavender));
    /* Remove transform to avoid layout thrash */
    /* transform: scale(1.05); */
    /* box-shadow: var(--shadow-card); */
}

/* Secondary button (used on light / neutral backgrounds) */
.btn-secondary {
    background: transparent;
    color: var(--color-deep-purple);
    border: 2px solid var(--color-bright-purple);
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--gradient-primary);
    color: #ffffff;
}

/* Small button size utility */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Viewport height utilities for stable hero sizing across mobile browsers */
.min-h-100dvh {
    min-height: 100dvh; /* Dynamic viewport to account for mobile UI */
}
.min-h-100svh {
    min-height: 100svh; /* Small viewport height fallback */
}
.min-h-100vh {
    min-height: 100vh; /* Fallback for older browsers */
}

/* Defer offscreen rendering where safe */
.defer-render {
    content-visibility: auto;
    contain-intrinsic-size: 1000px;
}

/* Section backgrounds */
.section-alt {
    background: linear-gradient(135deg, 
        rgba(57, 20, 79, 0.9), 
        rgba(184, 132, 254, 0.15)
    );
}

.section-alt-2 {
    background: linear-gradient(135deg, 
        rgba(235, 128, 253, 0.15), 
        rgba(57, 20, 79, 0.9)
    );
}

/* Neutral background for sections below hero */
.section-neutral {
    /* Unified background across all neutral sections */
    background: #f8fafc; /* Solid light neutral */
    color: #1e293b; /* Dark slate for better contrast */
}

/* -------------------------------------------
   Fix: Ensure header icons are white on cards
   Context: Programs page gradient header squares
   Reason: Avoid affecting smaller icons inside gradient content boxes
-------------------------------------------- */
/* Only force white on the big header squares */
.section-neutral .w-16.h-16.bg-gradient-to-br > i,
.section-neutral .w-20.h-20.bg-gradient-to-br > i,
.section-neutral .w-16.h-16.bg-gradient-to-r > i,
.section-neutral .w-20.h-20.bg-gradient-to-r > i {
    color: var(--color-pure-white) !important;
}

/* Default icons in neutral sections to purple for visibility */
.section-neutral i {
    color: var(--color-bright-purple) !important;
}

/* Override for icons that should stay white (in gradient backgrounds) */
/* Restrict white icons to only large header squares (handled above). */

/* Make smaller list icons inside "Who's this for?" gradient cards darker for contrast */
.section-neutral .bg-gradient-to-br .flex.items-start > i,
.section-neutral .bg-gradient-to-r .flex.items-start > i {
    color: var(--color-deep-purple) !important;
}

/* Ensure proper text contrast in neutral sections */
.section-neutral h1,
.section-neutral h2,
.section-neutral h3,
.section-neutral h4,
.section-neutral h5,
.section-neutral h6 {
    color: #0f172a; /* Slate 900 */
}

.section-neutral p,
.section-neutral span,
.section-neutral li {
    color: #334155; /* Slate 700 */
}

/* Adjust card styling in neutral sections */
.section-neutral .program-card,
.section-neutral .info-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(235, 128, 253, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.section-neutral .program-card h4,
.section-neutral .info-card h3 {
    color: #0f172a;
}

.section-neutral .program-card p,
.section-neutral .info-card p {
    color: #475569; /* Slate 600 */
}

.section-neutral .program-card i {
    color: #0f172a; /* Dark icons on light cards by default */
}

.section-neutral .program-card .text-sm {
    color: #64748b; /* Slate 500 for small text */
}

/* Ensure only PRIMARY or gradient buttons are forced white in neutral sections */
.section-neutral a.btn-primary,
.section-neutral a[class*="bg-gradient-to-"] {
    color: #ffffff !important;
}
.section-neutral a.btn-primary:hover,
.section-neutral a[class*="bg-gradient-to-"]:hover {
    color: #ffffff !important;
}

/* Allow secondary buttons to retain dark text for contrast */
.section-neutral a.btn-secondary {
    color: var(--color-deep-purple) !important;
}
.section-neutral a.btn-secondary:hover {
    color: #ffffff !important; /* becomes white when background gradient applied on hover */
}

/* Icons inside links should match the link color */
.section-neutral a i {
    color: currentColor !important;
}

/* Fix icon visibility in neutral sections - simplified rules */
.section-neutral .program-card i {
    color: var(--color-bright-purple) !important; /* Default purple for all icons */
}

/* Keep large header icons (inside gradient squares) white for contrast */
.section-neutral .program-card .bg-gradient-to-br i,
.section-neutral .program-card .bg-gradient-to-r i {
    color: #ffffff !important;
}

/* Ensure 3 pillars cards have white text (scope to home about section only)
   Note: The #about element itself has class .section-neutral, so target the same element
   rather than a descendant to ensure the selector matches. */
#about.section-neutral .grid .bg-gradient-to-br h3,
#about.section-neutral .grid .bg-gradient-to-br p {
    color: #ffffff !important;
}

/* -------------------------------------------
   Research page: Research Opportunities icons
   Goal: Ensure sufficient contrast against gradient squares
-------------------------------------------- */
/* Bright-purple square: keep icon white, add subtle shadow for definition */
.section-neutral .research-card .w-12.h-12.bg-gradient-to-br.from-bright-purple.to-bright-purple > i {
    color: #ffffff !important;
    /* Slight shadow improves visibility on gradients */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

/* Light-purple square: switch icon to deep purple for contrast */
/* Light-purple square: make icon white for consistency and add subtle shadow for definition */
.section-neutral .research-card .w-12.h-12.bg-gradient-to-br.from-light-purple.to-light-purple > i {
    color: #ffffff !important;
    /* Slight shadow improves visibility on light gradients */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

/* Subtle outline on the small gradient squares to separate from light cards */
.section-neutral .research-card .w-12.h-12.bg-gradient-to-br {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Adjust calendar container in neutral section */
.section-neutral .calendar-container {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(235, 128, 253, 0.2);
}

/* Adjust links in neutral sections */
.section-neutral a {
    color: #8b5cf6; /* Violet for links */
}

.section-neutral a:hover {
    color: #a78bfa; /* Lighter violet on hover */
}

/* -------------------------------------------
   Fixes for Programs page: Research Support
   - Improve contrast and brand color mapping
-------------------------------------------- */
/* Headings darker for strong contrast */
.section-neutral #research-projects .bg-gradient-to-br h5 {
    color: #0f172a !important; /* Slate 900 */
}
/* Body text to slate for readability */
.section-neutral #research-projects .bg-gradient-to-br p {
    color: #334155 !important; /* Slate 700 */
}
/* Icons should be brand purple */
.section-neutral #research-projects .bg-gradient-to-br i {
    color: #7c3aed !important; /* Purple */
}

/* Footer */
.footer {
    background: #39144F;
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(235, 128, 253, 0.2);
    padding: 3rem 0;
    text-align: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.social-links a {
    color: white;
    font-size: 1.875rem;
    transition: var(--transition-default);
}

.social-links a:hover {
    color: #EB80FD;
    transform: scale(1.1);
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-16 { margin-bottom: 4rem; }

.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }

.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }

.mx-auto { margin-left: auto; margin-right: auto; }

/* Icon color utilities (use to override context defaults) */
.icon-current { color: currentColor !important; }
.icon-white { color: #ffffff !important; }
.icon-bright-purple { color: var(--color-bright-purple) !important; }
.icon-light-purple { color: var(--color-light-purple) !important; }

/* Section divider */
.section-divider {
    width: 6rem;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 9999px;
    margin: 0 auto 4rem;
}

/* Form styles */
.form-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(235, 128, 253, 0.3);
    color: white;
    border-radius: var(--radius-xl);
    padding: 1rem;
    width: 100%;
    transition: var(--transition-default);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-bright-purple);
    box-shadow: 0 0 0 3px rgba(235, 128, 253, 0.2);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.checkbox-custom {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(235, 128, 253, 0.5);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    transition: var(--transition-default);
}

.checkbox-custom:checked {
    background: var(--gradient-primary);
    border-color: var(--color-bright-purple);
}

.checkbox-custom:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
}

/* Responsive utilities */
@media (max-width: 767px) {
    .hidden-mobile { display: none; }
}

@media (min-width: 768px) {
    .hidden-desktop { display: none; }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
