/* Public MVP: contextual search and public provider profile. */

[hidden] {
    display: none !important;
}

.search-card {
    max-width: 56rem;
    padding: 1.5rem 1.5rem 1.75rem;
}

/* A coluna do hero limita o card a ~36rem, entao tres colunas nunca cabiam e
   cortavam o texto dos campos. O auto-fit acompanha a largura real do card:
   duas colunas quando ha espaco, uma coluna quando nao ha. A cidade sempre
   ocupa a linha inteira. */
.search-fields-public {
    grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
    align-items: start;
    gap: 0.85rem 0.9rem;
}

.search-fields-public > label {
    align-content: start;
    min-width: 0;
}

.location-autocomplete {
    position: relative;
    display: grid;
    align-content: start;
    grid-column: 1 / -1;
    gap: 0.45rem;
    min-width: 0;
    color: var(--navy-900);
    font-size: 0.76rem;
    font-weight: 700;
}

.autocomplete-control {
    position: relative;
}

.autocomplete-control > input[type="search"] {
    padding-right: 2.8rem;
}

.autocomplete-clear {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    display: grid;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    color: var(--navy-800);
    background: transparent;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.autocomplete-clear:hover {
    background: var(--ice-100);
}

.field-help {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 500;
    line-height: 1.45;
}

.autocomplete-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.45rem);
    right: 0;
    left: 0;
    max-height: 17rem;
    margin: 0;
    overflow-y: auto;
    padding: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    list-style: none;
    background: var(--white);
    box-shadow: 0 20px 50px rgba(16, 58, 122, 0.18);
}

.autocomplete-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.8rem;
    border-radius: 0.65rem;
    cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option.is-active,
.autocomplete-option[aria-selected="true"] {
    background: var(--ice-100);
}

.autocomplete-option strong {
    font-size: 0.76rem;
}

.autocomplete-option small {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 600;
}

.autocomplete-empty {
    padding: 0.8rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.5;
}

.search-more {
    margin-top: 0.85rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
}

.search-more > summary {
    width: fit-content;
    color: var(--blue-700);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.search-more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.location-link[data-state="active"] {
    color: #128354;
}

.location-link[data-state="active"]::after {
    content: "Ativa";
    padding: 0.18rem 0.4rem;
    border-radius: 999px;
    color: #0b6842;
    background: #dff7ec;
    font-size: 0.56rem;
    text-transform: uppercase;
}

/* O cartao inteiro e definido em app.css, junto do resto da grade. Aqui ficam
   so os detalhes que nao existem fora da busca publica. */
.provider-card-link:focus-visible {
    border-radius: 1.15rem;
    outline: 3px solid var(--yellow-500);
    outline-offset: -4px;
}

/* "Encontrado: <anuncio>" -- aparece so quando a busca casou com um anuncio
   do anunciante, e nao com o nome dele. */
.provider-card .provider-listing-match {
    display: -webkit-box;
    margin: 0 0 0.7rem;
    padding: 0.45rem 0.6rem;
    overflow: hidden;
    border-radius: 0.55rem;
    color: var(--blue-700);
    background: var(--ice-100);
    font-size: 0.66rem;
    font-weight: 700;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.provider-grid[aria-busy="true"] {
    opacity: 0.58;
    pointer-events: none;
}

.results-more {
    display: flex;
    justify-content: center;
    margin-top: 1.4rem;
}

.results-more[hidden] {
    display: none;
}

.category-chip:focus-visible,
.city-chip:focus-visible,
.autocomplete-clear:focus-visible,
.location-link:focus-visible,
.search-more > summary:focus-visible,
.profile-back-link:focus-visible,
.profile-header a:focus-visible,
.profile-footer a:focus-visible {
    border-radius: 0.4rem;
    outline: 3px solid var(--yellow-500);
    outline-offset: 3px;
}

/* Public profile */

.public-profile-page {
    background: linear-gradient(180deg, var(--ice-50), var(--white) 38rem);
}

.profile-header {
    display: flex;
    justify-content: space-between;
}

/* Mesmo ritmo da home: o espaco entre blocos e o espaco antes do rodape
   saem das mesmas duas unidades. */
.profile-main {
    min-height: calc(100vh - 16rem);
    padding-block: var(--espaco-bloco) var(--espaco-secao);
}

.profile-back-link {
    display: inline-flex;
    margin-bottom: 1.5rem;
    color: var(--blue-700);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.profile-loading,
.profile-error {
    display: grid;
    min-height: 25rem;
    place-items: center;
    align-content: center;
    padding: 3rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    text-align: center;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.profile-loading p {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.profile-loading-mark {
    width: 2.8rem;
    height: 2.8rem;
    border: 4px solid var(--ice-100);
    border-top-color: var(--blue-600);
    border-radius: 50%;
    animation: profile-loading-spin 800ms linear infinite;
}

@keyframes profile-loading-spin {
    to { transform: rotate(1turn); }
}

.profile-error img {
    width: 7rem;
    margin-bottom: 0.75rem;
}

.profile-error h1 {
    margin-bottom: 0.5rem;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.profile-error p {
    max-width: 32rem;
    margin-bottom: 1.5rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.public-profile {
    display: grid;
    gap: 1rem;
}

.profile-hero-card {
    position: relative;
    isolation: isolate;
    display: flex;
    min-height: 21rem;
    align-items: center;
    gap: clamp(1.5rem, 5vw, 3.5rem);
    overflow: hidden;
    padding: clamp(2rem, 6vw, 4.5rem);
    border-radius: 2rem;
    color: var(--white);
    background:
        radial-gradient(circle at 88% 15%, rgba(19, 169, 232, 0.65), transparent 30%),
        linear-gradient(125deg, var(--navy-950), var(--blue-700));
    box-shadow: var(--shadow-lg);
}

.profile-cover-image {
    position: absolute;
    z-index: 0;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0.11;
    object-fit: cover;
    filter: saturate(0.72) contrast(0.9);
    pointer-events: none;
}

.profile-hero-card::after {
    position: absolute;
    z-index: 1;
    right: -8rem;
    bottom: -14rem;
    width: 30rem;
    height: 30rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    content: "";
}

.profile-logo-wrap {
    position: relative;
    z-index: 2;
    display: grid;
    width: clamp(7.5rem, 15vw, 10rem);
    height: clamp(7.5rem, 15vw, 10rem);
    flex: 0 0 auto;
    overflow: hidden;
    place-items: center;
    border: 5px solid rgba(255, 255, 255, 0.26);
    border-radius: 1.8rem;
    color: var(--white);
    background: linear-gradient(145deg, var(--blue-600), var(--cyan-500));
    box-shadow: 0 22px 50px rgba(3, 25, 72, 0.3);
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 800;
}

.profile-logo-wrap img {
    position: absolute;
    inset: -1px;
    display: block;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    max-width: none;
    padding: 0;
    background: transparent;
    object-fit: cover;
}

.profile-identity {
    position: relative;
    z-index: 2;
    min-width: 0;
}

.profile-badges,
.profile-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-badges span,
.profile-categories span {
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
}

.profile-badges span {
    color: var(--white);
    background: rgba(255, 255, 255, 0.14);
}

.profile-badges .verified {
    color: #5f3c00;
    background: var(--yellow-400);
}

.profile-identity h1 {
    max-width: 47rem;
    margin: 0.8rem 0;
    color: var(--white);
    font-size: clamp(2.3rem, 6vw, 5rem);
    letter-spacing: -0.055em;
    line-height: 1;
    overflow-wrap: anywhere;
}

.profile-location {
    margin: 0 0 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.88rem;
    font-weight: 600;
}

.profile-categories span {
    color: var(--navy-950);
    background: var(--white);
}

.profile-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(19rem, 0.5fr);
    gap: 1rem;
}

.profile-panel {
    padding: clamp(1.6rem, 4vw, 2.6rem);
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.profile-panel h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.profile-description {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.85;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.profile-listings {
    margin-top: 1rem;
}

.profile-listing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.profile-listing-card {
    display: grid;
    align-content: start;
    gap: 0.55rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--ice-50);
}

.profile-listing-card h3,
.profile-listing-card p {
    margin: 0;
}

.profile-listing-card h3 {
    color: var(--navy-900);
    font-size: 0.86rem;
}

.profile-listing-card p {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.6;
}

.profile-listing-card strong {
    color: var(--blue-700);
    font-size: 0.78rem;
}

.profile-distance {
    display: inline-flex;
    margin: 1.5rem 0 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.7rem;
    color: var(--blue-700);
    background: var(--ice-100);
    font-size: 0.72rem;
    font-weight: 700;
}

.profile-contact {
    position: relative;
    overflow: hidden;
    background: linear-gradient(150deg, var(--white), var(--ice-100));
}

.profile-contact > img {
    position: absolute;
    right: -3rem;
    bottom: -4rem;
    width: 10rem;
    opacity: 0.09;
}

.profile-contact > *:not(img) {
    position: relative;
    z-index: 1;
}

.profile-contact > p:not(.eyebrow, .profile-contact-unavailable) {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.7;
}

/* ---------------------------------------------------------------------
   Botoes de contato

   Instagram e site eram dois links sublinhados no pe do painel, com peso
   de nota de rodape -- quando sao, junto com o WhatsApp, o motivo de a
   pagina existir. Os tres viraram botoes da mesma largura, e o WhatsApp
   continua sendo o unico cheio, porque e o caminho principal.

   Quem nao informou Instagram ou site nao ganha botao: o script mantem o
   elemento escondido, e `[hidden]` nao ocupa espaco nem deixa buraco na
   grade.
   --------------------------------------------------------------------- */
.profile-contact-actions {
    display: grid;
    gap: 0.55rem;
    margin-top: 1rem;
}

/* O painel lateral tem cerca de 300 px: com o respiro padrao do botao,
   "Chamar no WhatsApp" quebrava em duas linhas. */
.profile-contact-actions .button {
    width: 100%;
    gap: 0.55rem;
    padding-inline: 0.9rem;
    font-size: 0.88rem;
}

.profile-contact-actions svg {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
}

/* A marca do WhatsApp e um desenho preenchido; o padrao do site e contorno. */
.icon-solid {
    fill: currentColor;
    stroke: none;
}

.profile-contact-unavailable {
    padding: 0.85rem;
    border-radius: 0.8rem;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    line-height: 1.6;
}

.profile-footer {
    background: var(--white);
}

@media (max-width: 1020px) {
    .profile-content-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(17rem, 0.8fr);
    }
}

@media (max-width: 760px) {
    .search-fields-public,
    .search-more-grid,
    .profile-content-grid {
        grid-template-columns: 1fr;
    }

    .profile-listing-grid {
        grid-template-columns: 1fr;
    }

    .location-autocomplete {
        grid-column: auto;
    }

    .profile-header {
        align-items: center;
        flex-direction: row;
    }

    .profile-header .text-link {
        display: none;
    }

    .profile-hero-card {
        min-height: 26rem;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
    }

    .profile-logo-wrap {
        width: 7rem;
        height: 7rem;
        border-radius: 1.35rem;
    }

    .profile-identity h1 {
        font-size: clamp(2.2rem, 12vw, 3.5rem);
    }
}

@media (max-width: 460px) {
    .profile-header .button {
        min-height: 2.45rem;
        padding-inline: 0.8rem;
        font-size: 0.72rem;
    }

    .profile-hero-card,
    .profile-panel {
        border-radius: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .profile-loading-mark {
        animation-duration: 1.8s;
    }

    .provider-card,
    .category-chip,
    .button {
        transition: none;
    }
}

/* ---------------------------------------------------------------------
   Galeria do anunciante na pagina publica
   --------------------------------------------------------------------- */
.profile-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-top: 1.1rem;
}

/* Quadrado, e nao 4:3: a galeria recebe foto em pe e foto deitada, e o
   quadrado e o unico formato que corta pouco dos dois lados. Em 4:3, uma
   foto vertical perdia metade da altura. A foto inteira continua a um
   clique de distancia, no visualizador. */
.profile-gallery-item {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--ice-50);
    aspect-ratio: 1 / 1;
    cursor: zoom-in;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.profile-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-gallery-item:hover,
.profile-gallery-item:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------
   Lightbox

   Sem biblioteca: a politica de seguranca do site nao carrega script de
   fora, e um visualizador de fotos nao justifica abrir excecao.
   --------------------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: clamp(1rem, 4vw, 3rem);
    background: rgba(7, 29, 78, 0.92);
}

.lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    margin: 0;
    max-width: min(100%, 1080px);
}

.lightbox-figure img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: 0.9rem;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    object-fit: contain;
}

.lightbox-figure figcaption {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.lightbox-close,
.lightbox-nav {
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    line-height: 1;
    cursor: pointer;
    transition: background 0.16s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-close {
    position: absolute;
    top: clamp(0.75rem, 3vw, 1.5rem);
    right: clamp(0.75rem, 3vw, 1.5rem);
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1.6rem;
}

.lightbox-nav {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    font-size: 2rem;
}

/* Com o lightbox aberto, a pagina atras nao rola junto. */
body.has-lightbox {
    overflow: hidden;
}

@media (max-width: 560px) {
    .lightbox {
        padding: 0.75rem;
    }

    .lightbox-nav {
        width: 2.4rem;
        height: 2.4rem;
        font-size: 1.6rem;
    }

    .lightbox-figure img {
        max-height: 68vh;
    }
}

/* ---------------------------------------------------------------------
   Onde e quando o anunciante atende

   Endereco e horario andam juntos: quem decide ir precisa dos dois ao mesmo
   tempo. O painel some inteiro quando nao ha nenhum dos dois -- e comum
   atender so a domicilio ou online.
   --------------------------------------------------------------------- */
.profile-visit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.4rem 2.4rem;
    margin-top: 1.1rem;
}

.profile-visit h3 {
    margin-bottom: 0.55rem;
    font-size: 0.84rem;
}

.profile-address p {
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.7;
}

.profile-address .button {
    gap: 0.5rem;
    padding-inline: 1rem;
}

.profile-address .button svg {
    width: 1.05rem;
    height: 1.05rem;
}

.profile-hours-list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.profile-hours-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.82rem;
}

.profile-hours-list li:last-child {
    border-bottom: 0;
}

.profile-hours-list span {
    color: var(--muted);
}

.profile-hours-list strong {
    font-size: 0.82rem;
}

/* Dia fechado e informacao, nao ausencia: aparece, so que sem destaque. */
.profile-hours-list li.is-closed strong {
    color: var(--muted);
    font-weight: 600;
}
