/* ===== Location section — realistic NE Poland SVG map ===== */

/* Pre-computed coords: gc(lon,lat) => [(lon-16.5)/7*700, (55.2-lat)/3.7*480] */

const MAP_CITIES = [
{ id: 'warsaw', label: 'Warszawa', cx: 452, cy: 385, r: 6, accent: true, time: '~2 h', tx: 12, ty: 4, anchor: 'start' },
{ id: 'trojmiasto', label: 'Trójmiasto', cx: 203, cy: 89, r: 5.5, accent: true, time: '~1 h 20 min', tx: -12, ty: -8, anchor: 'end' },
{ id: 'olsztyn', label: 'Olsztyn', cx: 399, cy: 185, r: 4, accent: false, time: null, tx: 11, ty: 4, anchor: 'start' },
{ id: 'ostroda', label: 'Ostróda', cx: 347, cy: 195, r: 3.5, accent: false, time: null, tx: 11, ty: 13, anchor: 'start' },
{ id: 'elblag', label: 'Elbląg', cx: 291, cy: 136, r: 3.5, accent: false, time: null, tx: -11, ty: 4, anchor: 'end' },
{ id: 'torun', label: 'Toruń', cx: 210, cy: 284, r: 3.5, accent: false, time: null, tx: 11, ty: 4, anchor: 'start' },
{ id: 'bydgoszcz', label: 'Bydgoszcz', cx: 150, cy: 270, r: 3, accent: false, time: null, tx: -11, ty: 4, anchor: 'end' },
{ id: 'gdansk', label: 'Gdańsk', cx: 215, cy: 110, r: 3.5, accent: false, time: null, tx: 11, ty: 8, anchor: 'start' },
{ id: 'grudziadz', label: 'Grudziądz', cx: 225, cy: 223, r: 3, accent: false, time: null, tx: 11, ty: 4, anchor: 'start' },
{ id: 'plock', label: 'Płock', cx: 361, cy: 338, r: 3, accent: false, time: null, tx: 11, ty: 4, anchor: 'start' }];


/* Plichta */
const PX = 349,PY = 191;

/* Land polygon — clockwise from bottom-left, coastline top */
const LAND = "M0,480 L700,480 L700,91 L627,101 L549,108 L477,108 L400,101 L335,110 L318,113 L256,131 L238,124 L215,110 L206,96 L195,88 L182,86 L168,79 L150,72 L105,59 L70,74 L45,91 L0,108 Z";

/* Hel Peninsula */
const HEL = "M195,88 L207,82 L218,77 L228,73 L232,70 L229,73 L221,78 L210,84 L195,88 Z";

/* Vistula (Wisła) simplified */
const VISTULA = "M450,385 Q300,299 210,284 L225,223 L227,149 Q235,132 243,127";

/* Masurian Lakes (pre-computed, simplified shapes) */
const LAKES = [
"M504,184 Q521,179 534,186 Q539,192 527,197 Q511,199 504,194 Z", /* Śniardwy */
"M522,155 Q534,150 540,158 Q536,168 524,165 Z", /* Niegocin */
"M506,144 Q514,138 524,144 Q528,152 518,156 Q508,154 506,144 Z", /* Mamry */
"M326,199 Q332,193 338,198 Q342,206 334,209 Q326,207 326,199 Z", /* Jeziorak */
"M405,178 Q412,173 416,178 Q414,184 407,183 Z", /* near Olsztyn */
"M563,182 Q571,177 576,184 Q574,191 565,188 Z" /* near Ełk */];


function LocationMapSVG() {
  return (
    <div className="loc-map-container"
    dangerouslySetInnerHTML={{ __html: window.MB_MAPA_PL || '<p>Ładowanie mapy…</p>' }} />);

}

function Location() {
  const feats = [
  ['~2 h', 'z Warszawy'],
  ['~1 h 20 min', 'z Trójmiasta'],
  ['30 min', 'od Olsztyna'],
  ['15 min', 'od Ostródy']];

  return (
    <section className="section" id="lokalizacja" style={{ background: 'var(--cream)' }}>
      <div className="wrap">
        <div className="loc-layout">
          <div className="loc-text">
            <span className="eyebrow reveal">Lokalizacja</span>
            <h2 className="display d-xl reveal d1">Mazury<br />w zasięgu ręki</h2>
            <p className="reveal d2" style={{ marginTop: '1.4rem', maxWidth: '44ch' }}>Plichta leży w samym sercu Warmii i Mazur. Z Warszawy lub Trójmiasta wystarczą dwie godziny jazdy — bez planowania długiego wyjazdu.



            </p>
            <div className="loc-feats reveal d2">
              {feats.map(([t, l], i) =>
              <div className="loc-feat" key={i}>
                  <div className="lf-time num">{t}</div>
                  <div className="lf-label">{l}</div>
                </div>
              )}
            </div>
          </div>
          <div className="loc-map-container reveal d1">
            <LocationMapSVG />
          </div>
        </div>
      </div>
    </section>);

}

window.Location = Location;