body, .projects-app, .projects-scroll, .project-slide {
  overflow: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

body::-webkit-scrollbar, .projects-app::-webkit-scrollbar, .projects-scroll::-webkit-scrollbar, .project-slide::-webkit-scrollbar {
  display: none;
}

.projects-app {
  position: relative;
  height: 100vh;
  background: var(--bg-color);
  color: var(--text-color);
}

.projects-scroll {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.project-slide {
  box-sizing: border-box;
  min-height: 90vh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0;
  border-bottom: 1px solid color-mix(in oklab, var(--text-color) 12%, transparent);
}

.project-slide:last-child {
  min-height: 100vh;
  margin-bottom: 100vh;
  border-bottom: 0;
}

.project-slide:last-child .project-media {
  margin-bottom: 10vh;
}

.project-slide:last-child .project-content {
  margin-bottom: 10vh;
}


@media (max-width: 900px) {
  .project-slide {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2rem 0;
  }
}

.project-media {
  height: 70vh;
  max-height: 70vh;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--colorful) 30%, var(--surface-color)),
    color-mix(in oklab, var(--contrasting-colorful) 30%, var(--surface-color))
  );
  box-shadow: 0 10px 30px var(--shadow-color);
  overflow: hidden;
}

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

.project-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-kicker {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--text-color) 60%, var(--colorful));
}

.project-title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  color: var(--text-color);
}

.project-subtitle {
  font-size: clamp(1rem, 2.1vw, 1.25rem);
  color: color-mix(in oklab, var(--text-color) 75%, var(--contrasting-colorful));
}

.project-desc {
  margin-top: 0.25rem;
  font-size: 1rem;
  line-height: 1.7;
  color: color-mix(in oklab, var(--text-color) 90%, var(--contrasting-colorful));
}

.project-tech {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--surface-color) 80%, var(--bg-color));
  border: 1px solid color-mix(in oklab, var(--text-color) 12%, transparent);
  color: var(--text-color);
  font-size: 0.85rem;
}

.project-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--colorful);
  color: white;
  border-color: color-mix(in oklab, var(--colorful) 85%, black);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--colorful) 88%, black);
}
.btn-ghost {
  background: transparent;
  color: var(--text-color);
  border-color: color-mix(in oklab, var(--text-color) 18%, transparent);
}
.btn-ghost:hover {
  border-color: color-mix(in oklab, var(--text-color) 28%, transparent);
}
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.projects-rail {
  position: fixed;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 6;
  margin: 0 1.5rem;
  pointer-events: auto;
}
@media (max-width: 900px) {
  .projects-rail {
    right: 0.2rem;
  }
}

.segment {
  width: 8px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in oklab, var(--text-color) 28%, transparent);
  opacity: 0.75;
  cursor: pointer;
}
.segment:hover {
  opacity: 1;
}
.segment[aria-current="true"] {
  background: var(--colorful);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--colorful) 18%, transparent);
  opacity: 1;
}

/* Enter animation */
.project-content {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 420ms ease, transform 420ms ease;
}
.project-slide.is-visible .project-content {
  opacity: 1;
  transform: translateY(0);
}

/* Colorful vertical bars rail using theme variables and no overlap */
.projects-rail {
  position: fixed;
  top: 50%;
  right: 1.25rem;                  /* a bit from the right */
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--rail-gap, 0.7rem);     /* extra spacing between bars */
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  z-index: 10;
}

/* Reserve a tall slot so the active bar can grow without overlapping neighbors */
.projects-rail .segment {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  inline-size: var(--bar-width, 0.5rem);    /* wider bar */
  block-size: var(--bar-slot, 2rem);        /* reserved vertical space */
  position: relative;
  cursor: pointer;
  outline: none;
}

/* The visible bar drawn inside the slot */
.projects-rail .segment::before {
  content: "";
  display: block;
  inline-size: 100%;
  block-size: var(--bar-size, 1.2rem);      /* default bar height */
  margin: 0 auto;
  border-radius: 0.25rem;
  opacity: 0.85;
  transition: block-size 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
  background: var(--contrasting-colorful);  /* fallback color from theme */
}

/* Colorful cycle using theme variables */
.projects-rail .segment::before { background: var(--colorful); }

/* Active section grows within the reserved slot (no overlap) */
.projects-rail .segment[aria-current="true"]::before {
  block-size: var(--bar-size-active, 1.7rem);
  opacity: 1;
  filter: brightness(1.12) saturate(1.12);
}

/* Subtle hover/focus without adding outlines/boxes */
.projects-rail .segment:hover::before,
.projects-rail .segment:focus-visible::before {
  filter: brightness(1.15) saturate(1.15);
}


/* ---------- Mobile-first improvements ---------- */
@media (max-width: 900px) {
  .projects-scroll {
    padding-top: 0.5rem;
    scroll-snap-type: none; /* Disable snap scrolling on mobile for better UX */
  }

  .project-slide {
    padding: 4rem 0;
    scroll-snap-type: none; /* Disable snap scrolling on mobile for better UX */
  }

  .project-media {
    height: clamp(220px, 45vh, 420px);
    max-height: clamp(220px, 45vh, 420px);
  }

  .project-content {
    max-width: 65ch;
    margin-inline: auto;
    padding-inline: 0.75rem;
  }

  .project-content:last-child {
    margin-bottom: 5vh;
  }
}

@media (max-width: 600px) {
  .projects-rail {
    display: none;
  }
}
