/* Live terrain map in a page (src/components/map-embed.mjs, static/map-embed.js). The map is the one light surface on
   the dark page, so it is the focal point; the frame is the plain panel line, the crosshair is the logo's reticle. */
.map-embed { margin: 0; display: grid; gap: 16px; }
.me-frame { position: relative; height: var(--me-h, 540px); overflow: hidden; border: var(--rule); border-radius: var(--r); background: var(--panel2); }
.me-preview, .me-preview img { display: block; width: 100%; height: 100%; }
.me-preview img { object-fit: cover; }
/* .me-frame raises the specificity over .maplibregl-map { position: relative } in the MapLibre stylesheet. */
.me-frame .me-live { position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; }
.map-embed.is-live .me-live { opacity: 1; }
.map-embed.is-live .me-preview { visibility: hidden; transition: visibility 0s .3s; }
/* The crosshair marks the centre, the point the coordinate row reads. */
.me-cross { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; color: var(--accent-ink); pointer-events: none; }
.me-cross svg { display: block; }
.me-cross .reticle { color: var(--accent-ink); }
.me-activate { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); min-height: 44px; padding: 0 18px;
  border: var(--border-strong) solid var(--accent-ink); border-radius: var(--btn-radius); background: var(--accent); color: var(--accent-ink);
  font: 700 18px/1 var(--disp); cursor: pointer; }
.me-activate[hidden] { display: none; }
.me-activate:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: 3px; }
.map-embed.is-loading .me-frame::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent);
  transform-origin: left; animation: me-load 1.2s ease-in-out infinite; }
@keyframes me-load { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .me-frame .me-live, .map-embed.is-live .me-preview { transition: none; } .map-embed.is-loading .me-frame::after { animation: none; } }

.me-cap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 32px; align-items: start; }
.me-where { display: grid; gap: 6px; }
.me-where p { margin: 0; }
.me-coord { margin: 0; }
.me-label { color: var(--ink); font-weight: 600; }
.me-help-desk { display: none; }
html:not(.js) .me-help { display: none; } /* gestures mean nothing on the static preview */
@media (hover: hover) and (pointer: fine) { .me-help-touch { display: none; } .me-help-desk { display: inline; } }
.me-note { color: var(--warn); }
/* Overlay legend: the classes in map colours, one row that wraps. */
.me-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 0; padding: 0; list-style: none; font-size: 0.9rem; color: var(--ink); }
.me-legend li { display: inline-flex; align-items: center; gap: 6px; }
.me-swatch { width: 14px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px var(--muted); }
.me-swatch-ring { width: 10px; height: 10px; margin: 2px; border-radius: 50%; }
.me-attrib { grid-column: 1 / -1; margin: 0; }
.me-attrib a { color: inherit; }

/* MapLibre controls in the site's colours: a dark plate, light marks, 44 px targets on touch. */
.map-embed .maplibregl-ctrl-group { background: var(--panel); border: var(--rule); border-radius: var(--btn-radius); box-shadow: none; }
.map-embed .maplibregl-ctrl-group button { width: 40px; height: 40px; }
.map-embed .maplibregl-ctrl-group button + button { border-top: var(--rule); }
.map-embed .maplibregl-ctrl-icon { filter: invert(1); }
.map-embed .maplibregl-ctrl-scale { background: var(--panel); color: var(--ink2); border-color: var(--ink2); font: 400 12px/1.4 var(--mono); }
.map-embed .maplibregl-canvas:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: -4px; }
.map-embed .maplibregl-cooperative-gesture-screen { font: 600 18px/1.4 var(--sans); }
@media (pointer: coarse) { .map-embed .maplibregl-ctrl-group button { width: 44px; height: 44px; } }

@media (max-width: 600px) {
  .me-frame { height: min(var(--me-h, 540px), var(--me-hn, 440px)); }
  .me-cap { grid-template-columns: minmax(0, 1fr); }
  .me-cap .btn { width: 100%; }
}

/* Home "Kokeile karttaa" (T96): heading and the one line side by side above the full-width map. */
.sec-try { display: grid; gap: 32px; }
.try-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px clamp(32px, 5vw, 80px); align-items: end; }
.try-head h2 { margin-bottom: 0; }
.try-head .body { margin: 0; }
@media (max-width: 760px) { .try-head { grid-template-columns: minmax(0, 1fr); } }
