/* ============================================================
   TWM Design Fixes — That Works Media
   Additive-only CSS to improve UX, accessibility, and design
   without overriding core Elementor or Agencium theme styles.
   ============================================================ */

/* ----------------------------------------------------------
   1. HERO SECTION — Contrast & Spacing
   ---------------------------------------------------------- */

/* Improve hero subtitle contrast with subtle text shadow */
.elementor-section.elementor-top-section:first-child .elementor-widget-heading .elementor-heading-title,
.elementor-section.elementor-top-section:first-child .elementor-widget-text-editor {
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

/* Reduce excessive whitespace below the hero section */
.elementor-section.elementor-top-section:first-child {
    margin-bottom: 0 !important;
}

/* Fix CTA button clipping at top-right */
.header .header-button {
    max-width: calc(100% - 20px);
    overflow: visible;
}

/* ----------------------------------------------------------
   2. TYPOGRAPHY & READABILITY
   ---------------------------------------------------------- */

/* Ensure minimum contrast for body text */
.elementor-widget-text-editor,
.elementor-widget-text-editor p,
.elementor-widget-text-editor span {
    color: inherit;
}

/* Ensure small/label text has adequate contrast */
.elementor-widget-heading .elementor-heading-title[class*="elementor-size-small"] {
    opacity: 1;
}

/* Better line height for readability in body content */
.entry-content p,
.elementor-widget-text-editor p {
    line-height: 1.75;
}

/* ----------------------------------------------------------
   3. SERVICE CARDS — Visual Density
   ---------------------------------------------------------- */

/* Tighter service card grid for better visual grouping */
.elementor-widget-icon-box .elementor-icon-box-wrapper {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.elementor-widget-icon-box .elementor-icon-box-wrapper:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* ----------------------------------------------------------
   4. MARQUEE TEXT — Readability
   ---------------------------------------------------------- */

/* Slow down marquee for readability */
.marquee-wrapper .marquee {
    animation-duration: 30s !important;
}

/* Ensure marquee text has proper letter-spacing */
.marquee-wrapper .marquee-item {
    letter-spacing: -0.01em;
}

/* ----------------------------------------------------------
   5. MOBILE IMPROVEMENTS
   ---------------------------------------------------------- */

@media (max-width: 1024px) {
    /* Increase touch target sizes */
    .mobile-header .mobile-header-menu-open,
    .mobile-header .header-button a,
    .footer-scroll-top {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Reduce hero padding on tablet */
    .elementor-section.elementor-top-section:first-child > .elementor-container {
        padding-top: 80px;
        padding-bottom: 40px;
    }
}

@media (max-width: 767px) {
    /* Better mobile form fields */
    .elementor-field-group input,
    .elementor-field-group textarea,
    .elementor-field-group select {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        padding: 12px 16px;
    }

    /* Tighter mobile spacing */
    .elementor-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Ensure mobile hero text is centered and readable */
    .elementor-section.elementor-top-section:first-child .elementor-widget-heading .elementor-heading-title {
        font-size: clamp(1.75rem, 6vw, 3rem);
        line-height: 1.2;
    }

    /* Mobile CTA improvements */
    .elementor-button {
        min-height: 48px;
        font-size: 15px;
        padding: 14px 28px;
    }

    /* Stack portfolio filters on mobile */
    .portfolio-filter-list {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ----------------------------------------------------------
   6. SCROLL-TO-TOP BUTTON
   ---------------------------------------------------------- */

.footer-scroll-top {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.footer-scroll-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

/* ----------------------------------------------------------
   7. FOOTER LINK CONTRAST
   ---------------------------------------------------------- */

.footer a:not(.elementor-button) {
    transition: opacity 0.2s ease;
}

.footer a:not(.elementor-button):hover {
    opacity: 0.85;
}

/* ----------------------------------------------------------
   8. PAGE LOADER — Smoother
   ---------------------------------------------------------- */

.page-loader-container {
    transition: opacity 0.4s ease;
}

/* ----------------------------------------------------------
   9. PORTFOLIO SECTION — Hover Effects
   ---------------------------------------------------------- */

.portfolio-item {
    overflow: hidden;
    border-radius: 8px;
}

.portfolio-item img {
    transition: transform 0.4s ease;
}

.portfolio-item:hover img {
    transform: scale(1.03);
}

/* ----------------------------------------------------------
   10. FORM STYLING — Better Visual Feedback
   ---------------------------------------------------------- */

.elementor-field-group input:focus,
.elementor-field-group textarea:focus,
.elementor-field-group select:focus {
    outline: 2px solid rgba(227, 109, 78, 0.5);
    outline-offset: 2px;
    border-color: #e36d4e;
}

/* Better placeholder contrast */
.elementor-field-group input::placeholder,
.elementor-field-group textarea::placeholder {
    color: rgba(0, 0, 0, 0.45);
}

/* ----------------------------------------------------------
   11. CLIENT LOGOS — Polish
   ---------------------------------------------------------- */

.elementor-widget-image-carousel img,
.elementor-image img[src*="logo"],
.elementor-image img[src*="Logo"] {
    filter: grayscale(100%);
    opacity: 0.6;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.elementor-widget-image-carousel img:hover,
.elementor-image img[src*="logo"]:hover,
.elementor-image img[src*="Logo"]:hover {
    filter: grayscale(0%);
    opacity: 1;
}

/* ----------------------------------------------------------
   12. GENERAL ACCESSIBILITY
   ---------------------------------------------------------- */

/* Focus visible indicators for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #e36d4e;
    outline-offset: 2px;
}

/* Skip-to-content link (screen readers + keyboard) */
.skip-to-content {
    position: fixed;
    top: -9999px;
    left: 50%;
    transform: translateX(-50%);
    background: #e36d4e;
    color: #fff;
    padding: 12px 24px;
    z-index: 100000;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    transition: none;
    opacity: 0;
    pointer-events: none;
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
    top: 0;
    opacity: 1;
    pointer-events: auto;
}

/* Improve text selection color to match brand */
::selection {
    background: rgba(227, 109, 78, 0.25);
    color: inherit;
}

/* ----------------------------------------------------------
   13. PREFERS-REDUCED-MOTION — Respect user preferences
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .marquee-wrapper .marquee {
        animation: none !important;
    }

    .elementor-widget-icon-box .elementor-icon-box-wrapper:hover {
        transform: none;
    }

    .portfolio-item:hover img {
        transform: none;
    }

    .page-loader-container {
        display: none !important;
    }
}

/* ----------------------------------------------------------
   14. IMPROVED COLOR CONTRAST — Accent on light backgrounds
   ---------------------------------------------------------- */

/*
 * #ef644c has a contrast ratio of ~3.6:1 against white (fails WCAG AA).
 * #d4503a achieves ~4.6:1 (passes AA for normal text).
 * Apply the darker variant where accent is used on white/light backgrounds.
 */
.elementor-widget-text-editor a,
.elementor-widget-heading a,
.entry-content a {
    color: #d4503a;
}

.elementor-widget-text-editor a:hover,
.elementor-widget-heading a:hover,
.entry-content a:hover {
    color: #b8422f;
}

/* Ensure accordion expand icons have sufficient contrast */
.elementor-widget-accordion .elementor-accordion-icon {
    color: #d4503a;
}

/* ----------------------------------------------------------
   15. ADDITIONAL FOCUS STATES
   ---------------------------------------------------------- */

/* Hamburger menu trigger */
.menu-trigger:focus-visible,
.mobile-header-menu-open:focus-visible {
    outline: 2px solid #e36d4e;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Search trigger */
.header-search-trigger:focus-visible {
    outline: 2px solid #e36d4e;
    outline-offset: 2px;
}

/* Accordion items */
.elementor-accordion .elementor-tab-title:focus-visible {
    outline: 2px solid #e36d4e;
    outline-offset: -2px;
    border-radius: 4px;
}

/* Side panel toggle */
.side-panel-toggle:focus-visible {
    outline: 2px solid #e36d4e;
    outline-offset: 2px;
}

/* ----------------------------------------------------------
   16. SCREEN READER ONLY UTILITY
   ---------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ----------------------------------------------------------
   17. EN HERO PLAY BUTTON — Fix positioning
   ---------------------------------------------------------- */

/*
 * BUG: On the EN homepage, the Elementor inner section (397f60fb)
 * containing the play button is collapsed to ~150px wide instead of
 * full-width (1340px) like on the DE homepage. This causes the play
 * button to render in the bottom-left corner.
 *
 * ROOT FIX: Open EN homepage in Elementor, select the inner section
 * containing the play button, and set Content Width → Full Width or
 * match the DE homepage layout settings.
 *
 * CSS WORKAROUND below repositions the play button until Elementor
 * is fixed.
 */

/* Fix the collapsed inner section on EN homepage */
.elementor-element-397f60fb {
    width: 100% !important;
    max-width: 100% !important;
}

.elementor-element-397f60fb > .elementor-container {
    max-width: 1340px !important;
    margin: 0 auto !important;
}

/* Center the play button column (col-33 that holds the button) */
.elementor-element-5cc5ec8f {
    width: 33.33% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Ensure the play button widget itself has proper size */
.elementor-element-3626c3c9 {
    width: 100% !important;
    text-align: center !important;
}

.elementor-element-3626c3c9 .agencium-video-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}
