:root {
  color-scheme: light;
  --ink: #1f2f2d;
  --muted: #5a6d69;
  --soft: #eef5f1;
  --line: #d8e3dd;
  --surface: #ffffff;
  --surface-strong: #f7fbf9;
  --accent: #167c76;
  --accent-deep: #0f5d58;
  --accent-soft: #dcefeb;
  --mint: #73b9a2;
  --gold: #b68b34;
  --shadow: 0 12px 32px rgba(31, 47, 45, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #f4f8f6;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

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

button,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 250px;
  font-weight: 700;
  color: var(--accent-deep);
}

.brand img {
  width: 118px;
  max-height: 48px;
  object-fit: contain;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
}

.site-nav a:hover,
.site-nav a.active {
  border-color: var(--line);
  background: var(--soft);
  color: var(--accent-deep);
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-deep);
  padding: 8px 12px;
  font-weight: 700;
}

main {
  width: 100%;
}

.page-section,
.intro-band {
  scroll-margin-top: 90px;
  padding: clamp(48px, 7vw, 88px) clamp(18px, 4vw, 56px);
}

.hero-section {
  min-height: 78vh;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  align-items: center;
  gap: clamp(26px, 5vw, 72px);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.96) 0%, rgba(235, 247, 242, 0.88) 48%, rgba(218, 237, 231, 0.88) 100%),
    url("../../public/assets/logo-inc.png") right 8% top 18% / min(440px, 56vw) auto no-repeat;
}

.hero-content {
  max-width: 900px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.14;
}

h1 {
  max-width: 920px;
  font-size: clamp(2.2rem, 6vw, 5.2rem);
  color: #193f3b;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  color: #193f3b;
}

h3 {
  font-size: 1.25rem;
  color: #244541;
}

.hero-subtitle {
  margin: 18px 0 22px;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  color: var(--accent-deep);
  font-weight: 700;
}

.hero-content p:not(.eyebrow):not(.hero-subtitle),
.section-heading p,
.intro-band p,
.methodology-section p {
  max-width: 860px;
  color: var(--muted);
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 800;
}

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

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent-deep);
}

.overview-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.overview-panel div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.overview-panel div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.overview-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.overview-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--accent-deep);
  font-size: 1.2rem;
}

.intro-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  background: #ffffff;
  border-block: 1px solid var(--line);
}

.section-heading {
  margin-bottom: 26px;
}

.explorer-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.control-panel,
.result-panel,
.territory-panel,
.map-panel,
.structure-summary {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 100px;
  display: grid;
  gap: 16px;
  padding: 20px;
}

label {
  color: var(--accent-deep);
  font-weight: 800;
}

select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

.context-box {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.context-box strong {
  color: var(--ink);
}

.context-list,
.mini-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.context-list li,
.mini-list li {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--soft);
}

.result-panel {
  overflow: hidden;
}

.heatmap-header,
.heatmap-row {
  display: grid;
  grid-template-columns: 64px minmax(150px, 1fr) minmax(80px, 120px) minmax(120px, 260px);
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
}

.heatmap-header {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.heatmap-row {
  min-height: 58px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.heatmap-row:hover {
  background: #f7fbf9;
}

.rank {
  color: var(--accent-deep);
  font-weight: 800;
}

.value {
  justify-self: end;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e5efeb;
  overflow: hidden;
}

.bar-fill {
  min-width: 2px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8bc8b5, #167c76);
}

.total-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 26px;
  align-items: start;
}

.map-panel {
  padding: 16px;
}

.map-root {
  min-height: 540px;
}

.map-root svg {
  display: block;
  width: 100%;
  height: min(70vh, 640px);
}

.map-feature {
  stroke: #ffffff;
  stroke-width: 0.75;
  cursor: pointer;
  transition: opacity 160ms ease, stroke-width 160ms ease;
}

.map-feature:hover,
.map-feature.active {
  opacity: 0.9;
  stroke: #153f3b;
  stroke-width: 1.6;
}

.map-label {
  fill: #294743;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.legend {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.legend-gradient {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e6f2ef, #9fd2c2, #167c76);
}

.territory-panel {
  padding: 20px;
}

.territory-panel .score {
  margin: 10px 0 18px;
  color: var(--accent-deep);
  font-size: 2.5rem;
  font-weight: 850;
  line-height: 1;
}

.panel-block {
  margin-top: 18px;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.score-row strong {
  color: var(--ink);
}

.ranking-section {
  margin-top: 34px;
}

.ranking-section h3 {
  margin-bottom: 14px;
}

.structure-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
}

.structure-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-strong);
}

.structure-item h3 {
  margin-bottom: 12px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 0.9rem;
}

.loading,
.empty {
  padding: 20px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .menu-button {
    display: none;
  }

  .site-nav {
    display: flex;
    width: 100%;
    justify-content: flex-start;
  }

  .site-nav.open {
    display: flex;
  }

  .hero-section,
  .intro-band,
  .explorer-layout,
  .total-layout,
  .structure-summary {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }
}

@media (max-width: 700px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-inline: 14px 76px;
  }

  .site-nav {
    grid-column: 1 / -1;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.86rem;
  }

  .brand img {
    flex: 0 0 auto;
    width: 72px;
  }

  .menu-button {
    display: none !important;
  }

  .hero-section {
    min-height: auto;
    background:
      linear-gradient(115deg, rgba(255, 255, 255, 0.97), rgba(231, 244, 239, 0.92)),
      url("../../public/assets/logo-inc.png") right 12px top 26px / 220px auto no-repeat;
  }

  .heatmap-header {
    display: none;
  }

  .heatmap-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
  }

  .heatmap-row > div:nth-child(2) {
    overflow-wrap: anywhere;
  }

  .heatmap-row .value {
    grid-column: 2;
    justify-self: start;
  }

  .heatmap-row .bar-track {
    grid-column: 1 / -1;
  }

  .legend {
    grid-template-columns: 1fr;
  }

  .map-root {
    min-height: 400px;
  }

  .map-root svg {
    height: 440px;
  }
}
