/* ================================================================
   PROJECTS.CSS — Projects List Section
   ================================================================ */

#projects {
  background: var(--bg-secondary);
  position: relative;
  /* override .section overflow:hidden so slide-in items aren't clipped */
  overflow: visible;
}

/* Wrapper — no sticky (parent has overflow:hidden which breaks it) */
.projects-sticky {
  position: relative;
  z-index: 1;
}

/* ── Scrolling background text ── */
.projects-bg-text {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: clamp(6rem, 14vw, 14rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-color);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* ── Project List ── */
.projects-list {
  position: relative;
  z-index: 1;
  margin-top: 4rem;
}

/* ── Each Project Row ── */
.project-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  cursor: none;
  position: relative;
  overflow: hidden;
  transition: padding-left var(--duration-mid) var(--ease-out),
              opacity 0.6s var(--ease-out),
              transform 0.6s var(--ease-out);
  /* Start hidden — clipped inside container, no overflow needed */
  opacity: 0;
  transform: translateX(-60px);
}

/* Visible state set by JS */
.project-item.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.project-item:last-child {
  border-bottom: 1px solid var(--border-color);
}

/* Per-project accent colors */
.project-item:nth-child(1) { --proj-color: #4F7C82;  --proj-bg: rgba(79,124,130,0.06); }
.project-item:nth-child(2) { --proj-color: #B8E3E9; --proj-bg: rgba(184,227,233,0.07); }
.project-item:nth-child(3) { --proj-color: #93B1B5; --proj-bg: rgba(147,177,181,0.07); }
.project-item:nth-child(4) { --proj-color: #0B2E33; --proj-bg: rgba(11,46,51,0.05); }
.project-item:nth-child(n+5) { --proj-color: #4F7C82; --proj-bg: rgba(79,124,130,0.06); }

/* Colored left accent line */
.project-item::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--proj-color, var(--accent));
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--duration-mid) var(--ease-out);
  z-index: 1;
}
.project-item:hover::after { transform: scaleY(1); }

.project-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--proj-bg, rgba(79,124,130,0.05));
  opacity: 0;
  transition: opacity var(--duration-mid) var(--ease-out);
  z-index: 0;
}

.project-item:hover::before { opacity: 1; }
.project-item:hover { padding-left: 1rem; }

/* ── Number ── */
.project-num {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--text-muted);
  letter-spacing: 0.1em;
  position: relative;
  z-index: 1;
  transition: color var(--duration-mid);
}

.project-item:hover .project-num { color: var(--proj-color, var(--accent)); }

/* ── Info ── */
.project-info {
  position: relative;
  z-index: 1;
}

.project-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  transition: color var(--duration-mid);
}

.project-item:hover .project-name { color: var(--proj-color, var(--accent)); }

.project-desc {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: 0.35rem;
  max-width: 500px;
}

/* ── Category ── */
.project-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.project-category {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--duration-mid);
}

.project-item:hover .project-category { color: var(--text-secondary); }

.project-arrow {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-mid) var(--ease-out);
  color: var(--text-muted);
}

.project-item:hover .project-arrow {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(45deg);
}

/* Coming Soon item — opacity set after is-visible so it renders dimmed once revealed */
.project-item--soon {
  cursor: default;
  pointer-events: none;
}
.project-item--soon.is-visible {
  opacity: 0.65;
}

.project-soon-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(79,124,130,0.12);
  border: 1px solid rgba(79,124,130,0.30);
  border-radius: 100px;
  padding: 0.25rem 0.7rem;
}

/* ── Floating Preview Image ── */
.project-preview {
  position: fixed;
  width: 320px;
  aspect-ratio: 16/10;
  border-radius: var(--border-radius);
  overflow: hidden;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transform: scale(0.9) rotate(-3deg);
  transition:
    opacity 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.project-preview.is-visible {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.project-preview iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  background: var(--bg-secondary);
}

/* Styled placeholder card */
.project-preview {
  background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.project-preview::before {
  content: attr(data-cat);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.project-preview::after {
  content: attr(data-name);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-align: center;
  padding: 0 1rem;
}

.project-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Modal ── */
#project-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vh 3vw;
  pointer-events: none;
  opacity: 0;
}

#project-modal.is-open {
  pointer-events: all;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--duration-mid) var(--ease-out);
}

#project-modal.is-open .modal-backdrop { opacity: 1; }

.modal-inner {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 94vh;
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transform: scale(0.9) translateY(30px);
  transition: all var(--duration-slow) var(--ease-out);
  box-shadow: var(--shadow-lg);
}

#project-modal.is-open .modal-inner {
  transform: scale(1) translateY(0);
}

#project-modal.is-fullscreen {
  padding: 0;
}

#project-modal.is-fullscreen .modal-inner {
  max-width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-url {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 0.4rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  flex: 1;
  margin: 0 1rem;
}

.modal-actions { display: flex; gap: 0.75rem; }

.modal-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  font-size: var(--fs-small);
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}
.modal-btn:hover { border-color: var(--accent); color: var(--accent); }

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.2rem;
  transition: all var(--duration-fast);
}
.modal-close:hover { border-color: #ff4444; color: #ff4444; }

.modal-frame {
  width: 100%;
  height: calc(100% - 65px);
  border: none;
  background: #fff;
}

/* ── Dot decorations ── */
.modal-dots {
  display: flex;
  gap: 6px;
}
.modal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.modal-dot:nth-child(1) { background: #ff5f57; }
.modal-dot:nth-child(2) { background: #ffbd2e; }
.modal-dot:nth-child(3) { background: #28ca41; }

@media (max-width: 768px) {
  .project-item {
    grid-template-columns: 50px 1fr;
  }
  .project-meta { display: none; }
}
