/* ─── מפת רשת החשמל (/guides/grid-map) ───────────────────────────
   An illustrated inline-SVG map (top→bottom = flow of energy) + sticky side
   panel. ≤900px: the map is zoomed in and pans sideways inside .gm-canvas,
   and the panel becomes a bottom sheet that sits above the news ticker. */
.gm-page { padding-top: 1.25rem; padding-bottom: 2rem; min-width: 0; }
.gm-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gm-head { margin-bottom: 0.8rem; }
.gm-lead { max-width: 760px; color: var(--text); margin: 0.3rem 0 0; }

/* owners palette: text tag + colour (never colour alone). All ≥ 4.5:1 on white text. */
[data-owner="authority"] { --o: #0F4C35; }
[data-owner="ministry"]  { --o: #6D28D9; }
[data-owner="noga"]      { --o: #1D4ED8; }
[data-owner="iec"]       { --o: #B45309; }
[data-owner="private"]   { --o: #0F766E; }
[data-owner="supplier"]  { --o: #BE185D; }
[data-owner="consumer"]  { --o: #475569; }

/* toolbar */
.gm-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0.4rem 0 0.6rem; }
.gm-js-only { display: none; }
.gm-js .gm-js-only { display: flex; }
.gm-viewswitch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; background: var(--card); padding: 3px; }
.gm-vbtn { display: inline-flex; align-items: center; gap: 0.3rem; border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 0.88rem; font-weight: 600; padding: 0.35rem 0.85rem; border-radius: 999px; cursor: pointer; min-height: 36px; }
.gm-vbtn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.gm-vbtn:focus-visible, .gm-switch input:focus-visible + span, .gm-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gm-switch { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; min-height: 36px; }
.gm-switch input { width: 18px; height: 18px; accent-color: var(--primary); }

.gm-legend { display: none; flex-wrap: wrap; gap: 0.35rem 0.9rem; list-style: none; margin: 0 0 0.75rem; padding: 0.55rem 0.75rem; background: var(--card); border: 1px solid var(--border); border-radius: 12px; font-size: 0.82rem; }
.gm-owners .gm-legend { display: flex; }
.gm-legend li { display: inline-flex; align-items: center; gap: 0.3rem; }

/* layout */
/* the map takes the full width; the explanation opens as a drawer over its
   left (inline-end) side on desktop, and as a bottom sheet on phones */
.gm-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.gm-diagram { min-width: 0; }
.gm-hint { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--text-light); margin: 0 0 0.6rem; }

/* ── the illustrated map (inline SVG) ───────────────────────────── */
.gm-hint-m { display: none; }
.gm-canvas { position: relative; max-width: 100%; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; background: #FBFDFC; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); outline: none; }
.gm-canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gm-map { display: block; width: calc(100% * var(--gm-z, 1)); height: auto; font-family: inherit; direction: rtl; }
.gm-map text { font-family: inherit; direction: rtl; unicode-bidi: plaintext; pointer-events: none; }

/* voltage + line legend (always visible) */
.gm-vlegend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; list-style: none; margin: 0 0 0.6rem; padding: 0; font-size: 0.82rem; color: var(--text); }
.gm-vlegend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.gm-sw { display: inline-block; width: 26px; height: 0; border-top: 4px solid var(--c, #1A7A56); border-radius: 2px; }
.gm-sw-data { border-top: 2px dashed #6D4BC8; }
.gm-sw-money { border-top: 3px dotted #BE185D; }
.gm-sw-zone { display: inline-block; width: 22px; height: 14px; border: 1.5px dashed #10B981; background: #ECFDF5; border-radius: 4px; }

/* zoom */
.gm-zoom { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; background: var(--card); padding: 3px; gap: 2px; }
.gm-zbtn { border: 0; background: transparent; color: var(--primary); font: inherit; font-weight: 700; font-size: 0.88rem; min-width: 36px; min-height: 36px; padding: 0 0.6rem; border-radius: 999px; cursor: pointer; }
.gm-zbtn:hover { background: var(--bg-alt); }
.gm-zbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.gm-zbtn[disabled] { opacity: 0.4; cursor: default; }

/* bands and zones (decoration) */
.gm-band-bg { stroke-width: 1.2; }
.gm-bb-bodies { fill: #0F3D2E; stroke: #0F3D2E; }
.gm-bb-gen { fill: #F1F8F4; stroke: #CDEBDD; }
.gm-bb-ehv { fill: #FDF1EF; stroke: #F3CFCB; }
.gm-bb-hv { fill: #FEF6EC; stroke: #F6DDBA; }
.gm-bb-mv { fill: #EFF4FC; stroke: #CBDCF4; }
.gm-bb-lv { fill: #EFF8F2; stroke: #C9E8D5; }
.gm-bb-supply { fill: #FDF2F8; stroke: #BE185D; stroke-dasharray: 6 4; }
.gm-side-bg { fill: #F6F3FD; stroke: #E2DAF7; }
.gm-zone { fill: rgba(16,185,129,0.07); stroke: #10B981; stroke-width: 1.4; stroke-dasharray: 5 4; }
.gm-zone-off { fill: #F8FAFC; stroke: #94A3B8; }
.gm-zone-pill { fill: #D1FAE5; }
.gm-zone-t { font-size: 10.5px; font-weight: 700; fill: #047857; }
.gm-note { font-size: 11px; fill: #475569; }
.gm-note-b { font-weight: 700; fill: #0F3D2E; }
.gm-note-s { font-size: 10px; fill: #9A5300; }
.gm-src-t { font-size: 10px; fill: #64748B; }
.gm-tower { opacity: 0.5; }

/* lines */
.gm-e { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.gm-w6 { stroke-width: 6; }
.gm-w5 { stroke-width: 5; }
.gm-w4 { stroke-width: 4.5; }
.gm-w35 { stroke-width: 4; }
.gm-d { fill: none; stroke: #6D4BC8; stroke-width: 1.8; stroke-dasharray: 5 4; }
.gm-m { fill: none; stroke: #BE185D; stroke-width: 2; stroke-dasharray: 1 5; stroke-linecap: round; }

/* callouts */
.gm-callout rect { fill: #FFF6DB; stroke: #E8C66A; }
.gm-callout-h { font-size: 15px; font-weight: 800; fill: #0F3D2E; }
.gm-callout-t { font-size: 11px; fill: #3F4B46; }
.gm-call { fill: #FFF6DB; stroke: #E8C66A; }
.gm-call-t { font-size: 11px; font-weight: 800; fill: #0F3D2E; }

/* clickable elements */
.gm-hit { cursor: pointer; outline: none; }
.gm-box { fill: #FFFFFF; stroke: #D3DED8; stroke-width: 1.3; transition: stroke .15s, fill .15s; }
.gm-hit:hover .gm-box { stroke: #1A7A56; stroke-width: 2; }
.gm-hit:focus-visible .gm-box, .gm-hit[aria-current="true"] .gm-box { stroke: #E0A100; stroke-width: 3.5; }
.gm-hit[aria-current="true"] .gm-box { fill: #FFFBEB; }
.gm-t { font-size: 12.5px; font-weight: 700; fill: #12352A; }
.gm-st { font-size: 10.5px; font-weight: 600; fill: #6B5200; }
.gm-st-num { font-weight: 800; }
.gm-n-pro .gm-box { fill: #F5FFF9; }
.gm-n-off .gm-box { fill: #F8FAFC; stroke-dasharray: 4 3; }
.gm-c .gm-ci { color: #1A7A56; }
.gm-c-link .gm-box { fill: #FFFBEB; stroke: #E9CF8B; }
.gm-c-link .gm-ci { color: #B45309; }
.gm-c-dark .gm-box { fill: rgba(255,255,255,0.1); stroke: rgba(255,255,255,0.35); }
.gm-c-dark .gm-t { fill: #FFFFFF; }
.gm-c-dark .gm-ci { color: #CDEBDD; }
.gm-c-dark:hover .gm-box { stroke: #FFFFFF; }
.gm-s .gm-box { fill: #FFFFFF; stroke: var(--vc); stroke-width: 1.5; }
.gm-s-strip { fill: var(--vc); }
.gm-s-t { font-size: 13.5px; font-weight: 800; fill: #0F3D2E; }
.gm-s-v { font-size: 11.5px; font-weight: 700; fill: var(--vc); }
.gm-s-more { font-size: 13px; fill: #1A7A56; }
.gm-s-bodies .gm-s-v, .gm-s-gen .gm-s-v { fill: #1A7A56; }

/* "who is responsible" layer on the map */
.gm-ot { display: none; }
.gm-ot-r { fill: var(--o, #475569); }
.gm-ot text { font-size: 10.5px; font-weight: 800; fill: #FFFFFF; }
.gm-owners .gm-ot { display: inline; }
.gm-owners .gm-n .gm-box, .gm-owners .gm-c:not(.gm-c-dark) .gm-box { stroke: var(--o); stroke-width: 2.4; }
.gm-owners .gm-c-dark .gm-box { fill: #FFFFFF; stroke: var(--o); stroke-width: 2.4; }
.gm-owners .gm-c-dark .gm-t { fill: #12352A; }
.gm-owners .gm-c-dark .gm-ci { color: var(--o); }

/* energy flow animation (off for reduced motion, or via the toggle) */
/* energy lines stay solid; a second copy carries small light pulses */
@keyframes gmDash { to { stroke-dashoffset: -40; } }
@keyframes gmBi { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -40; } }
@keyframes gmData { to { stroke-dashoffset: -18; } }
.gm-pulse { display: none; }
.gm-flow .gm-pulse { display: inline; }
.gm-pulse .gm-e { stroke: #FFFFFF !important; stroke-opacity: 0.9; stroke-width: 1.6; stroke-dasharray: 3 17; animation: gmDash 1.3s linear infinite; }
.gm-pulse .gm-bi { animation: gmBi 1.8s ease-in-out infinite alternate; }
.gm-flow .gm-d { animation: gmData 1.6s linear infinite; }
@media (prefers-reduced-motion: reduce) {
    .gm-panel, .gm-panel.is-open { transition: none; }
    .gm-pulse .gm-e, .gm-pulse .gm-bi, .gm-flow .gm-d { animation: none !important; }
    .gm-flow .gm-pulse { display: none; }
    .gm-box { transition: none; }
}

.gm-foot { font-size: 0.8rem; color: var(--text-light); margin: 0.6rem 0 0; line-height: 1.6; overflow-wrap: anywhere; }

/* side panel */
.gm-panel { position: fixed; z-index: 1001; top: 92px; inset-inline-end: max(16px, calc((100vw - 1200px) / 2 + 16px)); width: 360px; max-height: calc(100vh - 110px - var(--nt-h, 0px)); overflow: auto; overscroll-behavior: contain; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 18px 44px rgba(10,52,37,0.25); padding: 0.4rem 1rem 1rem; outline: none; visibility: hidden; opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s; }
.gm-panel.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity .18s ease, transform .18s ease; }
.gm-panel:not(.is-open) .gm-panel-body { display: none; }
.gm-panel-bar { display: flex; justify-content: flex-end; align-items: center; min-height: 36px; }
.gm-panel-grip { display: none; }
.gm-close { display: none; border: 0; background: var(--bg-alt); color: var(--primary); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; align-items: center; justify-content: center; }
.gm-panel.is-open .gm-close { display: inline-flex; }
.gm-panel-empty-title { font-size: 1.05rem; color: var(--primary); margin: 0 0 0.4rem; }
.gm-panel .gm-entry { border: 0; padding: 0; margin: 0; box-shadow: none; background: transparent; }
.gm-panel .gm-entry-title { font-size: 1.1rem; }
.gm-backdrop { display: none; }

/* entries (list view + panel content) */
.gm-list { margin-top: 2rem; }
.gm-js .gm-list { display: none; }
.gm-js.gm-view-list .gm-list { display: block; margin-top: 0.5rem; }
.gm-js.gm-view-list .gm-layout, .gm-js.gm-view-list .gm-legend { display: none; }
.gm-list-seg { margin-bottom: 1.4rem; }
.gm-list-seg > .gm-entry:first-child { background: var(--bg-alt); }
.gm-entry { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 0.8rem 1rem; margin-bottom: 0.6rem; scroll-margin-top: 90px; min-width: 0; overflow-wrap: break-word; }
.gm-entry-title { display: flex; align-items: center; gap: 0.5rem; color: var(--primary); font-size: 1.02rem; margin: 0 0 0.35rem; line-height: 1.35; }
h3.gm-entry-title { font-size: 1.15rem; }
.gm-entry-ico { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: var(--bg-alt); color: var(--o, var(--primary-light)); }
.gm-entry-text { margin: 0 0 0.5rem; line-height: 1.75; }
.gm-facts, .gm-who { margin: 0 0 0.5rem; display: grid; gap: 0.25rem; font-size: 0.88rem; }
.gm-facts div, .gm-who div { display: flex; flex-wrap: wrap; gap: 0.1rem 0.5rem; }
.gm-facts dt, .gm-who dt { font-weight: 700; color: var(--primary); }
.gm-facts dt::after, .gm-who dt::after { content: ':'; }
.gm-facts dd, .gm-who dd { margin: 0; }
.gm-facts { background: #FFFBEB; border-radius: 10px; padding: 0.45rem 0.65rem; }
.gm-sub { display: flex; align-items: center; gap: 0.35rem; font-weight: 700; font-size: 0.86rem; color: var(--primary); margin: 0.5rem 0 0.2rem; }
.gm-links { margin: 0; padding-inline-start: 1.2rem; font-size: 0.9rem; line-height: 1.6; }
.gm-links li { margin-bottom: 0.2rem; }
.gm-src { font-size: 0.76rem; color: var(--text-light); margin: 0.55rem 0 0; line-height: 1.55; }
.gm-review { background: #FFFBEB; border: 1px solid #F6E3B4; color: #78350F; border-radius: 10px; padding: 0.45rem 0.65rem; font-size: 0.84rem; margin: 0.55rem 0 0; }

/* ── mobile / tablet: bottom sheet ─────────────────────────────── */
@media (max-width: 900px) {
    .gm-layout { grid-template-columns: minmax(0, 1fr); }
    .gm-panel { position: fixed; inset-inline: 0; width: auto; opacity: 1; top: auto; bottom: 0; z-index: 1001; max-height: 72vh; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 0.2rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; box-shadow: 0 -10px 30px rgba(10,52,37,0.22); }
    body.has-ticker .gm-panel { bottom: calc(var(--nt-h) + env(safe-area-inset-bottom, 0px)); max-height: calc(72vh - var(--nt-h)); }
    .gm-panel.is-open { transform: none; visibility: visible; transition: transform .25s ease; }
    .gm-panel-bar { justify-content: space-between; position: sticky; top: 0; background: var(--card); z-index: 1; }
    .gm-panel-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin-inline: auto; }
    .gm-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(10,52,37,0.35); }
    .gm-panel:not(.is-open) .gm-panel-body { display: none; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .gm-panel, .gm-panel.is-open { transition: none; } }
@media (max-width: 900px) {
    .gm-hint-m { display: inline; }
    .gm-canvas { border-radius: 12px; }
}
@media print {
    .gm-toolbar, .gm-panel, .gm-backdrop, .gm-hint, .gm-ot { display: none !important; }
    .gm-map { width: 100% !important; }
    .gm-flow .gm-e { stroke-dasharray: none; animation: none; }
    .gm-js .gm-list { display: block; }
}
@media (prefers-reduced-motion: reduce) { .gm-panel, .gm-panel.is-open { transition: none; } }

/* "פתח מפה מוגדלת" button on the map page */
.gm-fullbtn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 36px; padding: 0 0.85rem; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.88rem; font-weight: 700; text-decoration: none; }
.gm-fullbtn:hover { background: var(--primary-light); color: #fff; }
.gm-fullbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ── full-screen map (/guides/grid-map/full) ───────────────────────── */
.gm-fullpage { margin: 0; background: #FBFDFC; }
.gm-fullpage.gm-locked { overflow: hidden; height: 100vh; }
.gm-full { position: relative; display: flex; flex-direction: column; min-height: 100vh; }
.gm-locked .gm-full { height: 100vh; height: 100dvh; }
.gm-fbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.9rem; padding: 0.4rem 0.8rem; background: #0F3D2E; color: #fff; }
.gm-ftitle { font-size: 1.05rem; margin: 0; color: #fff; }
.gm-flogo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: rgba(255,255,255,0.12); }
.gm-flogo:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gm-fbar .gm-toolbar { margin: 0; margin-inline-start: auto; }
.gm-fbar .gm-switch { color: #fff; }
.gm-full .gm-legend { position: absolute; z-index: 5; top: 60px; inset-inline-start: 0.6rem; margin: 0; box-shadow: var(--shadow-md); }
.gm-canvas-full { flex: 1 1 auto; min-height: 0; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; touch-action: none; cursor: grab; }
.gm-canvas-full.is-dragging { cursor: grabbing; }
.gm-canvas-full.is-dragging .gm-hit { cursor: grabbing; }
.gm-stage { width: 100%; height: 100%; transform-origin: 0 0; will-change: transform; }
.gm-canvas-full .gm-map { width: 100%; height: 100%; }
.gm-fhint { position: absolute; bottom: 0.5rem; inset-inline-end: 0.75rem; margin: 0; padding: 0.25rem 0.6rem; border-radius: 999px; background: rgba(15,61,46,0.8); color: #fff; font-size: 0.75rem; pointer-events: none; }
.gm-full .gm-panel { top: 64px; }
.gm-js .gm-list-full { display: none; }
.gm-list-full { padding: 1rem; }
@media (max-width: 900px) {
    .gm-ftitle { font-size: 0.95rem; }
    .gm-fbar .gm-toolbar { margin-inline-start: 0; }
    .gm-full .gm-legend { top: auto; bottom: 2.4rem; }
}
