/* =========================================================================
   Projects slider — kept out of style.css on purpose (loaded deferred via
   rel=preload in welcome.blade.php, since this section sits below the fold).
   Uses native CSS scroll-snap instead of a JS carousel library: works with
   zero script (touch/trackpad scroll + snap), and main.js only layers on
   prev/next buttons, dot sync and keyboard support as progressive
   enhancement. No extra HTTP request, no render-blocking JS.
   ========================================================================= */

.projects-slider {
  position: relative;
}

.projects-slider__viewport {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.projects-slider__track {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.projects-slider__track::-webkit-scrollbar {
  display: none;
}
.projects-slider__track:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.project-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.project-slide__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

/* ---------- Media placeholders ----------
   Empty-space stand-ins for real screenshots. Website projects get a
   desktop-frame + phone-frame pair; app-only projects get a single
   phone frame. Swap the .project-media__placeholder spans for <img>/
   <picture> once real screenshots are ready. */
.project-media {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.project-media__frame {
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}

.project-media--web .project-media__frame--desktop {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  align-items: flex-start;
  padding-top: 34px;
}
.project-media__browser-dots {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  gap: 6px;
}
.project-media__browser-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  display: block;
}

.project-media--web .project-media__frame--mobile {
  width: 34%;
  flex-shrink: 0;
  aspect-ratio: 9 / 19;
}

.project-media--app .project-media__frame--standalone {
  position: relative;
  width: 200px;
  aspect-ratio: 9 / 19;
  border-radius: 22px;
  padding-top: 28px;
}
.project-media__notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}

.project-media__placeholder {
  max-width: 90%;
}

/* ---------- Real screenshots (.has-shot) ----------
   When a project has a real WebP screenshot, the frame drops its dashed
   placeholder look and the image fills it via object-fit:cover, so the same
   frame proportions (16/10 desktop, 9/19 phone) hold on desktop, tablet and
   mobile — the image is cropped, never stretched. */
.project-media__shot {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.project-media__frame.has-shot {
  padding: 0;
  border-style: solid;
  border-color: var(--border);
  overflow: hidden;
  background: rgba(248, 250, 252, 0.02);
}

/* Desktop: keep the 34px browser bar (dots) on top, image fills below it. */
.project-media__frame--desktop.has-shot {
  padding-top: 34px;
}
.project-media__frame--desktop.has-shot .project-media__shot {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
}

/* Phone frames: image fills the whole frame; notch (app) overlays on top. */
.project-media__frame--mobile.has-shot,
.project-media__frame--standalone.has-shot {
  position: relative;
}
.project-media__frame--mobile.has-shot .project-media__shot,
.project-media__frame--standalone.has-shot .project-media__shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

/* ---------- Slide content ---------- */
.project-slide__content {
  min-width: 0;
}

.project-slide__badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.project-slide__badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 5px 12px;
  border-radius: 999px;
}

/* "В разработка" status badge — amber, with a softly pulsing dot. */
.project-slide__badge--wip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.12);
}
.project-slide__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F59E0B;
  animation: wip-pulse 1.6s ease-in-out infinite;
}
@keyframes wip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .project-slide__badge-dot { animation: none; }
}

.project-slide__title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.project-slide__text {
  margin: 0 0 18px;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 15px;
}

.project-slide__features {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 9px;
}
.project-slide__features li {
  position: relative;
  padding-left: 22px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.project-slide__features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.project-slide__tech {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
}
.project-slide__tech li {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 999px;
}

.project-slide__link {
  margin-top: 4px;
}

/* ---------- Controls ---------- */
.projects-slider__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 28px;
}

.projects-slider__arrow {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.04);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.projects-slider__arrow:hover,
.projects-slider__arrow:focus-visible {
  background: rgba(248, 250, 252, 0.1);
  border-color: var(--border-soft);
}
.projects-slider__arrow:disabled {
  opacity: 0.35;
  cursor: default;
}
.projects-slider__arrow svg {
  pointer-events: none;
}

.projects-slider__dots {
  display: flex;
  align-items: center;
  gap: 9px;
}

.projects-slider__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease;
}
.projects-slider__dot:hover {
  background: var(--text-dim);
}
.projects-slider__dot.is-active {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  transform: scale(1.3);
}

@media (max-width: 880px) {
  .project-slide__inner {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 24px;
  }
  .project-media {
    min-height: 220px;
  }
}

@media (max-width: 640px) {
  .project-slide__inner {
    padding: 20px;
  }
  /* On phones show only the mobile screenshot for web projects — the desktop
     frame is hidden, and the phone frame gets centered with more room. */
  .project-media--web .project-media__frame--desktop {
    display: none;
  }
  .project-media--web .project-media__frame--mobile {
    width: 58%;
    max-width: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .projects-slider__track {
    scroll-behavior: auto;
  }
}
