/* Land use change detection page — interactive comparator + dashboard.
   Vanilla JS/CSS re-implementation (no framework) of the before/after
   slider and analytics dashboard. Paired with /static/js/landcover.js */

.lc-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0 20px;
  font-size: 14px;
  color: #5e6f67;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.lc-breadcrumb a {
  color: #5e6f67;
}

.lc-breadcrumb a:hover {
  color: #2f8f5b;
}

.lc-breadcrumb .current {
  color: #2f8f5b;
}

.lc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.lc-badge-pill {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #2f8f5b;
  background: #eaf4ee;
  border-radius: 999px;
  padding: 6px 12px;
}

.lc-comparator {
  margin: 8px 0 32px;
}

.lc-comparator-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.lc-comparator-head h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f1f19;
  margin: 0;
}

.lc-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.lc-btn {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid #d7e3dc;
  background: #ffffff;
  color: #2f8f5b;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.lc-btn:hover {
  border-color: #2f8f5b;
  background: #f4f8f6;
}

.lc-btn-mask {
  color: #c85a28;
}

.lc-btn-mask:hover {
  border-color: #e0703a;
  background: #fdf3ee;
}

.lc-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 835;
  border-radius: 16px;
  overflow: hidden;
  background: #0d1a15;
  border: 1px solid #e3ebe6;
  user-select: none;
  touch-action: none;
}

.lc-layer {
  position: absolute;
  inset: 0;
}

.lc-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.lc-layer-after {
  clip-path: inset(0 0 0 50%);
}

.lc-mask-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 1;
  transition: opacity .35s;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .55));
}

.lc-mask-svg.lc-mask-hidden {
  opacity: 0;
}

@keyframes lc-pulse {
  0%, 100% { opacity: .25; }
  50% { opacity: .7; }
}

.lc-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .18);
  left: 50%;
  pointer-events: none;
}

.lc-handle {
  position: absolute;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: ew-resize;
  touch-action: none;
  left: 50%;
}

.lc-handle:active {
  cursor: grabbing;
}

.lc-handle-arrow {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.lc-handle-arrow.left {
  border-right: 7px solid #2f8f5b;
}

.lc-handle-arrow.right {
  border-left: 7px solid #2f8f5b;
}

.lc-badge {
  position: absolute;
  box-sizing: border-box;
  max-width: 44%;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.3;
  color: #ffffff;
  background: rgba(13, 26, 21, .72);
  border-radius: 8px;
  padding: 7px 11px;
  pointer-events: none;
}

.lc-badge-tl { left: 16px; top: 16px; }
.lc-badge-tr { right: 16px; top: 16px; text-align: right; }

.lc-legend-badge {
  position: absolute;
  right: 16px;
  bottom: 16px;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.3;
  color: #ffffff;
  background: rgba(13, 26, 21, .72);
  border-radius: 8px;
  padding: 8px 12px;
  pointer-events: none;
}

@media (max-width: 480px) {
  .lc-badge, .lc-legend-badge {
    font-size: 10px;
  }
  .lc-badge {
    padding: 5px 8px;
  }
  .lc-legend-badge {
    padding: 6px 9px;
  }
  .lc-handle {
    width: 36px;
    height: 36px;
    margin-left: -18px;
    margin-top: -18px;
  }
}

.lc-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #ff3d6e;
  flex-shrink: 0;
}

.lc-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(180deg, rgba(143, 214, 166, 0) 0%, rgba(143, 214, 166, .18) 60%, rgba(143, 214, 166, 0) 100%);
  pointer-events: none;
  animation: lc-scan 7s linear infinite;
}

@keyframes lc-scan {
  0% { transform: translateY(-6%); opacity: 0; }
  15% { opacity: .55; }
  85% { opacity: .55; }
  100% { transform: translateY(106%); opacity: 0; }
}

.lc-caption {
  margin: 12px 0 0;
  font-size: 14px;
  color: #5e6f67;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* ── Dashboard ──────────────────────────────────────────────────────── */

.lc-dashboard {
  border: 1px solid #e3ebe6;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  margin-bottom: 40px;
}

.lc-dashboard-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e3ebe6;
  background: #0f1f19;
}

.lc-dashboard-top-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.lc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8fd6a6;
  animation: lc-pulse 2.4s ease-in-out infinite;
}

.lc-dashboard-title {
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #ffffff;
}

.lc-dashboard-meta {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  color: #8fd6a6;
  letter-spacing: .06em;
}

.lc-year-chips {
  padding: 22px 24px;
  border-bottom: 1px solid #e3ebe6;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.lc-year-chips-label {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  color: #5e6f67;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-right: 6px;
}

.lc-chip {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  border: 1px solid #d7e3dc;
  background: #ffffff;
  color: #54665e;
}

.lc-chip.active {
  background: #0f1f19;
  color: #8fd6a6;
  border-color: #0f1f19;
}

.lc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 45%), 1fr));
  gap: 1px;
  background: #e3ebe6;
}

.lc-kpi {
  background: #ffffff;
  padding: 20px 24px;
}

.lc-kpi-label {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #5e6f67;
}

.lc-kpi-value {
  font-family: Raleway, sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: #0f1f19;
  margin-top: 10px;
  line-height: 1;
}

.lc-kpi-delta {
  font-size: 13px;
  margin-top: 8px;
}

.lc-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 1px;
  background: #e3ebe6;
  border-top: 1px solid #e3ebe6;
}

.lc-dashboard-panel {
  background: #ffffff;
  padding: 24px;
}

.lc-panel-title {
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #0f1f19;
  margin-bottom: 4px;
}

.lc-panel-sub {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  color: #5e6f67;
  margin-bottom: 20px;
}

.lc-chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(6px, 1.4vw, 14px);
  height: 220px;
}

.lc-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.lc-chart-bar {
  display: flex;
  flex-direction: column;
  height: 196px;
  border-radius: 6px;
  overflow: hidden;
  opacity: .42;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: opacity .3s;
}

.lc-chart-col.active .lc-chart-bar {
  opacity: 1;
  outline-color: #0f1f19;
}

.lc-chart-seg {
  transition: height .55s cubic-bezier(.4, 0, .2, 1);
}

.lc-chart-label {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  text-align: center;
  color: #7b8b83;
}

.lc-chart-col.active .lc-chart-label {
  color: #0f1f19;
}

.lc-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
}

.lc-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #54665e;
}

.lc-legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

.lc-transitions {
  display: grid;
  gap: 1px;
  background: #e3ebe6;
  border: 1px solid #e3ebe6;
  border-radius: 10px;
  overflow: hidden;
}

.lc-transition-row {
  background: #ffffff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
}

.lc-transition-from {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  color: #0f1f19;
}

.lc-transition-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.lc-transition-arrow {
  color: #a7b5ae;
}

.lc-transition-ha {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 14px;
  color: #0f1f19;
  font-weight: 600;
}

.lc-transition-n {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  color: #5e6f67;
}

.lc-map-panel {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e3ebe6;
  aspect-ratio: 16 / 10;
  margin-top: 18px;
  background:
    repeating-linear-gradient(0deg, rgba(47, 143, 91, .08) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(47, 143, 91, .08) 0 1px, transparent 1px 34px),
    #eef4f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lc-map-panel i {
  font-size: 26px;
  color: #9fb5aa;
}

.lc-map-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lc-map-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: #ffffff;
  background: rgba(13, 26, 21, .75);
  border-radius: 7px;
  padding: 6px 10px;
  pointer-events: none;
}

/* ── Stat grid ──────────────────────────────────────────────────────── */

.lc-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 45%), 1fr));
  gap: 1px;
  background: #e3ebe6;
  border: 1px solid #e3ebe6;
  border-radius: 14px;
  overflow: hidden;
  margin: 28px 0 8px;
}

.lc-stat {
  background: #ffffff;
  padding: 24px;
}

.lc-stat-value {
  font-family: Raleway, sans-serif;
  font-weight: 800;
  font-size: 34px;
  color: #0f1f19;
  line-height: 1;
}

.lc-stat-label {
  font-size: 15px;
  color: #5e6f67;
  margin-top: 8px;
  line-height: 1.45;
}

/* ── Reason cards ───────────────────────────────────────────────────── */

.lc-reason-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  margin: 8px 0 8px;
}

.lc-reason-card {
  border: 1px solid #e3ebe6;
  border-radius: 14px;
  padding: 22px;
  background: #f4f8f6;
}

.lc-reason-icon {
  font-size: 20px;
  color: #2f8f5b;
  margin-bottom: 10px;
}

.lc-reason-title {
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #0f1f19;
  margin-bottom: 8px;
}

.lc-reason-text {
  font-size: 16px;
  line-height: 1.6;
  color: #54665e;
}

/* ── 4-step process ─────────────────────────────────────────────────── */

.lc-process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 16px;
  margin-top: 8px;
}

.lc-process-step {
  border-top: 3px solid #2f8f5b;
  padding: 18px 0 0;
}

.lc-process-num {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  color: #2f8f5b;
  letter-spacing: .08em;
}

.lc-process-title {
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #0f1f19;
  margin: 8px 0;
}

.lc-process-text {
  font-size: 15px;
  line-height: 1.6;
  color: #54665e;
}

/* ── Scenario cards (with photos) ──────────────────────────────────── */

.lc-scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  margin-bottom: 8px;
}

.lc-scenario-card {
  border: 1px solid #e3ebe6;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.lc-scenario-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #eef4f0;
}

.lc-scenario-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lc-scenario-media.lc-scenario-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9fb5aa;
  font-size: 26px;
  background:
    repeating-linear-gradient(0deg, rgba(47, 143, 91, .08) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(47, 143, 91, .08) 0 1px, transparent 1px 34px),
    #eef4f0;
}

.lc-scenario-body {
  padding: 22px;
  display: grid;
  gap: 10px;
}

.lc-scenario-tag {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #2f8f5b;
}

.lc-scenario-title {
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #0f1f19;
  line-height: 1.25;
}

.lc-scenario-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: #54665e;
}

/* ── CTA banner ─────────────────────────────────────────────────────── */

.lc-cta-banner {
  background: #0f1f19;
  border-radius: 18px;
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 8px;
}

.lc-cta-text {
  max-width: 620px;
}

.lc-cta-title {
  font-family: Raleway, sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 30px);
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 12px;
}

.lc-cta-sub {
  font-size: 17px;
  line-height: 1.6;
  color: #b6c7bf;
}

.lc-cta-button {
  font-family: Raleway, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #0f1f19 !important;
  background: #8fd6a6;
  border-radius: 999px;
  padding: 16px 30px;
  white-space: nowrap;
  display: inline-block;
}

.lc-cta-button:hover {
  background: #a8e4bb;
  text-decoration: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .lc-scan, .lc-dot, .lc-mask-svg circle {
    animation: none !important;
  }
}
