/* KickOff 2027 - ranking de fotos (#/fotos e aba "Fotos" do admin). Usa as variaveis de styles.css. */

/* ---------- alternador Pontos / Fotos (topo dos dois rankings) ---------- */
.rank-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.rank-switch a { font: 600 14px var(--sans); color: var(--muted); text-align: center; text-decoration: none; border-radius: 999px; padding: 10px; min-height: 40px; }
.rank-switch a:hover { color: var(--text); }
.rank-switch a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(11, 12, 14, 0.12); }

/* ---------- barra de envio e filtros ---------- */
.ph-bar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.ph-bar .btn svg { width: 18px; height: 18px; }
.ph-bar p { flex: 1; min-width: 200px; }
.ph-chips .chip { text-transform: none; }
.ph-final { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.ph-more { font: 600 13px var(--sans); color: var(--cyan); background: none; border: 0; padding: 0; min-height: 40px; cursor: pointer; white-space: nowrap; }
.ph-more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- grade e podio ---------- */
.ph-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .ph-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Podio: a campea ocupa dois tercos e a altura das outras duas somadas. */
.ph-podium { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }
.ph-podium.n1, .ph-podium.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ph-podium.n3 .ph.hero { grid-row: span 2; }
.ph-podium.n3 .ph.hero .ph-media { aspect-ratio: auto; flex: 1; min-height: 0; }

/* ---------- foto ---------- */
.ph { margin: 0; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ph.mine { border-color: var(--cyan); }
.ph-media { position: relative; aspect-ratio: 1; background: var(--surface-2); }
.ph-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; overflow: hidden; }
.ph-open img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.ph-open:hover img { transform: scale(1.04); }
.ph-open:focus-visible { outline-offset: -3px; }
.ph figcaption { padding: 9px 12px 11px; line-height: 1.3; min-width: 0; }
.ph figcaption b, .ph figcaption span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph figcaption b { font-size: 13px; font-weight: 600; }
.ph figcaption span { font-size: 12px; color: var(--muted); min-height: 1.3em; }
.ph-pos { font: 700 13px var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.ph-pos.top { color: var(--orange); }
.ph-media .ph-pos { position: absolute; left: 6px; top: 6px; padding: 4px 8px; border-radius: 8px; background: rgba(20, 23, 26, 0.82); color: #FFFFFF; pointer-events: none; }
/* Sobre o veu escuro vale o laranja claro do logo: o --orange do tema claro some no escuro. */
.ph-media .ph-pos.top { color: var(--logo-orange, #FF7A45); }

/* Curtida: botao (ou so o contador, na propria foto e com a votacao encerrada). */
.ph-like { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; min-height: 40px; min-width: 56px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.ph-like svg { width: 18px; height: 18px; flex: none; }
.ph-like b { font: 700 13px var(--mono); font-variant-numeric: tabular-nums; }
.ph-like.on { color: var(--orange); border-color: var(--orange); }
.ph-like.on svg { fill: currentColor; }
.ph-like.still { cursor: default; color: var(--muted); }
button.ph-like:hover { border-color: var(--orange); }
.ph-like.pop svg { animation: ph-pop 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes ph-pop { 0% { transform: scale(0.7); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
.ph-media .ph-like { position: absolute; right: 6px; bottom: 6px; border-color: transparent; background: rgba(20, 23, 26, 0.82); color: #FFFFFF; }
.ph-media .ph-like.on { color: var(--logo-orange, #FF7A45); border-color: transparent; }
.ph-media button.ph-like:hover { background: rgba(20, 23, 26, 0.96); border-color: transparent; }
.ph-media .ph-like.still { color: #FFFFFF; }
/* Coracao cheio = quem esta vendo votou "gostei" nesta foto. */
.ph-like.still.on { color: var(--orange); border-color: var(--line); }
.ph-media .ph-like.still.on { color: var(--logo-orange, #FF7A45); border-color: transparent; }

/* ---------- votacao: uma foto por vez, arrasta para o lado ---------- */
.ph-deck { display: flex; flex-direction: column; align-items: center; gap: 14px; outline: none; }
/* Altura pela tela: a foto e os botoes de voto cabem sem rolar (cabecalho, abas, botoes e menu de baixo somam ~430px). */
.ph-stack { position: relative; width: min(100%, 420px); height: clamp(220px, calc(100vh - 430px), 525px); }
@supports (height: 100dvh) { .ph-stack { height: clamp(220px, calc(100dvh - 430px), 525px); } }
.ph-card { position: absolute; inset: 0; margin: 0; overflow: hidden; border-radius: 24px; background: #14171A; box-shadow: var(--shadow, 0 8px 24px rgba(11, 12, 14, 0.16)); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; transition: transform 0.3s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)); }
.ph-card.drag { transition: none; cursor: grabbing; }
.ph-card:not(.top) { transform: scale(0.95) translateY(14px); box-shadow: none; }
.ph-card:not(.top) .ph-card-info { visibility: hidden; }
.ph-card.top { animation: ph-rise 0.3s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)); }
@keyframes ph-rise { from { transform: scale(0.95) translateY(14px); } }
.ph-card img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
/* Veu so no rodape, para a legenda e o nome ficarem legiveis sobre qualquer foto. */
.ph-card-info { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 56px 18px 18px; color: #FFFFFF; background: linear-gradient(to top, rgba(11, 12, 14, 0.88), rgba(11, 12, 14, 0)); pointer-events: none; }
.ph-card-info .tag { background: rgba(255, 255, 255, 0.18); color: #FFFFFF; }
.ph-card-info b { font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ph-card-info > span:last-child { font-size: 13px; color: rgba(255, 255, 255, 0.86); }
/* Carimbo que aparece conforme a foto e arrastada (--like e --pass vao de 0 a 1). */
.ph-stamp { position: absolute; top: 20px; padding: 6px 14px; border-radius: 12px; font: 800 18px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; background: rgba(11, 12, 14, 0.78); pointer-events: none; }
.ph-stamp.like { left: 16px; color: var(--logo-orange, #FF7A45); opacity: var(--like, 0); transform: rotate(-8deg); }
.ph-stamp.pass { right: 16px; color: #FFFFFF; opacity: var(--pass, 0); transform: rotate(8deg); }
.ph-deck-actions { display: flex; align-items: center; justify-content: center; gap: 18px; }
.ph-round { width: 64px; height: 64px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong, var(--line)); background: var(--surface); color: var(--text); box-shadow: var(--shadow, 0 8px 24px rgba(11, 12, 14, 0.12)); cursor: pointer; transition: transform 0.15s var(--ease, ease-out); }
.ph-round svg { width: 28px; height: 28px; }
.ph-round:hover { border-color: var(--text); }
.ph-round:active { transform: scale(0.92); }
.ph-round.like { background: var(--orange); border-color: var(--orange); color: var(--on-accent, #14171A); }
.ph-round.like svg { fill: currentColor; }
.ph-round.sm { width: 44px; height: 44px; box-shadow: none; color: var(--muted); }
.ph-round.sm svg { width: 20px; height: 20px; }
.ph-round:disabled { opacity: 0.4; cursor: default; transform: none; }
.ph-round:disabled:hover { border-color: var(--line-strong, var(--line)); }
.ph-deck-hint { max-width: 420px; text-align: center; }
.ph-deck.is-done .ph-stack { height: auto; }
.ph-deck.is-done .ph-deck-hint, .ph-deck.is-done [data-swipe] { display: none; }
.ph-deck-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; text-align: center; font-size: 13px; color: var(--muted); border: 1px dashed var(--line-strong, var(--line)); border-radius: 24px; }
.ph-deck-done b { font-size: 17px; font-weight: 600; color: var(--text); }
.ph-deck-done .btn { margin-top: 10px; }

/* Voto na foto aberta: troca ou desfaz o voto dado. */
.ph-vote { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ph-vote .btn { gap: 8px; }
.ph-vote .btn svg { width: 18px; height: 18px; flex: none; }
.ph-vote [data-vote="like"][aria-pressed="true"] { background: var(--orange); border-color: var(--orange); color: var(--on-accent, #14171A); }
.ph-vote [data-vote="like"][aria-pressed="true"] svg { fill: currentColor; }
.ph-vote [data-vote="pass"][aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }

/* Categoria sem fotos: o proprio espaco vazio envia a primeira. */
.ph-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 26px 16px; font: 400 13px var(--sans); color: var(--muted); background: transparent; border: 1px dashed var(--line); border-radius: var(--radius); cursor: pointer; }
.ph-empty svg { width: 26px; height: 26px; color: var(--cyan); margin-bottom: 4px; }
.ph-empty b { font-size: 15px; font-weight: 600; color: var(--text); }
.ph-empty:hover { border-color: var(--cyan); }

/* ---------- foto aberta ---------- */
dialog.ph-view { padding: 0; width: min(720px, calc(100vw - 24px)); }
.ph-view-img { position: relative; display: grid; place-items: center; background: #14171A; min-height: 160px; }
.ph-view-img img { max-width: 100%; max-height: 62vh; object-fit: contain; }
@supports (height: 100dvh) { .ph-view-img img { max-height: 62dvh; } }
.ph-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(20, 23, 26, 0.82); color: #FFFFFF; cursor: pointer; }
.ph-close svg { width: 20px; height: 20px; }
.ph-view-body { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.ph-view-body h2 { margin: 0; overflow-wrap: anywhere; }
.ph-view-by { display: flex; align-items: center; gap: 12px; }
.ph-view-by .grow { flex: 1; min-width: 0; }
.ph-view-by .grow b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.ph-view-by .grow span { display: block; font-size: 12px; color: var(--muted); }

/* ---------- envio ---------- */
.ph-drop { position: relative; align-items: center; justify-content: center; min-height: 168px; text-align: center; background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; cursor: pointer; overflow: hidden; }
.ph-drop:hover { border-color: var(--cyan); }
.ph-drop:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }
.ph-drop.has { border-style: solid; background: #14171A; }
.ph-drop-in { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; }
.ph-drop-in svg { width: 28px; height: 28px; color: var(--cyan); margin-bottom: 4px; }
.ph-drop-in b { font-size: 15px; color: var(--text); }
.ph-drop.has .ph-drop-in { display: none; }
.ph-drop img { width: 100%; max-height: 260px; object-fit: contain; }
.ph-drop img[hidden], .ph-drop-swap[hidden] { display: none; }
.ph-drop-swap { position: absolute; right: 8px; bottom: 8px; padding: 7px 12px; border-radius: 999px; background: rgba(20, 23, 26, 0.82); color: #FFFFFF; font-size: 13px; }
.ph-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.ph-field legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ph-field .option { align-items: flex-start; text-align: left; gap: 2px; }
.ph-field .option b { font-size: 14px; font-weight: 600; line-height: 1.3; }
.ph-field .option span { font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.35; }
.ph-field .option.full { opacity: 0.55; cursor: default; }

/* ---------- inicio e admin ---------- */
.mission .ph-mark { color: var(--cyan); border-color: var(--cyan); }
.ph-mark svg { width: 14px; height: 14px; }
.ph-thumb { flex: none; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.ph-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row > .ph-pos { width: 30px; flex: none; }
