/* Belarus («Чистый Кит») Новостройки, ЖК и котлованы Беларуси — UI, Sortable Responsive Table, LEGRE Studio & Move-In Calculator */

:root {
  --nd-brand: #1d4ed8;
  --nd-brand-dark: #1e3a8a;
  --nd-bg-soft: #f8fafc;
  --nd-line: #e2e8f0;
}

/* Strictly below-the-fold rendering deferral (modern-web-guidance: defer-rendering-heavy-content) */
.nd-deferred-sec {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 400px;
}

.nd-blueprint-svg {
  width: 100%;
  height: auto;
  display: block;
}

.nd-jump-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 var(--gutter, 24px) 16px;
}

/* Canonical accessible visually-hidden utility (never display: none) */
.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

/* Stage & price badges */
.nd-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.nd-stage-badge--amber {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.nd-stage-badge--blue {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.nd-stage-badge--indigo {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
.nd-stage-badge--green {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.nd-price-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13.5px;
  font-weight: 700;
}
.nd-price-pill--muted {
  background: #f1f5f9;
  color: #475569;
  font-weight: 500;
}

/* KPI stat bar */
.nd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.nd-kpi-card {
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--nd-line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nd-kpi-val {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}
.nd-kpi-lbl {
  font-size: 13px;
  color: #64748b;
}

/* Filter Form (<search><form method="GET">) — modern-web-guidance: forms */
.nd-filter-bar {
  margin-top: 20px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid var(--nd-line);
  border-radius: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 14px;
  align-items: end;
}
.nd-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.nd-field label {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
}
.nd-field input,
.nd-field select,
.nd-calc-form input[type="text"],
.nd-calc-form select {
  font: inherit;
  font-size: max(1rem, 1em);
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #64748b;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
  width: 100%;
}
.nd-field input:focus-visible,
.nd-field select:focus-visible,
.nd-filter-submit:focus-visible,
.nd-calc-form input:focus-visible,
.nd-calc-form select:focus-visible,
.nd-legre-tab:focus-visible,
.nd-table-wrap:focus-visible {
  outline: 3px solid var(--nd-brand);
  outline-offset: 2px;
}
.nd-filter-submit {
  font: inherit;
  font-size: max(1rem, 1em);
  font-weight: 700;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: var(--nd-brand);
  color: #ffffff;
  cursor: pointer;
}
.nd-filter-submit:hover {
  background: var(--nd-brand-dark);
}
@media (pointer: coarse) {
  .nd-field input,
  .nd-field select,
  .nd-filter-submit,
  .nd-calc-form input[type="text"],
  .nd-calc-form select {
    min-height: 52px;
  }
}

/* Development Cards Grid */
.nd-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.nd-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid var(--nd-line);
  border-radius: 15px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.025);
}
.nd-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nd-card h3 {
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.3;
  margin: 6px 0 4px;
}
.nd-card h3 a {
  color: #0f172a;
  text-decoration: none;
}
.nd-card h3 a:hover {
  color: var(--nd-brand);
  text-decoration: underline;
}
.nd-card-addr {
  font-size: 14px;
  color: #475569;
  margin: 0;
}
.nd-card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 13px;
  color: #475569;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

/* Responsive + Sortable Apartments Table (modern-web-guidance: responsive-table + sortable-table + dynamic-sort) */
.nd-table-wrap {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 80vh);
  container-type: inline-size;
  border: 1px solid var(--nd-line);
  border-radius: 14px;
  background: #ffffff;
  margin-top: 14px;
}
.nd-units-table {
  width: 100%;
  min-inline-size: 640px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14.5px;
}
.nd-units-table caption {
  text-align: left;
  padding: 12px 16px;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid var(--nd-line);
}
.nd-units-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: #f8fafc;
}
.nd-units-table th,
.nd-units-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: middle;
}
.nd-units-table thead th {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
  border-bottom: 1.5px solid var(--nd-line);
  white-space: nowrap;
}
.nd-units-table thead th:has(> button) {
  padding: 0;
}
.nd-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  text-align: left;
}
.nd-sort-btn:hover {
  background: #eef2ff;
  color: var(--nd-brand);
}
.nd-sort-btn:focus-visible {
  outline: 3px solid var(--nd-brand);
  outline-offset: -3px;
}
.nd-sort-ico {
  width: 14px;
  height: 14px;
  opacity: 0.4;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
th[aria-sort] .nd-sort-ico {
  opacity: 1;
  color: var(--nd-brand);
}
th[aria-sort="descending"] .nd-sort-ico {
  transform: rotate(180deg);
}
.nd-units-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: #ffffff;
  font-weight: 600;
  color: #0f172a;
  z-index: 1;
}
.nd-units-table tbody tr {
  view-transition-name: match-element;
}
.nd-units-table tbody tr:hover td,
.nd-units-table tbody tr:hover th {
  background: #f8fafc;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}

@container (width < 600px) {
  .nd-units-table {
    min-inline-size: 0;
  }
  .nd-units-table,
  .nd-units-table thead,
  .nd-units-table tbody,
  .nd-units-table tr,
  .nd-units-table th,
  .nd-units-table td {
    display: block;
  }
  .nd-units-table thead {
    display: none;
  }
  .nd-units-table tbody tr {
    margin: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
  }
  .nd-units-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
  }
  .nd-units-table td:nth-child(2)::before { content: var(--label-2) ": "; font-weight: 600; color: #475569; }
  .nd-units-table td:nth-child(3)::before { content: var(--label-3) ": "; font-weight: 600; color: #475569; }
  .nd-units-table td:nth-child(4)::before { content: var(--label-4) ": "; font-weight: 600; color: #475569; }
  .nd-units-table td:nth-child(5)::before { content: var(--label-5) ": "; font-weight: 600; color: #475569; }
  .nd-units-table td:nth-child(6)::before { content: var(--label-6) ": "; font-weight: 600; color: #475569; }
}

.nd-extra-units {
  margin-top: 12px;
}
.nd-extra-units summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--nd-brand);
  font-weight: 700;
  font-size: 14px;
}

/* LEGRE Studio Interior Design Showcase */
.nd-legre-card {
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--nd-line);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.nd-legre-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}
.nd-legre-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nd-legre-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.nd-legre-tab {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
}
.nd-legre-tab[aria-pressed="true"] {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}
.nd-legre-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 860px) {
  .nd-legre-body {
    grid-template-columns: 1fr;
  }
}
.nd-legre-hero-wrap {
  border-radius: 14px;
  overflow: hidden;
  background: #f1f5f9;
  aspect-ratio: 16 / 10;
}
.nd-legre-hero-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.nd-legre-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.nd-legre-thumb {
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  background: #f1f5f9;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}
.nd-legre-thumb[aria-current="true"] {
  border-color: var(--nd-brand);
}
.nd-legre-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.nd-legre-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.nd-legre-price-box {
  padding: 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.nd-legre-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  background: #0f172a;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none !important;
}
.nd-legre-cta:hover {
  background: var(--nd-brand);
}

/* 6-Service Turnkey Move-In Calculator (modern-web-guidance: forms + brand-consistent-forms) */
.nd-calc-card {
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--nd-line);
  border-radius: 18px;
}
.nd-calc-form {
  accent-color: var(--nd-brand);
  color-scheme: light;
}
.nd-calc-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  padding: 16px 18px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  margin-bottom: 18px;
}
.nd-calc-range {
  width: 100%;
  min-height: 48px;
  cursor: pointer;
}
.nd-services-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}
.nd-svc-item {
  padding: 16px 18px;
  border: 1px solid var(--nd-line);
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.nd-svc-check-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  font-size: 15.5px;
  color: #0f172a;
  cursor: pointer;
  padding: 6px 0;
}
.nd-svc-check-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}
.nd-svc-desc {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
}
.nd-svc-out-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}
.nd-svc-output {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.nd-calc-summary {
  margin-top: 18px;
  padding: 18px 22px;
  border-radius: 14px;
  background: #eff6ff;
  border: 1.5px solid #93c5fd;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.nd-calc-total-out {
  font-size: 22px;
  font-weight: 800;
  color: #1e3a8a;
}

/* Fallback for older browsers without accent-color (modern-web-guidance: brand-consistent-forms) */
@supports not (accent-color: #1d4ed8) {
  .nd-calc-form input[type="checkbox"] {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }
  .nd-svc-check-label {
    position: relative;
    padding-left: 2rem;
  }
  .nd-svc-check-label input[type="checkbox"] + span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55rem;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid #64748b;
    background: #ffffff;
    border-radius: 4px;
    box-sizing: border-box;
  }
  .nd-svc-check-label input[type="checkbox"]:focus-visible + span::before {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
  }
  .nd-svc-check-label input[type="checkbox"]:checked + span::before {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
  }
  .nd-svc-check-label input[type="checkbox"]:checked + span::after {
    content: "";
    position: absolute;
    left: 0.42rem;
    top: 0.72rem;
    width: 0.35rem;
    height: 0.65rem;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }
  .nd-calc-range {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
  }
  .nd-calc-range::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(to right, #1d4ed8 var(--progress, 40%), #cbd5e1 var(--progress, 40%));
    border-radius: 4px;
  }
  .nd-calc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1d4ed8;
    margin-top: -5px;
  }
}
