/* wallburgen.de — atlas components on top of weltsein.css (tokens, fonts, buttons). */

.mono { font-family: var(--font-mono); }
.meta { color: var(--text-muted); font-size: 0.75rem; }
.small { font-size: 0.72rem; }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

main.wide { padding: 0 clamp(1rem, 4vw, 4rem) 3rem; }
main.full { max-width: none; padding: 0; }

/* ---------------------------------------------------------------- overview */
.intro { max-width: var(--max-width); margin: 2rem 0 1.5rem; }
.intro h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1; margin-bottom: 0.75rem; }

.map-frame { margin-top: 2rem; border: var(--hard); box-shadow: var(--shadow); background: var(--bg-secondary); }
.atlas-map { height: min(70vh, 640px); }
.map-attrib { font-size: 0.68rem; color: var(--text-muted); margin: 0.6rem 0 0; }

.site-list { margin-top: 2.5rem; }
.site-list h2, .sheet h2, .credits h2, .h-small {
  font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; margin-bottom: 1rem;
}
.h-small { font-size: 1.35rem; margin-bottom: 0.5rem; }
.count { font-size: 0.8rem; border: 1px solid var(--ink); padding: 0 0.4rem; vertical-align: middle; }
.cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.site-card {
  display: flex; flex-direction: column; gap: 0.35rem; height: 100%;
  padding: 0.9rem 1rem; border: var(--hard); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; background: var(--bg);
}
.site-card:hover { background: var(--bg); color: var(--text); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.site-card:hover .site-card-title { background: var(--brand); color: var(--on-brand); }
.site-card-title { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.1; align-self: flex-start; }
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* MapLibre in the hard look */
.maplibregl-popup-content { border: var(--hard); box-shadow: var(--shadow); background: var(--bg); color: var(--text); padding: 0.6rem 0.8rem; font-family: var(--font-mono); font-size: 0.75rem; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-content a { font-family: var(--font-display); font-size: 1.15rem; }
.maplibregl-ctrl-group { border: var(--hard) !important; box-shadow: var(--shadow) !important; background: var(--bg) !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--ink) !important; }
html.dark .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { font-family: var(--font-mono); font-size: 0.62rem; }

/* ---------------------------------------------------------------- site page */
.site-head { margin: 2rem 0 1.5rem; }
.site-head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1; margin: 0.3rem 0 0.5rem; }

.panel { border: var(--hard); box-shadow: var(--shadow); background: var(--bg); padding: 0.75rem; }
.terrain-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr); gap: 1.5rem; align-items: start; }
.terrain-grid.two { grid-template-columns: 1fr 1fr; margin-top: 1.5rem; }
@media (max-width: 860px) { .terrain-grid, .terrain-grid.two { grid-template-columns: 1fr; } }
.relief-panel { margin: 0; padding: 0; }
.relief-panel figcaption { font-size: 0.68rem; color: var(--text-muted); padding: 0.4rem 0.6rem; border-top: 1px solid var(--ink); }
.relief-box { min-height: 260px; background: var(--bg-secondary); position: relative; --hsr-ink: var(--ink); --hsr-accent: var(--brand); }
.relief-box canvas { cursor: crosshair; }
.status { padding: 1rem; font-size: 0.75rem; }
.status.err { background: var(--danger); color: var(--paper); }

.controls { display: flex; flex-direction: column; gap: 0.7rem; font-family: var(--font-mono); font-size: 0.72rem; }
.ctl-row { display: flex; flex-direction: column; gap: 0.15rem; }
.ctl-row label { display: flex; gap: 0.5rem; align-items: center; padding: 0.25rem 0.35rem; cursor: pointer; border: 1px solid transparent; }
.ctl-row label:has(input:checked) { background: var(--ink); color: var(--paper); }
.ctl-row input { accent-color: var(--brand); }
.slider { display: flex; flex-direction: column; gap: 0.2rem; }
.slider span { display: flex; justify-content: space-between; }
.slider input { width: 100%; accent-color: var(--brand); }
.slider.off { display: none; }
.hint { min-height: 1.2em; color: var(--text-muted); }
.ctl-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.profile-panel { margin-top: 1.5rem; }
.profile-box { min-height: 140px; }
.profile-box svg { display: block; width: 100%; height: auto; font-family: var(--font-mono); }
.profile-box .area { fill: var(--bg-secondary); stroke: none; }
.profile-box .line { fill: none; stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.profile-box .axis { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile-box .grid { stroke: var(--text-muted); stroke-width: 0.5; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.profile-box text { fill: var(--text-muted); font-size: 11px; }
.profile-box .cursor { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile-box .dot { fill: var(--brand); stroke: var(--ink); stroke-width: 1.5; }
.profile-box .readout { fill: var(--text); font-size: 12px; }

.site-map { height: 360px; }
.three-box { height: 360px; background: var(--bg-secondary); }

.sheet { margin-top: 3rem; columns: 2 420px; column-gap: 2.5rem; }
.sheet h2 { column-span: all; }
.sheet-sec { break-inside: avoid; margin-bottom: 1.6rem; }
.sheet-sec h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; border-bottom: var(--hard); padding-bottom: 0.2rem; margin-bottom: 0.5rem; }
.sheet dl { display: grid; grid-template-columns: minmax(9rem, 38%) 1fr; }
.sheet dt, .sheet dd { padding: 0.35rem 0; border-bottom: 1px solid var(--ink); font-size: 0.85rem; }
.sheet dt { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); padding-right: 0.8rem; }
.sheet dd .txt { white-space: pre-line; }
.sheet dd.unknown { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }
.refs { margin: 0; padding-left: 1.2rem; white-space: normal; }
.refs li { margin-bottom: 0.3rem; }
.ref-link { font-size: 0.68rem; border: 1px solid var(--ink); padding: 0 0.3rem; text-decoration: none; white-space: nowrap; }
.credits { margin-top: 2rem; }
.credits ul { padding-left: 1.2rem; }

.src-table { font-size: 0.78rem; }

/* ---------------------------------------------------------------- login */
.login { max-width: 420px; margin: 3rem auto; }
.login h1 { font-family: var(--font-display); font-weight: 400; font-size: 2.4rem; margin-bottom: 1rem; }
.login .msg { margin-bottom: 1rem; }
.login form { display: flex; flex-direction: column; gap: 1rem; }

/* ---------------------------------------------------------------- admin */
body.admin { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.admin .site-footer { display: none; }
body.admin main { flex: 1; min-height: 0; }
.admin-layout { display: grid; grid-template-columns: 1fr minmax(340px, 30vw); height: 100%; }
@media (max-width: 900px) {
  body.admin { height: auto; overflow: auto; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-map, .map-stack { height: 70vh; }
}
.admin-mapcol { display: flex; flex-direction: column; min-height: 0; border-right: var(--hard); }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.5rem 0.75rem; border-bottom: var(--hard); font-size: 0.72rem; }
.toolbar .btn.on { background: var(--ink); color: var(--paper); }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--ink); }
.toolbar .grow { flex: 1; }
.toolbar select { font-family: var(--font-mono); font-size: 0.72rem; border: var(--hard); background: var(--bg); color: var(--text); padding: 0.3rem; }
.tgl { display: inline-flex; gap: 0.35rem; align-items: center; }
.tgl input[type=range] { width: 90px; accent-color: var(--brand); }
.map-stack { position: relative; flex: 1; min-height: 0; }
/* !important: MapLibre sets position: relative on its container */
.admin-map { position: absolute !important; inset: 0; }
.mode-hint { position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 3; background: var(--ink); color: var(--paper); padding: 0.35rem 0.6rem; font-size: 0.72rem; }

.admin-side { overflow-y: auto; min-height: 0; padding: 0.75rem 1rem 3rem; }
.side-head { display: flex; gap: 0.5rem; align-items: center; position: sticky; top: -0.75rem; background: var(--bg); padding: 0.5rem 0; z-index: 2; border-bottom: 1px solid var(--ink); }
.side-head select { flex: 1; font-family: var(--font-mono); font-size: 0.78rem; border: var(--hard); background: var(--bg); color: var(--text); padding: 0.4rem; min-height: 40px; }
.site-form .form-group { margin-bottom: 0.7rem; }
.site-form .form-group label { font-size: 0.68rem; }
.site-form fieldset { border: none; border-top: var(--hard); padding: 0.6rem 0 0.2rem; margin-top: 0.8rem; }
.site-form legend { font-family: var(--font-display); font-size: 1.15rem; padding-right: 0.5rem; }
.site-form .checks { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; font-size: 0.75rem; }
.site-form .checks label { display: inline-flex; gap: 0.3rem; align-items: center; font-family: var(--font-body); font-size: 0.78rem; text-transform: none; letter-spacing: 0; }
.site-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.site-form .geo { font-family: var(--font-mono); font-size: 0.7rem; display: flex; flex-direction: column; gap: 0.3rem; margin: 0.4rem 0 0.8rem; }
.site-form .geo .ok::before { content: "■ "; color: var(--brand); }
.site-form .geo .missing::before { content: "□ "; }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.2rem; position: sticky; bottom: -3rem; background: var(--bg); padding: 0.6rem 0; border-top: 1px solid var(--ink); }
.status-badge { font-family: var(--font-mono); font-size: 0.68rem; padding: 0.1rem 0.4rem; border: 1px solid var(--ink); }
.status-badge.published { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.status-badge.draft { border-style: dashed; }
