/* 
   Newer Design - Dylan Hayden Personal Website 
   Design Inspiration: Adam Grant (Minimalist, Clean, Centered)
*/

:root {
    /* Branding Colors - Light Mode (Default) */
    --primary-blue: #011F5B;
    --accent-red: #990000;
    --bg-white: #FFFFFF;
    --bg-light: #F5F5F5;
    --text-color: #011F5B;
    --text-muted: #555;
    --card-bg: #FFFFFF;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.15);

    /* Typography */
    --font-heading: 'Georgia', serif;
    --font-body: 'Lato', sans-serif;

    /* Spacing */
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --container-width: 1200px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Component Specific */
    --footer-bg: #011F5B;
    --footer-text: #FFFFFF;
}

/* Dark Mode Variables - Midnight Blue Theme */
body.dark-mode {
    --primary-blue: #E6F1FF;
    /* Very light blue for high contrast text */
    --accent-red: #ff6b6b;
    /* Softer red for dark mode */
    --bg-white: #020c1b;
    /* Deep "Midnight" Blue */
    --bg-light: #0a192f;
    /* Lighter Midnight Blue */
    --text-color: #ccd6f6;
    /* Soft blue-white text */
    --text-muted: #8892b0;
    --card-bg: #112240;
    /* Distinct card color */

    --footer-bg: #010810;
    /* Darker than body */
    --footer-text: #ccd6f6;

    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.5);
}

/* Accessibility: High Contrast Focus Indicators */
:focus-visible {
    outline: 2px solid var(--accent-red);
    outline-offset: 4px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--text-color);
    background-color: var(--bg-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-weight: 700;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-red);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.text-center {
    text-align: center;
}

.bg-light {
    background-color: var(--bg-light);
    transition: background-color 0.3s ease;
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    font-family: var(--font-body);
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: #7a0000;
    color: white;
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.btn-secondary:hover {
    background-color: var(--primary-blue);
    color: var(--bg-white);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 20px;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--accent-red);
    transform: rotate(15deg);
}

/* Header & Navigation */
header {
    padding: 30px 0 20px;
    background: var(--bg-white);
    position: sticky;
    /* Make header sticky */
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    /* Subtle shadow when sticky */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Mobile Brand - Visible only on mobile */
.mobile-brand {
    display: none;
    text-align: center;
    margin-bottom: 15px;
}

.mobile-brand .site-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--primary-blue);
    text-decoration: none;
}

/* Centered Desktop Brand */
.brand-centered-container {
    text-align: center;
    padding-top: 10px;
    padding-bottom: 20px;
}

.site-title-large {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    color: var(--primary-blue);
    text-decoration: none;
    letter-spacing: -1px;
}

/* Main Nav */
.main-nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    /* Increased gap for better spacing */
    flex-wrap: wrap;
    /* Allow wrapping on smaller desktop screens */
}

.main-nav a {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    padding-bottom: 5px;
    white-space: nowrap;
}

.main-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--accent-red);
    transition: var(--transition);
}

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

/* Dropdown */
.has-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-white);
    box-shadow: var(--shadow-md);
    padding: 15px 0;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 8px;
    /* Softer corners */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

@media (min-width: 769px) {
    .has-dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(5px);
        /* Slide down slightly */
    }
}

.dropdown-menu li {
    text-align: center;
}

.dropdown-menu a {
    font-size: 0.95rem;
    padding: 5px 20px;
    display: block;
}

.dropdown-menu a::after {
    display: none;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-blue);
    cursor: pointer;
    position: absolute;
    top: 25px;
    right: 20px;
}


/* Hero */
.hero {
    text-align: center;
    padding: 80px 0 60px;
}

.hero-tagline {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    /* Increased from 2.2rem */
    max-width: 900px;
    margin: 0 auto 20px;
    font-style: normal;
    font-weight: 600;
    /* Bolder */
    line-height: 1.2;
    letter-spacing: -0.5px;
    /* Tighter */
    color: var(--primary-blue);
}

.hero-sub {
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 40px;
}

/* Feature Grid (3 Columns with Images) */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    padding: 60px 0;
}

.feature-item {
    text-align: center;
    transition: transform 0.3s ease;
    border-radius: 12px;
    padding: 20px;
}

.feature-item:hover {
    transform: translateY(-10px);
}

.feature-image-wrapper {
    width: 100%;
    height: 300px;
    overflow: hidden;
    margin-bottom: 20px;
    background-color: #ddd;
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.feature-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.feature-image-wrapper:hover img {
    transform: scale(1.08);
}

.feature-link {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary-blue);
    border-bottom: 2px solid transparent;
}

.feature-item:hover .feature-link {
    border-color: var(--accent-red);
}

/* Logo Grid (Static) */
.logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 40px;
    align-items: center;
    justify-items: center;
    padding: 40px 0;
    opacity: 0.7;
}

.logo-grid img {
    max-height: 50px;
    width: auto;
    filter: grayscale(100%);
    transition: var(--transition);
}

.logo-grid img:hover {
    filter: grayscale(0%);
    opacity: 1;
}

/* Newsletter Section - Refined */
.newsletter-section {
    background-color: var(--bg-light);
    padding: 80px 0;
    text-align: center;
}

.newsletter-content {
    max-width: 600px;
    margin: 0 auto;
}

.newsletter-input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

.newsletter-input {
    padding: 12px 20px;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 300px;
}

/* Footer */
footer {
    padding: 60px 0;
    text-align: center;
    font-size: 0.9rem;
    background-color: var(--footer-bg);
    color: var(--footer-text);
    transition: background-color 0.3s ease;
}

footer p {
    color: var(--footer-text);
}

footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse;
}

.footer-social-icons {
    margin-bottom: 0;
}

.footer-social-icons a {
    color: var(--footer-text);
    font-size: 1.5rem;
    text-decoration: none;
    transition: var(--transition);
}

.footer-social-icons a:hover {
    color: rgba(255, 255, 255, 0.8);
}

.social-icons-header {
    position: absolute;
    top: 25px;
    right: 30px;
}

.social-icons-header a {
    font-size: 1.2rem;
    margin-left: 15px;
}

/* Responsive */
@media (max-width: 768px) {

    /* Show Mobile Brand */
    .mobile-brand {
        display: block;
    }

    /* Hide Desktop Brand */
    .brand-centered-container {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        background: var(--bg-white);
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        box-shadow: var(--shadow-md);
        padding: 20px;
        z-index: 1000;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 15px;
    }

    .main-nav li {
        width: 100%;
        text-align: center;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .logo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .cta-group {
        flex-direction: column;
        align-items: center;
    }

    .newsletter-input-group {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .newsletter-input {
        width: 100%;
    }

    /* Mobile Dropdown handling */
    .dropdown-menu {
        display: none !important;
        /* Force hide in this simplifieid version */
    }

    .social-icons-header {
        position: static;
        text-align: center;
        margin-bottom: 10px;
        top: 0;
        right: 0;
    }

    footer .container {
        flex-direction: column;
        gap: 20px;
    }
}

/* Featured / Trusted By Section */
.featured-section {
    padding: 60px 0;
    background-color: var(--bg-white);
    text-align: center;
}

.featured-heading {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 40px;
    font-weight: 700;
}

/* Animations - Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays if needed */
.delay-100 {
    transition-delay: 0.1s;
}

.delay-200 {
    transition-delay: 0.2s;
}

.delay-300 {
    transition-delay: 0.3s;
}


/* Newsletter Feed Specific Styles */
.newsletter-feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
    padding: 20px 0;
}

.newsletter-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.newsletter-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.newsletter-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.newsletter-image-wrapper {
    width: 100%;
    height: 200px;
    background-color: var(--bg-light);
    overflow: hidden;
}

.newsletter-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.newsletter-card:hover .newsletter-image-wrapper img {
    transform: scale(1.05);
}

.newsletter-content-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.newsletter-date {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.newsletter-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--primary-blue);
    margin-bottom: 15px;
    line-height: 1.3;
}

.newsletter-excerpt {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    /* Pushes Read More to bottom */
}

.read-more {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-red);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: auto;
}

/* Dark Mode Adjustments for Newsletter */
body.dark-mode .newsletter-card {
    background: var(--card-bg);
    /* Uses dark mode card bg */
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .newsletter-title {
    color: var(--primary-blue);
    /* This variable shifts in dark mode */
}

body.dark-mode .newsletter-excerpt {
    color: var(--text-muted);
}

/* --- AI Chat Widget --- */
.chat-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    font-size: 24px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget-btn:hover {
    transform: scale(1.1) rotate(15deg);
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-mode .chat-window {
    background: rgba(10, 25, 47, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-header {
    background: var(--primary-blue);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    border-bottom: 2px solid var(--accent-red);
}

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.bot {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.dark-mode .message.bot {
    background: rgba(255, 255, 255, 0.1);
}

.message.user {
    background: var(--primary-blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.5);
}

.dark-mode .chat-input-area {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-area input {
    flex-grow: 1;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-color);
}

.chat-send-btn {
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

/* Typing Indicator */
.typing {
    font-style: italic;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    align-self: flex-start;
}