/* Laknam structural CSS. base.html sets the CSS variables:
   --bg --surface --surface-2 --ink --muted --line --accent --accent-ink --radius --shadow
   --u-today --u-week --u-future --font-display --font-body --font-mono */

body { background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
.display { font-family: var(--font-display); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Buttons: one system, three tones. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1rem; border-radius: var(--radius);
       font-size: .875rem; font-weight: 500; line-height: 1; border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--muted); padding-left: .5rem; padding-right: .5rem; }
.btn-quiet:hover { color: var(--ink); }
.btn-lg { padding: .9rem 1.25rem; font-size: 1rem; }

/* Urgency chip: data-u = today | week | future | ended */
.chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 500; padding: .2rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.chip::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.chip[data-u="today"]::before, .dot-today { background: var(--u-today); }
.chip[data-u="week"]::before,  .dot-week  { background: var(--u-week); }
.chip[data-u="future"]::before,.dot-future{ background: var(--u-future); }
.chip[data-u="today"] { color: var(--u-today); }
.chip[data-u="none"]::before { display: none; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }

/* Countdown states from laknam.js */
[data-countdown][data-state="ended"] { color: var(--muted); text-decoration: line-through; }
[data-countdown][data-state="urgent"] { color: var(--u-today); }
[data-countdown][data-state="soon"] { color: var(--u-week); }
tr[data-state="ended"], [data-row][data-state="ended"] { opacity: .55; }

/* Long-form text (PDF brief, description) rendered from markdown; no Tailwind typography plugin needed. */
.brief { font-size: .95rem; line-height: 1.65; color: var(--ink); }
.brief h3 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 .5rem; color: var(--ink); }
.brief h3:first-child { margin-top: 0; }
.brief ul { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.brief li { padding: .5rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 11rem) 1fr; gap: 1rem; }
.brief li strong { color: var(--muted); font-weight: 500; font-size: .85rem; }
.brief p { margin: .5rem 0; }
@media (max-width: 640px) { .brief li { grid-template-columns: 1fr; gap: .15rem; } }

/* Map chrome */
.map-shell { position: relative; height: calc(100dvh - var(--nav-h, 56px)); width: 100%; }
.map-shell .maplibregl-canvas { outline: none; }
.map-float { position: absolute; z-index: 5; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; padding: .25rem; }  /* wraps instead of scrolling so the dropdowns are never clipped */
.pill { position: relative; flex: 0 0 auto; }
.pill > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .9rem; border-radius: 999px;
                  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .8125rem; font-weight: 500; color: var(--ink); white-space: nowrap; }
.pill > summary::-webkit-details-marker { display: none; }
.pill > summary::after { content: ""; width: .4rem; height: .4rem; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); }
.pill[data-active="1"] > summary { border-color: var(--accent); color: var(--accent); }
.pill[data-active="1"] > summary::after { border-color: var(--accent); }
.pill-menu { position: absolute; top: calc(100% + .4rem); left: 0; min-width: 14rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .4rem; z-index: 10; }
.pill-menu label { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: calc(var(--radius) - 2px); font-size: .8125rem; cursor: pointer; }
.pill-menu label:hover { background: var(--surface-2); }
.pill-menu input[type="radio"] { accent-color: var(--accent); }
.pill-menu input[type="number"] { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); background: var(--surface); color: var(--ink); font: inherit; }
.legend { display: flex; gap: 1rem; align-items: center; font-size: .75rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; box-shadow: var(--shadow); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }

/* Popup: minimal card + one big action. */
.maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem; font-family: var(--font-body); border: 1px solid var(--line); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.maplibregl-popup-close-button { color: var(--muted); font-size: 1.1rem; padding: .25rem .5rem; }
.maplibregl-popup-close-button:hover { background: transparent; color: var(--ink); }
.pp-case { font-size: .7rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.pp-addr { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin: .15rem 0 .5rem; line-height: 1.3; }
.pp-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .8125rem; color: var(--muted); padding: .2rem 0; }
.pp-row b { color: var(--ink); font-weight: 600; }
.pp-btn { margin-top: .75rem; width: 100%; }

/* Drawer: right sheet on desktop, bottom sheet on mobile. */
.drawer { position: fixed; z-index: 40; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column;
          top: 0; right: 0; bottom: 0; width: min(28rem, 100vw); transform: translateX(105%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.drawer.open { transform: none; }
@media (max-width: 640px) { .drawer { top: auto; left: 0; width: 100%; max-height: 85dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; transform: translateY(105%); } }
.drawer-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .28s; }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer-body { overflow-y: auto; flex: 1; }
[data-panel][hidden], #drawer-back[hidden] { display: none !important; }  /* Tailwind's .flex would otherwise beat [hidden] */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; font-size: .875rem; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { text-align: right; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.cookie-banner { position: fixed; z-index: 50; left: 1rem; right: 1rem; bottom: 1rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 40rem; margin: 0 auto; }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: .875rem; line-height: 1.45; color: var(--ink); flex: 1 1 14rem; }
.cookie-banner a { color: var(--accent); text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: .5rem; flex-shrink: 0; }
