/* =============================================
   SMARTBUILD — Projects Section (Наши проекты)
   ============================================= */

.projects {
  background-color: var(--color-alabaster);
}

/* Cards grid */
.projects__grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 var(--content-padding);
}

.projects__row {
  display: flex;
  gap: 20px;
  height: 700px;
}

/* Card sizing: wide = 738px, narrow = 511px out of 1800px total (minus 40px gaps)
   Use flex with ratios: wide:narrow = 738:511 ≈ 1.44:1 */
.projects__card--wide {
  flex: 738 0 0;
}

.projects__card--narrow {
  flex: 511 0 0;
}

/* Project category card */
.projects__card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: block;
  text-decoration: none;
  color: inherit;
}

.projects__card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.projects__card:hover .projects__card-image {
  transform: scale(1.12);
}

/* Darkening overlay on cards */
.projects__card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(0,0,0,0) 75.7%, rgba(0,0,0,0.6) 100%),
              linear-gradient(180deg, rgba(0,0,0,0) 55.7%, rgba(0,0,0,0.6) 93.8%);
  transition: background 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.projects__card:hover .projects__card-overlay {
  background: linear-gradient(0deg, rgba(0,0,0,0.15) 75.7%, rgba(0,0,0,0.7) 100%),
              linear-gradient(180deg, rgba(0,0,0,0.15) 55.7%, rgba(0,0,0,0.7) 93.8%);
}

/* Card content — fills card, flex column with space-between */
.projects__card-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
}

/* Top row: badge (left) + arrow icon (right) */
.projects__card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

/* Yellow badge (e.g. "200 м² +") — hidden by default */
.projects__card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  background-color: var(--color-yellow);
  border-radius: 20px;
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: 1;
  color: var(--color-dark);
  opacity: 0;
}

.projects__card-badge--visible {
  opacity: 1;
}

/* Arrow icon button (pill shape) */
.projects__card-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 40px;
  border: 1.333px solid var(--color-white);
  border-radius: 67px;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.projects__card:hover .projects__card-arrow {
  background-color: transparent;
}

.projects__card-arrow-icon {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.projects__card:hover .projects__card-arrow-icon {
  transform: rotate(-45deg);
}

/* Bottom text area */
.projects__card-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.projects__card-title {
  font-size: var(--h4-size);
  font-weight: var(--h4-weight);
  line-height: var(--h4-line-height);
  letter-spacing: var(--h4-letter-spacing);
  color: var(--color-white);
}

.projects__card-description {
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-line-height);
  letter-spacing: var(--body-letter-spacing);
  color: var(--color-alabaster);
}

/* ---- "Нужен индивидуальный проект?" banner ---- */
.projects__custom {
  margin-top: 40px;
  padding: 0 var(--content-padding);
}

.projects__custom-inner {
  background-color: var(--color-white);
  border-radius: var(--radius-md);
  padding: 40px;
  display: flex;
  gap: 20px;
  min-height: 660px;
  overflow: visible;
}

/* Left column: title + description + CTA */
.projects__custom-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.projects__custom-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.projects__custom-title {
  font-size: 54px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -2.7px;
  color: var(--color-dark);
}

.projects__custom-description {
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-line-height);
  letter-spacing: var(--body-letter-spacing);
  color: var(--color-graphite);
}

.projects__custom-cta {
  width: fit-content;
}

/* CTA button max-width from Figma (538px) */
.projects__custom-info .btn {
  max-width: 538px;
}

/* Right column: house illustration with feature tags */
.projects__custom-visual {
  flex: 1;
  position: relative;
  min-width: 0;
  /* Fixed aspect ratio matching Figma (850×580) */
  max-width: 850px;
  height: 580px;
  align-self: center;
}

/* Clip wrapper: fills visual container, hides image overflow */
.projects__custom-illustration-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.projects__custom-illustration {
  position: absolute;
  /* Center the oversized image (1062×885 in 850×580 container) */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 125%;
  max-width: none;
  height: auto;
  pointer-events: none;
}

/* Feature tags floating around the illustration */
.projects__custom-tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  background-color: var(--color-yellow);
  border-radius: var(--radius-md);
  font-size: var(--btn-size);
  font-weight: var(--body-weight);
  line-height: 1.4;
  letter-spacing: var(--btn-letter-spacing);
  color: var(--color-dark);
  white-space: nowrap;
  z-index: 2;
}

/* Connector dot — small circle on the house */
.projects__custom-tag::before {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--color-yellow);
  z-index: 3;
}

/* Connector line — thin line from tag to dot */
.projects__custom-tag::after {
  content: '';
  position: absolute;
  background-color: var(--color-yellow);
  z-index: 2;
}

/* ======================================================================
   Tag positions & connectors
   All coordinates from Figma, relative to 850×580 visual container.
   Figma node 1:2381 = right half of the "Нужен индивидуальный проект?" block.
   ====================================================================== */

/* ---- "Учитываем ориентацию по солнцу" ----
   Figma: tag at (466, 49), vertical line down 49px, dot at (507, 129)
   → right edge area, top; line goes down from near left edge of tag */
.projects__custom-tag--sun {
  top: 49px;
  left: 441px;
}
.projects__custom-tag--sun::after {
  /* Vertical line from dot position (x=511 in container, relative to tag left=466 → 45px from tag left) */
  left: 45px;
  top: 100%;
  width: 1.5px;
  height: 40px;
}
.projects__custom-tag--sun::before {
  /* Dot at end of line */
  left: 41px;
  top: calc(100% + 40px);
}

/* ---- "Под особенности рельефа" ----
   Figma: tag at (-139, 234), horizontal line 53px, dot at (152, 249)
   → far left, line goes right from tag right edge to dot on house wall */
.projects__custom-tag--terrain {
  top: 234px;
  left: -139px;
}
.projects__custom-tag--terrain::after {
  right: -53px;
  top: 50%;
  width: 53px;
  height: 1.5px;
  transform: translateY(-50%);
}
.projects__custom-tag--terrain::before {
  right: -57px;
  top: 50%;
  transform: translateY(-50%);
}

/* ---- "Под заданный бюджет" ----
   Figma: tag at (-75, 345), horizontal line 105px, dot at (236, 360)
   → left side, line goes right to dot on lower wall */
.projects__custom-tag--budget {
  top: 345px;
  left: -75px;
}
.projects__custom-tag--budget::after {
  right: -105px;
  top: 50%;
  width: 105px;
  height: 1.5px;
  transform: translateY(-50%);
}
.projects__custom-tag--budget::before {
  right: -109px;
  top: 50%;
  transform: translateY(-50%);
}

/* ---- "Оптимизация стоимости" ----
   Figma: tag at (562, 199), horizontal line 43px left, dot at (514, 214)
   → right side of house, line goes left to dot on roof edge */
.projects__custom-tag--cost {
  top: 199px;
  left: 562px;
}
.projects__custom-tag--cost::after {
  left: -43px;
  top: 50%;
  width: 43px;
  height: 1.5px;
  transform: translateY(-50%);
}
.projects__custom-tag--cost::before {
  left: -47px;
  top: 50%;
  transform: translateY(-50%);
}

/* ---- "Индивидуальная планировка" ----
   Figma: tag at (119, 493), vertical line up 29px, dot at (245, 462)
   → bottom-center-left, line goes up to dot on foundation */
.projects__custom-tag--layout {
  top: 493px;
  left: 119px;
}
.projects__custom-tag--layout::after {
  /* line up from center-right of tag (245 - 119 = 126px from tag left) */
  left: 126px;
  bottom: 100%;
  width: 1.5px;
  height: 29px;
}
.projects__custom-tag--layout::before {
  left: 122px;
  bottom: calc(100% + 29px);
}

/* ---- "Просторная кухня-гостиная" ----
   Figma: tag at (511, 496), vertical line up 29px, dot at (634, 462)
   → bottom-right, line goes up to dot on deck area */
.projects__custom-tag--kitchen {
  top: 496px;
  left: 486px;
}
.projects__custom-tag--kitchen::after {
  /* line up from tag (634 - 511 = 123px from tag left) */
  left: 123px;
  bottom: 100%;
  width: 1.5px;
  height: 29px;
}
.projects__custom-tag--kitchen::before {
  left: 119px;
  bottom: calc(100% + 29px);
}
