/* ==========================================================================
   روزنة هجر — خريطة الأحساء الفنية (atlas.js)
   ========================================================================== */
@property --reveal { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

.map { --paper: #f0e5d1; --paper-2: #f4eadb; --ink: #3b2a1c; --sea-ink: #3e5a5c;
  position: relative; border-radius: 20px; overflow: hidden; background: var(--paper); border: 1px solid rgba(59, 42, 28, .22);
  isolation: isolate; box-shadow: 0 34px 70px -44px rgba(46, 33, 22, .7); }
.map.leaflet-container { background: var(--paper); font-family: var(--sans); outline: 0; }
.map .leaflet-tile-container img { image-rendering: auto; }

/* printed-paper grain, soft vignette and an inked inner rule over the whole plate */
.atlas::after { content: ""; position: absolute; inset: 0; z-index: 450; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(120% 95% at 50% 45%, transparent 58%, rgba(59, 42, 28, .2) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .22 0 0 0 0 .15 0 0 0 0 .09 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply; opacity: .55; }
.atlas.is-sat::after { opacity: .25; }
.atlas::before { content: ""; position: absolute; inset: 9px; z-index: 451; pointer-events: none; border-radius: 13px;
  border: 1px solid rgba(59, 42, 28, .38); box-shadow: inset 0 0 0 3px rgba(240, 229, 209, .35), inset 0 0 0 4px rgba(59, 42, 28, .18); }

/* the ink spreads from the old town when the map first comes into view */
.atlas.is-intro .leaflet-map-pane { -webkit-mask-image: radial-gradient(circle at var(--rx, 40%) var(--ry, 60%), #000 var(--reveal), transparent calc(var(--reveal) + 22%));
  mask-image: radial-gradient(circle at var(--rx, 40%) var(--ry, 60%), #000 var(--reveal), transparent calc(var(--reveal) + 22%)); }
.atlas.is-reveal .leaflet-map-pane { animation: atlasInk 2.6s cubic-bezier(.3, .6, .2, 1) forwards; }
@keyframes atlasInk { from { --reveal: 0%; } to { --reveal: 160%; } }
.atlas.is-intro .mk__medal, .atlas.is-intro .mk__lead, .atlas.is-intro .mk__dot { opacity: 0; }
.atlas.is-reveal .mk__medal, .atlas.is-reveal .mk__lead, .atlas.is-reveal .mk__dot { animation: mkIn .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 900ms); }
@keyframes mkIn { from { opacity: 0; scale: .35; } to { opacity: 1; scale: 1; } }
.atlas.is-intro .deco, .atlas.is-intro .lbl { opacity: 0; }
.atlas.is-reveal .deco, .atlas.is-reveal .lbl { animation: fadeIn 1.2s ease 1.6s both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- destination medallions ---------- */
.mk { --dx: 0px; --dy: -46px; --len: 24px; --ang: -90deg; --cc: var(--brown); --m: 50px; }
.mk__dot { position: absolute; left: -4.5px; top: -4.5px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px rgba(59, 42, 28, .35); }
.mk__lead { position: absolute; left: 0; top: 0; width: var(--len); height: 0; border-top: 1.5px dashed rgba(59, 42, 28, .8); transform-origin: 0 0; transform: rotate(var(--ang)); transition: width .5s var(--ease), transform .5s var(--ease); }
.mk__medal { position: absolute; left: 0; top: 0; width: var(--m); height: var(--m); margin: calc(var(--m) / -2) 0 0 calc(var(--m) / -2);
  display: grid; place-items: center; border-radius: 50%; color: var(--ink); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #f8f0e2, var(--paper-2) 60%, #ead9bd);
  box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 4px var(--paper-2), 0 0 0 5.5px var(--cc), 0 12px 22px -10px rgba(46, 33, 22, .75);
  transform: translate(var(--dx), var(--dy)); transition: transform .5s var(--ease), box-shadow .3s, background-color .3s; }
.mk__medal svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.mk__medal svg .f { fill: currentColor; stroke: none; }
.mk__name { position: absolute; left: 0; top: 0; padding: 2px 10px 3px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  font-family: var(--display); font-weight: 700; font-size: .95rem; line-height: 1.5; color: var(--cream); background: var(--ink);
  transform: translate(calc(var(--dx) - 50%), calc(var(--dy) + var(--m) / 2 + 9px)); opacity: 0; transition: opacity .25s, transform .5s var(--ease); }
.mk:hover .mk__medal, .mk:focus-visible .mk__medal { transform: translate(var(--dx), var(--dy)) scale(1.1); }
.mk:hover .mk__name, .mk:focus-visible .mk__name, .mk.is-active .mk__name { opacity: 1; }
.mk.is-active .mk__medal { color: var(--cream); background: var(--cc); box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 4px var(--paper-2), 0 0 0 5.5px var(--ink), 0 16px 26px -10px rgba(46, 33, 22, .8); transform: translate(var(--dx), var(--dy)) scale(1.14); }
.mk.is-active .mk__dot { animation: dotPulse 2s ease-out infinite; }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px rgba(59, 42, 28, .5); } 70%, 100% { box-shadow: 0 0 0 2px var(--paper), 0 0 0 16px rgba(59, 42, 28, 0); } }
.mk:focus-visible { outline: 0; }
.mk.is-off, .mk.is-grouped { pointer-events: none; }
.mk.is-off > *, .mk.is-grouped > * { opacity: 0 !important; transition: opacity .3s; }
.mk__count { position: absolute; top: -4px; right: -6px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  background: var(--clay); color: var(--cream); font-family: var(--display); font-weight: 700; font-size: .8rem; line-height: 1; box-shadow: 0 0 0 2px var(--paper-2); }

/* ---------- labels and drawings on the plate ---------- */
.lbl, .deco { pointer-events: none; transition: opacity .5s; }
.lbl span { position: absolute; left: 0; top: 0; white-space: nowrap; transform: translate(-50%, -50%) rotate(var(--r, 0deg)); font-family: var(--display); color: var(--ink); }
.lbl--city span { font-weight: 700; font-size: 1.12rem; text-shadow: 0 0 2px var(--paper), 0 0 6px var(--paper), 0 0 12px var(--paper); }
.lbl--sea span { font-weight: 500; font-size: 1.25rem; color: var(--sea-ink); opacity: .9; }
.lbl--route span { font-weight: 500; font-size: .84rem; color: var(--brown-2); transform: translate(-50%, -50%) rotate(var(--r, 0deg)) translateY(-12px); text-shadow: 0 0 3px var(--paper), 0 0 8px var(--paper); }
.deco svg { position: absolute; left: 0; top: 0; max-width: none; transform: translate(-50%, -50%); fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.deco svg .k { fill: #8b6542; stroke: var(--ink); stroke-width: 1.2; }
.deco svg .s { fill: #f4eadb; }
.deco svg .w { stroke: var(--sea-ink); stroke-width: 1.3; opacity: .8; }
.deco svg .t { stroke-width: .8; opacity: .6; }
.deco--dhow svg { width: 104px; }
.deco--birds svg { width: 78px; stroke-width: 1.7; }
.deco--camels svg { width: 104px; }
.deco--camels svg .k { fill: #6c4a2e; stroke: none; }
.atlas[data-zoom="near"] .lbl--sea, .atlas[data-zoom="near"] .lbl--city, .atlas[data-zoom="near"] .deco, .atlas[data-zoom="near"] .lbl--route { opacity: 0; }
.atlas[data-zoom="mid"] .deco--birds, .atlas[data-zoom="mid"] .deco--camels { opacity: .55; }
.atlas.is-sat .lbl--sea span { color: #e8eee8; }

.atlas-caravan { fill: none; stroke: #6c4a2e; stroke-width: 2; stroke-dasharray: 1 7; stroke-linecap: round; opacity: .85; }
.atlas-trail { fill: none; stroke: #a8683c; stroke-width: 2.6; stroke-dasharray: 9 7; stroke-linecap: round; filter: drop-shadow(0 1px 0 rgba(240, 229, 209, .9)); animation: march 1.2s linear infinite; }
@keyframes march { to { stroke-dashoffset: -32; } }

/* ---------- compass rose and cartouche ---------- */
.atlas-compass { position: absolute; top: 20px; left: 22px; z-index: 460; width: 92px; color: var(--ink); pointer-events: none; opacity: .92; }
.atlas-compass svg { width: 100%; height: auto; overflow: visible; }
.atlas-compass .o { fill: rgba(240, 229, 209, .55); stroke: var(--ink); stroke-width: 1; }
.atlas-compass .thin { stroke: var(--ink); stroke-width: .6; fill: none; }
.atlas-compass .dk { fill: var(--ink); }
.atlas-compass .lt { fill: #f4eadb; stroke: var(--ink); stroke-width: .7; stroke-linejoin: round; }
.atlas-compass text { font-family: var(--display); font-weight: 700; font-size: 15px; fill: var(--ink); }

.atlas-cart { position: absolute; right: 22px; bottom: 34px; z-index: 460; display: grid; justify-items: center; gap: 1px; padding: 12px 22px 12px; text-align: center; color: var(--ink);
  background: rgba(244, 234, 219, .93); border: 1px solid var(--ink); outline: 1px solid rgba(59, 42, 28, .4); outline-offset: 3px; border-radius: 3px; }
.atlas-cart::before, .atlas-cart::after { content: "✦"; position: absolute; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--clay); }
.atlas-cart::before { right: 7px; } .atlas-cart::after { left: 7px; }
.atlas-cart__k { font-size: .7rem; color: var(--ink-3); }
.atlas-cart b { font-family: var(--display); font-weight: 700; font-size: 1.45rem; line-height: 1.25; }
.atlas-cart__s { font-size: .76rem; color: var(--ink-2); }
.atlas-scale { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: .74rem; color: var(--ink-2); }
.atlas-scale i { display: block; height: 6px; border: 1px solid var(--ink); border-top: 0; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%) 0 100% / 50% 3px no-repeat; transition: width .3s; }
.atlas-scale em { font-style: normal; }

/* ---------- controls ---------- */
.atlas-ctl { position: absolute; top: 20px; right: 22px; z-index: 900; display: grid; justify-items: start; gap: 10px; }
.atlas-seg { display: flex; padding: 4px; border-radius: 999px; background: rgba(244, 234, 219, .94); border: 1px solid rgba(59, 42, 28, .3); box-shadow: 0 10px 24px -14px rgba(46, 33, 22, .6); }
.atlas-seg button { padding: 6px 14px; border-radius: 999px; font-size: .84rem; font-weight: 500; color: var(--ink-2); transition: background-color .25s, color .25s; }
.atlas-seg button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.atlas-zoom { display: grid; border-radius: 14px; overflow: hidden; background: rgba(244, 234, 219, .94); border: 1px solid rgba(59, 42, 28, .3); box-shadow: 0 10px 24px -14px rgba(46, 33, 22, .6); }
.atlas-zoom button { display: grid; place-items: center; width: 42px; height: 42px; font-size: 1.35rem; line-height: 1; color: var(--ink); transition: background-color .2s; }
.atlas-zoom button + button { border-top: 1px solid rgba(59, 42, 28, .18); }
.atlas-zoom button:hover, .atlas-seg button:hover:not([aria-pressed="true"]) { background: rgba(59, 42, 28, .08); }
.atlas-zoom svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.atlas-tour { position: absolute; left: 22px; bottom: 34px; z-index: 900; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 20px 0 16px;
  border-radius: 999px; background: var(--ink); color: var(--cream); font-weight: 600; font-size: .95rem; box-shadow: 0 16px 30px -14px rgba(46, 33, 22, .8); transition: transform .3s var(--ease), background-color .3s, opacity .3s; }
.atlas-tour:hover { background: #4a3523; transform: translateY(-2px); }
.atlas-tour svg { width: 20px; height: 20px; fill: var(--cream); stroke: var(--cream); stroke-width: 2.2; stroke-linecap: round; }
.atlas-tour .ps, .atlas.is-touring .atlas-tour .pl { display: none; }
.atlas.is-touring .atlas-tour .ps { display: inline; }
.atlas-card:not([hidden]) ~ .atlas-tour { opacity: 0; pointer-events: none; }
.atlas.is-touring .atlas-card:not([hidden]) ~ .atlas-tour { opacity: 1; pointer-events: auto; left: 22px; bottom: auto; top: 20px; min-height: 40px; padding: 0 14px 0 12px; font-size: .85rem; }
.atlas.is-touring .atlas-compass { opacity: 0; }

.atlas-hint { position: absolute; left: 50%; top: 50%; z-index: 905; transform: translate(-50%, -50%); padding: 10px 18px; border-radius: 999px;
  background: rgba(46, 33, 22, .85); color: var(--cream); font-size: .9rem; pointer-events: none; opacity: 0; transition: opacity .3s; }
.atlas.show-hint .atlas-hint { opacity: 1; }

/* ---------- place card ---------- */
.atlas-card { position: absolute; left: 22px; bottom: 34px; z-index: 900; width: 320px; border-radius: 18px; overflow: hidden; background: var(--paper-2); color: var(--ink);
  border: 1px solid rgba(59, 42, 28, .28); box-shadow: 0 30px 60px -24px rgba(46, 33, 22, .75); opacity: 0; transform: translateY(14px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.atlas-card.is-on { opacity: 1; transform: none; }
.atlas-card__img { aspect-ratio: 16 / 9.5; background: var(--bg-3); }
.atlas-card__img img { width: 100%; height: 100%; object-fit: cover; }
.atlas-card__b { padding: 14px 18px 16px; }
.atlas-card__step { display: block; font-size: .76rem; color: var(--clay); font-weight: 600; }
.atlas-card__name { display: block; font-family: var(--display); font-weight: 700; font-size: 1.55rem; line-height: 1.35; }
.atlas-card__txt { margin: 2px 0 12px; font-size: .9rem; line-height: 1.7; color: var(--ink-2); }
.atlas-card__act { display: flex; gap: 8px; }
.atlas-card__act button { flex: 1; min-height: 40px; padding: 0 12px; border-radius: 999px; font-size: .86rem; font-weight: 600; border: 1px solid var(--ink); transition: background-color .2s, color .2s; }
.atlas-card__more { background: var(--ink); color: var(--cream); }
.atlas-card__next { color: var(--ink); }
.atlas-card__next:hover { background: rgba(59, 42, 28, .08); }
.atlas-card__x { position: absolute; top: 10px; left: 10px; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(46, 33, 22, .6); color: var(--cream); }
.atlas-card__x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.map .leaflet-control-attribution { margin: 0 12px 6px 0 !important; padding: 1px 8px; border-radius: 6px; background: rgba(244, 234, 219, .82); color: var(--ink-2); font-size: 9.5px; line-height: 1.6; direction: ltr; }
.map .leaflet-control-attribution a { color: var(--brown-2); }

/* ---------- full screen ---------- */
.map.is-full { position: fixed; inset: 0; z-index: 150; height: auto !important; border-radius: 0; border: 0; }
.map.is-full::before { border-radius: 6px; }
html.atlas-lock, html.atlas-lock body { overflow: hidden; }

@media (max-width: 980px) {
  .atlas-compass { width: 70px; }
  .atlas-cart__k, .atlas-cart__s { display: none; }
}
@media (max-width: 640px) {
  .mk { --m: 44px; }
  .mk__medal svg { width: 30px; height: 30px; }
  .mk__name { font-size: .85rem; }
  .atlas::before { inset: 6px; border-radius: 12px; }
  .atlas-compass { top: 14px; left: 14px; width: 54px; }
  .atlas-compass text { font-size: 18px; }
  .atlas-ctl { top: 14px; right: 14px; gap: 8px; }
  .atlas-seg button { padding: 5px 10px; font-size: .78rem; }
  .atlas-zoom button { width: 38px; height: 38px; }
  .atlas-cart { right: 14px; bottom: 30px; padding: 7px 14px; }
  .atlas-cart b { font-size: 1.08rem; }
  .atlas-scale { margin-top: 3px; }
  .atlas-tour { left: 14px; bottom: 30px; min-height: 42px; padding: 0 14px 0 12px; font-size: .86rem; }
  .atlas-card { left: 10px; right: 10px; bottom: 28px; width: auto; display: grid; grid-template-columns: 104px 1fr; border-radius: 16px; }
  .atlas-card__img { aspect-ratio: auto; height: 100%; }
  .atlas-card__b { padding: 10px 12px 12px; }
  .atlas-card__name { font-size: 1.15rem; }
  .atlas-card__txt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; font-size: .8rem; line-height: 1.6; }
  .atlas-card__act button { min-height: 34px; font-size: .78rem; padding: 0 8px; }
  .atlas-card__x { width: 28px; height: 28px; top: 6px; left: 6px; }
  .atlas.is-touring .atlas-card:not([hidden]) ~ .atlas-tour { left: 14px; top: 14px; }
  .lbl--city span { font-size: .95rem; }
  .map .leaflet-control-attribution { max-width: calc(100vw - 60px); margin: 0 10px 5px 0 !important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 8.5px; }
  .deco--dhow svg { width: 76px; } .deco--camels svg { width: 80px; } .deco--birds svg { width: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas-trail { animation: none; }
  .mk.is-active .mk__dot { animation: none; }
}
