/* =========================================================
   Atlas SOUZAIA: versão editorial (clara)
   ========================================================= */

.portfolio.atlas {
  padding: 100px 0 108px;
  scroll-margin-top: 80px;
}

.atlas .sec-head {
  align-items: flex-end;
}

.atlas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.atlas-filters,
.atlas-switch {
  display: flex;
  align-items: center;
  gap: 6px;
}

.atlas button {
  font-family: Archivo, sans-serif;
}

.atlas-filters button,
.atlas-switch button {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: #3d3a34;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.atlas-filters button:hover,
.atlas-switch button:hover {
  border-color: var(--ink);
}

.atlas-filters button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.atlas-switch {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.atlas-switch button {
  min-height: 36px;
  padding: 7px 14px;
  border-color: transparent;
}

.atlas-switch button[aria-pressed="true"] {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 600;
}

.atlas [hidden] {
  display: none !important;
}

.atlas :focus-visible,
.project-dialog :focus-visible {
  outline: 2px solid var(--blue-deep);
  outline-offset: 4px;
}

/* ---------- Mapa ---------- */

.map-shell {
  position: relative;
  border: 1px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
  background: var(--card);
}

.map-topline {
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.map-topline strong {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.16em;
}

.map-live {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.map-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2f7d55;
}

.map-viewport {
  height: 640px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #b9b2a3 var(--card);
  scrollbar-width: thin;
  cursor: grab;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(27, 54, 224, 0.035), transparent 70%),
    var(--card);
}

.map-viewport.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.map-space {
  position: relative;
  margin: auto;
}

.map-scene {
  width: 1040px;
  height: 680px;
  transform-origin: top left;
  position: absolute;
  inset: 0 auto auto 0;
}

.city-drawing {
  position: absolute;
  inset: 0;
  width: 1040px;
  height: 680px;
  pointer-events: none;
}

.map-district-title {
  position: absolute;
  font-family: Archivo, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.16em;
  color: var(--ink);
  pointer-events: none;
}

.map-district-title small {
  display: block;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.map-district-title.sites-title {
  left: 125px;
  top: 50px;
}

.map-district-title.apps-title {
  left: 658px;
  top: 53px;
}

.map-district-title.games-title {
  left: 106px;
  top: 382px;
}

.map-hub {
  position: absolute;
  top: 355px;
  left: 495px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 56px;
  height: 56px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 0 0 6px rgba(242, 239, 231, 0.9);
  color: var(--ink);
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  letter-spacing: -0.04em;
  pointer-events: none;
}

.map-hub span {
  color: var(--blue-deep);
}

/* ---------- Pontos ---------- */

.district-sites {
  --district-color: #2f6b4c;
}

.district-apps {
  --district-color: #3d5be0;
}

.district-games {
  --district-color: #6b5a86;
}

.map-point {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  width: 220px;
  padding: 10px;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  z-index: 2;
  text-align: center;
  touch-action: manipulation;
}

.map-point:hover,
.map-point:focus-visible {
  z-index: 5;
}

.point-building {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 64px;
  border: 1.5px solid var(--district-color);
  border-radius: 13px 13px 6px 6px;
  background: var(--card);
  color: var(--district-color);
  box-shadow: 0 5px 0 rgba(16, 21, 33, 0.9);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.point-building svg {
  width: 34px;
  height: 34px;
}

.point-number {
  position: absolute;
  top: -11px;
  right: -10px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--district-color);
  font-family: Archivo, sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.point-label {
  display: block;
  min-width: 166px;
  margin-top: 14px;
  padding: 7px 11px;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 2px;
  box-shadow: 3px 3px 0 rgba(16, 21, 33, 0.14);
}

.point-label strong {
  display: block;
  font-family: Archivo, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.point-label strong::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  background: var(--district-color);
  border-radius: 50%;
  vertical-align: middle;
}

.point-status-development .point-label strong::before {
  background: #b07a1c;
}

.point-status-concept .point-label strong::before {
  background: #6b5a86;
}

.point-label > span {
  display: none;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.is-overview .point-label {
  min-width: 0;
  width: max-content;
  transform: scale(var(--overview-label-scale));
  transform-origin: top center;
}

.is-overview .point-label > span {
  display: none;
}

.is-overview .point-label strong {
  font-size: 15px;
}

.is-overview .point-hint {
  display: none;
}

.point-hint {
  position: absolute;
  top: calc(100% + 2px);
  padding: 6px 10px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--card);
  color: var(--district-color);
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.map-point:hover .point-hint,
.map-point:focus-visible .point-hint {
  opacity: 1;
}

.map-point:hover .point-building,
.map-point:focus-visible .point-building {
  transform: translateY(-5px);
  box-shadow: 0 10px 0 rgba(16, 21, 33, 0.9);
}

.muted-district {
  opacity: 0.2;
}

/* ---------- Controles ---------- */

.map-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.map-controls button {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.map-controls button:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.map-controls button:disabled {
  opacity: 0.35;
  cursor: default;
}

.map-controls #zoom-fit {
  font-size: 11px;
  padding: 0 13px;
  margin-left: 8px;
}

#zoom-value {
  color: var(--muted);
  min-width: 44px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.map-help {
  margin: 0 0 0 auto;
  max-width: 350px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.atlas-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 11px;
}

.atlas-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.atlas-legend span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #2f7d55;
}

.atlas-legend span:last-child::before {
  background: #b07a1c;
}

.noscript {
  margin-top: 24px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.noscript a {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

/* ---------- Lista ---------- */

.atlas-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.atlas-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  overflow: hidden;
}

.atlas-card > img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: cover;
  object-position: top;
  background: #e6e1d6;
}

.atlas-card-body {
  padding: 24px;
}

.atlas-card-body h3 {
  font-family: Fraunces, Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 10px 0;
}

.atlas-card-body > p:not(.atlas-category) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.atlas-category {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 18px;
}

.atlas-card button {
  min-height: 46px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding: 16px 0 0;
  background: none;
  color: var(--blue-deep);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.atlas-card button:hover {
  color: var(--ink);
}

.project-status {
  display: inline-block;
  color: #143d2f;
  background: #e0ecdf;
  padding: 5px 9px;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1.5;
}

.status-development {
  color: #6b4a12;
  background: #f4e8cd;
}

.status-concept {
  color: #4b3f63;
  background: #e8e1f0;
}

/* ---------- Painel de detalhes ---------- */

.project-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(600px, 100%);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-left: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  box-shadow: -30px 0 80px rgba(16, 21, 33, 0.18);
}

.project-dialog::backdrop {
  background: rgba(16, 21, 33, 0.42);
  backdrop-filter: blur(3px);
}

.project-detail-open {
  overflow: hidden;
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(242, 239, 231, 0.97);
  border-bottom: 1px solid var(--line);
}

.detail-topbar > span {
  min-width: 0;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.6;
  color: var(--muted);
}

#close-project {
  flex-shrink: 0;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
}

#close-project:hover {
  background: var(--ink);
  color: var(--paper);
}

.detail-media {
  margin: 0;
}

.detail-media img {
  display: block;
  width: 100%;
  height: auto;
  background: #e6e1d6;
}

.detail-media figcaption {
  padding: 10px 28px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}

.detail-body {
  padding: 14px 32px 44px;
}

.detail-body h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin: 12px 0 16px;
}

.detail-body h3 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 400;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 28px 0 8px;
}

.detail-body p:not(.atlas-category),
.detail-body li {
  font-size: 13px;
  color: #3d3a34;
  line-height: 1.8;
}

.detail-body .detail-intro {
  margin-top: 22px;
}

.detail-body ul {
  padding-left: 18px;
}

.detail-body li {
  padding: 4px 0;
}

.detail-body li::marker {
  color: var(--blue-deep);
}

.detail-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
  padding: 16px 20px;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.detail-link:hover {
  background: var(--blue-deep);
}

.detail-body p.detail-footnote {
  font-size: 10px;
  margin-top: 20px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.map-signal {
  animation: city-signal 5s ease-in-out infinite;
}

@keyframes city-signal {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .portfolio.atlas {
    padding: 74px 0 82px;
  }

  .atlas-filters {
    flex-wrap: wrap;
  }

  .atlas-filters button {
    padding: 9px 12px;
  }

  .atlas-toolbar {
    align-items: flex-start;
  }

  .map-viewport {
    height: 480px;
  }

  .map-topline {
    padding: 13px 15px;
    font-size: 7.5px;
    letter-spacing: 0.1em;
  }

  .map-controls {
    flex-wrap: wrap;
    padding: 12px;
    gap: 5px;
  }

  .map-help {
    flex: 1 0 100%;
    margin: 8px 0 0;
    max-width: none;
  }

  .atlas-bottom {
    flex-direction: column;
    gap: 10px;
  }

  .atlas-list {
    grid-template-columns: 1fr;
  }

  .atlas-card > img {
    height: auto;
  }

  .project-dialog {
    inset: auto 0 0;
    width: 100vw;
    height: 92dvh;
    max-height: 92dvh;
    border-left: 0;
    border-top: 1px solid var(--ink);
    border-radius: 16px 16px 0 0;
  }

  .detail-body {
    padding: 10px 24px 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
