/* ===========================================================================
   The Reading Atlas — interactive world-map blog browser.
   Scoped under .lwl-map. Pairs with blog.css (the .lwl-pcard cards are reused
   inside the country panel). Behaviour in assets/js/blog-map.js.
   ========================================================================== */

/* full-height column: a slim toolbar on top, the map fills the rest — so the
   map itself is never covered by any control. */
.lwl-map { position: relative; background: var(--color-paper, #FFFCF7);
	height: calc(100vh - 116px); min-height: 560px; overflow: hidden;
	display: flex; flex-direction: column; }

/* ---- hero = a slim toolbar bar between the nav and the map ---- */
.lwl-map__hero { flex: none; z-index: 20; position: relative;
	background: rgba(255, 252, 247, .97); border-bottom: 1px solid #efe3d2;
	box-shadow: 0 4px 16px rgba(43, 37, 48, .05); padding: .5rem clamp(1rem, 3vw, 2rem); }
.lwl-map__hero-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
	gap: .8rem 1.2rem; max-width: 1180px; margin: 0 auto; width: 100%; }
.lwl-map__hero-stats { grid-column: 1; justify-self: start; display: flex; align-items: center;
	flex-wrap: wrap; gap: .4rem .65rem; }
.lwl-map__hero .lwl-map__title { grid-column: 2; justify-self: center; margin: 0;
	font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.1; }
.lwl-map__hero .lwl-map__surprise { grid-column: 3; justify-self: end; }
.lwl-map__hero-stats .lwl-map__count, .lwl-map__hero-stats .lwl-map__legend { margin: 0; }
/* retired bits */
.lwl-map__eyebrow, .lwl-map__lede, .lwl-map__sky, .lwl-map__hint { display: none !important; }

@media (max-width: 760px) {
	.lwl-map__hero-inner { grid-template-columns: 1fr auto;
		grid-template-areas: "title title" "stats surprise"; gap: .35rem .6rem; }
	.lwl-map__hero-stats { grid-area: stats; }
	.lwl-map__hero .lwl-map__title { grid-area: title; grid-column: auto; }
	.lwl-map__hero .lwl-map__surprise { grid-area: surprise; grid-column: auto; }
}
.lwl-map__sky { display: none; }
/* drifting clouds over the map sky */
.lwl-map__cloud { position: absolute; z-index: 2; opacity: .7; pointer-events: none;
	animation: lwlm-drift linear infinite; }
@keyframes lwlm-drift { from { transform: translateX(-12vw); } to { transform: translateX(112vw); } }
.lwl-map__hero-inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; }
.lwl-map__eyebrow { font-size: var(--fs-xs, .8rem); font-weight: var(--fw-heavy, 800);
	letter-spacing: .14em; text-transform: uppercase; color: var(--color-coral, #FC3C30); margin: 0 0 .5rem; }
.lwl-map__title { font-family: var(--font-display, Georgia, serif); color: var(--color-deep, #2B2538);
	font-size: clamp(1.45rem, 2.9vw, 2.05rem); font-weight: var(--fw-bold, 700); line-height: 1.05; margin: 0; letter-spacing: -.01em; }
.lwl-map__title em { font-style: italic; color: var(--color-coral, #FC3C30); }
.lwl-map__lede { color: var(--color-ink-soft, #5A4632); font-size: .86rem;
	line-height: 1.4; margin: .25rem auto 0; max-width: 440px; }
.lwl-map__count { display: inline-flex; align-items: center; gap: .45rem; margin-top: .7rem;
	font-size: var(--fs-xs, .82rem); font-weight: var(--fw-bold, 700); color: var(--color-ink-soft, #5A4632);
	background: rgba(255,255,255,.6); border: 1px solid #f0dcc4; border-radius: 999px; padding: .35rem .85rem; }
.lwl-map__count .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--color-level-b2, #3F6F4A);
	box-shadow: 0 0 0 0 rgba(63,111,74,.5); animation: lwlm-pip 2.4s infinite; }
@keyframes lwlm-pip { 0%{box-shadow:0 0 0 0 rgba(63,111,74,.45)} 70%{box-shadow:0 0 0 7px rgba(63,111,74,0)} 100%{box-shadow:0 0 0 0 rgba(63,111,74,0)} }

.lwl-map__hero-actions { margin-top: .7rem; }
.lwl-map__surprise { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
	border: none; border-radius: 999px; padding: .55rem 1.15rem; font-size: .9rem; font-weight: 800;
	color: #fff; background: linear-gradient(135deg, #FC780C, #FC3C30);
	box-shadow: 0 6px 18px rgba(252,60,48,.32); transition: transform .14s ease, box-shadow .14s ease; }
.lwl-map__surprise svg { width: 17px; height: 17px; }
.lwl-map__surprise:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 26px rgba(252,60,48,.4); }
.lwl-map__surprise:active { transform: translateY(0) scale(.99); }

/* ---- stage: fills the remaining height below the toolbar ---- */
.lwl-map__stage { position: relative; flex: 1; min-height: 0; max-width: none; margin: 0; padding: 0; overflow: hidden; }
.lwl-map__canvas { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden;
	background:
		radial-gradient(40% 46% at 88% 6%, rgba(255,214,59,.45) 0%, rgba(252,192,0,0) 62%),
		radial-gradient(120% 120% at 50% 120%, rgba(132,178,93,.12) 0%, rgba(132,178,93,0) 45%),
		radial-gradient(130% 100% at 50% 6%, #EBF2FA 0%, #E0EBF3 44%, #D6E5EC 100%); }
/* soft inner vignette for depth */
.lwl-map__canvas::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 11;
	box-shadow: inset 0 0 90px rgba(43,57,80,.12); }
.lwl-map__canvas svg.lwlm-svg { width: 100%; height: 100%; display: block; touch-action: manipulation; }
/* zoom group — CSS transform so the final state is applied instantly (robust to
   background tabs) while still animating smoothly on a visible page */
.lwl-map .lwlm-zoom { transform-box: view-box; transform-origin: 0 0;
	transition: transform .68s cubic-bezier(.22,.61,.36,1); }

.lwl-map__loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	gap: .6rem; color: var(--color-ink-soft, #5A4632); font-size: .9rem; font-weight: 600; }
.lwl-map__spin { width: 17px; height: 17px; border-radius: 50%; border: 2.5px solid #cfe0cf;
	border-top-color: var(--color-level-b2, #3F6F4A); animation: lwlm-spin .8s linear infinite; }
@keyframes lwlm-spin { to { transform: rotate(360deg); } }

/* ocean sphere + graticule */
.lwl-map .lwlm-sphere { fill: #DCEAF1; stroke: #b9cdd8; stroke-width: 1px; }
.lwl-map .lwlm-grat { fill: none; stroke: #ffffff; stroke-width: .5px; opacity: .55; }

/* country paths */
.lwl-map .land { fill: #C7D8C2; stroke: #EAF1FB; stroke-width: .4px; stroke-linejoin: round;
	transition: fill .3s ease, opacity .45s ease; }
.lwl-map .lwlm-borders { fill: none; stroke: #ffffff; stroke-width: .5px; opacity: .5; pointer-events: none; }
.lwl-map .land.has-posts { fill: url(#lwlm-landgrad); cursor: pointer; outline: none; }
.lwl-map .land.has-posts.glow { filter: url(#lwlm-glow); }
.lwl-map .land.has-posts:hover, .lwl-map .land.has-posts:focus-visible { fill: #FC3C30; }
.lwl-map .land.has-posts:focus-visible { stroke: #2B2538; stroke-width: 1.1px; }
.lwl-map.is-zoomed .land:not(.is-active) { opacity: .16; }
.lwl-map.is-zoomed .land.has-posts:not(.is-active) { opacity: .3; }
.lwl-map .land.is-active { fill: #FC780C; }
/* gentle breathing pulse on glowing lands (disabled when zoomed / reduce-fx) */
.lwl-map:not(.is-zoomed) .land.has-posts.glow { animation: lwlm-breathe 3.8s ease-in-out infinite; }
@keyframes lwlm-breathe { 0%,100%{ opacity: 1 } 50%{ opacity: .82 } }

/* marker pin + pulsing rings */
.lwl-map .lwlm-pin { pointer-events: none; }
.lwl-map .lwlm-marker { fill: #fff; stroke: #FC3C30; stroke-width: 1.6px;
	filter: drop-shadow(0 1px 2px rgba(0,0,0,.28)); }
.lwl-map .lwlm-marker-core { fill: #FC3C30; }
.lwl-map .lwlm-ring { fill: none; stroke: #FC3C30; stroke-width: 1.4px; transform-box: fill-box;
	transform-origin: center; animation: lwlm-ping 2.8s ease-out infinite; }
@keyframes lwlm-ping { 0%{ transform: scale(.5); opacity: .7 } 80%,100%{ transform: scale(3.4); opacity: 0 } }

/* entrance: lands rise/fade in, pins pop */
.lwl-map .lwlm-zoom .land { opacity: 0; animation: lwlm-landin .7s ease forwards; }
@keyframes lwlm-landin { from { opacity: 0; } to { opacity: 1; } }
.lwl-map .lwlm-pin { opacity: 0; animation: lwlm-pinin .5s cubic-bezier(.34,1.56,.64,1) forwards; }
@keyframes lwlm-pinin { from { opacity: 0; transform: translateY(-8px) scale(.4); } to { opacity: 1; } }

/* tooltip */
.lwl-map__tooltip { position: absolute; z-index: 30; pointer-events: none; transform: translate(-50%, -135%);
	background: var(--color-deep, #2B2538); color: #fff; font-size: .8rem; font-weight: 700;
	padding: .4rem .7rem; border-radius: 10px; white-space: nowrap; box-shadow: 0 8px 22px rgba(0,0,0,.3);
	display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.lwl-map__tooltip::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
	border: 6px solid transparent; border-top-color: var(--color-deep, #2B2538); }
.lwl-map__tooltip .c { color: #FFD63B; font-weight: 600; font-size: .72rem; }
.lwl-map__tooltip .go { color: #FFC9BD; font-weight: 700; font-size: .68rem; letter-spacing: .03em; }

/* compass rose */
.lwl-map__compass { position: absolute; left: calc(var(--container-pad, 1.25rem) + 16px); bottom: 26px;
	width: 64px; height: 64px; z-index: 12; opacity: .9; pointer-events: none;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,.12)); transition: opacity .4s ease; }
.lwl-map__compass svg { width: 100%; height: 100%; }
.lwl-map.is-zoomed .lwl-map__compass { opacity: 0; }

/* when a country is open, clear the floating bottom chrome (the toolbar stays;
   it never overlaps the map) */
.lwl-map__chips, .lwl-map__cta { transition: opacity .35s ease, transform .35s ease; }
.lwl-map.is-zoomed .lwl-map__chips, .lwl-map.is-zoomed .lwl-map__cta { opacity: 0; transform: translateY(14px); pointer-events: none; }

/* country chips — float along the bottom of the map */
.lwl-map__chips { position: absolute; z-index: 20; left: 0; right: 0; bottom: clamp(58px, 8vh, 78px);
	display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 0; padding: 0 14px; }
.lwl-map__chips button { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
	border: 1px solid rgba(231,221,207,.9); background: rgba(255,255,255,.92);
	backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
	color: var(--color-deep, #2B2538); border-radius: 999px;
	padding: .4rem .8rem; font-size: .82rem; font-weight: 700; box-shadow: 0 4px 14px rgba(43,37,48,.14);
	transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.lwl-map__chips button:hover { transform: translateY(-2px); border-color: var(--color-coral, #FC3C30); background: #FFF6F2; }
.lwl-map__chips .dot { width: 9px; height: 9px; border-radius: 50%; background: #E2725B; }
.lwl-map__chips .n { font-size: .72rem; color: var(--color-ink-soft, #7b7368); font-weight: 600; }

/* ---- slide-in panel ---- */
.lwl-map__panel { position: absolute; top: 0; right: 0; height: 100%; width: min(560px, 92%);
	max-width: 92%; background: var(--color-paper, #FFFCF7); border-left: 1px solid #e7ddcf;
	border-radius: 0 var(--radius-lg, 20px) var(--radius-lg, 20px) 0;
	box-shadow: -20px 0 50px rgba(43,37,48,.18); transform: translateX(102%);
	transition: transform .42s cubic-bezier(.22,.61,.36,1); display: flex; flex-direction: column;
	z-index: 40; overflow: hidden; }
.lwl-map.is-zoomed .lwl-map__panel { transform: translateX(0); }

.lwl-map__panel-bar { flex: none; display: flex; align-items: center; justify-content: space-between;
	gap: .5rem; padding: .9rem .9rem 0; }
.lwl-map__panel-close { display: inline-flex; align-items: center; gap: .4rem;
	border: 1px solid #e7ddcf; background: #fff; color: var(--color-deep, #2B2538);
	border-radius: 999px; padding: .4rem .8rem .4rem .55rem; font-size: .8rem; font-weight: 700; cursor: pointer;
	box-shadow: var(--shadow-sm, 0 1px 3px rgba(43,37,48,.08)); transition: border-color .12s, color .12s; }
.lwl-map__panel-close svg { width: 16px; height: 16px; }
.lwl-map__panel-close:hover { border-color: var(--color-coral, #FC3C30); color: var(--color-coral, #FC3C30); }
.lwl-map__panel-pager { display: flex; gap: .35rem; }
.lwl-map__panel-pager button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid #e7ddcf; background: #fff; color: var(--color-deep, #2B2538); border-radius: 50%; cursor: pointer;
	transition: border-color .12s, color .12s, transform .12s; }
.lwl-map__panel-pager button svg { width: 16px; height: 16px; }
.lwl-map__panel-pager button:hover { border-color: var(--color-coral, #FC3C30); color: var(--color-coral, #FC3C30); transform: translateY(-1px); }

.lwl-map__panel-head { flex: none; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.1rem 1rem;
	border-bottom: 1px solid #efe6da; }
.lwl-map__panel-headtext { min-width: 0; flex: 1; }
.lwl-map__panel-kicker { margin: 0; font-size: .72rem; font-weight: 800; letter-spacing: .12em;
	text-transform: uppercase; color: var(--color-coral, #FC3C30); }
.lwl-map__panel-title { margin: .1rem 0 .15rem; font-family: var(--font-display, Georgia, serif);
	font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; color: var(--color-deep, #2B2538); line-height: 1.1; }
.lwl-map__panel-sub { margin: 0; font-size: .82rem; color: var(--color-ink-soft, #7b7368); font-weight: 600; }
.lwl-map__panel-banner { flex: none; width: 138px; aspect-ratio: 1150 / 250; border-radius: 12px; overflow: hidden;
	box-shadow: var(--shadow-md, 0 8px 22px rgba(43,37,48,.14)); }
.lwl-map__panel-banner svg { width: 100%; height: 100%; display: block; }

.lwl-map__panel-list { flex: 1; overflow-y: auto; overscroll-behavior: contain;
	padding: 1rem 1.1rem 1.4rem; display: grid; gap: 1rem; align-content: start; }
.lwl-map__panel-list .lwl-pcard { max-width: none; margin: 0; }
.lwl-map__panel-list .lwl-pcard__cover { aspect-ratio: 1150 / 250; }
.lwl-map__panel-list::-webkit-scrollbar { width: 9px; }
.lwl-map__panel-list::-webkit-scrollbar-thumb { background: #e0d4c2; border-radius: 9px; border: 2px solid var(--color-paper,#FFFCF7); }

/* ---- footer CTAs — float at the bottom of the map ---- */
.lwl-map__cta { position: absolute; z-index: 20; left: 0; right: 0; bottom: clamp(12px, 2vh, 18px);
	display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: center; padding: 0 14px; }
.lwl-map__cta .cta { box-shadow: 0 6px 18px rgba(43,37,48,.18); }
.lwl-map .cta--ghost { background: rgba(255,255,255,.92); color: var(--color-deep, #2B2538); border: 1px solid #e7ddcf;
	backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lwl-map .cta--ghost:hover { border-color: var(--color-coral, #FC3C30); color: var(--color-coral, #FC3C30); }

/* CEFR legend in the hero */
.lwl-map__legend { display: inline-flex; gap: .8rem; flex-wrap: wrap; justify-content: center; margin: .7rem 0 0; }
.lwl-map__legend-item { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem;
	font-weight: 800; color: var(--color-ink-soft, #5A4632); letter-spacing: .02em; }
.lwl-map__legend-item .sw { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }

/* level-coloured pins (B1 red · B2 green · C1 blue, matching site tokens) */
.lwl-map .lwlm-pin.lvl-B1 .lwlm-marker, .lwl-map .lwlm-pin.lvl-B1 .lwlm-ring { stroke: #FC3C30; }
.lwl-map .lwlm-pin.lvl-B1 .lwlm-marker-core { fill: #FC3C30; }
.lwl-map .lwlm-pin.lvl-B2 .lwlm-marker, .lwl-map .lwlm-pin.lvl-B2 .lwlm-ring { stroke: #3F6F4A; }
.lwl-map .lwlm-pin.lvl-B2 .lwlm-marker-core { fill: #3F6F4A; }
.lwl-map .lwlm-pin.lvl-C1 .lwlm-marker, .lwl-map .lwlm-pin.lvl-C1 .lwlm-ring { stroke: #5460A8; }
.lwl-map .lwlm-pin.lvl-C1 .lwlm-marker-core { fill: #5460A8; }

/* dashed "journey" route arcs linking the lesson countries */
.lwl-map .lwlm-route { fill: none; stroke: #E2725B; stroke-width: 1.4px; stroke-linecap: round;
	stroke-dasharray: 1.5 7; opacity: .45; pointer-events: none; animation: lwlm-route 22s linear infinite; }
@keyframes lwlm-route { to { stroke-dashoffset: -200; } }
.lwl-map.is-zoomed .lwlm-route { opacity: .18; }

/* stronger glow on hover/focus for a clear "lift" affordance */
.lwl-map .land.has-posts.glow:hover, .lwl-map .land.has-posts.glow:focus-visible { filter: url(#lwlm-glow-strong); }

/* crisp HTML country placard shown over the zoomed country */
.lwl-map__placard { position: absolute; z-index: 14; left: 0; top: 0; transform: translate(-50%, -50%) scale(.9);
	pointer-events: none; opacity: 0; transition: opacity .4s ease .15s, transform .4s cubic-bezier(.22,.61,.36,1) .15s;
	font-family: var(--font-display, Georgia, serif); font-weight: 700; color: var(--color-deep, #2B2538);
	font-size: clamp(1.1rem, 2.4vw, 1.7rem); letter-spacing: .01em; text-align: center; white-space: nowrap;
	text-shadow: 0 1px 0 #fff, 0 0 14px rgba(255,252,247,.95), 0 0 28px rgba(255,252,247,.8); }
.lwl-map__placard .flag { display: block; font-size: 1.7em; line-height: 1; margin-bottom: .12em;
	filter: drop-shadow(0 2px 3px rgba(0,0,0,.18)); }
.lwl-map.is-zoomed .lwl-map__placard.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* first-visit hint */
.lwl-map__hint { position: absolute; z-index: 14; left: 50%; top: 16px; transform: translateX(-50%);
	background: var(--color-deep, #2B2538); color: #fff; font-size: .8rem; font-weight: 700;
	padding: .5rem .95rem; border-radius: 999px; box-shadow: 0 8px 22px rgba(43,37,48,.28);
	display: inline-flex; align-items: center; gap: .4rem; opacity: 0; animation: lwlm-hint 1s ease .9s forwards; }
.lwl-map__hint::before { content: '✦'; color: #FFD63B; }
.lwl-map__hint.hide { opacity: 0 !important; transform: translateX(-50%) translateY(8px); transition: opacity .4s, transform .4s; }
@keyframes lwlm-hint { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: .96; transform: translateX(-50%); } }
.lwl-map.is-zoomed .lwl-map__hint { opacity: 0; pointer-events: none; }

/* level chips in the panel header */
.lwl-map__panel-levels { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.lwl-map__panel-levels .lv { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem;
	font-weight: 800; letter-spacing: .03em; color: #fff; border-radius: 999px; padding: .12rem .5rem; }

/* pager position counter */
.lwl-map__panel-pos { align-self: center; font-size: .74rem; font-weight: 800; color: var(--color-ink-soft, #7b7368);
	min-width: 2.4em; text-align: center; font-variant-numeric: tabular-nums; }

/* paper plane gliding along the journey route */
.lwl-map .lwlm-plane { pointer-events: none; transition: opacity .4s ease; }
.lwl-map .lwlm-plane path { fill: #FC3C30; stroke: #FFFCF7; stroke-width: .8px; stroke-linejoin: round;
	filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }

/* hover preview thumbnail inside the tooltip */
.lwl-map__tooltip { max-width: 180px; }
.lwl-map__tooltip .thumb { width: 158px; aspect-ratio: 1150 / 250; border-radius: 7px; overflow: hidden;
	margin-bottom: 5px; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.lwl-map__tooltip .thumb svg { width: 100%; height: 100%; display: block; }

/* ---- responsive ---- */
@media (max-width: 760px) {
	.lwl-map { height: calc(100vh - 96px); }
	.lwl-map__hero { width: calc(100% - 16px); top: 8px; padding: .75rem 1rem .85rem; }
	.lwl-map__lede { display: none; }
	.lwl-map__panel { width: 100%; max-width: 100%; border-radius: var(--radius-lg, 20px); border-left: none; }
	.lwl-map__panel-banner { width: 104px; }
	.lwl-map__compass { display: none; }
	.lwl-map__cta .cta--ghost { display: none; } /* keep just "Start your Journey" on small screens */
	.lwl-map__chips { bottom: 56px; gap: .35rem; }
	.lwl-map__chips button { padding: .32rem .6rem; font-size: .76rem; }
}
/* very short viewports: trim the hero so the map breathes */
@media (max-height: 620px) {
	.lwl-map__lede { display: none; }
	.lwl-map__legend { display: none; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
	.lwl-map .land, .lwl-map__panel, .lwl-map .lwlm-zoom, .lwl-map__placard { transition: none; }
	.lwl-map__hint { animation: none; opacity: .96; }
	.lwl-map:not(.is-zoomed) .land.has-posts.glow,
	.lwl-map .lwlm-ring, .lwl-map .lwlm-zoom .land, .lwl-map .lwlm-pin,
	.lwl-map .lwlm-route, .lwl-map__count .pip, .lwl-map__cloud { animation: none; }
	.lwl-map .lwlm-zoom .land, .lwl-map .lwlm-pin { opacity: 1; }
}
