/* Experiência mobile dedicada — app shell com dock inferior.
   Desktop permanece intacto (media query max-width: 980px). */

@media (max-width: 980px) {
    :root {
        --mobile-dock-height: 64px;
        --mobile-header-height: 48px;
        --scroll-offset: calc(var(--mobile-header-height) + 10px);
        --shell-gutter: clamp(16px, 4.5vw, 22px);
        --section-space: clamp(48px, 9vw, 64px);
    }

    /* Oculta navegação lateral desktop no mobile */
    .sidebar-nav,
    .sidebar-backdrop {
        display: none !important;
    }

    body.is-mobile-shell {
        --scroll-offset: calc(var(--mobile-header-height) + 10px);
        overflow-x: hidden;
    }

    body.is-mobile-shell.is-sheet-open {
        overflow: hidden;
    }

    /* Topbar compacta — sem hamburger */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: center;
        position: sticky;
        top: 0;
        z-index: 35;
        min-height: var(--mobile-header-height);
        padding:
            max(8px, env(safe-area-inset-top))
            max(16px, var(--shell-gutter))
            8px;
        border-bottom: 1px solid var(--color-border);
        background: color-mix(in srgb, var(--color-page) 88%, transparent);
        backdrop-filter: blur(16px);
    }

    .mobile-topbar .menu-toggle {
        display: none !important;
    }

    .mobile-topbar__title {
        font-family: var(--font-display);
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: -0.01em;
    }

    .site-main-column {
        padding-bottom: calc(var(--mobile-dock-height) + env(safe-area-inset-bottom) + 12px);
    }

    /* Hero mobile — perfil primeiro, sem banner pesado */
    .hero-section {
        min-height: auto;
        border-bottom: 1px solid var(--color-border);
        overflow: visible;
    }

    .hero-background,
    .hero-overlay {
        display: none;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        gap: clamp(20px, 5vw, 28px);
        padding: clamp(12px, 3vw, 20px) 0 clamp(28px, 6vw, 36px);
        overflow: visible;
    }

    .profile-panel {
        order: 1;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: clamp(18px, 4vw, 24px);
        box-shadow: none;
        background: color-mix(in srgb, var(--color-surface) 92%, transparent);
        overflow: visible;
    }

    .profile-panel__intro {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 14px;
    }

    .profile-panel__intro > img {
        width: clamp(72px, 20vw, 88px);
        flex-shrink: 0;
        margin: 0;
        border-radius: 50%;
        border-width: 2px;
        border-color: color-mix(in srgb, var(--color-primary) 36%, var(--color-border));
    }

    .profile-panel__intro > div {
        flex: 1;
        min-width: 0;
    }

    .profile-panel__intro .panel-kicker {
        margin: 0 0 4px;
    }

    .profile-panel__intro h2 {
        font-size: clamp(1rem, 3.6vw, 1.15rem);
        margin: 0 0 6px;
    }

    .profile-panel__intro p {
        font-size: var(--text-sm);
        max-width: none;
        margin: 0;
    }

    .profile-panel__stack {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
        overflow: visible;
        padding-top: 14px;
        margin-inline: 0;
        padding-inline: 0;
    }

    .profile-panel__stack .tech-badge {
        flex: 0 1 auto;
        max-width: 100%;
        font-size: 0.74rem;
        gap: 5px;
        padding: 5px 8px;
    }

    .profile-panel__stack .tech-badge__icon {
        width: 18px;
        height: 18px;
    }

    .hero-copy {
        order: 2;
        min-width: 0;
        text-align: left;
    }

    .hero-copy .eyebrow {
        text-align: left;
        margin-inline: 0;
        max-width: none;
        overflow-wrap: anywhere;
    }

    .hero-copy h1 {
        font-size: clamp(1.45rem, 5.2vw, 1.75rem);
        line-height: 1.14;
        text-align: left;
        max-width: none;
        overflow-wrap: anywhere;
        text-wrap: pretty;
    }

    .hero-summary {
        font-size: var(--text-sm);
        line-height: 1.58;
        text-align: left;
        margin-top: 14px;
        max-width: none;
        text-wrap: pretty;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 20px;
        width: 100%;
    }

    .hero-actions .button {
        font-size: 0.88rem;
        padding-inline: 10px;
        min-width: 0;
    }

    .hero-metrics {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        overflow: visible;
        margin-top: clamp(24px, 4vw, 32px);
        padding-bottom: 0;
    }

    .hero-metrics li {
        min-width: 0;
        padding: 14px 12px;
        text-align: left;
    }

    .hero-metrics strong {
        display: block;
        font-size: clamp(1rem, 3.8vw, 1.125rem);
        font-weight: 700;
        line-height: 1.15;
    }

    .hero-metrics span {
        display: block;
        margin-top: 6px;
        font-size: var(--text-xs);
        line-height: 1.35;
        text-align: left;
    }

    /* Tipografia editorial — alinhamento consistente à esquerda */
    .section-heading,
    .section-heading > div,
    .about-copy,
    .contact-shell > div:first-child {
        text-align: left;
    }

    .section-heading h2,
    .about-copy h2,
    .contact-section h2 {
        text-align: left;
    }

    .section-lead,
    .about-copy p,
    .contact-details {
        text-align: left;
    }

    .eyebrow,
    .section-block .eyebrow,
    .contact-section .eyebrow {
        text-align: left;
    }

    /* Seções — ritmo editorial mobile */
    .section-block {
        border-bottom: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
    }

    .section-heading {
        grid-template-columns: 1fr;
        gap: var(--stack-sm);
        margin-bottom: var(--section-heading-space);
    }

    .section-heading h2 {
        font-size: clamp(1.35rem, 4.8vw, 1.55rem);
        line-height: 1.14;
    }

    .section-lead {
        font-size: var(--text-sm);
        line-height: 1.55;
        margin-top: 10px;
    }

    .about-grid--single {
        grid-template-columns: 1fr;
    }

    .about-copy h2 {
        font-size: clamp(1.3rem, 4.5vw, 1.5rem);
    }

    .about-copy p {
        font-size: var(--text-sm);
    }

    .about-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .about-actions .button {
        width: 100%;
    }

    /* Projetos — grid 2 colunas × 2 linhas (4 cards visíveis) */
    .projects-section .section-heading {
        margin-bottom: clamp(16px, 3vw, 22px);
    }

    .project-toolbar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-bottom: 12px;
    }

    .project-filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .project-filter-chips::-webkit-scrollbar {
        display: none;
    }

    .projects-section .projects-grid,
    .projects-section .projects-grid--compact {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        overflow: visible;
        padding: 0 0 4px;
        margin-inline: 0;
        align-items: stretch;
    }

    .projects-section .project-card--compact {
        min-width: 0;
        min-height: 100%;
        box-shadow: 0 8px 22px color-mix(in srgb, var(--color-shadow) 55%, transparent);
    }

    .projects-section .project-card__visual {
        min-height: 0;
        height: clamp(68px, 20vw, 84px);
    }

    .projects-section .project-card__visual-label {
        margin: 0 8px 8px;
        max-width: calc(100% - 16px);
        font-size: 0.58rem;
        letter-spacing: 0.04em;
        line-height: 1.25;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .projects-section .project-card__visual-zoom {
        top: 6px;
        right: 6px;
        min-height: 24px;
        padding: 2px 7px;
        font-size: 0.58rem;
    }

    .projects-section .project-card__body {
        gap: 6px;
        padding: 10px 10px 12px;
        grid-template-rows: auto auto 1fr auto;
    }

    .projects-section .project-card__meta {
        gap: 4px;
        align-items: flex-start;
    }

    .projects-section .project-card__domain {
        font-size: 0.58rem;
        line-height: 1.25;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .projects-section .project-card--compact .project-availability {
        flex-shrink: 0;
        padding: 2px 6px;
        font-size: 0.56rem;
    }

    .projects-section .project-card__title {
        font-size: clamp(0.82rem, 3.4vw, 0.92rem);
        line-height: 1.2;
    }

    .projects-section .project-card__hook {
        display: none;
    }

    .projects-section .project-card__stack {
        display: none;
    }

    .projects-section .project-card__footer {
        padding-top: 2px;
        margin-top: 0;
    }

    .projects-section .project-card__link {
        font-size: 0.72rem;
        font-weight: 700;
    }

    .projects-section .shell::after {
        display: none;
    }

    /* Tablets na faixa mobile — cards um pouco maiores, mantém 2 colunas */
    @media (min-width: 640px) and (max-width: 980px) {
        .projects-section .projects-grid,
        .projects-section .projects-grid--compact {
            gap: 12px;
        }

        .projects-section .project-card__visual {
            height: clamp(76px, 12vw, 92px);
        }

        .projects-section .project-card__title {
            font-size: 0.92rem;
        }
    }

    /* Experiência — cards compactos */
    .experience-section .section-lead {
        display: block;
        padding: 12px 14px;
        font-size: var(--text-sm);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-card);
        background: color-mix(in srgb, var(--color-surface) 68%, transparent);
    }

    .experience-snapshot {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: var(--stack-md);
    }

    .experience-snapshot article {
        text-align: left;
    }

    .experience-snapshot article {
        padding: 10px 8px;
    }

    .experience-snapshot strong {
        font-size: 0.82rem;
    }

    .experience-snapshot span {
        font-size: 0.68rem;
    }

    /* Formação — lista simples */
    .education-grid {
        display: grid;
        gap: 10px;
    }

    .education-grid .mini-record {
        padding: 14px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-card);
        background: color-mix(in srgb, var(--color-surface) 78%, transparent);
    }

    /* Contato — bloco de ação */
    .contact-section {
        background: color-mix(in srgb, var(--color-surface) 55%, transparent);
    }

    .contact-shell {
        grid-template-columns: 1fr;
        gap: var(--stack-md);
    }

    .contact-section h2 {
        font-size: clamp(1.3rem, 4.5vw, 1.5rem);
    }

    .contact-details {
        gap: 12px;
    }

    .contact-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .site-footer {
        padding-bottom: 8px;
    }

    .footer-shell {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Dock inferior */
    .mobile-dock {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed;
        inset: auto 0 0;
        z-index: 70;
        min-height: var(--mobile-dock-height);
        padding:
            6px max(8px, env(safe-area-inset-right))
            max(6px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
        border-top: 1px solid var(--color-border);
        background: color-mix(in srgb, var(--color-page) 90%, transparent);
        backdrop-filter: blur(20px);
    }

    .mobile-dock__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 48px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--color-muted);
        font-family: var(--font-body);
        font-size: 0.62rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        text-decoration: none;
        transition: color 160ms ease, background 160ms ease;
    }

    .mobile-dock__item svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .mobile-dock__item.is-active {
        color: var(--color-primary);
        background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    }

    .mobile-dock__item:focus-visible {
        outline: 2px solid color-mix(in srgb, var(--color-primary) 60%, transparent);
        outline-offset: 1px;
    }

    /* FAB WhatsApp */
    .mobile-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: max(14px, env(safe-area-inset-right));
        bottom: calc(var(--mobile-dock-height) + env(safe-area-inset-bottom) + 14px);
        z-index: 65;
        width: 52px;
        height: 52px;
        border-radius: 50%;
        border: 1px solid color-mix(in srgb, #25d366 40%, transparent);
        background: linear-gradient(
            145deg,
            color-mix(in srgb, #25d366 88%, #1a9e4a),
            #128c7e
        );
        color: #f4fff8;
        box-shadow: 0 10px 28px color-mix(in srgb, #128c7e 42%, transparent);
        transition: transform 180ms var(--ease-out-expo), opacity 160ms ease;
    }

    .mobile-fab:active {
        transform: scale(0.94);
    }

    .mobile-fab svg {
        width: 26px;
        height: 26px;
    }

    body.is-sheet-open .mobile-fab {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.88);
    }

    /* Sheet "Mais" */
    .mobile-sheet-backdrop {
        position: fixed;
        inset: 0;
        z-index: 80;
        border: 0;
        padding: 0;
        background: color-mix(in srgb, #040807 55%, transparent);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 220ms var(--ease-out-expo), visibility 220ms;
    }

    body.is-sheet-open .mobile-sheet-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .mobile-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: auto 0 0;
        z-index: 85;
        max-height: min(78vh, 560px);
        border-radius: 18px 18px 0 0;
        border: 1px solid var(--color-border);
        border-bottom: 0;
        background: color-mix(in srgb, var(--color-surface) 96%, var(--color-page));
        box-shadow: 0 -20px 60px var(--color-shadow);
        transform: translateY(105%);
        transition: transform 280ms var(--ease-out-expo);
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    body.is-sheet-open .mobile-sheet {
        transform: translateY(0);
    }

    .mobile-sheet__handle {
        width: 40px;
        height: 4px;
        margin: 10px auto 6px;
        border-radius: var(--radius-pill);
        background: color-mix(in srgb, var(--color-muted) 50%, transparent);
    }

    .mobile-sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 18px 12px;
        border-bottom: 1px solid var(--color-border);
    }

    .mobile-sheet__header h2 {
        margin: 0;
        font-family: var(--font-display);
        font-size: 1.05rem;
        font-weight: 700;
    }

    .mobile-sheet__close {
        display: grid;
        width: 36px;
        height: 36px;
        place-items: center;
        border: 1px solid var(--color-border);
        border-radius: 50%;
        background: color-mix(in srgb, var(--color-page) 80%, transparent);
        color: var(--color-text);
        font-size: 1.25rem;
        line-height: 1;
    }

    .mobile-sheet__body {
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 14px 18px 18px;
    }

    .mobile-sheet__nav {
        display: grid;
        gap: 8px;
        margin-bottom: 18px;
    }

    .mobile-sheet__link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 48px;
        padding: 12px 14px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-card);
        background: color-mix(in srgb, var(--color-page) 70%, transparent);
        color: var(--color-text);
        font-weight: 600;
    }

    .mobile-sheet__link span {
        color: var(--color-muted);
        font-size: 0.85rem;
    }

    .mobile-sheet__theme {
        display: grid;
        gap: 10px;
    }

    .mobile-sheet__theme-label {
        margin: 0;
        color: var(--color-primary);
        font-family: var(--font-body);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .mobile-sheet__theme .segmented-control {
        display: flex;
        width: 100%;
        border-radius: var(--radius-card);
    }

    .mobile-sheet__theme .segmented-control button {
        flex: 1;
        min-height: 40px;
        font-size: 0.85rem;
    }

    /* Páginas internas — dock simplificado */
    [data-page="about-more"] .hero-section,
    [data-page="project"] .hero-section {
        border-bottom: 0;
    }

    [data-page="about-more"] .about-more-hero,
    [data-page="project"] .project-page-hero {
        padding-top: clamp(20px, 5vw, 32px);
    }

    [data-page="about-more"] .about-more-back,
    [data-page="project"] .project-hero-back {
        display: inline-flex;
        min-height: 40px;
        align-items: center;
        margin-bottom: 12px;
        color: var(--color-primary);
        font-weight: 700;
        font-size: var(--text-sm);
    }

    [data-page="about-more"] .thinking-section__intro h2,
    [data-page="about-more"] .about-more-hero h1 {
        font-size: clamp(1.35rem, 4.8vw, 1.65rem);
        line-height: 1.12;
    }

    [data-page="about-more"] .about-more-lead,
    [data-page="about-more"] .thinking-section p {
        font-size: var(--text-sm);
        line-height: 1.58;
    }

    [data-page="project"] .project-hero-copy h1 {
        font-size: clamp(1.4rem, 5vw, 1.75rem);
    }

    [data-page="project"] .project-hero-summary {
        font-size: var(--text-sm);
    }
}

@media (min-width: 981px) {
    .mobile-dock,
    .mobile-fab,
    .mobile-sheet,
    .mobile-sheet-backdrop {
        display: none !important;
    }
}

@media (max-width: 980px) and (prefers-reduced-motion: reduce) {
    .mobile-sheet,
    .mobile-sheet-backdrop,
    .mobile-fab {
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 360px) {
    .profile-panel__intro {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-panel__intro > img {
        width: clamp(80px, 22vw, 96px);
    }

    .hero-actions {
        grid-template-columns: 1fr;
    }
}
