/* Frimages 1.8.1 Mobile Web Bridge */

:root {
    --fi-mobile-header-height: 58px;
    --fi-mobile-nav-height: 66px;
    --fi-visual-height: 100svh;
}

html {
    min-width: 0;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--fi-mobile-header-height) + env(safe-area-inset-top));
}

body {
    min-width: 0;
    min-height: 100%;
    min-height: 100svh;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

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

[hidden] {
    display: none !important;
}

.fi-mobile-file-status {
    display: block;
    margin-top: 8px;
    overflow: hidden;
    color: var(--muted, #a4a4a4);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
    }

    body {
        padding-bottom: calc(var(--fi-mobile-nav-height) + env(safe-area-inset-bottom));
    }

    body.fi-keyboard-open {
        padding-bottom: 0;
    }

    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    .fi-app,
    .fi-app-shell,
    .fi-layout,
    .fi-main,
    main {
        min-width: 0;
        max-width: 100%;
    }

    .fi-sidebar,
    .fi-right-rail,
    .fi-secondary-rail,
    .fi-context-rail,
    .fi-desktop-only {
        display: none !important;
    }

    .fi-main {
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
    }

    .fi-mobile-header {
        position: sticky;
        top: 0;
        z-index: 900;
        display: flex !important;
        min-height: calc(var(--fi-mobile-header-height) + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
        padding-right: max(12px, env(safe-area-inset-right));
        padding-left: max(12px, env(safe-area-inset-left));
        background: #090909;
        border-bottom: 1px solid var(--border, #282828);
    }

    .fi-mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .fi-mobile-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1000;
        display: flex !important;
        align-items: stretch;
        width: 100%;
        min-height: calc(var(--fi-mobile-nav-height) + env(safe-area-inset-bottom));
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        overflow-x: auto;
        overflow-y: hidden;
        background: #090909;
        border-top: 1px solid var(--border, #282828);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .fi-mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .fi-mobile-nav > a,
    .fi-mobile-nav > button,
    .fi-mobile-nav > form {
        flex: 1 0 64px;
        min-width: 64px;
        max-width: 110px;
    }

    .fi-mobile-nav a,
    .fi-mobile-nav button {
        display: flex;
        min-height: var(--fi-mobile-nav-height);
        padding: 7px 6px 6px;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        border: 0;
        background: transparent;
        color: var(--muted, #a4a4a4);
        font: inherit;
        font-size: 10px;
        line-height: 1.1;
        text-align: center;
        text-decoration: none;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .fi-mobile-nav a.active,
    .fi-mobile-nav a[aria-current="page"],
    .fi-mobile-nav a:focus-visible {
        color: var(--text, #f4f4f4);
        background: var(--surface-2, #151515);
        outline: none;
    }

    .fi-mobile-nav svg,
    .fi-mobile-header svg {
        width: 22px;
        height: 22px;
        flex: 0 0 auto;
    }

    body.fi-keyboard-open .fi-mobile-nav {
        display: none !important;
    }

    .fi-feed-shell,
    .fi-wide-shell,
    .fi-form-shell,
    .fi-detail-shell,
    .fi-notifications-shell,
    .fi-settings-shell,
    .fi-page,
    .fi-plan-shell,
    .fi-inbox-shell,
    .fi-conversation-shell {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .fi-page-header {
        display: flex;
        width: 100%;
        min-width: 0;
        padding: 16px 14px !important;
        align-items: stretch !important;
        flex-direction: column;
        gap: 12px;
        border-right: 0;
        border-left: 0;
    }

    .fi-page-header > div {
        min-width: 0;
    }

    .fi-page-header h1 {
        overflow-wrap: anywhere;
        font-size: clamp(24px, 8vw, 36px);
        line-height: 1.05;
    }

    .fi-page-header .fi-button,
    .fi-page-header > a,
    .fi-page-header > button {
        width: 100%;
        min-height: 46px;
        justify-content: center;
    }

    .fi-feed-header {
        position: sticky;
        top: calc(var(--fi-mobile-header-height) + env(safe-area-inset-top));
        z-index: 700;
        background: #090909;
    }

    .fi-segmented,
    .fi-tabs,
    .fi-filter-tabs,
    .fi-profile-tabs {
        display: flex;
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .fi-segmented::-webkit-scrollbar,
    .fi-tabs::-webkit-scrollbar,
    .fi-filter-tabs::-webkit-scrollbar,
    .fi-profile-tabs::-webkit-scrollbar {
        display: none;
    }

    .fi-segmented > *,
    .fi-tabs > *,
    .fi-filter-tabs > *,
    .fi-profile-tabs > * {
        flex: 0 0 auto;
        min-height: 44px;
        scroll-snap-align: start;
    }

    .fi-feed-list {
        width: 100%;
        gap: 8px !important;
        padding: 8px 0 0 !important;
    }

    .fi-post-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-right: 0 !important;
        border-left: 0 !important;
        border-radius: 0 !important;
    }

    .fi-post-header,
    .fi-post-copy,
    .fi-post-caption,
    .fi-post-actions,
    .fi-post-meta {
        min-width: 0;
        padding-right: 12px;
        padding-left: 12px;
    }

    .fi-post-author,
    .fi-post-author span,
    .fi-post-header-meta {
        min-width: 0;
    }

    .fi-post-author strong,
    .fi-post-author small,
    .fi-post-caption,
    .fi-comment-body,
    .fi-notification-copy,
    .fi-conversation-preview {
        overflow-wrap: anywhere;
    }

    .fi-post-image-wrap,
    .fi-grid-tile,
    .fi-post-video-wrap {
        width: 100%;
        max-width: 100%;
    }

    .fi-post-image,
    .fi-post-video,
    .fi-post-image-wrap img,
    .fi-post-video-wrap video {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .fi-post-image-wrap img {
        aspect-ratio: 1 / 1;
        object-fit: cover;
    }

    .fi-post-actions {
        display: flex;
        min-height: 52px;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px;
    }

    .fi-post-actions button,
    .fi-post-actions a,
    .fi-icon-link,
    .fi-button.compact {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }

    .fi-photo-grid,
    .fi-video-grid,
    .fi-profile-grid {
        width: 100%;
        gap: 2px !important;
        padding: 2px 0 0 !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .fi-grid-tile {
        min-width: 0;
        aspect-ratio: 1 / 1;
    }

    .fi-profile-header {
        width: 100%;
        padding: 18px 14px !important;
        grid-template-columns: 78px minmax(0, 1fr) !important;
        gap: 14px !important;
    }

    .fi-profile-header .fi-avatar-large {
        width: 76px !important;
        height: 76px !important;
    }

    .fi-profile-title,
    .fi-profile-actions,
    .fi-profile-stats {
        min-width: 0;
    }

    .fi-profile-actions,
    .fi-profile-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .fi-panel-form,
    .fi-auth-card,
    .fi-auth-principles,
    .fi-settings-card,
    .fi-plan-card,
    .fi-policy-note,
    .fi-danger-panel {
        width: 100%;
        max-width: 100%;
        margin-right: 0 !important;
        margin-left: 0 !important;
        border-right: 0 !important;
        border-left: 0 !important;
        border-radius: 0 !important;
    }

    .fi-panel-form {
        padding-bottom: 0;
    }

    .fi-upload-layout {
        display: grid !important;
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .fi-upload-zone,
    .fi-square-upload-zone,
    .fi-video-upload-zone {
        width: 100%;
        min-width: 0;
        min-height: clamp(260px, 48svh, 520px) !important;
        border-right: 0 !important;
        border-left: 0 !important;
        border-radius: 0 !important;
        touch-action: manipulation;
    }

    .fi-upload-zone img,
    .fi-upload-zone video,
    .fi-square-upload-zone img,
    .fi-video-upload-zone video {
        width: 100%;
        max-width: 100%;
        max-height: 65svh;
        object-fit: contain;
    }

    .fi-form-fields {
        min-width: 0;
        padding: 16px 14px 20px !important;
    }

    .fi-form-fields label,
    .fi-panel-form label,
    .fi-search-form label {
        min-width: 0;
        max-width: 100%;
    }

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

    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea {
        width: 100%;
        min-height: 48px;
    }

    input[type="file"] {
        width: 100%;
        min-height: 48px;
        padding: 10px;
    }

    textarea {
        min-height: 110px;
        resize: vertical;
    }

    .fi-checkbox-row {
        display: grid !important;
        min-height: 48px;
        align-items: center;
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 10px;
    }

    .fi-checkbox-row input {
        width: 24px;
        height: 24px;
        margin: 0;
    }

    .fi-form-actions {
        position: sticky;
        bottom: calc(var(--fi-mobile-nav-height) + env(safe-area-inset-bottom));
        z-index: 800;
        display: grid !important;
        width: 100%;
        padding: 10px 12px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
        gap: 8px;
        background: #090909;
        border-top: 1px solid var(--border, #282828);
    }

    body.fi-keyboard-open .fi-form-actions {
        bottom: 0;
    }

    .fi-form-actions .fi-button,
    .fi-form-actions button,
    .fi-form-actions a {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .fi-auth-shell {
        display: block !important;
        min-height: var(--fi-visual-height);
        padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)) !important;
    }

    .fi-auth-card,
    .fi-auth-principles {
        margin: 0 auto 12px !important;
        padding: 20px 16px !important;
    }

    .fi-auth-card button,
    .fi-auth-card .fi-button {
        width: 100%;
        min-height: 50px;
    }

    .fi-message-stack {
        right: 10px;
        bottom: calc(var(--fi-mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
        left: 10px;
        max-width: none;
    }

    .fi-dm-layout,
    .fi-message-layout,
    .fi-inbox-layout,
    .fi-conversation-layout {
        display: grid !important;
        width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .fi-conversation-list,
    .fi-message-list,
    .fi-dm-thread,
    .fi-message-thread {
        min-width: 0;
        max-width: 100%;
    }

    .fi-conversation-row {
        display: grid;
        min-width: 0;
        min-height: 72px;
        padding: 10px 12px;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 10px;
    }

    .fi-conversation-copy,
    .fi-conversation-line,
    .fi-conversation-preview {
        min-width: 0;
    }

    .fi-conversation-line {
        display: flex;
        justify-content: space-between;
        gap: 8px;
    }

    .fi-conversation-line time {
        flex: 0 0 auto;
        font-size: 11px;
    }

    .fi-dm-thread,
    .fi-message-thread {
        min-height: 42svh;
        max-height: calc(var(--fi-visual-height) - 230px);
        padding: 12px;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .fi-dm-message,
    .fi-dm-bubble {
        max-width: 88%;
        overflow-wrap: anywhere;
    }

    .fi-dm-composer,
    .fi-message-composer,
    .fi-message-compose {
        position: sticky;
        bottom: calc(var(--fi-mobile-nav-height) + env(safe-area-inset-bottom));
        z-index: 800;
        display: grid !important;
        width: 100%;
        padding: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        background: #090909;
        border-top: 1px solid var(--border, #282828);
    }

    body.fi-keyboard-open .fi-dm-composer,
    body.fi-keyboard-open .fi-message-composer,
    body.fi-keyboard-open .fi-message-compose {
        bottom: 0;
    }

    .fi-dm-composer textarea,
    .fi-message-composer textarea,
    .fi-message-compose textarea {
        min-height: 48px;
        max-height: 140px;
        resize: none;
    }

    .fi-dm-composer button,
    .fi-message-composer button,
    .fi-message-compose button {
        min-width: 54px;
        min-height: 48px;
    }

    .fi-settings-grid,
    .fi-plan-grid,
    .fi-safety-grid,
    .fi-results-grid {
        width: 100%;
        padding: 0 10px 10px;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px;
    }

    .fi-search-form,
    .fi-results-section,
    .fi-notification-list,
    .fi-comments-panel,
    .fi-pagination {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .fi-search-form {
        display: grid;
        padding: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .fi-search-form button {
        min-width: 52px;
        min-height: 48px;
    }

    .fi-notification,
    .fi-comment,
    .fi-user-row,
    .fi-result-row {
        min-width: 0;
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    table,
    .fi-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    pre,
    code {
        max-width: 100%;
        overflow-wrap: anywhere;
        white-space: pre-wrap;
    }

    .fi-button,
    button,
    a {
        -webkit-tap-highlight-color: transparent;
    }

    :focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }
}

@media (max-width: 430px) {
    .fi-page-header {
        padding: 14px 12px !important;
    }

    .fi-form-fields {
        padding-right: 12px !important;
        padding-left: 12px !important;
    }

    .fi-profile-header {
        grid-template-columns: 64px minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    .fi-profile-header .fi-avatar-large {
        width: 62px !important;
        height: 62px !important;
    }

    .fi-post-header,
    .fi-post-copy,
    .fi-post-caption,
    .fi-post-actions,
    .fi-post-meta {
        padding-right: 10px;
        padding-left: 10px;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    :root {
        --fi-mobile-header-height: 50px;
        --fi-mobile-nav-height: 56px;
    }

    .fi-mobile-nav a,
    .fi-mobile-nav button {
        min-height: var(--fi-mobile-nav-height);
        flex-direction: row;
        font-size: 11px;
    }

    .fi-upload-zone,
    .fi-square-upload-zone,
    .fi-video-upload-zone {
        min-height: 68svh !important;
    }
}

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