/* ─── CSS custom properties, color schemes, reset, shared primitives ─── */

:root {
  color-scheme: light;
  --bg: #f6fbff;
  --surface: #ffffff;
  --surface-soft: #eef8ff;
  --text: #081a4a;
  --muted: #4c5f86;
  --text-muted: #4c5f86;
  --line: #dce7f5;
  --accent: #0b78f0;
  --accent-strong: #006be2;
  --success: #0aa876;
  --warning: #d86c00;
  --shadow: 0 16px 42px rgba(20, 52, 96, 0.1);
  --radius: 14px;
  --font-scale: 1;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
}

html[data-font-scale="compact"] {
  --font-scale: 0.875;
}

html[data-font-scale="large"] {
  --font-scale: 1.15;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071120;
  --surface: #0e1a2c;
  --surface-soft: #10263f;
  --text: #edf5ff;
  --muted: #a9b9d3;
  --text-muted: #a9b9d3;
  --line: #243b5c;
  --accent: #4aa3ff;
  --accent-strong: #1687ff;
  --success: #36c991;
  --warning: #ffb05c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: calc(16px * var(--font-scale));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 82% 18%, rgba(8, 119, 242, 0.08), transparent 26rem),
    radial-gradient(circle at 15% 72%, rgba(10, 168, 118, 0.06), transparent 22rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  min-width: 320px;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(100% - 28px, 1480px);
  margin-inline: auto;
}

/* ─── Shared card surface ─── */

.search-panel,
.panel,
.metric-card,
.map-card,
.price-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

/* ─── Form primitives ─── */

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

select:hover,
input:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

input:disabled,
select:disabled {
  cursor: not-allowed;
  background: var(--surface-soft);
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

/* ─── Buttons ─── */

.button {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 20px;
  color: var(--text);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 4px 16px rgba(11, 120, 240, 0.3);
}

.button.success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  width: 100%;
}

.button.ghost {
  background: var(--surface);
}

/* ─── Typography ─── */

h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.text-button.danger {
  color: #b42318;
}

.text-button.danger:hover {
  color: #7a271a;
}

/* ─── Cross-section muted text ─── */

.empty-state span,
.panel p,
.price-panel span {
  color: var(--muted);
}

/* ─── Analytics / consent banner (global overlay) ─── */

.analytics-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  width: min(560px, calc(100% - 36px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 18px 50px rgb(15 23 42 / 0.18);
}

.analytics-banner p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.analytics-banner div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.analytics-banner .button {
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}
