/* ==========================================================================
   Coframax · o globo das obras (página inicial) e a sua pré-visualização no painel.
   Preto e branco; só os países com obra levam o laranja da marca. Ver public/js/globe.js
   e docs/PROJECT.md §O globo das obras. Usa as variáveis de site.css (--paper, --orange, --move…).
   ========================================================================== */

.globe-sec { position: relative; overflow: hidden; isolation: isolate; border-top: 1px solid var(--line, rgba(255, 226, 212, .13)); }
/* Uma luz fria por trás do globo: o escuro tem sempre uma luz por cima. */
.globe-sec::before { content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: radial-gradient(38% 52% at 74% 52%, rgba(245, 239, 234, .07), transparent 70%); }

.globe-sec__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto 1fr;
  grid-template-areas: "head globe" "list globe"; column-gap: clamp(32px, 5vw, 80px); }
.globe-sec__head { grid-area: head; }
.globe-sec__head .lead { margin: 14px 0 0; }

/* ── O globo ── */
.globe { grid-area: globe; align-self: center; justify-self: center; position: relative; width: 100%; max-width: 660px; aspect-ratio: 1; }
/* A esfera antes de o mapa chegar (e se não chegar): o mesmo mar com volume que o canvas desenha por cima. */
.globe::before { content: ""; position: absolute; inset: 7%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 34% 31%, #3b3431 0, #211a17 62%, #130d0b 100%);
  box-shadow: 0 0 0 1px rgba(245, 239, 234, .12), 0 0 70px rgba(245, 239, 234, .07);
  transition: opacity .6s linear .9s; }
.globe.is-ready::before { opacity: 0; }
.globe__canvas { position: relative; display: block; width: 100%; height: 100%; cursor: grab; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;   /* o dedo na vertical continua a descer a página; na horizontal roda o globo */
  opacity: 0; filter: blur(12px); transform: scale(.965);
  transition: opacity 1.2s var(--arrive, cubic-bezier(.16, 1, .3, 1)), filter 1.2s var(--arrive, cubic-bezier(.16, 1, .3, 1)), transform 1.8s var(--arrive, cubic-bezier(.16, 1, .3, 1)); }
.globe.is-ready .globe__canvas { opacity: 1; filter: none; transform: none; }
.globe__canvas.is-over { cursor: pointer; }
.globe.is-grabbing .globe__canvas { cursor: grabbing; }

.globe__tag { position: absolute; left: 0; top: 0; z-index: 2; translate: -50% calc(-100% - 14px); pointer-events: none;
  padding: 7px 14px; border-radius: 999px; background: rgba(15, 8, 6, .88); border: 1px solid rgba(245, 239, 234, .24);
  color: var(--paper, #F5EFEA); font-size: 15px; font-weight: 800; line-height: 1.3; white-space: nowrap; font-variant-numeric: tabular-nums;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s var(--arrive, ease); }
.globe__tag.is-on { opacity: 1; }

.globe__live { position: absolute; left: 50%; bottom: 0; translate: -50% 0; margin: 0; display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--paper-3, rgba(245, 239, 234, .58)); white-space: nowrap; pointer-events: none; }
.globe__live i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange, #F44D25); flex: none; animation: globe-live 2.4s var(--arrive, ease-out) infinite; }
@keyframes globe-live { from { box-shadow: 0 0 0 0 rgba(244, 77, 37, .6); } to { box-shadow: 0 0 0 10px rgba(244, 77, 37, 0); } }
.globe.is-failed .globe__live { display: none; }

/* ── A lista dos países: o que se lê e se usa com o teclado ── */
.gl-list { grid-area: list; list-style: none; margin: clamp(24px, 3vw, 40px) 0 0; padding: 0; border-top: 1px solid var(--line); }
.gl-item { border-bottom: 1px solid var(--line); }
.gl-item__head { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "mark name chev" ". sub chev";
  column-gap: 14px; row-gap: 2px; align-items: center; min-height: 72px; padding: 14px 4px; margin: 0;
  background: none; border: 0; color: var(--paper); text-align: left; cursor: pointer; border-radius: 0; }
.gl-item__mark { grid-area: mark; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--orange); transition: background-color .3s var(--arrive); }
.gl-item.is-open .gl-item__mark, .gl-item__head:hover .gl-item__mark { background: var(--orange); }
.gl-item__name { grid-area: name; font-size: 21px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.gl-item__sub { grid-area: sub; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; font-size: 15px; color: var(--paper-3); }
.gl-item__chev { grid-area: chev; width: 24px; height: 24px; fill: none; stroke: var(--paper-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .5s var(--move); }
.gl-item.is-open .gl-item__chev { transform: rotate(180deg); }
.gl-item__head:focus-visible { outline-offset: -3px; }

.gl-clock { display: inline-flex; align-items: center; gap: 8px; color: var(--paper-2); font-variant-numeric: tabular-nums; }
.gl-clock__s { color: var(--paper-3); }
.gl-clock__sky { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.gl-clock__sky.is-day { background: var(--paper); box-shadow: 0 0 0 3px rgba(245, 239, 234, .14); }
.gl-clock__sky.is-night { box-shadow: inset -3.5px -1.5px 0 0 var(--paper-2); transform: rotate(-25deg); }

/* Sem JavaScript fica tudo aberto; com ele, abre um de cada vez e cresce até à altura. */
.gl-item__body { display: grid; grid-template-rows: 1fr; }
.js .gl-item__body { grid-template-rows: 0fr; transition: grid-template-rows .55s var(--move); }
.js .gl-item.is-open .gl-item__body { grid-template-rows: 1fr; }
.gl-item__in { min-height: 0; overflow: hidden; padding: 0 4px 0 26px; }
.js .gl-item:not(.is-open) .gl-item__in { visibility: hidden; opacity: 0; filter: blur(6px); transition: opacity .25s linear, filter .25s linear, visibility 0s linear .55s; }
.js .gl-item.is-open .gl-item__in { transition: opacity .5s var(--arrive) .12s, filter .5s var(--arrive) .12s; }
.gl-item__note { color: var(--paper-2); font-size: 17px; margin: 0 0 14px; }
.gl-works { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.gl-works a { display: grid; grid-template-columns: 72px minmax(0, 1fr) 20px; gap: 14px; align-items: center; padding: 8px; margin: 0 -8px;
  border-radius: 12px; text-decoration: none; transition: background-color .25s var(--arrive); }
.gl-works a:hover { background: rgba(245, 239, 234, .06); }
.gl-works img, .gl-works__ph { width: 72px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--night-2); display: block; }
.gl-works__t b { display: block; font-size: 17px; font-weight: 800; line-height: 1.3; }
.gl-works__t small { display: block; font-size: 15px; color: var(--paper-3); line-height: 1.4; margin-top: 2px; }
.gl-works .glyph { width: 20px; height: 20px; color: var(--orange); transition: transform .3s var(--arrive); }
.gl-works a:hover .glyph { transform: translateX(3px); }
.gl-item__more, .gl-item__cta { margin: 6px 28px 24px 0; }

@media (max-width: 900px) {
  .globe-sec__grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "head" "globe" "list"; }
  .globe { max-width: 560px; margin-top: 8px; }
  .gl-list { margin-top: 12px; }
}
/* No telemóvel o globo vai de ponta a ponta do ecrã. */
@media (max-width: 600px) {
  .globe { justify-self: stretch; width: auto; max-width: none; margin-inline: calc(-1 * var(--gutter)); }
  .gl-item__name { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .globe__canvas, .globe::before, .js .gl-item__body, .js .gl-item__in, .gl-item__chev { transition: none !important; }
  .globe__canvas { filter: none; transform: none; }
  .globe__live i { animation: none; }
}

/* ==========================================================================
   Painel → Site → Mapa
   ========================================================================== */
/* O painel não tem o .sr do site: o mesmo «só para o leitor de ecrã», aqui dentro. */
.gpanel .sr, .gpanel__preview .sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.gpanel__preview { position: relative; background: #0F0806; border-radius: 16px; overflow: hidden; margin-bottom: 16px; padding: 12px;
  display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 8px 24px; align-items: center; color: #F5EFEA; }
.gpanel__preview .globe { grid-area: auto; max-width: 360px; justify-self: start; margin: 0; --paper: #F5EFEA; --paper-3: rgba(245, 239, 234, .58); --orange: #F44D25; }
.gpanel__preview p { margin: 0 0 8px; font-size: 15.5px; color: rgba(245, 239, 234, .78); }
.gpanel__preview b { color: #fff; }
.gpanel__list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line, #E4DCD5); }
.gpanel__row { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line, #E4DCD5); }
.gpanel__name b { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.gpanel__name b::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #F44D25; flex: none; }
.gpanel__name small { display: block; font-size: 15px; color: var(--ink-3, #7A6D66); margin: 2px 0 0 20px; }
.gpanel__row .pfield { margin: 0; }
.gpanel__add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-top: 18px; }
.gpanel__add .pfield { margin: 0; }
.gpanel__hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0 0; }
.gpanel__empty { padding: 18px 0; color: var(--ink-2, #5B4D46); }
@media (max-width: 760px) {
  .gpanel__preview { grid-template-columns: 1fr; }
  .gpanel__preview .globe { justify-self: center; width: 100%; }
  .gpanel__row { grid-template-columns: minmax(0, 1fr) auto; }
  .gpanel__row .pfield { grid-column: 1 / -1; grid-row: 2; }
  .gpanel__add { grid-template-columns: 1fr; }
}
