/*
 * EDC PVG'S COET&M - Global Theme Styles
 * Mobile-first responsive design
 * Baseline: 320px screen width
 */

/* BASE RESETS & DEFAULTS */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.6;
}

/* Prevent text overflow */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Images should never cause horizontal scroll */
img {
    max-width: 100%;
    height: auto;
}

/* MOBILE TOUCH TARGET CONSTRAINTS */

@media (max-width: 768px) {

    button,
    a,
    input,
    textarea,
    select {
        min-height: 44px;
    }

    /* Reset min-height for inline links that don't need large touch targets */
    p a,
    li a,
    span a,
    footer a:not(.bg-accent-primary):not([class*="rounded"]) {
        min-height: auto;
    }
}

/* RESPONSIVE TYPOGRAPHY */

@media (max-width: 768px) {
    h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem) !important;
        line-height: 1.2 !important;
    }

    h2 {
        font-size: clamp(1.4rem, 5vw, 2rem) !important;
        line-height: 1.25 !important;
    }

    h3 {
        font-size: clamp(1.15rem, 4vw, 1.5rem) !important;
        line-height: 1.3 !important;
    }

    h4 {
        font-size: clamp(1rem, 3.5vw, 1.25rem) !important;
        line-height: 1.4 !important;
    }

    p,
    li,
    span,
    td,
    th {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* Extra small phones (320px) */
@media (max-width: 360px) {
    h1 {
        font-size: clamp(1.5rem, 7vw, 2rem) !important;
    }

    h2 {
        font-size: clamp(1.25rem, 6vw, 1.75rem) !important;
    }
}

/* HEADER & NAVIGATION */

header {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating header on scroll */
header.header-scrolled {
    background: rgba(240, 249, 255, 0.65) !important;
    -webkit-backdrop-filter: blur(30px) saturate(200%) brightness(1.1);
    backdrop-filter: blur(30px) saturate(200%) brightness(1.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    margin: 1rem auto;
    max-width: min(1320px, calc(100% - 8rem));
    border-radius: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

header.header-scrolled .max-w-7xl {
    max-width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header.header-scrolled .flex.justify-between {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header.header-scrolled img {
    height: 3rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header.header-scrolled h1 {
    font-size: 0.875rem !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive header adjustments */
@media (max-width: 1400px) {
    header.header-scrolled {
        max-width: calc(100% - 8rem);
    }
}

@media (max-width: 768px) {
    header.header-scrolled {
        max-width: calc(100% - 2rem);
        margin: 0.5rem auto;
        border-radius: 1.5rem;
    }

    header.header-scrolled img {
        height: 2.5rem;
    }

    header.header-scrolled h1 {
        font-size: 0.8rem !important;
    }
}

/* Header logo sizing on mobile */
@media (max-width: 480px) {

    header .h-16,
    header .h-18 {
        height: 3rem !important;
    }

    header h1 {
        font-size: 0.9rem !important;
        white-space: nowrap;
    }
}

@media (max-width: 360px) {

    header .h-16,
    header .h-18 {
        height: 2.5rem !important;
    }

    header h1 {
        font-size: 0.8rem !important;
    }
}

/* MOBILE MENU */

.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.mobile-menu.active {
    max-height: 600px;
}

.mobile-menu nav {
    padding: 1rem 0 0.5rem 0;
    border-top: 1px solid rgba(226, 232, 240, 0.3);
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
}

.mobile-menu a {
    position: relative;
    padding: 0.875rem 1.25rem;
    margin: 0.25rem 0.75rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    font-size: 1rem;
    min-height: 48px;
}

.mobile-menu a:not(:last-child):not([href="contact.html"]) {
    margin-bottom: 0.125rem;
}

.mobile-menu a:hover:not([href="contact.html"]) {
    background: rgba(224, 242, 254, 0.4);
    transform: translateX(4px);
}

.mobile-menu a[href="contact.html"] {
    margin-top: 0.75rem;
    background: linear-gradient(135deg, #0891B2 0%, #0EA5E9 100%);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
    justify-content: center;
    color: white;
}

.mobile-menu a[href="contact.html"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(8, 145, 178, 0.4);
}

@media (max-width: 360px) {
    .mobile-menu a {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0.5rem;
        font-size: 0.9375rem;
    }
}

/* HERO SECTIONS */

@media (max-width: 480px) {

    section.py-20:first-of-type,
    section.py-20.relative {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    section .min-h-\[70vh\] {
        min-height: 60vh;
    }
}

@media (max-width: 360px) {

    section.py-20:first-of-type,
    section.py-20.relative {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

/* BUTTONS */

/* Ensure buttons stack nicely on mobile */
@media (max-width: 480px) {
    .flex.flex-col.sm\:flex-row {
        gap: 0.75rem;
    }

    .flex.flex-col.sm\:flex-row>a,
    .flex.flex-col.sm\:flex-row>button {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Button minimum sizes */
button,
a[class*="rounded"] {
    min-height: 44px;
}

/* CARDS & GRIDS */

/* Fix card padding on small screens */
@media (max-width: 480px) {
    .p-8 {
        padding: 1.5rem !important;
    }

    .p-6 {
        padding: 1.25rem !important;
    }
}

@media (max-width: 360px) {
    .p-8 {
        padding: 1.25rem !important;
    }

    .p-6 {
        padding: 1rem !important;
    }
}

/* Team cards responsive fix */
.team-card {
    transition: all 0.3s ease;
    width: 100%;
}

@media (max-width: 640px) {
    .team-card {
        max-width: 100% !important;
    }
}

/* TEAM PAGE SPECIFIC FIXES */

/* Student leadership grid - prevent cramping on mobile */
@media (max-width: 640px) {
    .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-3.lg\:grid-cols-6 {
        gap: 1rem;
    }

    .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-3.lg\:grid-cols-6>div {
        max-width: 100%;
    }
}

/* Mentors grid - ensuring proper wrapping */
@media (max-width: 768px) {
    .grid.grid-cols-1.sm\:grid-cols-2.md\:grid-cols-5 {
        gap: 1rem;
    }
}

/* PROGRAMS PAGE STEPS */

/* How to Apply section - better mobile spacing */
@media (max-width: 768px) {
    .grid.grid-cols-1.md\:grid-cols-4 {
        gap: 1rem;
    }
}

/* PARTNERS/SPONSORS GRID */

@media (max-width: 360px) {
    .grid.grid-cols-2 {
        gap: 0.75rem;
    }

    .grid.grid-cols-2>div {
        padding: 0.5rem;
    }

    .grid.grid-cols-2 img {
        height: 2.5rem !important;
        max-height: 2.5rem;
    }
}

/* EVENTS PAGE GALLERY */

@media (max-width: 480px) {
    .h-48 {
        height: 10rem;
    }

    .h-56 {
        height: 12rem;
    }
}

/* CONTACT PAGE */

/* Contact cards equal sizing */
.contact-card {
    transition: all 0.3s ease;
    width: 100%;
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .contact-card {
        max-width: 100%;
    }
}

/* Map container */
@media (max-width: 480px) {
    .h-96 {
        height: 16rem;
    }
}

/* FORMS */

/* Prevent iOS zoom on form inputs */
input,
textarea,
select {
    font-size: 16px !important;
    -webkit-appearance: none;
    appearance: none;
}

.form-input-mobile {
    font-size: 16px !important;
    min-height: 48px;
}

.textarea-mobile {
    font-size: 16px !important;
    line-height: 1.6;
    min-height: 120px;
}

/* Form grid spacing on mobile */
@media (max-width: 768px) {
    .grid.grid-cols-1.md\:grid-cols-2 {
        gap: 1rem;
    }
}

/* FOOTER */

/* Footer social icons - consistent spacing on mobile */
footer .flex.items-center.gap-4 {
    display: flex;
    align-items: center;
    gap: 1rem !important;
}

footer .flex.items-center.gap-4 a {
    min-height: auto !important;
    min-width: auto !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

footer .flex.items-center.gap-4 svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Mobile footer compact layout */
@media (max-width: 640px) {

    /* Reduce overall footer padding */
    footer>div {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }

    /* Create 2-column grid for footer sections */
    footer .grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem 0.75rem;
    }

    /* Logo/description section - full width */
    footer .grid>div:first-child {
        grid-column: 1 / -1;
        margin-bottom: 0.25rem;
    }

    /* Quick Links - left column */
    footer .grid>div:nth-child(2) {
        grid-column: 1;
    }

    /* Get Involved - right column */
    footer .grid>div:nth-child(3) {
        grid-column: 2;
    }

    /* Contact section - full width */
    footer .grid>div:last-child {
        grid-column: 1 / -1;
        margin-top: 0.25rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(226, 232, 240, 0.5);
    }

    /* Make contact info horizontal on mobile */
    footer .grid>div:last-child>div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    footer .grid>div:last-child>div>p {
        flex: 1;
        min-width: 130px;
    }

    /* Compact Contact section labels and text */
    footer .grid>div:last-child h4 {
        font-size: 0.8rem !important;
        margin-bottom: 0.375rem !important;
    }

    footer .grid>div:last-child span {
        font-size: 0.8rem !important;
        margin-bottom: 0.125rem !important;
    }

    footer .grid>div:last-child p {
        font-size: 0.8rem !important;
        line-height: 1.3 !important;
    }

    footer .grid>div:last-child a {
        font-size: 0.8rem !important;
    }

    /* Reduce section headings margin */
    footer h4 {
        margin-bottom: 0.5rem !important;
        font-size: 0.8125rem !important;
    }

    /* Reduce link spacing */
    footer ul {
        gap: 0.25rem;
    }

    footer ul li {
        margin-bottom: 0.125rem;
    }

    footer .space-y-1\.5>*+*,
    footer .space-y-2>*+* {
        margin-top: 0.25rem !important;
    }

    footer .text-sm {
        font-size: 0.8125rem;
    }

    /* Compact logo section */
    footer .grid>div:first-child p {
        margin-bottom: 0.5rem;
        font-size: 0.8125rem;
        line-height: 1.4;
    }

    /* Reduce copyright section spacing */
    footer .border-t {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }

    /* Ensure footer social icons maintain consistent spacing */
    footer .flex.items-center.gap-4 {
        gap: 0.875rem !important;
        margin-top: 0.5rem;
    }

    footer .flex.items-center.gap-4 a {
        min-height: auto !important;
        min-width: auto !important;
    }

    footer .flex.items-center.gap-4 svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 360px) {
    footer>div {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    footer .grid {
        gap: 0.875rem 0.5rem;
    }

    footer h4 {
        font-size: 0.75rem !important;
    }

    footer .text-sm,
    footer ul li a,
    footer p {
        font-size: 0.75rem !important;
    }

    /* Smaller gap for very small screens */
    footer .flex.items-center.gap-4 {
        gap: 0.75rem !important;
    }

    footer .flex.items-center.gap-4 svg {
        width: 18px;
        height: 18px;
    }
}

/* ACCORDION (FAQ) */

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-content.active {
    max-height: 500px;
}

.accordion-content>div {
    padding-top: 0;
    padding-bottom: 1rem;
}

.accordion-toggle {
    cursor: pointer;
    min-height: 56px;
}

.accordion-toggle:hover {
    background-color: rgba(249, 250, 251, 0.8);
}

.accordion-toggle svg[data-icon] {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

/* FAQ Card styling */
.faq-card .accordion-content {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

@media (min-width: 640px) {
    .faq-card .accordion-content {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Answer content styling */
.faq-answer {
    margin-left: 3.25rem;
    padding-left: 0.75rem;
    border-left: 2px solid rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .faq-answer {
        margin-left: 3.75rem;
        padding-left: 1rem;
    }
}

@media (max-width: 480px) {
    .accordion-toggle {
        padding: 1rem 1rem;
    }

    .accordion-toggle span {
        font-size: 0.9375rem;
    }

    .faq-answer {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }
}

/* UTILITY CLASSES */

.text-line-height-relaxed {
    line-height: 1.6;
}

/* Scale hover effect */
.scale-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-hover:hover {
    transform: scale(1.02) translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
    .scale-hover:hover {
        transform: none;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
}

/* Gradients */
.gradient-gold {
    background: linear-gradient(135deg, #0EA5E9 0%, #0891B2 100%);
}

.gradient-blue {
    background: linear-gradient(135deg, #0EA5E9 0%, #0369A1 100%);
}

.gradient-accent {
    background: linear-gradient(135deg, #0891B2 0%, #0EA5E9 50%, #0369A1 100%);
}

/* ANIMATIONS */

.fade-in {
    animation: fadeIn 0.8s ease-in;
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* SECTION SPACING */

@media (max-width: 480px) {
    .py-20 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .py-16 {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .mb-16 {
        margin-bottom: 2.5rem;
    }

    .mb-12 {
        margin-bottom: 2rem;
    }

    .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 360px) {
    .py-20 {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .py-16 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .gap-8 {
        gap: 1.25rem;
    }

    .gap-6 {
        gap: 1rem;
    }
}

/* AVATAR PLACEHOLDER (Team page) */

.avatar-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 150px;
    background: linear-gradient(135deg, #E2E8F0 0%, #CBD5E0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #64748B;
}

@media (max-width: 480px) {
    .avatar-placeholder {
        min-height: 120px;
    }
}