/*
 * RMY Grup - mobile responsive layer.
 * Loaded after the per-page bundle (css/bundle/<slug>.css, see tools/build-assets.py), so it is
 * the place for hand written overrides of the Elementor export. Everything is scoped to small
 * screens; the desktop layout is not touched.
 *
 * Why this exists: on phones every page mixed side gutters of 0, 5, 10, 20, 40, 50 and 60px
 * (desktop margins and paddings copied from the Elementor widgets), the hamburger button sat on
 * top of the page content and the header took a third of the screen. The rules below give the
 * whole site one gutter, one rhythm and a compact header.
 */

@media (max-width: 767px) {
    :root {
        --rmy-gutter: 20px;
        --rmy-gap: 28px;
    }

    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    html,
    body {
        overflow-x: clip;
    }

    img,
    video {
        max-width: 100%;
        height: auto;
    }

    iframe,
    embed,
    object {
        max-width: 100%;
    }

    /* ---------------------------------------------------------------- gutters */

    /* Widgets copied desktop side margins (50-60px) that squeeze headings into a narrow strip. */
    .elementor-widget-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Some sections add their own side padding (22px on the contact page); the columns below own the gutter. */
    .elementor-top-section {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* One side gutter for every top level column; sections keep their own full width backgrounds. */
    .elementor-top-section > .elementor-container > .elementor-column > .elementor-widget-wrap {
        padding-left: var(--rmy-gutter) !important;
        padding-right: var(--rmy-gutter) !important;
    }

    /* The gutter is already applied by the parent column. */
    .elementor-inner-section > .elementor-container > .elementor-column > .elementor-widget-wrap,
    .elementor-inner-section > .elementor-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .elementor-inner-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* The hero slider runs edge to edge. */
    .elementor-top-section:has(.owl-carousel) > .elementor-container > .elementor-column > .elementor-widget-wrap {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* ------------------------------------------------------------- typography */

    .elementor-heading-title,
    .entry-title,
    .elementor-widget-text-editor,
    .elementor-icon-list-text {
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    /* Body copy was 21px in some sections and 16px in others; one size on phones. */
    .elementor-widget-text-editor {
        font-size: 1rem !important;
        line-height: 1.65;
    }

    .elementor-widget-text-editor h1 {
        font-size: clamp(1.75rem, 8vw, 2.25rem) !important;
        line-height: 1.2;
        margin-bottom: 0.5em;
    }

    .elementor-widget-text-editor h2 {
        font-size: clamp(1.5rem, 6.5vw, 2rem) !important;
        line-height: 1.25;
    }

    .elementor-widget-heading h1.elementor-heading-title {
        font-size: clamp(1.75rem, 8vw, 2.25rem) !important;
        line-height: 1.2;
    }

    .elementor-widget-heading h2.elementor-heading-title {
        font-size: clamp(1.5rem, 6.5vw, 2rem) !important;
        line-height: 1.25;
    }

    /* ----------------------------------------------------------------- header */

    /* Green strip: tagline, "Bize Ulasin" and the contact lines, centred and compact. */
    #masthead .elementor-top-section:first-of-type .elementor-widget-wrap {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
        justify-content: center;
        text-align: center;
    }

    #masthead .elementor-top-section:first-of-type .elementor-heading-title {
        margin: 0;
    }

    #masthead .elementor-top-section:first-of-type h3.elementor-heading-title {
        font-size: 1.35rem !important;
        line-height: 1.25;
    }

    #masthead .elementor-top-section:first-of-type h2.elementor-heading-title {
        font-size: 1.05rem !important;
    }

    #masthead .sina-direct-contact {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Logo row: logo centred, hamburger on the right edge instead of floating over the content. */
    #masthead .elementor-top-section:nth-of-type(2) {
        position: relative;
    }

    #masthead .elementor-top-section:nth-of-type(2) .elementor-col-33 .elementor-widget-wrap {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    #masthead .custom-logo,
    #masthead .elementor-widget-theme-site-logo img,
    #masthead .elementor-widget-image img {
        max-height: 84px;
        width: auto;
        margin-left: auto;
        margin-right: auto;
    }

    #masthead .elementor-top-section:nth-of-type(2) .elementor-col-66 {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: auto !important;
    }

    #masthead .elementor-top-section:nth-of-type(2) .elementor-col-66 > .elementor-widget-wrap {
        height: 100%;
        padding: 0 !important;
        align-items: center;
    }

    #masthead .sina-ext-nav-toggle {
        position: static !important;
        margin-right: var(--rmy-gutter);
    }

    /* Slide-out menu: 12px links were hard to read on a phone. */
    .sina-ext-nav-collapse .sina-ext-menu a {
        font-size: 15px !important;
    }

    /* ----------------------------------------------------------------- footer */

    /* The footer menu button floated over the footer heading; keep it in the flow, centred. */
    footer .sina-ext-nav-mobile-sidebar {
        display: flex;
        justify-content: center;
    }

    footer .sina-ext-nav-toggle {
        position: static !important;
        margin: 8px auto 4px;
    }

    .sina-visit-counter {
        text-align: center;
    }

    /* Dark red on the green footer is unreadable. */
    .sina-visit-counter .sina-visit-number {
        color: #ffe08a;
        font-weight: 700;
        margin-left: 6px;
    }

    /* Keep the copyright line clear of the fixed "back to top" button. */
    .elementor-widget-copyright {
        padding-bottom: 56px;
    }

    .elementor-widget-copyright a {
        display: inline-block;
        padding: 9px 0;
    }

    /* --------------------------------------------------------- touch targets */

    .wpcf7-submit,
    .elementor-button,
    .sina-banner-pbtn {
        min-height: 44px;
    }

    .elementor-icon-list-items .elementor-icon-list-item > a {
        padding-top: 6px;
        padding-bottom: 6px;
    }

    /* ------------------------------------------------------------------ forms */

    .wpcf7-form-control-wrap {
        display: block;
    }

    .wpcf7-form input[type="text"],
    .wpcf7-form input[type="email"],
    .wpcf7-form input[type="tel"],
    .wpcf7-form textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px;
    }

    /* The form widget shrank to its content and its fields touched the edge of the tinted card. */
    .elementor-widget-eael-contact-form-7 {
        width: 100% !important;
        max-width: 100% !important;
    }

    .eael-contact-form.eael-contact-form-7 {
        box-sizing: border-box;
        padding: 20px;
        border-radius: 8px;
    }

    .wpcf7-form p {
        margin-bottom: 14px;
    }

    .wpcf7-form .wpcf7-submit {
        width: 100% !important;
        margin: 4px 0 0;
        border: 0;
        border-radius: 6px;
        background: #f60;
        color: #fff;
        font-weight: 600;
        cursor: pointer;
    }

    /* ---------------------------------------------------------------- overlays */

    .sgpb-popup-dialog-main-div-wrapper {
        max-width: calc(100vw - 24px) !important;
    }

    .joinchat__chatbox {
        max-width: calc(100vw - 24px);
    }
}

/*
 * Mobile / tablet menu (the script switches to click mode at 1024px and below).
 * sina-widgets.js toggles both the "in" (zoomInDown) and "out" (rollOut) animation classes
 * on every click, so the rollOut animation ends at opacity 0 and the opened submenu stayed
 * invisible. Plain open/close instead: no animation, no fade.
 */
@media (max-width: 1024px) {
    .sina-ext-nav .sina-ext-menu .sub-menu,
    .sina-ext-nav .sina-ext-menu .sub-menu.animated {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
    }
}
