/* A project: the gallery dialog of the homepage (.ov) and the project's own page (/projetos/<slug>), which share the same parts.
   The homepage loads this file next to inicio.css; project pages load it alone. */

:root { --t-sec: clamp(2.5rem, 5.4vw, 4.8rem); }

/* Gallery dialog ------------------------------------------------------------ */
html.ov-aberto { overflow: hidden; }
.ov { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--paper); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; }
.ov::backdrop { background: rgba(18, 13, 10, .5); }
.ov[open], .ov[open]::backdrop { animation: ov-entra .2s ease-out; }
@keyframes ov-entra { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ov[open], .ov[open]::backdrop { animation: none; } }
.ov-barra { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding: 12px max(var(--pad), env(safe-area-inset-right)) 12px max(var(--pad), env(safe-area-inset-left)); background: var(--paper); border-bottom: 1px solid var(--rule); }
.ov-botao { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-family: var(--q); font-size: 16px; font-weight: 600; cursor: pointer; transition: background-color .15s ease-out; }
@media (hover: hover) and (pointer: fine) { .ov-botao:hover { background: var(--plaster); } .ov-fechar:hover { background: var(--oxblood); } }
.ov-fechar { background: var(--ink); color: var(--paper); padding: 0 20px; }
.ov-barra .ov-seg { margin-right: auto; }
.ov-x { position: relative; width: 14px; height: 14px; }
.ov-x::before, .ov-x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 1.6px; background: currentColor; }
.ov-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.ov-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
@media (max-width: 520px) { .ov-rot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

.ov-corpo { display: block; max-width: 1480px; margin: 0 auto; padding: clamp(28px, 4vw, 48px) max(var(--pad), env(safe-area-inset-right)) calc(clamp(64px, 8vw, 120px) + env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left)); }
.ov-cabeca { display: grid; gap: 18px clamp(32px, 5vw, 80px); margin-bottom: clamp(28px, 3.5vw, 44px); align-items: end; }
@media (min-width: 900px) { .ov-cabeca { grid-template-columns: 5fr 7fr; } }
.ov-cabeca h1, .ov-cabeca h2 { font-size: var(--t-sec); outline: none; }
.ov-factos { margin: 0; display: grid; gap: 12px 24px; font-size: var(--t-small); line-height: 1.5; }
@media (min-width: 640px) { .ov-factos { grid-template-columns: 2fr 1fr; } }
.ov-factos dt { font-family: var(--q); font-size: 15px; font-weight: 600; color: var(--soft); }
.ov-factos dd { margin: 2px 0 0; }

.ov-mosaico { list-style: none; margin: 0; padding: 0; columns: 3; column-gap: 10px; }
@media (max-width: 1099px) { .ov-mosaico { columns: 2; } }
@media (max-width: 639px) { .ov-mosaico { columns: 1; } }
.ov-fig { break-inside: avoid; margin: 0 0 10px; }
.ov-ampliar { display: block; width: 100%; padding: 0; border: 0; background: var(--plaster); cursor: zoom-in; }
.ov-ampliar img, .ov-ampliar .par { display: block; width: 100%; height: auto; }
.ov-ampliar:focus-visible { outline-offset: -4px; }
@media (hover: hover) and (pointer: fine) { .ov-ampliar { transition: opacity .15s ease-out; } .ov-ampliar:hover { opacity: .9; } }

.ov.a-ver .ov-barra, .ov.a-ver .ov-corpo { visibility: hidden; }
.ov-ver { position: fixed; inset: 0; z-index: 3; display: flex; flex-direction: column; background: var(--paper); }
.ov-ver[hidden] { display: none; }
.ov-ver-barra { display: flex; align-items: center; gap: 4px; padding: 12px max(var(--pad), env(safe-area-inset-right)) 12px max(var(--pad), env(safe-area-inset-left)); border-bottom: 1px solid var(--rule); }
.ov-ver-legenda { margin: 0 auto 0 12px; font-family: var(--q); font-size: 16px; color: var(--soft); }
.ov-ver-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: clamp(12px, 2vw, 28px); }
/* While a large image loads, its box is already there in plaster, not blank paper. */
.ov-ver-img > picture img, .ov-ver-img > img { background: var(--plaster); }
.ov-ver-img > img, .ov-ver-img > picture, .ov-ver-img > picture img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.ov-ver-img > picture { display: contents; }
.ov-ver-img > .par { width: min(100%, calc((100dvh - 120px) * var(--r, 1.6))); max-height: 100%; }

/* Project page -------------------------------------------------------------- */
/* The dialog's content as a page: the same header, facts and mosaic; the viewer opens in a dialog of its own. */
a.ov-ampliar { color: inherit; }

/* Previous and next project, by name. */
.vizinhos { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: clamp(48px, 6vw, 88px); padding-top: clamp(24px, 3vw, 36px); border-top: 1px solid var(--rule); font-family: var(--q); }
.vizinhos a { display: flex; flex-direction: column; gap: 6px; min-height: 44px; text-decoration: none; }
.vizinhos .vizinho-seg { grid-column: 2; text-align: right; align-items: flex-end; }
.vizinho-rot { font-size: 15px; font-weight: 600; color: var(--soft); }
.vizinho-lugar { font-size: clamp(1.4rem, 2.4vw, 2.2rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
@media (hover: hover) and (pointer: fine) { .vizinhos a:hover .vizinho-lugar { color: var(--oxblood); } }

.ov-botao:active { transform: scale(.94); }
.ov-ampliar:active, .capa:active { opacity: .85; }
@media (prefers-reduced-motion: reduce) { .ov-botao:active { transform: none; } }
