/* ==========================================================================
   Dr. Mohammad Harris - site-wide stylesheet
   Single source of truth for every page. Edit here, not in page <style> tags.
   ========================================================================== */

:root {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-muted: #f9fafb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent: #008080;
    --accent-hover: #ff6f61;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --border: #e5e7eb;
    --chip-bg: #e0f2f1;
    --chip-text: #00695c;
    overscroll-behavior: none;
    overflow-x: hidden;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-muted: #172033;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #0ea5e9;
    --accent-hover: #ff6f61;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25);
    --border: #334155;
    --chip-bg: #0f766e;
    --chip-text: #ecfdf5;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { font-family: 'Poppins', sans-serif; }

/* Tailwind utility overrides so theme variables win ---------------------- */
.bg-gray-100 { background-color: var(--bg-primary) !important; }
.bg-white { background-color: var(--bg-secondary) !important; }
.bg-gray-50 { background-color: var(--bg-muted) !important; }
.text-gray-800 { color: var(--text-primary) !important; }
.text-gray-700 { color: var(--text-primary) !important; }
.text-gray-600 { color: var(--text-secondary) !important; }
.text-gray-500 { color: var(--text-secondary) !important; }
.text-teal-800, .text-teal-700, .text-teal-600 { color: var(--accent) !important; }
.bg-teal-600 { background-color: var(--accent) !important; }
.hover\:bg-teal-700:hover { background-color: var(--accent-hover) !important; }
.border-gray-200 { border-color: var(--border) !important; }
.shadow-lg { box-shadow: var(--card-shadow) !important; }

/* Accessibility --------------------------------------------------------- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1.25rem;
    z-index: 100;
    border-radius: 0 0 0.5rem 0;
}
.skip-link:focus { left: 0; }

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--accent-hover);
    outline-offset: 2px;
}

/* Navigation ------------------------------------------------------------ */
nav.site-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(135deg, var(--accent) 0%, #1a3c5e 100%);
}

.nav-link {
    font-size: 16px;
    transition: color 0.3s ease, transform 0.2s ease;
    position: relative;
    color: #ffffff;
    white-space: nowrap;
}
.nav-link:hover { color: var(--accent-hover); transform: scale(1.1); }
.nav-link.active,
.nav-link[aria-current="page"] {
    color: var(--accent-hover) !important;
    transform: scale(1.05);
    font-weight: 700;
}

/* The menu is a real vertical stack. Tailwind's `flex-col` alone does nothing
   here because removing `hidden` leaves the div at display:block, which let the
   links flow inline and wrap into a grid. Both rules below are load-bearing. */
#mobile-menu { max-height: 0; overflow: hidden; }
#mobile-menu.open {
    display: flex !important;
    flex-direction: column;
    max-height: 900px;
}
@media (min-width: 768px) {
    #mobile-menu.open { display: none !important; }
}

.nav-link-mobile {
    display: block;
    width: 100%;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.nav-link-mobile:hover,
.nav-link-mobile.active,
.nav-link-mobile[aria-current="page"] {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--accent-hover) !important;
    font-weight: 700;
}

.theme-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.theme-toggle:hover { transform: scale(1.2); }

.cv-download {
    background-color: var(--accent);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: inline-block;
}
.cv-download:hover { background-color: var(--accent-hover); color: #fff; }

/* Headers --------------------------------------------------------------- */
.header-bg {
    background-image: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url('/assets/images/banner.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.header-text { opacity: 0; animation: fadeIn 1s ease-in-out forwards; }
.header-text:nth-child(1) { animation-delay: 0.15s; }
.header-text:nth-child(2) { animation-delay: 0.3s; }
.header-text:nth-child(3) { animation-delay: 0.45s; }
.header-text:nth-child(4) { animation-delay: 0.6s; }
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }

.header-bg h1,
.header-bg p { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }

/* Keep header text off the screen edges on narrow viewports. */
.header-bg { padding-left: 1rem; padding-right: 1rem; }
.header-bg > * { max-width: 100%; }

/* Cards and sections ---------------------------------------------------- */
.fade-in { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

.project-card, .section-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover, .section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 128, 128, 0.2);
}

.section-card h2::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    margin: 8px 0 16px;
}

.tile {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0, 128, 128, 0.15); }

.tile-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--chip-bg);
    color: var(--accent);
    flex-shrink: 0;
}

.outlet-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--card-shadow);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.outlet-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0, 128, 128, 0.15); }

.profile-photo {
    border: 3px solid var(--accent);
    box-shadow: 0 4px 8px rgba(0, 128, 128, 0.2);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    margin: 4px 4px 4px 0;
    background-color: var(--chip-bg);
    color: var(--chip-text);
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
}

.highlight-box {
    background: linear-gradient(135deg, #e0f2f1 0%, #b2dfdb 100%);
    border-left: 4px solid var(--accent);
    padding: 16px;
    margin: 16px 0;
    border-radius: 8px;
}
[data-theme="dark"] .highlight-box {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
}

/* Skills and counters --------------------------------------------------- */
.progress-bar { background-color: var(--border); height: 8px; border-radius: 4px; overflow: hidden; position: relative; }
.progress-fill { background-color: var(--accent); height: 100%; width: 0; transition: width 1.5s ease-in-out; }

.counter { font-size: 2.5rem; font-weight: bold; color: var(--accent); opacity: 0; transition: opacity 0.3s ease; }
.counter.visible { opacity: 1; }

/* Hobbies --------------------------------------------------------------- */
.hobby-item { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 1.1rem; }
.hobby-icon { font-size: 1.5rem; width: 40px; text-align: center; color: var(--accent); }

/* FAQ ------------------------------------------------------------------- */
.faq-item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.faq-question {
    width: 100%;
    text-align: left;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: background-color 0.2s ease;
}
.faq-question:hover { background-color: var(--bg-primary); }
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: var(--bg-primary);
    padding: 0 20px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}
.faq-answer.open { max-height: 900px; padding: 16px 20px; }
.faq-icon { transition: transform 0.3s ease; font-size: 0.85rem; flex-shrink: 0; }
.faq-item.open .faq-icon { transform: rotate(180deg); }

/* Contact form ---------------------------------------------------------- */
.contact-form { max-width: 500px; margin: 0 auto; }
.contact-form input, .contact-form textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}
.contact-form button {
    width: 100%;
    background-color: var(--accent);
    color: #fff;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.contact-form button:hover { background-color: var(--accent-hover); }

/* Social icons ---------------------------------------------------------- */
.social-icon { transition: color 0.3s ease, transform 0.3s ease; color: var(--accent); }
.social-icon:hover { color: var(--accent-hover); transform: scale(1.2); }

/* Back to top and preloader --------------------------------------------- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--accent);
    color: #fff;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 45;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }

.preloader {
    position: fixed;
    inset: 0;
    background-color: #1a3c5e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    transition: opacity 0.5s ease;
}
.preloader.hidden { opacity: 0; pointer-events: none; }
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-hover);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer ---------------------------------------------------------------- */
footer.site-footer {
    background: linear-gradient(135deg, var(--accent) 0%, #1a3c5e 100%);
    color: #fff;
}
footer.site-footer p,
footer.site-footer a { color: #ffffff !important; }
footer.site-footer p { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
footer.site-footer a:hover { color: var(--accent-hover) !important; }
.footer-nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 768px) {
    .nav-link:hover { transform: none; }
    .counter { font-size: 2rem; }
    /* Hero calls to action stack rather than running off the screen. */
    .header-bg .cv-download {
        display: block;
        width: 100%;
        max-width: 22rem;
        text-align: center;
    }
}

@media (max-width: 400px) {
    .header-bg h1 { font-size: 2rem; line-height: 1.15; }
    .badge { font-size: 13px; padding: 3px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .fade-in { opacity: 1; transform: none; }
    .header-text { opacity: 1; }
}

/* Legacy alias kept so any older markup still picks up the nav gradient. */
.gradient-bg { background: linear-gradient(135deg, var(--accent) 0%, #1a3c5e 100%); }
