/**
 * Public last-layer mobile/tablet polish.
 * Desktop (≥1025px) is untouched. Do not change JS hooks or layout IDs.
 */

@media (max-width: 1024px) {
    html {
        max-width: 100%;
    }

    body {
        max-width: 100%;
        overscroll-behavior-x: none;
    }

    img,
    video,
    canvas,
    svg {
        max-width: 100%;
    }

    img,
    video {
        height: auto;
    }

    iframe {
        max-width: 100%;
    }

    /* Ölçekli tema mock iframe'leri (375→%50) %100 ile yarım ekran kalmasın */
    .frame-wrapper iframe {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .profile-container,
    .profile-hero,
    .profile-header,
    .links-container,
    .cover-slider,
    .profile-bio {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .profile-header h1,
    .profile-name,
    .profile-username,
    .profile-bio,
    .link-item,
    .link-item span,
    .link-item .link-title {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .link-item {
        max-width: 100%;
        box-sizing: border-box;
    }

    nav.fixed-bottom-nav {
        left: max(12px, env(safe-area-inset-left, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        width: auto;
        max-width: calc(100% - 24px);
        box-sizing: border-box;
        padding-bottom: max(11px, env(safe-area-inset-bottom, 0px));
    }

    .modal.show,
    .modal[style*="display"] {
        max-width: 100vw;
        padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
        box-sizing: border-box;
    }

    .cover-slider img,
    .cover-slider__img,
    .profile-avatar {
        max-width: 100%;
        object-fit: cover;
    }

    input,
    select,
    textarea {
        max-width: 100%;
        font-size: 16px;
    }

    button,
    a.btn,
    .bottom-nav-item {
        min-height: 44px;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    .profile-bio {
        max-width: 100%;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

@media (max-width: 360px) {
    nav.fixed-bottom-nav {
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        max-width: calc(100% - 16px);
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    nav.fixed-bottom-nav {
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 768px) {
    .home-btn,
    .popup-close,
    .password-toggle,
    .bottom-nav-item,
    a.action-item {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }

    label:has(> input[type="checkbox"]),
    label:has(> input[type="radio"]),
    .checkbox-item,
    .checkbox-text {
        min-height: 44px;
    }

    .reset-container {
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
    }

    .home-btn {
        top: max(12px, env(safe-area-inset-top, 0px));
        left: max(12px, env(safe-area-inset-left, 0px));
    }

    .file-input-label,
    .submit-btn,
    .skip-btn,
    .back-home a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
        box-sizing: border-box;
    }

    .profile-form .form-input,
    .profile-form .form-textarea {
        font-size: 16px;
        min-height: 44px;
    }
}

@media (max-width: 1024px) and (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;
    }
}
