/* Shared phone and tablet layouts. Loaded after page styles. */
    .site-main { min-width: 0; }
    .site-main :where(h1, h2, h3, p, dd, a, strong, label, .profile-tag) { overflow-wrap: anywhere; }
    .site-main :where(.profile-grid, .profile-main, .profile-sidebar, .portfolio-section,
        .portfolio-card, .portfolio-card-content, .talent-card, .shortlist-card,
        .job-card, .applicant-card, .my-application-card, .form-field, .form-group,
        .filter-field, .job-search-field, .contact-field, .messaging-shell) { min-width: 0; }

.mobile-menu-toggle { display: none; }
.mobile-menu-toggle[hidden] { display: none !important; }

@media (max-width: 900px) {
    .site-header .nav-shell {
        width: calc(100% - 32px);
        min-height: 72px;
        gap: 12px;
        padding: 12px 0;
        flex-wrap: wrap;
    }
    .site-header .brand { min-width: 0; flex-shrink: 1; }
    .site-header .brand img { width: min(240px, 60vw); height: auto; }
    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        min-width: 64px;
        padding: 10px 14px;
        border: 1px solid var(--border);
        border-radius: 9px;
        background: var(--panel);
        color: var(--text);
        font: inherit;
        font-weight: 600;
        cursor: pointer;
    }
    .mobile-menu-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
    .site-header .site-nav {
        display: flex;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
        border-top: 1px solid var(--border);
    }
    .site-header[data-mobile-menu="ready"] .site-nav:not(.is-open) { display: none; }
    .site-header .site-nav > a,
    .site-header .nav-logout-button {
        display: flex;
        align-items: center;
        min-height: 44px;
        width: 100%;
        padding: 12px;
        border-radius: 8px;
        text-align: left;
    }
    .site-header .nav-logout-form { width: 100%; }
    .site-header .site-nav > .nav-join { margin: 6px 0; }
    .profile-top, .profile-identity { min-width: 0; }
    .profile-actions { flex-wrap: wrap; }
}

@media (max-width: 700px) {
    .site-main img { max-width: 100%; }
    .site-main :where(input, select, textarea) { max-width: 100%; min-width: 0; }
    .site-main input:not([type="checkbox"]):not([type="radio"]),
    .site-main select, .site-main textarea { font-size: 16px; }
    .site-main input[type="file"] { width: 100%; }
    .site-main input[type="file"]::file-selector-button { min-height: 44px; }
    .site-main :where(button, .button, .auth-button, .auth-submit, .auth-link-button,
        .shortlist-button, .job-action, .application-action, .contact-submit,
        .portfolio-view-button, .filter-button, .error-button) { min-height: 44px; }
    .site-main :where(.button, .auth-button, .auth-submit, .auth-link-button,
        .shortlist-button, .job-action, .application-action, .contact-submit,
        .filter-button, .error-button) { white-space: normal; text-align: center; }
    .site-main .button { height: auto; padding-top: 12px; padding-bottom: 12px; }
    .hero { padding: 56px 0 64px; }
    .hero h1 { font-size: clamp(2.4rem, 10vw, 3.4rem); }
    .hero-actions { flex-wrap: wrap; }
    .join-grid { grid-template-columns: minmax(0, 1fr); }
    .join-card { grid-template-columns: auto minmax(0, 1fr); padding: 20px; gap: 14px; }
    .join-card > :last-child { grid-column: 2; }
    .auth-brand img { width: min(100%, 280px); }
    .auth-card, .onboarding-card { padding: 24px 18px; }
    .label-row { flex-wrap: wrap; gap: 4px 12px; }
    .onboarding-grid, .job-form-grid, .job-search-grid,
    .job-detail-facts, .contact-form-grid { grid-template-columns: minmax(0, 1fr); }
    .talent-filters { grid-template-columns: minmax(0, 1fr); padding: 18px; }
    .talent-grid, .shortlist-grid, .portfolio-grid { grid-template-columns: minmax(0, 1fr); }
    .filter-actions, .job-search-actions, .job-card-heading, .job-card-actions,
    .application-actions, .applicant-card-actions, .shortlist-card-actions,
    .talent-results-heading, .portfolio-heading, .my-application-rate,
    .job-detail-header .job-meta { flex-wrap: wrap; }
    .filter-actions > *, .job-search-actions > * { flex: 1 1 140px; }
    .profile-top { align-items: stretch; flex-direction: column; gap: 20px; }
    .freelancer-public-profile .profile-top > .profile-identity { order: -1; }
    .profile-identity { gap: 16px; }
    .profile-identity > :last-child { min-width: 0; }
    .profile-top h1 { font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.05; }
    .profile-actions { width: 100%; flex-direction: column; align-items: stretch; }
    .profile-actions > a, .profile-actions > form,
    .profile-actions > form > button { width: 100%; }
    .profile-details div { flex-wrap: wrap; gap: 6px 12px; }
    .profile-details dd { max-width: 100%; }
    .profile-main > .profile-panel > .button,
    .profile-main > .profile-panel > form { margin-top: 10px; max-width: 100%; }
    .portfolio-heading { align-items: flex-start; gap: 14px; }
    .portfolio-heading .button { flex-shrink: 0; }
    .job-card-actions, .applicant-card-actions { align-items: stretch; gap: 12px; }
    .job-card-actions > *, .applicant-card-actions > * { flex: 1 1 120px; }
    .application-actions form { max-width: 100%; }
    .shortlist-card-top, .applicant-card-top, .my-application-top { min-width: 0; }
    .freelancer-public-profile .rating-options label { min-height: 44px; }
    .cookie-banner { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .cookie-banner-inner { max-height: calc(100dvh - 24px); overflow-y: auto; }
    .cookie-button { min-height: 44px; }
    .portfolio-lightbox-dialog { height: calc(100dvh - 20px); }
    .portfolio-lightbox-main { min-height: 140px; grid-template-columns: 44px minmax(0, 1fr) 44px; }
    .portfolio-lightbox-stage { padding: 8px; }
    .portfolio-lightbox-nav { width: 44px; height: 44px; }
    .portfolio-lightbox-meta { flex: 0 1 auto; max-height: 40%; overflow-y: auto; padding: 16px; gap: 12px; }
    .portfolio-lightbox-meta :where(h2, p, a) { overflow-wrap: anywhere; }
    .portfolio-lightbox-links { flex-shrink: 1; }
    .portfolio-lightbox-links a { display: inline-flex; align-items: center; min-height: 44px; }
    .message-compose, .chat-message, .conversation-item { min-width: 0; }
    .messaging-page .chat-message { max-width: 95%; }
    .message-compose textarea { font-size: 16px; }
    .message-pagination a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (max-width: 400px) {
    .profile-identity { align-items: flex-start; }
    .profile-avatar { width: 64px; height: 64px; border-radius: 14px; }
    .portfolio-heading { flex-direction: column; align-items: stretch; }
    .portfolio-heading .button { width: 100%; }
    .profile-main > .profile-panel > .button,
    .profile-main > .profile-panel > form,
    .profile-main > .profile-panel > form > button { width: 100%; }
    .profile-details div { flex-direction: column; }
    .profile-details dd { text-align: left; }
}

@media (max-height: 500px) and (max-width: 900px) {
    .portfolio-lightbox-dialog { width: calc(100% - 20px); height: calc(100dvh - 20px); margin: 10px auto; flex-direction: row; }
    .portfolio-lightbox-main { flex: 1 1 65%; min-width: 0; }
    .portfolio-lightbox-meta { flex: 0 1 35%; max-height: 100%; border-top: 0; }
}
