:root {
  --panel-green: #00bf63;
  --ink: #0a0f0c;
  --muted: #6b746e;
  --card: #ffffff;
  --page: #f4f6f4;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Class rules that set `display` outrank the UA `[hidden]` rule, so panels
   toggled from JS stay painted without this. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

.atlas {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* Floats over the map. Nothing here is interactive, so pointer events pass
   straight through to the map underneath. */
.atlas-top {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  padding: calc(14px + var(--safe-top)) 18px 46px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    rgba(255, 255, 255, 0.96) 42%,
    rgba(255, 255, 255, 0.72) 66%,
    rgba(255, 255, 255, 0) 100%
  );
}

.atlas-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel-green);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.atlas-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atlas-identity {
  min-width: 0;
  padding-top: 2px;
}

.atlas-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-tagline {
  margin: 3px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.atlas-meta {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Taller than the visible map, because the header overlay eats the top ~150px. */
.atlas-map-wrap {
  position: relative;
  height: min(56vh, 480px);
  min-height: 340px;
  background: #dfe8e2;
}

.atlas-map {
  position: absolute;
  inset: 0;
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 30% 40%, rgba(0, 191, 99, 0.18), transparent 50%),
    #d7e4db;
}

.map-placeholder__title {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
}

.map-placeholder__body {
  margin: 8px 0 0;
  font-size: 13px;
  color: #3d463f;
  max-width: 280px;
}

/* Rides above the control row, which itself clears Apple's attribution. */
.map-note {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 96px;
  margin: 0;
  background: rgba(10, 15, 12, 0.78);
  color: #fff;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  pointer-events: none;
}

.map-ctl {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(10, 15, 12, 0.18);
  cursor: pointer;
  white-space: nowrap;
}

.map-ctl svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* Lifted clear of the Apple Maps logo, which MapKit pins to the bottom edge
   and which its terms require to stay visible. */
.map-ctl--fit {
  left: 12px;
  bottom: 44px;
  padding: 9px 14px 9px 11px;
}

.map-ctl--fit svg {
  color: var(--panel-green);
}

.map-ctl--locate {
  right: 12px;
  bottom: 44px;
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.map-ctl--locate.is-active {
  color: var(--panel-green);
}

.atlas-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e8ece9;
  padding: 0 6px;
}

.atlas-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 4px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.atlas-tab svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.atlas-tab.is-active {
  color: var(--panel-green);
  border-bottom-color: var(--panel-green);
}

.atlas-stack {
  flex: 1;
  padding: 18px 0 4px;
  min-height: 220px;
}

.card-track {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 10px 16px 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.card-track::-webkit-scrollbar {
  display: none;
}

/* Negative margins pull neighbours in so they tuck behind the active card
   and only peek out at the edges. */
.post-card {
  flex: 0 0 min(72%, 300px);
  margin: 0 -26px;
  position: relative;
  z-index: 1;
  scroll-snap-align: center;
  background: var(--card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(10, 15, 12, 0.16);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transform: scale(0.86) rotate(-2deg);
  opacity: 0.92;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

/* Cards after the active one tilt the other way, so the deck fans out. */
.post-card.is-active ~ .post-card {
  transform: scale(0.86) rotate(2deg);
}

.post-card.is-active {
  z-index: 3;
  transform: scale(1);
  opacity: 1;
  box-shadow: 0 18px 48px rgba(10, 15, 12, 0.22);
}

.post-card__media {
  aspect-ratio: 1 / 1;
  background: #111;
  overflow: hidden;
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card__text {
  aspect-ratio: 1 / 1;
  padding: 22px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  background: var(--panel-green);
}

.post-card__body {
  padding: 12px 14px 14px;
}

.post-card__caption {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.post-card__stats {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid #eef1ef;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.post-card__stats:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.post-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.post-card__stat svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-card__stat--likes svg {
  fill: #ff4d4f;
  stroke: #ff4d4f;
}

.card-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 16px 0;
  min-height: 8px;
}

.card-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d3dad5;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.card-dot.is-active {
  background: var(--panel-green);
  transform: scale(1.25);
}

.card-dot--edge {
  transform: scale(0.6);
}

.swipe-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.swipe-hint span {
  color: #aab2ac;
  padding: 0 4px;
}

.empty-state {
  margin: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.atlas-footer {
  padding: 14px 16px calc(18px + var(--safe-bottom));
  border-top: 1px solid #e8ece9;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 700;
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn--primary {
  background: var(--panel-green);
  color: #fff;
  width: 100%;
}

.btn--primary img {
  display: block;
  border-radius: 4px;
}

.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid #dde3df;
  width: 100%;
}

.not-found {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  background: #fff;
  gap: 12px;
}

.not-found h1 {
  margin: 8px 0 0;
  font-size: 22px;
}

.not-found p {
  margin: 0 0 8px;
  color: var(--muted);
  max-width: 320px;
}

.not-found .btn {
  width: auto;
  min-width: 180px;
}

.atlas-pin {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  overflow: hidden;
  background: var(--panel-green);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.atlas-pin img {
  width: 140%;
  height: 140%;
  object-fit: cover;
  transform: rotate(45deg) translate(-8%, -8%);
  display: block;
}

.atlas-pin--text {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.atlas-pin--text span {
  transform: rotate(45deg);
}

.atlas-pin.is-active {
  border-color: var(--panel-green);
  transform: rotate(-45deg) scale(1.18);
  z-index: 2;
}
