/* SKAT design system
   Shared by the map, the dashboard and the privacy page. Page-specific layout lives next to each page.
   Breakpoints: 640px (tablet) and 900px (desktop). */

@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/Geist-Variable.woff2) format('woff2');
}

:root {
  /* colour: black and white, one signal blue (focus, location, private pins), one red (caution) */
  --ink: #000;
  --paper: #fff;
  --wash: #f2f2f2;
  --wash-hover: #e8e8e8;
  --mute: #666;
  --faint: #8e8e8e;
  --line: rgba(0, 0, 0, .1);
  --line-strong: rgba(0, 0, 0, .2);
  --signal: #2f2bff;
  --red: #c8281e;
  --red-wash: #fdecea;
  --red-line: rgba(200, 40, 30, .28);

  /* type: three weights, seven sizes */
  --font: Geist, -apple-system, "SF Pro Text", system-ui, sans-serif;
  --fs-xs: 12px;
  --fs-s: 14px;
  --fs-m: 16px;
  --fs-l: 20px;
  --fs-xl: 28px;
  --fs-2xl: 40px;
  --fs-hero: clamp(44px, 11vw, 72px);
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semi: 600;

  /* space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --gutter: 20px;

  /* shape: 8 small things, 12 controls and media, 20 surfaces, pill for toggles and floating capsules */
  --r-1: 8px;
  --r-2: 12px;
  --r-3: 20px;
  --r-pill: 999px;

  /* elevation: floating controls, then surfaces */
  --sh-float: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .1);
  --sh-surface: 0 2px 8px rgba(0, 0, 0, .06), 0 24px 64px rgba(0, 0, 0, .16);

  /* motion */
  --ease: cubic-bezier(.32, .72, 0, 1);
  --t-1: .15s;
  --t-2: .25s;
  --t-3: .45s;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; -webkit-tap-highlight-color: transparent; }

body {
  font: var(--fw-regular) var(--fs-m)/1.5 var(--font);
  letter-spacing: -.011em;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- type ---------- */
.h1 { font-size: var(--fs-hero); font-weight: var(--fw-semi); letter-spacing: -.04em; line-height: 1; }
.h2 { font-size: var(--fs-xl); font-weight: var(--fw-semi); letter-spacing: -.03em; line-height: 1.15; }
.h3 { font-size: var(--fs-l); font-weight: var(--fw-semi); letter-spacing: -.02em; line-height: 1.25; }
.label { font-size: var(--fs-s); font-weight: var(--fw-medium); color: var(--mute); }
.mute { color: var(--mute); }
.small { font-size: var(--fs-s); }
.note { font-size: var(--fs-s); color: var(--red); min-height: 1.5em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons ----------
   .btn is the one button. Variants change weight, not shape:
   primary (one per view) · ghost (default) · quiet (tertiary) · danger (destructive).
   Sizes: default 48px, .sm 40px. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0 var(--s5);
  border-radius: var(--r-2);
  font-weight: var(--fw-semi);
  white-space: nowrap;
  text-decoration: none;
  transition: transform var(--t-1) var(--ease), background-color var(--t-2), opacity var(--t-2);
}
.btn.sm { min-height: 40px; padding: 0 var(--s4); font-size: var(--fs-s); }
.btn.wide { width: 100%; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.ghost { background: var(--wash); }
.btn.quiet { color: var(--mute); }
.btn.danger { background: var(--red-wash); color: var(--red); }
.btn.danger.solid { background: var(--red); color: var(--paper); }
.btn.quiet.danger { background: none; }
.btn:disabled { opacity: .35; pointer-events: none; }

/* round icon button for floating map controls */
.ico {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--wash);
  transition: transform var(--t-1) var(--ease), background-color var(--t-2);
}
.ico.sm { width: 36px; height: 36px; }
.ico.sm::after { content: ""; position: absolute; inset: -4px; } /* 44px hit area */
.ico svg, .btn svg { flex: none; }

.btn:active, .ico:active, .chip:active { transform: scale(.97); }

@media (hover: hover) {
  .btn.primary:hover { background: #262626; }
  .btn.ghost:hover, .ico:hover { background: var(--wash-hover); }
  .btn.quiet:hover { background: var(--wash); color: var(--ink); }
  .btn.danger:hover { background: #fadbd7; }
  .btn.danger.solid:hover { background: #b0231a; }
  .btn.quiet.danger:hover { background: var(--red-wash); color: var(--red); }
}

/* ---------- inputs ---------- */
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--s3) var(--s4);
  font: inherit;
  font-size: var(--fs-m); /* 16px stops iOS zooming into the field */
  border: 0;
  border-radius: var(--r-2);
  background: var(--wash);
  outline: 0;
  resize: none;
  transition: box-shadow var(--t-1);
}
.input::placeholder { color: var(--mute); opacity: 1; }
.input:focus { box-shadow: 0 0 0 2px var(--ink); }
.input:disabled { opacity: .5; }
select.input { appearance: none; padding-right: var(--s6); background: var(--wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23666' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5'/%3E%3C/svg%3E") right 14px center / 12px no-repeat; }

/* ---------- toggles: segmented control and chips ---------- */
.seg {
  display: flex;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--wash);
  border-radius: var(--r-pill);
}
.seg.fit { display: inline-flex; }
.seg button {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  font-size: var(--fs-s);
  font-weight: var(--fw-semi);
  white-space: nowrap;
  transition: background-color var(--t-2) var(--ease), color var(--t-2);
}
.seg button.on { background: var(--ink); color: var(--paper); }
@media (hover: hover) { .seg button:not(.on):hover { background: var(--wash-hover); } }

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font-size: var(--fs-s);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background-color var(--t-2), color var(--t-2), box-shadow var(--t-2), transform var(--t-1) var(--ease);
}
.chip.on { background: var(--ink); color: var(--paper); box-shadow: none; }
.chip.sm { min-height: 28px; padding: 0 var(--s3); background: var(--wash); box-shadow: none; }
.chip.pg { background: var(--red-wash); color: var(--red); box-shadow: inset 0 0 0 1px var(--red-line); }
@media (hover: hover) { .chip:not(.on):not(.sm):hover { background: var(--wash); } }
@media (pointer: coarse) { .chip:not(.sm) { min-height: 40px; } }

/* small status label; only shown for non-default states */
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--wash);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.pill.hidden { background: var(--ink); color: var(--paper); }

/* ---------- feedback ---------- */
.toast {
  position: fixed;
  z-index: 1100;
  left: 50%;
  top: calc(var(--sat) + var(--s4));
  max-width: min(90vw, 420px);
  padding: var(--s3) var(--s5);
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-s);
  font-weight: var(--fw-medium);
  text-align: center;
  transform: translate(-50%, -200%);
  transition: transform var(--t-3) var(--ease);
}
.toast.on { transform: translate(-50%, 0); }

.sk {
  border-radius: var(--r-2);
  background: linear-gradient(90deg, var(--wash) 30%, var(--paper) 50%, var(--wash) 70%) 0 0 / 300% 100%;
  animation: sk 1.6s linear infinite;
}
@keyframes sk { to { background-position: -100% 0; } }

/* ---------- confirm dialog (see dialog.js) ---------- */
.dlg-back {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--app-h, 100%);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(0, 0, 0, .3);
  opacity: 0;
  transition: opacity var(--t-2);
}
.dlg-back.on { opacity: 1; }
.dlg {
  width: 100%;
  max-width: 360px;
  padding: var(--s5);
  border-radius: var(--r-3);
  background: var(--paper);
  box-shadow: var(--sh-surface);
  transform: translateY(12px) scale(.97);
  opacity: 0;
  transition: transform var(--t-3) var(--ease), opacity var(--t-2);
}
.dlg-back.on .dlg { transform: none; opacity: 1; }
.dlg h2 { font-size: var(--fs-l); font-weight: var(--fw-semi); letter-spacing: -.02em; line-height: 1.25; }
.dlg p { margin-top: var(--s2); color: var(--mute); line-height: 1.45; }
.dlg-row { display: flex; gap: var(--s2); margin-top: var(--s5); }
.dlg-row .btn { flex: 1; }
.dlg-reasons { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.dlg textarea.input { margin-top: var(--s4); min-height: 72px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
