/**
 * Tech Unlock Hub Theme - Responsive Styles
 * Mobile-first approach
 *
 * @package TUH_Theme
 * @version 1.3.0
 */

/* ==========================================================================
   MOBILE MENU (shown only on mobile via JS toggle)
   ========================================================================== */

.tuh-mobile-menu {
    position: fixed;
    top: var(--tuh-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tuh-bg);
    z-index: var(--tuh-z-mobile-menu);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

/* Admin bar offset for mobile menu */
.admin-bar .tuh-mobile-menu {
    top: calc(var(--tuh-header-height) + 32px);
}

@media (max-width: 782px) {
    .admin-bar .tuh-mobile-menu {
        top: calc(var(--tuh-header-height) + 46px);
    }
}

.tuh-mobile-menu.active {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

.tuh-mobile-menu__inner {
    padding: 1.5rem;
}

.tuh-mobile-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tuh-mobile-nav li {
    list-style: none;
}

.tuh-mobile-nav a {
    display: block;
    padding: 0.875rem 1rem;
    font-size: var(--tuh-font-size-lg);
    font-weight: 500;
    color: var(--tuh-text);
    border-radius: var(--tuh-radius);
    transition: all var(--tuh-transition);
    text-decoration: none;
}

.tuh-mobile-nav a:hover,
.tuh-mobile-nav .current-menu-item > a {
    background: var(--tuh-primary-light);
    color: var(--tuh-primary);
}

/* Mobile submenu - indent child items */
.tuh-mobile-nav .sub-menu {
    padding-left: 1rem;
    border-left: 2px solid var(--tuh-primary-light);
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.tuh-mobile-nav .sub-menu a {
    font-size: var(--tuh-font-size-base);
    padding: 0.625rem 1rem;
    color: var(--tuh-text-secondary);
}

.tuh-mobile-menu__cta {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--tuh-border);
}

/* ==========================================================================
   TOP BAR RESPONSIVE (v1.5.0)
   ========================================================================== */

@media (max-width: 768px) {
    .tuh-topbar__inner {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.375rem 0;
        text-align: center;
    }

    .tuh-topbar__left,
    .tuh-topbar__right {
        justify-content: center;
    }
}

/* ==========================================================================
   HEADER CTA RESPONSIVE (v1.5.0)
   ========================================================================== */

@media (max-width: 768px) {
    .tuh-header__cta {
        display: none;
    }
}

/* ==========================================================================
   MOBILE MENU STYLES (v1.5.0)
   ========================================================================== */

.tuh-mobile-menu--slide-left {
    transform: translateX(-100%);
}

.tuh-mobile-menu--slide-left.active {
    transform: translateX(0);
}

.tuh-mobile-menu--fullscreen {
    transform: none;
    opacity: 0;
    top: 0;
    z-index: var(--tuh-z-modal);
    background: var(--tuh-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tuh-mobile-menu--fullscreen.active {
    opacity: 1;
}

.tuh-mobile-menu--fullscreen .tuh-mobile-nav a {
    font-size: var(--tuh-font-size-2xl);
    padding: 1rem;
}

.tuh-mobile-menu--dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    bottom: auto;
    max-height: 60vh;
    overflow-y: auto;
    transform: translateY(-10px);
    box-shadow: var(--tuh-shadow-lg);
}

.tuh-mobile-menu--dropdown.active {
    transform: translateY(0);
}

/* ==========================================================================
   AUTHOR BOX RESPONSIVE (v1.5.0)
   ========================================================================== */

@media (max-width: 480px) {
    .tuh-author-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ==========================================================================
   POST NAVIGATION CARD STYLE (v1.5.0)
   ========================================================================== */

.tuh-post-nav--card {
    gap: 1rem;
}

.tuh-post-nav--card > div {
    flex: 1;
    padding: 1rem;
    border: 1px solid var(--tuh-border);
    border-radius: var(--tuh-radius);
    transition: all var(--tuh-transition);
}

.tuh-post-nav--card > div:hover {
    box-shadow: var(--tuh-shadow);
}

/* ==========================================================================
   FEATURED IMAGE STYLES (v1.5.0)
   ========================================================================== */

.tuh-featured-image--wide {
    width: 100%;
    max-width: none;
}

/* ==========================================================================
   PAYMENT METHODS GRID
   ========================================================================== */

.tuh-payments-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--tuh-gap);
    text-align: center;
}

.tuh-payment-method {
    background: var(--tuh-bg-card);
    border: 1px solid var(--tuh-border);
    border-radius: var(--tuh-radius-lg);
    padding: 2rem 1rem;
    transition: all var(--tuh-transition);
}

.tuh-payment-method:hover {
    transform: translateY(-2px);
    box-shadow: var(--tuh-shadow);
}

.tuh-payment-method__icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.tuh-payment-method h4 {
    font-size: var(--tuh-font-size-base);
    margin-bottom: 0.25rem;
}

.tuh-payment-method p {
    font-size: var(--tuh-font-size-xs);
    color: var(--tuh-text-muted);
}

/* ==========================================================================
   POST TAGS
   ========================================================================== */

.tuh-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tuh-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--tuh-primary-light);
    color: var(--tuh-primary);
    border-radius: var(--tuh-radius-full);
    font-size: var(--tuh-font-size-xs);
    font-weight: 500;
}

.tuh-tag a {
    color: inherit;
}

/* Featured image */
.tuh-featured-image {
    width: 100%;
    border-radius: var(--tuh-radius-lg);
}

/* ==========================================================================
   DESKTOP: Ensure horizontal nav list items are inline
   ========================================================================== */

.tuh-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.tuh-nav li {
    list-style: none;
    white-space: nowrap;
}

/* ==========================================================================
   BREAKPOINTS
   ========================================================================== */

/* Large desktop: > 1200px — all good by default */

/* Quick Links: hide on desktop where full nav is visible */
@media (min-width: 1025px) {
    .tuh-header__quick-links {
        display: none;
    }
}

/* Tablet and below: < 1024px */
@media (max-width: 1024px) {
    /* Hide desktop nav, show hamburger */
    .tuh-nav {
        display: none !important;
    }

    .tuh-menu-toggle {
        display: flex;
    }

    /* Hero: stack to single column */
    .tuh-hero__inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .tuh-hero__buttons {
        justify-content: center;
    }

    .tuh-hero__stats {
        justify-content: center;
    }

    .tuh-hero__image {
        order: -1;
    }

    .tuh-hero__image svg {
        max-width: 300px;
    }

    /* Services: 2 columns */
    .tuh-services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Steps: 2 columns */
    .tuh-steps {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Trust: 2 columns */
    .tuh-trust-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Footer: 2 columns, brand full width */
    .tuh-footer__grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--tuh-gap-lg);
    }

    .tuh-footer__brand {
        grid-column: 1 / -1;
        max-width: none;
    }

    /* Posts: 2 columns */
    .tuh-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    /* Payments: 3 columns */
    .tuh-payments-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Sidebar: collapse on tablet */
@media (max-width: 1024px) {
    .tuh-layout-sidebar {
        grid-template-columns: 1fr;
    }

    .tuh-sidebar--sticky {
        position: static;
    }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
    :root {
        --tuh-header-height: 60px;
        --tuh-gap-xl: 3rem;
    }

    /* Header */
    .tuh-header__logo {
        font-size: var(--tuh-font-size-base);
    }

    .tuh-header__logo img {
        height: 32px;
    }

    /* Hero */
    .tuh-hero {
        padding: 3rem 0;
        min-height: auto;
    }

    .tuh-hero__badge {
        font-size: var(--tuh-font-size-xs);
    }

    .tuh-hero__title {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    .tuh-hero__text {
        font-size: var(--tuh-font-size-base);
    }

    .tuh-hero__stats {
        flex-direction: row;
        gap: 1.5rem;
    }

    .tuh-hero__buttons {
        flex-direction: column;
        align-items: center;
    }

    .tuh-hero__buttons .tuh-btn {
        width: 100%;
        max-width: 300px;
    }

    /* Services: single column */
    .tuh-services-grid {
        grid-template-columns: 1fr;
    }

    /* Steps: single column */
    .tuh-steps {
        grid-template-columns: 1fr;
        gap: var(--tuh-gap);
    }

    /* Trust: 2x2 */
    .tuh-trust-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Footer: single column */
    .tuh-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--tuh-gap);
    }

    /* Posts: single column */
    .tuh-posts-grid {
        grid-template-columns: 1fr;
    }

    .tuh-grid--2,
    .tuh-grid--3,
    .tuh-grid--4 {
        grid-template-columns: 1fr;
    }

    /* Page header */
    .tuh-page-header {
        padding: 2rem 0;
    }

    .tuh-page-header h1 {
        font-size: var(--tuh-font-size-2xl);
    }

    /* Sections */
    .tuh-section {
        padding: 3rem 0;
    }

    .tuh-section__title {
        font-size: var(--tuh-font-size-2xl);
    }

    .tuh-section__subtitle {
        font-size: var(--tuh-font-size-base);
    }

    /* CTA */
    .tuh-cta {
        border-radius: var(--tuh-radius);
        padding: 2.5rem 1.5rem;
        margin-left: 1rem;
        margin-right: 1rem;
    }

    .tuh-cta h2 {
        font-size: var(--tuh-font-size-2xl);
    }

    .tuh-cta__buttons {
        flex-direction: column;
        align-items: center;
    }

    /* Search */
    .tuh-search-form {
        flex-direction: column;
    }

    /* Post nav */
    .tuh-post-nav {
        flex-direction: column;
        gap: 1rem;
    }

    /* Payments: 2 columns */
    .tuh-payments-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .tuh-payment-method {
        padding: 1.25rem 0.75rem;
    }

    .tuh-payment-method__icon {
        font-size: 2rem;
    }

    /* Footer bottom */
    .tuh-footer__bottom {
        flex-direction: column;
        text-align: center;
    }

    /* Payment bar in footer */
    .tuh-payments {
        flex-direction: column;
        gap: 1rem;
    }

    .tuh-payments__icons {
        justify-content: center;
    }

    /* Single post meta */
    .tuh-single-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Service cards: reduce padding */
    .tuh-service-card {
        padding: 1.5rem;
    }

    /* Blog post cards */
    .tuh-post-card__body {
        padding: 1rem;
    }

    /* Content area */
    .tuh-content__inner {
        padding: 0 0.5rem;
    }

    /* WooCommerce compatibility */
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Comments */
    .tuh-comment-form__row {
        grid-template-columns: 1fr;
    }

    .tuh-comments__list .children {
        padding-left: 1rem;
    }

    /* Search overlay */
    .tuh-search-overlay__input {
        font-size: var(--tuh-font-size-lg);
    }

    /* TOC */
    .tuh-toc {
        padding: 1rem;
    }
}

/* Small mobile: < 480px */
@media (max-width: 480px) {
    .tuh-container {
        padding: 0 0.75rem;
    }

    /* Hero stats */
    .tuh-hero__stats {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .tuh-hero__stat {
        flex: 1;
        min-width: 80px;
    }

    /* Trust section */
    .tuh-trust-item__number {
        font-size: var(--tuh-font-size-2xl);
    }

    /* 404 */
    .tuh-404__code {
        font-size: 5rem;
    }

    /* Payment grid: still 2 cols but tighter */
    .tuh-payments-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .tuh-payment-method {
        padding: 1rem 0.5rem;
    }

    .tuh-payment-method__icon {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .tuh-payment-method h4 {
        font-size: var(--tuh-font-size-sm);
    }

    /* Steps: tighter */
    .tuh-step {
        padding: 0 0.5rem;
    }

    /* WooCommerce: single column on tiny screens */
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
    }

    /* Blog cards: smaller image */
    .tuh-post-card__image {
        aspect-ratio: 16/10;
    }
}

/* ==========================================================================
   LANDSCAPE PHONE FIX
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .tuh-hero {
        padding: 2rem 0;
        min-height: auto;
    }

    .tuh-hero__image {
        display: none;
    }

    .tuh-hero__inner {
        grid-template-columns: 1fr;
    }

    .tuh-mobile-menu {
        top: var(--tuh-header-height);
    }
}

/* ==========================================================================
   TABLET PORTRAIT FIX (768px - 1024px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1024px) {
    .tuh-hero__image svg {
        max-width: 280px;
    }

    .tuh-service-card__text {
        font-size: var(--tuh-font-size-xs);
    }

    /* Footer: better spacing */
    .tuh-footer__grid {
        gap: var(--tuh-gap);
    }
}

/* ==========================================================================
   TOUCH DEVICE HELPERS
   ========================================================================== */

@media (hover: none) {
    /* On touch devices, dropdowns don't work on hover.
       Make parent links go to their URL directly.
       Submenu items are accessible via the mobile menu. */
    .tuh-nav .sub-menu {
        display: none !important;
    }

    .tuh-nav .menu-item-has-children > a::after {
        display: none;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .tuh-header,
    .tuh-footer,
    .tuh-dark-toggle,
    .tuh-menu-toggle,
    .tuh-mobile-menu,
    .tuh-hero__buttons,
    .tuh-cta,
    .tuh-live-chat-widget,
    .tuh-search-overlay,
    .tuh-lightbox,
    .tuh-scroll-top,
    .tuh-toc {
        display: none !important;
    }

    body {
        color: #000;
        background: #fff;
    }

    .tuh-content__inner {
        max-width: 100%;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
