/* ═══════════════════════════════════════════════════════════════
   ATLAS — ATOMIC DESIGN TOKENS
   Mapped 1:1 from Swift (MapPillViews.swift + MapDetailViews.swift)
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Craft Paper — AppColors.craftPaper (pill dark background) */
  --atl-craft:         #1A1520;
  --atl-craft-soft:    #221B28;
  --atl-craft-fg:      #F5F0E8;
  --atl-craft-mute:    rgba(245, 240, 232, 0.55);
  --atl-craft-dim:     rgba(245, 240, 232, 0.35);

  /* Glass layers — AppColors.glass2..6 */
  --atl-glass2:        rgba(255, 255, 255, 0.04);
  --atl-glass3:        rgba(255, 255, 255, 0.06);
  --atl-glass5:        rgba(255, 255, 255, 0.10);
  --atl-glass6:        rgba(255, 255, 255, 0.14);

  /* Rarity — AppColors brand */
  --atl-r-common:      #9AA5B1;
  --atl-r-uncommon:    #4ADE80;
  --atl-r-rare:        #3B82F6;
  --atl-r-epic:        #A855F7;
  --atl-r-legendary:   #F5B301;

  /* UV Spectrum (UVRevealOverlay) */
  --atl-uv-violet:     #8C00F2;
  --atl-uv-blue:       #4033FF;
  --atl-uv-cyan:       #00B3E6;
  --atl-uv-green:      #00D966;
  --atl-uv-yellow:     #E6D900;
  --atl-uv-orange:     #FF8000;
  --atl-uv-pink:       #F23380;
  --atl-uv-base:       #8C4DFF;

  /* District theme accents (12 merkez ilçe) */
  --atl-t-fatih:       #D4A574;
  --atl-t-beyoglu:     #E74C3C;
  --atl-t-besiktas:    #1A1A1A;
  --atl-t-sisli:       #8E44AD;
  --atl-t-sariyer:     #27AE60;
  --atl-t-kadikoy:     #00BCD4;
  --atl-t-uskudar:     #F39C12;
  --atl-t-beykoz:      #16A085;
  --atl-t-eyupsultan:  #2C5F5C;
  --atl-t-adalar:      #5D6D7E;
  --atl-t-bakirkoy:    #3498DB;
  --atl-t-zeytinburnu: #A04000;

  /* Pill geometry — 1:1 Swift */
  --atl-rad-lg:        20px;  /* PlaceDetailCard .cornerRadius(20) */
  --atl-rad-md:        14px;  /* DistrictPill cornerRadius 14 */
  --atl-rad-sm:        12px;  /* NeighborhoodPill cornerRadius 12 */
  --atl-rad-inner-md:  10px;  /* DistrictPill inner dashed RR 10 */
  --atl-rad-inner-sm:  8px;   /* NeighborhoodPill inner dashed RR 8 */
  --atl-rad-inner-lg:  16px;  /* PlaceDetailCard inner dashed RR 16 */

  /* Padding — 1:1 Swift */
  --atl-pad-district-x: 14px; --atl-pad-district-y: 12px;
  --atl-pad-nbhd-x:     12px; --atl-pad-nbhd-y:    10px;
  --atl-pad-place:      16px;

  /* Inner-frame inset — .padding(5) around inner dashed stroke */
  --atl-inset-5: 5px;
  --atl-inset-4: 4px;

  /* Border widths */
  --atl-border-soft:  1.5px;
  --atl-border-strong: 2px;

  /* Shadows — 1:1 Swift */
  --atl-sh-black:  0 4px 8px rgba(0, 0, 0, 0.4);           /* DistrictPill */
  --atl-sh-black-sm: 0 3px 6px rgba(0, 0, 0, 0.35);        /* NeighborhoodPill */
  --atl-sh-black-lg: 0 8px 15px rgba(0, 0, 0, 0.4);
  --atl-sh-color-lg: 0 8px 15px;  /* uses color */
  --atl-sh-color-md: 0 4px 12px;

  /* Guilloche spacings */
  --atl-guilloche-lg: 10;  /* DistrictPill */
  --atl-guilloche-md: 8;   /* NeighborhoodPill */
  --atl-guilloche-sm: 6;
}

/* ═══════════════════════════════════════════════════════════════
   BASE PILL — shared chrome for DistrictPill / NeighborhoodPill
   ═══════════════════════════════════════════════════════════════ */
.atl-pill {
  --c: var(--atl-uv-violet);       /* effective color — overridable inline */
  --rad: var(--atl-rad-md);
  --rad-inner: var(--atl-rad-inner-md);
  --inset: var(--atl-inset-5);
  --bw: var(--atl-border-soft);

  position: relative;
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: var(--atl-pad-district-y) var(--atl-pad-district-x);
  background: var(--atl-craft);
  color: var(--atl-craft-fg);
  border-radius: var(--rad);
  isolation: isolate;
  overflow: visible;
  box-shadow: var(--atl-sh-black);
  transition: transform 320ms cubic-bezier(.2,.9,.3,1.2),
              box-shadow 280ms ease, filter 240ms ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.atl-pill .atl-layer {
  position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none;
}
.atl-pill .atl-layer-guilloche { overflow: hidden; border-radius: inherit; mix-blend-mode: normal; opacity: 1; }
.atl-pill .atl-layer-outer {
  border: var(--bw) solid color-mix(in oklab, var(--c) 40%, transparent);
}
.atl-pill .atl-layer-inner {
  inset: var(--inset);
  border: 1px dashed color-mix(in oklab, var(--c) 15%, transparent);
  border-radius: var(--rad-inner);
}
.atl-pill .atl-layer-stamp { overflow: hidden; border-radius: inherit; }

.atl-pill.is-complete { --bw: var(--atl-border-strong); }
.atl-pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--atl-sh-black-lg),
              0 0 24px color-mix(in oklab, var(--c) 30%, transparent);
}

/* Size variants */
.atl-pill.sz-district {
  --rad: var(--atl-rad-md);       /* 14 */
  --rad-inner: var(--atl-rad-inner-md); /* 10 */
  --inset: var(--atl-inset-5);
  padding: var(--atl-pad-district-y) var(--atl-pad-district-x);
  min-width: 132px;
}
.atl-pill.sz-nbhd {
  --rad: var(--atl-rad-sm);       /* 12 */
  --rad-inner: var(--atl-rad-inner-sm); /* 8 */
  --inset: var(--atl-inset-4);
  padding: var(--atl-pad-nbhd-y) var(--atl-pad-nbhd-x);
  min-width: 112px;
}

/* Typography */
.atl-pill .atl-icon {
  font-size: 28px; line-height: 1;
  filter: drop-shadow(0 0 8px color-mix(in oklab, var(--c) 60%, transparent));
}
.atl-pill.sz-nbhd .atl-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px color-mix(in oklab, var(--c) 60%, transparent));
}
.atl-pill .atl-name {
  font-weight: 700; font-size: 12px; letter-spacing: 0.01em;
  color: var(--atl-craft-fg);
  max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.atl-pill.sz-nbhd .atl-name { font-size: 10px; max-width: 96px; }
.atl-pill .atl-stats {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: rgba(245, 240, 232, 0.85);
}
.atl-pill.sz-nbhd .atl-stats { gap: 4px; font-size: 9px; }
.atl-pill .atl-stat {
  display: inline-flex; align-items: center; gap: 2px;
}
.atl-pill .atl-stat .atl-dot-ic { color: var(--c); font-size: 11px; line-height: 1; }
.atl-pill .atl-progress {
  width: 70px; height: 4px; border-radius: 2px;
  background: var(--atl-glass5);
  overflow: hidden; position: relative;
}
.atl-pill.sz-nbhd .atl-progress { width: 50px; height: 3px; }
.atl-pill .atl-progress > i {
  display: block; height: 100%;
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--c) 80%, transparent), var(--c));
}
.atl-pill .atl-pct {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  color: var(--atl-craft-dim); letter-spacing: 0.08em;
}

/* Gem color pivot */
.atl-pill.is-gem .atl-stats .gem-count { color: var(--atl-uv-cyan); }

/* Rarity diamond badge — top-right */
.atl-rarity-badge {
  position: absolute; top: -4px; right: -4px; z-index: 2;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 900; color: var(--rr, var(--atl-r-legendary));
  background: var(--atl-craft); border: 1px solid color-mix(in oklab, var(--rr, var(--atl-r-legendary)) 60%, transparent);
  border-radius: 999px;
  box-shadow: 0 0 6px color-mix(in oklab, var(--rr, var(--atl-r-legendary)) 40%, transparent);
}

/* Lock badge — top-left */
.atl-lock-badge {
  position: absolute; top: -4px; left: -4px; z-index: 2;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; color: rgba(245, 240, 232, 0.7);
  background: var(--atl-craft); border: 0.5px solid var(--atl-glass6);
  border-radius: 999px;
}

/* Sezon spotlight badge — top-left (when unlocked) */
.atl-season-badge {
  position: absolute; top: -4px; left: -4px; z-index: 2;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; background: var(--c);
  border-radius: 999px;
  box-shadow: 0 0 3px color-mix(in oklab, var(--c) 60%, transparent);
}

/* Gem sender badge — top-right */
.atl-gem-badge {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  background: color-mix(in oklab, var(--c) 25%, var(--atl-craft));
  border: 1px solid color-mix(in oklab, var(--c) 50%, transparent);
  border-radius: 999px;
}
.atl-gem-badge .atl-gem-plus {
  position: absolute; bottom: -3px; right: -4px;
  font-family: var(--font-mono); font-size: 6px; font-weight: 800;
  color: white;
  padding: 1px 3px; border-radius: 999px;
  background: color-mix(in oklab, var(--c) 70%, transparent);
}

/* UV reveal — on hover or .is-revealed */
.atl-pill .atl-uv { opacity: 0; transition: opacity 320ms ease; z-index: 3; }
.atl-pill.is-revealed .atl-uv,
.atl-pill:not(.no-uv-hover):hover .atl-uv { opacity: 1; }
.atl-pill.is-revealed {
  transform: scale(1.35);
  z-index: 100;
  box-shadow: 0 10px 40px color-mix(in oklab, var(--atl-uv-base) 55%, transparent);
}

/* ═══════════════════════════════════════════════════════════════
   PLACE DETAIL CARD — mirrors PlaceDetailCard in MapDetailViews.swift
   ═══════════════════════════════════════════════════════════════ */
.atl-place {
  --c: var(--atl-r-legendary);
  --rad: var(--atl-rad-lg);        /* 20 */
  --rad-inner: var(--atl-rad-inner-lg); /* 16 */
  --inset: var(--atl-inset-5);

  position: relative;
  width: 320px;
  background: var(--atl-craft);
  color: var(--atl-craft-fg);
  border-radius: var(--rad);
  box-shadow: var(--atl-sh-color-lg) color-mix(in oklab, var(--c) 20%, transparent),
              0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  isolation: isolate;
}
.atl-place .atl-layer-outer {
  position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  border: var(--atl-border-soft) solid color-mix(in oklab, var(--c) 35%, transparent);
}
.atl-place .atl-layer-inner {
  position: absolute; inset: var(--inset); pointer-events: none;
  border-radius: var(--rad-inner);
  border: 0.8px dashed color-mix(in oklab, var(--c) 12%, transparent);
}

.atl-place-hd {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 16px 12px;
}
.atl-place-hd .ic {
  width: 50px; height: 50px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; flex-shrink: 0;
  background: color-mix(in oklab, var(--c) 20%, transparent);
}
.atl-place-hd .meta { flex: 1; min-width: 0; }
.atl-place-hd .nm {
  font-size: 16px; font-weight: 700; line-height: 1.2;
  color: var(--atl-craft-fg);
}
.atl-place-hd .loc {
  font-size: 12px; margin-top: 4px;
  color: rgba(245, 240, 232, 0.6);
  font-family: var(--font-mono); letter-spacing: 0.04em;
}
.atl-place-hd .x {
  background: transparent; border: 0;
  color: rgba(245, 240, 232, 0.4);
  font-size: 22px; line-height: 1; cursor: pointer;
  padding: 0 2px;
}

.atl-place-desc {
  font-size: 13px; line-height: 1.45;
  color: rgba(245, 240, 232, 0.7);
  padding: 0 16px 12px;
}

.atl-place-stats {
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px 14px;
  font-size: 13px;
}
.atl-place-stats .st { display: inline-flex; align-items: center; gap: 4px; }
.atl-place-stats .xp { font-weight: 600; }
.atl-place-stats .xp .star { color: var(--atl-r-legendary); font-size: 12px; }
.atl-place-stats .rar { color: var(--c); font-weight: 500; font-size: 12px; }
.atl-place-stats .sp { flex: 1; }
.atl-place-stats .status.unl { color: var(--atl-r-uncommon); font-weight: 500; font-size: 12px; }
.atl-place-stats .status.loc { color: var(--atl-uv-orange); font-weight: 500; font-size: 12px; }

.atl-place-div {
  height: 1px; background: color-mix(in oklab, var(--c) 20%, transparent);
  margin: 0;
}

.atl-place-actions {
  display: flex; gap: 12px;
  padding: 14px 16px;
}
.atl-place-actions .btn {
  flex: 1; padding: 12px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--atl-craft-fg); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: filter 180ms ease;
}
.atl-place-actions .btn:hover { filter: brightness(1.1); }
.atl-place-actions .btn.discover {
  background: linear-gradient(90deg, #F39C12, rgba(230, 217, 0, 0.8));
}
.atl-place-actions .btn.dir {
  background: color-mix(in oklab, var(--c) 30%, transparent);
}
.atl-place-actions .btn.share {
  background: var(--atl-glass5);
}

.atl-place-secondary {
  display: flex; gap: 8px; padding: 0 16px 16px;
}
.atl-place-secondary .btn {
  flex: 1; padding: 10px 8px; border-radius: 8px;
  background: var(--atl-glass3);
  color: rgba(245, 240, 232, 0.7);
  border: 0; cursor: pointer;
  font-size: 11px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.atl-place-secondary .btn.gem {
  color: var(--atl-uv-cyan);
  background: color-mix(in oklab, var(--atl-uv-cyan) 10%, transparent);
  border: 0.8px solid color-mix(in oklab, var(--atl-uv-cyan) 30%, transparent);
}

/* ═══════════════════════════════════════════════════════════════
   GRID CONTAINERS
   ═══════════════════════════════════════════════════════════════ */
.atl-pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}
.atl-nbhd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   SHOWCASE CONTAINERS — in-context "from the app" sections
   Placed on ivory craft-paper body; pills sit on dark craft tiles
   ═══════════════════════════════════════════════════════════════ */
.pill-showcase,
.rarity-showcase {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid rgba(139, 105, 20, 0.16);
  position: relative;
}
.pill-showcase::before,
.rarity-showcase::before {
  content: '';
  position: absolute; left: 0; right: 0; top: -1px; height: 1px;
  background-image: linear-gradient(90deg, transparent 0, rgba(139,105,20,0.4) 50%, transparent 100%);
}
.pill-showcase-head,
.rarity-showcase-head {
  display: flex;
  align-items: flex-start; justify-content: space-between;
  gap: 40px;
  margin-bottom: 32px;
}
.pill-showcase-head p,
.rarity-showcase-head p {
  font-size: 13px; color: var(--text-mute);
  line-height: 1.55;
  max-width: 400px; text-align: right;
}
.pill-showcase .atl-pill-grid,
.nbhd-showcase .atl-nbhd-grid {
  padding: 28px;
  background: radial-gradient(ellipse at top, #1F1A2C 0%, var(--atl-craft) 60%, #120E18 100%);
  border-radius: 20px;
  border: 1px solid rgba(139, 105, 20, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 20px 60px rgba(10, 22, 40, 0.12);
  position: relative;
}
.pill-showcase .atl-pill-grid::before,
.nbhd-showcase .atl-nbhd-grid::before {
  content: 'UV · TUR · İST · PASSPORT · XII DIS';
  position: absolute; top: 12px; left: 18px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em;
  color: rgba(245, 240, 232, 0.22);
  pointer-events: none;
}
.pill-showcase .atl-pill-grid::after,
.nbhd-showcase .atl-nbhd-grid::after {
  content: '';
  position: absolute; inset: 8px; border-radius: 14px;
  border: 0.5px dashed rgba(245, 240, 232, 0.08);
  pointer-events: none;
}
.pill-showcase-foot {
  margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  color: var(--text-mute);
}
.pill-showcase-foot .mrz {
  opacity: 0.7;
}

/* ═══ Nbhd showcase inside Passport.jsx ═══ */
.nbhd-showcase {
  margin: 20px 0 24px;
  padding: 20px;
  border-radius: 14px;
  background: var(--atl-craft);
  border: 1px solid rgba(139, 105, 20, 0.2);
  box-shadow: 0 8px 28px rgba(10, 22, 40, 0.15);
  position: relative;
}
.nbhd-showcase::before {
  content: 'ÜSKÜDAR · ANADOLU YAKASI · SAYFA 08 / 12';
  display: block;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em;
  color: rgba(245, 240, 232, 0.4);
  padding-bottom: 14px;
  border-bottom: 0.5px dashed rgba(245, 240, 232, 0.12);
  margin-bottom: 16px;
}
.nbhd-showcase .atl-nbhd-grid {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.nbhd-showcase .atl-nbhd-grid::before,
.nbhd-showcase .atl-nbhd-grid::after { display: none; }
.nbhd-showcase-head { margin-bottom: 12px; }

/* ═══ Rarity showcase ═══ */
.rarity-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  justify-items: center;
  padding: 32px;
  background: radial-gradient(ellipse at top, #1F1A2C 0%, var(--atl-craft) 60%, #120E18 100%);
  border-radius: 20px;
  border: 1px solid rgba(139, 105, 20, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 20px 60px rgba(10, 22, 40, 0.12);
}
.rarity-cards .atl-place {
  width: 100%;
  max-width: 340px;
}

/* Ensure caption class exists outside .device */
.atlas-caption-std,
.pill-showcase .caption,
.rarity-showcase .caption {
  font-family: var(--font-sans);
  font-size: 13px; line-height: 1.55;
  color: var(--text-mute);
}
