/*
 * TechKaiju — techkaiju-mobile-fixes.css
 * Place in: /wp-content/themes/storex-child/techkaiju-mobile-fixes.css
 *
 * PURPOSE: Targeted mobile patches for issues visible in screenshots.
 * Enqueued separately so it loads AFTER style.css and overrides cleanly.
 *
 * ISSUES FIXED:
 *  1. Hero text overflowing horizontally on small screens
 *  2. Hero eyebrow wrapping across 2 lines awkwardly
 *  3. CTA buttons overflowing viewport width
 *  4. Spec chips overflowing their pill container
 *  5. Brand card logos not loading (CSS fallback polish)
 *  6. Footer description text invisible (dark-on-dark)
 *  7. Device card single-column on very small screens
 *  8. Header search hidden but compare icon overlapping hamburger
 *  9. Hero section horizontal scroll bug
 * 10. Mobile menu z-index / full-width fix
 */

/* ============================================================
   GLOBAL OVERFLOW PREVENTION
   ============================================================ */

html, body {
    overflow-x: hidden !important;
    max-width: 100vw;
}

.tk-hero,
.tk-hero__inner,
.tk-hero__content,
.tk-container {
    overflow-x: hidden;
    max-width: 100%;
}

/* ============================================================
   1. HERO — TEXT OVERFLOW FIX
   ============================================================ */

/* Eyebrow: stop it wrapping mid-word */
.tk-hero__eyebrow {
    font-size: 10px !important;
    letter-spacing: 0.8px !important;
    flex-wrap: wrap;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
}

/* Hero title: scale more aggressively on tiny screens */
.tk-hero__title {
    font-size: clamp(26px, 8vw, 52px) !important;
    letter-spacing: -0.5px !important;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* Hero subtitle: tighten font on mobile */
.tk-hero__subtitle {
    font-size: 14px !important;
    line-height: 1.6 !important;
    max-width: 100%;
}

/* Hero inner: single column, no grid on mobile */
.tk-hero__inner {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 40px 0 28px !important;
}

/* Hide decorative hero image on mobile — saves space */
.tk-hero__image {
    display: none !important;
}

/* ============================================================
   2. HERO SEARCH BAR — MOBILE FIX
   ============================================================ */

.tk-hero-search {
    max-width: 100% !important;
    width: 100% !important;
    flex-direction: row;
    border-radius: 12px !important;
}

.tk-hero-search input {
    width: 100%;
    min-width: 0;          /* prevents flex overflow */
    font-size: 14px !important;
    padding: 14px 14px !important;
}

.tk-hero-search button {
    padding: 14px 16px !important;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px !important;
}

/* ============================================================
   3. CTA BUTTONS — PREVENT OVERFLOW
   ============================================================ */

.tk-hero__ctas {
    flex-direction: column !important;
    gap: 10px !important;
    width: 100%;
}

.tk-hero__ctas .tk-btn {
    width: 100% !important;
    justify-content: center !important;
    font-size: 15px !important;
    padding: 14px 20px !important;
}

/* ============================================================
   4. SPEC CHIPS — OVERFLOW TEXT FIX
   This is the biggest visual bug: long chipset names
   overflow the rounded pill badge.
   ============================================================ */

.tk-spec-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: calc(100% - 4px);  /* stay within card */
    vertical-align: middle;
}

/* Device card specs row: allow wrapping but prevent overflow */
.tk-device-card__specs {
    flex-wrap: wrap;
    gap: 4px !important;
    overflow: hidden;
    max-width: 100%;
}

/* Chipset specifically tends to be very long — truncate after 1 line */
.tk-device-card__specs .tk-spec-chip:first-child {
    max-width: 100%;          /* chipset gets full width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   5. BRAND CARDS — BROKEN IMAGE FALLBACK POLISH
   ============================================================ */

/* When img tag src fails to load (broken logo URL),
   the alt text shows raw. This hides the broken img icon
   and shows a styled letter avatar instead. */

.tk-brand-card__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #0a2463, #2563eb);
    color: #fff;
    font-family: var(--tk-font-display, 'Syne', sans-serif);
    font-size: 22px;
    font-weight: 800;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    overflow: hidden;
    object-fit: contain;
}

/* Real images: reset the flex centering so they display normally */
img.tk-brand-card__logo {
    background: transparent;
    display: block;
    object-fit: contain;
}

/* Broken image: hide the broken icon, show background */
img.tk-brand-card__logo:not([src]),
img.tk-brand-card__logo[src=""],
img.tk-brand-card__logo:-moz-broken {
    color: transparent;
}

/* Brand grid: 3 cols on mobile (as seen in screenshots — looks OK) */
.tk-brand-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
}

.tk-brand-card {
    padding: 14px 10px !important;
    gap: 8px !important;
}

.tk-brand-card__name {
    font-size: 12px !important;
    line-height: 1.2;
}

/* ============================================================
   6. FOOTER — VISIBILITY FIX
   ============================================================ */

/* Footer description was dark text on dark background */
.tk-footer__desc {
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 13px !important;
    line-height: 1.65 !important;
}

/* Footer logo name text */
.tk-footer__logo-name {
    color: #ffffff !important;
}

/* Footer quick links headings */
.tk-footer__col h4 {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Footer links */
.tk-footer__col ul li a {
    color: rgba(255, 255, 255, 0.65) !important;
}

/* Footer copyright */
.tk-footer__copyright {
    color: rgba(255, 255, 255, 0.45) !important;
}

/* Mobile: stack footer columns nicely */
@media (max-width: 768px) {
    .tk-footer__grid {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
        padding-bottom: 32px !important;
    }

    .tk-footer__desc {
        max-width: 100% !important;
    }

    .tk-footer__social {
        margin-bottom: 4px;
    }

    .tk-footer__bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 10px !important;
        padding: 16px 0 !important;
    }

    .tk-footer__bottom-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px !important;
    }
}

/* ============================================================
   7. DEVICE CARDS — MOBILE LAYOUT
   ============================================================ */

@media (max-width: 768px) {
    /* 2 columns on most mobiles */
    .tk-device-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .tk-device-card__img {
        min-height: 120px !important;
        padding: 14px !important;
    }

    .tk-device-card__img img {
        max-height: 100px !important;
    }

    .tk-device-card__body {
        padding: 12px !important;
        gap: 4px !important;
    }

    .tk-device-card__title {
        font-size: 13px !important;
        line-height: 1.25 !important;
    }

    .tk-device-card__brand {
        font-size: 10px !important;
    }

    .tk-device-card__price {
        font-size: 14px !important;
    }

    .tk-device-card__price--announced {
        font-size: 10px !important;
        display: block;
    }

    .tk-device-card__footer {
        padding: 0 10px 10px !important;
        gap: 6px !important;
    }

    .tk-device-card__footer .tk-btn {
        font-size: 11px !important;
        padding: 6px 10px !important;
    }
}

@media (max-width: 380px) {
    /* Very small screens: still 2 cols but tighter */
    .tk-device-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
}

/* ============================================================
   8. HEADER — MOBILE ICON SPACING
   ============================================================ */

@media (max-width: 768px) {
    .tk-header__inner {
        padding: 0 !important;
        gap: 0 !important;
    }

    .tk-header__actions {
        gap: 4px !important;
        margin-left: auto;
    }

    /* Compare icon + hamburger don't overlap */
    .tk-header-icon-btn {
        width: 34px !important;
        height: 34px !important;
    }

    .tk-hamburger {
        padding: 6px 4px !important;
    }

    /* Logo: reduce size on mobile */
    .tk-logo {
        margin-right: 8px !important;
    }

    .tk-logo img,
    .tk-logo .custom-logo {
        height: 36px !important;
        width: auto !important;
    }

    .tk-logo__name {
        font-size: 15px !important;
    }

    .tk-logo__tagline {
        font-size: 9px !important;
    }
}

/* ============================================================
   9. MOBILE MENU — FULL WIDTH + Z-INDEX
   ============================================================ */

.tk-mobile-menu {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}

/* Mobile menu links: comfortable tap targets */
.tk-mobile-menu a {
    padding: 13px 16px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
    min-height: 44px;           /* accessibility: min tap target */
    display: flex !important;
    align-items: center;
}

/* ============================================================
   10. NEWSLETTER — MOBILE STACK
   ============================================================ */

@media (max-width: 768px) {
    .tk-newsletter {
        padding: 40px 0 !important;
    }

    .tk-newsletter__inner {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        text-align: center;
    }

    .tk-newsletter__text h2 {
        font-size: 20px !important;
    }

    .tk-newsletter__text p {
        font-size: 14px !important;
    }

    .tk-newsletter__form {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .tk-newsletter__form input,
    .tk-newsletter__form button {
        width: 100% !important;
        border-radius: 10px !important;
    }
}

/* ============================================================
   11. SECTION HEADERS — PREVENT OVERFLOW
   ============================================================ */

.tk-section-header {
    gap: 8px !important;
    flex-wrap: wrap !important;
}

.tk-section-title {
    font-size: clamp(18px, 4.5vw, 26px) !important;
    overflow-wrap: break-word;
    word-break: break-word;
}

.tk-view-all {
    font-size: 13px !important;
    white-space: nowrap;
}

/* ============================================================
   12. ARCHIVE PAGE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .tk-archive-hero {
        padding: 28px 0 !important;
    }

    .tk-archive-hero h1 {
        font-size: clamp(22px, 6vw, 32px) !important;
        word-break: break-word;
    }

    .tk-results-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 10px 12px !important;
    }

    .tk-results-bar__sort {
        width: 100%;
        justify-content: space-between;
    }

    .tk-mobile-filter-toggle {
        display: flex !important;
    }
}

/* ============================================================
   13. SINGLE DEVICE PAGE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .tk-device-hero {
        grid-template-columns: 1fr !important;
        padding: 16px !important;
        gap: 16px !important;
        border-radius: 16px !important;
    }

    .tk-device-hero__title {
        font-size: clamp(20px, 5.5vw, 28px) !important;
        letter-spacing: -0.3px !important;
    }

    .tk-device-hero__meta {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .tk-device-hero__meta-item {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }

    .tk-quick-specs {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .tk-quick-spec-item {
        padding: 10px 12px !important;
    }

    .tk-quick-spec-item__value {
        font-size: 13px !important;
    }

    .tk-specs-table td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .tk-spec-label {
        width: 38% !important;
        font-size: 12px !important;
    }

    .tk-spec-value {
        width: 62% !important;
        font-size: 13px !important;
        word-break: break-word;
    }

    .tk-specs-section-title {
        font-size: 12px !important;
        padding: 12px 14px !important;
    }

    /* Bottom CTA */
    .tk-bottom-cta__inner {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }

    .tk-bottom-cta__actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px !important;
    }

    .tk-bottom-cta__actions .tk-btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        font-size: 13px !important;
    }
}

/* ============================================================
   14. COMPARE PAGE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .tk-compare-search-wrap {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .tk-compare-device-slot {
        padding: 20px !important;
    }

    .tk-compare-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .tk-compare-table th,
    .tk-compare-table td {
        padding: 10px 12px !important;
        font-size: 13px !important;
        min-width: 120px;
    }

    .tk-compare-table th:first-child {
        min-width: 100px !important;
        width: 100px !important;
    }

    /* Buy CTA row */
    .tk-compare-page div[style*="grid-template-columns:1fr 1fr"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }
}

/* ============================================================
   15. COMPARE BAR — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .tk-compare-bar {
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 12px 16px !important;
    }

    .tk-compare-bar__devices {
        flex-direction: column !important;
        gap: 8px !important;
        width: 100%;
    }

    .tk-compare-slot {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 12px !important;
    }

    #tkGoCompare {
        width: 100%;
        justify-content: center !important;
    }
}

/* ============================================================
   16. FILTER PANEL — MOBILE SLIDE-UP
   ============================================================ */

.tk-filter-panel {
    padding: 20px 16px !important;
}

.tk-pill {
    font-size: 12px !important;
    padding: 5px 10px !important;
}

/* ============================================================
   17. HERO STATS — HORIZONTAL SCROLL PREVENTION
   ============================================================ */

@media (max-width: 480px) {
    .tk-hero-stats {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 16px !important;
        padding: 20px 0 !important;
    }

    .tk-hero-stat__number {
        font-size: 22px !important;
    }

    .tk-hero-stat__label {
        font-size: 10px !important;
    }
}

/* ============================================================
   18. BREADCRUMBS — MOBILE WRAP
   ============================================================ */

.tk-breadcrumb {
    flex-wrap: wrap !important;
    gap: 4px !important;
    font-size: 12px !important;
    margin-bottom: 20px !important;
}

.tk-breadcrumb span,
.tk-breadcrumb a {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   19. NEWS CARDS — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .tk-news-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .tk-news-card__title {
        font-size: 14px !important;
    }
}

/* ============================================================
   20. GLOBAL CONTAINER PADDING CONSISTENCY
   ============================================================ */

@media (max-width: 768px) {
    .tk-container {
        padding: 0 14px !important;
    }

    .tk-section {
        padding: 40px 0 !important;
    }

    .tk-section--lg {
        padding: 52px 0 !important;
    }
}

@media (max-width: 380px) {
    .tk-container {
        padding: 0 12px !important;
    }
}

/* ============================================================
   21. TAP TARGET SIZES — ACCESSIBILITY
   All interactive elements: min 44×44px tap area
   ============================================================ */

.tk-btn,
.tk-brand-card,
.tk-pill,
.tk-header-icon-btn,
.tk-hamburger {
    min-height: 44px;
}

.tk-brand-card {
    min-height: auto; /* brand cards can be shorter */
}

/* ============================================================
   22. STORE LINKS — SINGLE DEVICE — MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .tk-store-link {
        padding: 10px 12px !important;
        gap: 8px !important;
    }

    .tk-store-link__logo {
        width: 48px !important;
        height: 20px !important;
    }

    .tk-store-link__action {
        font-size: 11px !important;
    }
}
