
/* ==============================
   1. Design tokens
   Change these values first when you want to redesign the map.
================================= */
:root {
  --page-bg: #f4efe6;
  --panel-bg:  rgba(231, 244, 250, 0.94);
  --panel-border: rgba(47, 42, 35, 0.16);
  --text: #17163C;
  --muted-text: #262626;
  --soft-shadow: 0 18px 45px rgba(45, 35, 20, 0.16);

  --problem-color: #F8B8B9;
  --emotion-color: #FBB433;
  --meaning-color: #6F8CFF;
  --social-color: #002CDB;
  --insufficient-color: #d8d2c8;
  --default-country: #e8dfd1;
  --country-border: #fffaf2;
  --selected-border: #17163C;

  --font-heading: "Shippori Mincho", Georgia, serif;
  --font-main: "Figtree", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-large: 26px;
  --radius-medium: 18px;
  --radius-pill: 999px;
}

/* ==============================
   2. Base page setup
================================= */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: var(--font-main);
  color: var(--text);
  background: var(--page-bg);
}

button {
  font: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 600;
}

/* ==============================
   3. Full-screen map section
================================= */
.map-section {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(232, 236, 252, 0.30) 0%, transparent 26%),
    linear-gradient(270deg, #B3D0FF 26.44%, #D3E5FF 100%);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: transparent;
}

/* Hide default Leaflet UI pieces we do not need for the editorial map look. */
.leaflet-control-attribution {
  display: none;
}

.leaflet-container {
  background: transparent;
  font-family: var(--font-main);
}

/* ==============================
   4. Floating UI panels
================================= */
.intro-card,
.map-filters,
.country-panel,
.map-legend {
  position: absolute;
  z-index: 10;
}

.intro-card {
  top: 24px;
  left: 24px;
  width: min(420px, calc(100% - 48px));
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-large);
  background: var(--panel-bg);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted-text);
}

.intro-card h1,
.country-panel h2 {
  margin: 0;
  line-height: 1.02;
}

.intro-card h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  max-width: 9ch;
}

.intro-card p:last-child {
  margin-bottom: 0;
  color: var(--muted-text);
  line-height: 1.5;
}

.map-filters {
  top: 24px;
  right: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(720px, calc(100% - 462px));
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  background: var(--panel-bg);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.filter-button {
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.filter-button:hover {
  border-color: rgba(37, 33, 28, 0.22);
  background: rgba(255, 255, 255, 0.62);
}

.filter-button.active {
  color: #fffaf2;
  background: var(--text);
}

.country-panel {
  top: 24px;
  left: 24px;
  width: min(390px, calc(100% - 48px));
  max-height: min(560px, calc(100vh - 160px));
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-large);
  background: var(--panel-bg);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.country-panel h2 {
  font-size: 2rem;
  margin-bottom: 6px;
  font-weight: 900;
  letter-spacing: -1px;
}

.muted-text {
  color: var(--muted-text);
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  color: #fffaf2;
  background: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}

.panel-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(47, 42, 35, 0.12);
}

.panel-section h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: bolder;
  color: var(--text);
}

.map-legend h3 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-text);
}

.panel-section p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted-text)
}

.score-bars {
  display: grid;
  gap: 14px;
}

.score-row {
  display: grid;
  gap: 6px;
}

.score-label-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.92rem;
}

.score-track {
  height: 9px;
  border-radius: var(--radius-pill);
  background: rgba(37, 33, 28, 0.12);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  transition: width 220ms ease;
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.meta-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-text);
  font-size: 0.79rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.map-legend {
  right: 24px;
  bottom: 24px;
  width: min(390px, calc(100% - 48px));
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-medium);
  background: var(--panel-bg);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  color: var(--muted-text);
  font-size: 0.9rem;
}

.legend-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(37, 33, 28, 0.12);
}

#panel-reigon {
  font-weight: 600;
}
/* ==============================
   5. Leaflet country layer states
================================= */
.country-hovered {
  filter: drop-shadow(0 5px 10px rgba(37, 33, 28, 0.18));
}

/* ==============================
   6. Responsive layout
================================= */
@media (max-width: 920px) {
  .map-section {
    min-height: 100vh;
    height: auto;
    display: grid;
    grid-template-rows: 56vh auto;
    overflow: visible;
  }

  #map {
    position: relative;
    min-height: 56vh;
  }

  .intro-card,
  .map-filters,
  .country-panel,
  .map-legend {
    position: relative;
    inset: auto;
    width: calc(100% - 32px);
    max-width: none;
    margin: 16px;
  }

  .map-filters {
    order: 2;
    border-radius: var(--radius-medium);
  }

  .country-panel {
    order: 3;
    max-height: 58vh;
  }

  .map-legend {
    order: 4;
  }

  .intro-card {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    width: min(360px, calc(100% - 32px));
    margin: 0;
  }
}
