/* =========================
   PORTFOLIO (Block 4) — PRO / CLEAN / WARM
   Uses global vars from style.css:
   --bg, --bg-alt, --text, --muted, --border, --accent, --shadow, --radius
========================= */

.portfolio{
  position: relative;
  padding: clamp(60px, 6vw, 96px) 0;

  /* Smooth transition background (from previous block to portfolio) */
  background:
    linear-gradient(
      to bottom,
      var(--bg) 0%,
      var(--bg-alt) 42%,
      var(--bg-alt) 100%
    );
}

/* Soft depth at top (studio-like separation) */
.portfolio::before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:52px;
  background: linear-gradient(
    to bottom,
    rgba(17,24,39,0.06),
    rgba(17,24,39,0)
  );
  pointer-events:none;
}

/* Optional: soft exit to next block */
.portfolio::after{
  content:"";
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:48px;
  background: linear-gradient(
    to top,
    rgba(17,24,39,0.04),
    rgba(17,24,39,0)
  );
  pointer-events:none;
}

.portfolio__inner{
  display: grid;
  gap: 26px;
}

.portfolio__header{
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.portfolio__title{
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 10px;
}

.portfolio__subtitle{
  margin: 0 auto;
  max-width: 62ch;
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.6;
  color: var(--muted);
}

/* Grid */
.portfolio__grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

@media (max-width: 880px){
  .portfolio__grid{ grid-template-columns: 1fr; }
}

/* Card */
.baCard{
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(17,24,39,0.08);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(17,24,39,.07);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}

.baCard:hover{
  transform: translateY(-4px);
  box-shadow: 0 28px 80px rgba(17,24,39,.10);
}

.baCard__desc{
  margin: 0;
  padding: 14px 18px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(31,41,55,0.82);
}

/* =========================
   BEFORE / AFTER SLIDER
========================= */

.ba{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 240px;
  background: #f3f4f6;
  overflow: hidden;
  isolation: isolate; /* важно для слоёв */
}

/* Images */
.ba__img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  transform: scale(1.02);
}

/* After layer visible only up to --pos */
.ba__after{
  position: absolute;
  inset: 0;
  width: var(--pos);
  overflow: hidden;
  z-index: 1;
}

/* Soft vignette for “premium photo” feel (very subtle) */
.ba::after{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(120% 80% at 50% 50%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.10) 100%);
  z-index: 2;
  pointer-events:none;
}

/* Labels (clean, not screaming) */
.ba__label{
  position: absolute;
  top: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  background: rgba(255,255,255,0.88);
  color: rgba(31,41,55,0.78);
  border: 1px solid rgba(17,24,39,0.10);
  backdrop-filter: blur(8px);

  z-index: 5;
  user-select: none;
}

.ba__label--before{ left: 14px; }
.ba__label--after{ right: 14px; }

/* Divider line — always UNDER knob */
.ba__line{
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  transform: translateX(-50%);
  width: 3px;
  background: rgba(255,255,255,0.96);
  box-shadow:
    0 0 0 1px rgba(17,24,39,0.12),
    0 20px 45px rgba(17,24,39,0.16);
  z-index: 3;
  pointer-events: none;
}

/* Knob — ONLY white circle, no grey border */
.ba__knob{
  position: absolute;
  left: var(--pos);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #fff;

  /* мягкая тень, без обводки */
  box-shadow: 0 16px 40px rgba(17,24,39,0.18);

  z-index: 4; /* выше линии */
  pointer-events: none;
}

/* Minimal chevrons inside knob (no extra circles) */
.ba__knob::before,
.ba__knob::after{
  content:"";
  position:absolute;
  top:50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(31,41,55,0.55);
  border-bottom: 2px solid rgba(31,41,55,0.55);
  transform-origin: center;
}

.ba__knob::before{
  left: 14px;
  transform: translateY(-50%) rotate(135deg); /* < */
}

.ba__knob::after{
  right: 14px;
  transform: translateY(-50%) rotate(-45deg); /* > */
}

/* =========================
   RANGE INPUT (invisible, no orange track)
   We keep it draggable but visually it must NOT exist.
========================= */

.ba__range{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;              /* скрываем полностью */
  background: transparent; /* убираем трек */
  cursor: ew-resize;
  z-index: 6;              /* выше всех, чтобы тянуть было легко */
  -webkit-appearance: none;
  appearance: none;
}

/* Remove default styles completely (safety) */
.ba__range:focus{ outline: none; }
.ba__range::-webkit-slider-runnable-track{ background: transparent; border: none; }
.ba__range::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 46px;
  height: 46px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.ba__range::-moz-range-track{ background: transparent; border: none; }
.ba__range::-moz-range-thumb{
  width: 46px;
  height: 46px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* CTA under portfolio */
.portfolio__cta{
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.portfolio__btn{
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 800;
  border: 1px solid rgba(17,24,39,0.12);
  background: color-mix(in srgb, var(--accent) 92%, white 8%);
  border-color: var(--accent-border);
  color: white;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.portfolio__btn:hover{
  border-color: rgba(242,140,40,0.35);
  background: var(--accent);
  transform: translateY(-1px);
}
