/* ========================================
   Responsive Design
   Mobile-first approach matching neuralwanderer.top
   ======================================== */

/* Tablet and smaller desktops */
@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    
    .hero-text {
        text-align: center;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-highlights {
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .hero-photo {
        width: clamp(200px, 55vw, 280px);
        margin: 0 auto;
    }

    .home-subscribe-card {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .home-subscribe-copy p {
        margin: 0 auto;
    }

    .home-subscribe-card .newsletter-form {
        justify-content: center;
    }

    .post-layout {
        grid-template-columns: 1fr;
    }

    .post-sidebar {
        position: static;
        order: 2;
        margin-top: var(--spacing-md);
    }

    .header-social {
        display: none;
    }

    .skills-showcase {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .about-sidebar {
        order: -1;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .resume-hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.6fr);
    }

    .category-row__items {
        grid-auto-columns: minmax(220px, 260px);
    }

    .blog-hero__inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .blog-hero__copy {
        order: 2;
    }

    .blog-hero__art {
        order: 1;
    }

    .blog-hero__actions {
        justify-content: center;
    }

    .series-strip__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .series-strip__scroller {
        grid-auto-columns: minmax(260px, 280px);
    }

    .series-hero__layout {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .series-hero__copy {
        order: 2;
    }

    .series-hero__art {
        order: 1;
    }

    .series-hero__meta {
        justify-content: center;
    }
}

/* Mobile devices */
@media (max-width: 768px) {
    :root {
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }

    .hero-highlights {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .hero-content {
        gap: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .sidebar-cta-button {
        width: 100%;
        text-align: center;
    }

    .skill-item--media {
        padding: 0.85rem;
    }

    .skill-logo {
        width: 40px;
        height: 40px;
    }
    
    .home-subscribe-card {
        padding: 1.5rem;
    }

    .home-subscribe-card .newsletter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .home-subscribe-card .newsletter-form input[type="email"],
    .home-subscribe-card .newsletter-form button {
        width: 100%;
        min-width: unset;
    }

    .about-sidebar {
        grid-template-columns: 1fr;
        order: -1;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    
    /* Header adjustments */
    .header-content {
        gap: var(--spacing-sm);
    }

    .site-branding {
        flex: 1;
        min-width: 0;
    }

    .main-navigation {
        position: relative;
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: var(--spacing-xs);
        flex-shrink: 0;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--primary-white);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        gap: 0;
        display: none;
        padding: var(--spacing-md);
        border-radius: 0 0 8px 8px;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }
    
    .nav-menu a {
        padding: 1rem;
        text-align: center;
        display: block;
    }
    
    .main-navigation .subscribe-btn {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        margin-left: var(--spacing-xs);
    }

    .footer-grid {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-lg);
    }

    .footer-column {
        width: 100%;
        align-items: center;
        text-align: center;
    }

    .footer-tagline,
    .footer-category,
    .footer-brand {
        text-align: center;
        width: 100%;
    }

    .footer-newsletter {
        width: 100%;
    }

    .footer-newsletter-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .footer-newsletter-form input,
    .footer-newsletter-form button {
        width: 100%;
    }

    .newsletter-form .cf-turnstile,
    .footer-newsletter-form .cf-turnstile {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    
    /* Hero section adjustments */
    .hero-section::before {
        opacity: 0.22;
    }

    .skills-showcase {
        grid-template-columns: 1fr;
    }

    .skill-card {
        padding: var(--spacing-lg);
    }

    .skill-pill-collection {
        gap: 0.6rem;
    }
    
    /* Newsletter adjustments */
    .newsletter-title {
        font-size: 2rem;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input[type="email"],
    .newsletter-form button {
        width: 100%;
        min-width: unset;
    }
    
    /* Posts grid adjustments */
    .posts-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .blog-hero__title {
        font-size: clamp(2rem, 5vw, 2.4rem);
    }

    .category-row__items {
        grid-auto-columns: minmax(250px, 270px);
    }

    .blog-hero__timeline {
        max-width: 100%;
    }

    .blog-hero__title {
        font-size: clamp(2rem, 5vw, 2.4rem);
    }

    .blog-filter__bar {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .series-parts__grid {
        grid-template-columns: 1fr;
    }

    .series-part-card__thumb {
        height: 170px;
    }

    .post-series-nav {
        padding: 1.15rem 1.2rem;
    }

    .post-series-nav__actions {
        grid-template-columns: 1fr;
    }

    .blog-filter__pills {
        overflow-x: auto;
        width: 100%;
    }

    .post-card--compact {
        max-width: 100%;
        min-width: 0;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    /* Footer adjustments */
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }

    .about-layout {
        gap: var(--spacing-lg);
    }

    .about-section,
    .about-section-with-bg .section-inner,
    .about-highlight-card {
        padding: var(--spacing-md);
    }

    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-hero-section {
        background-attachment: scroll;
    }

    .resume-hero {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .resume-motion--left,
    .resume-motion--right {
        transform: translate3d(0, 24px, 0);
    }

    .section-content,
    .resume-intro {
        padding: var(--spacing-lg);
    }

    .resume-iframe {
        min-height: 280px;
    }

    .resume-iframe.education-iframe {
        min-height: 520px;
    }

    .publication-card {
        min-width: 0;
        width: 100%;
    }

    .interests-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .publication-iframe {
        min-height: 680px;
    }

    .post-title {
        font-size: 2.2rem;
    }

    .post-summary {
        font-size: 1rem;
    }

    .projects-frame {
        min-height: 620px;
    }

    .publications-scroll-container {
        flex-direction: column;
        overflow-x: visible;
        padding-bottom: 0;
        gap: var(--spacing-md);
    }

    .projects-grid,
    .projects-embed-container {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: var(--spacing-md);
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .hero-section.home-hero {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .hero-inner {
        margin: clamp(1.5rem, 8vw, 2.5rem) auto;
        padding: clamp(1.5rem, 6vw, 2.5rem);
        border-radius: 22px;
    }

    .hero-photo-wrapper::before {
        width: clamp(220px, 64vw, 300px);
        height: clamp(280px, 70vw, 340px);
    }

    .hero-photo {
        width: clamp(190px, 68vw, 240px);
    }

    .about-hero-section {
        min-height: 40vh;
        background-attachment: scroll;
    }

    .about-hero-overlay {
        padding: clamp(2.2rem, 8vw, 3rem) 0;
    }
}

/* Smaller mobile devices */
@media (max-width: 480px) {
    .newsletter-title {
        font-size: 1.8rem;
    }
    .section-title {
        font-size: 1.8rem;
    }
    
    .post-content {
        padding: 1rem;
    }

    .post-title {
        font-size: 1.2rem;
    }

    .photo-gallery {
        grid-template-columns: 1fr;
    }

    .interests-grid {
        grid-template-columns: 1fr;
    }

    .publication-card {
        min-width: 240px;
    }

    .publication-thumb img {
        height: 180px;
    }

    .resume-iframe {
        min-height: 240px;
    }

    .resume-iframe.education-iframe {
        min-height: 400px;
    }

    .skills-showcase {
        gap: var(--spacing-md);
    }

    .skill-card {
        padding: var(--spacing-md);
    }

    .about-hero-subtitle {
        font-size: 1rem;
    }

    .publication-iframe {
        min-height: 520px;
    }

    .single-post-meta {
        font-size: 0.85rem;
    }

    .post-title {
        font-size: 1.8rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .blog-hero__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .series-strip__scroller,
    .category-row__items {
        grid-auto-columns: minmax(180px, 210px);
    }
}

/* Print styles */
@media print {
    .site-header,
    .newsletter-section,
    .site-footer {
        display: none;
    }
    
    .hero-section {
        min-height: auto;
        padding: 1rem 0;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .post-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .post-card {
        border: 2px solid var(--primary-black);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .post-card:hover {
        transform: none;
    }
    
    .post-card:hover .post-thumbnail img {
        transform: none;
    }
}
