/* ─── Work Page ─── */

.work-hero {
  padding: 160px 40px 80px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CURTAIN SCROLL SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.work-curtain-container {
  position: relative;
}

.work-section {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--white);
}

.work-section[data-index="0"] { z-index: 1; background: #fafafa; }
.work-section[data-index="1"] { z-index: 2; background: #f5f5f5; }
.work-section[data-index="2"] { z-index: 3; background: #fafafa; }

.work-section-curtain {
  position: absolute;
  inset: 0;
  background: var(--white);
  z-index: 10;
  transform: translateY(0);
  transition: transform 0.9s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: none;
}

.work-section.curtain-open .work-section-curtain {
  transform: translateY(-100%);
}

.work-section-inner {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 80px;
  gap: 60px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROJECT INFO
   ═══════════════════════════════════════════════════════════════════════════ */

.work-info {
  flex: 0 0 38%;
  max-width: 420px;
}

.project-number {
  display: block;
  font-family: var(--font-serif);
  font-size: 4rem;
  color: var(--accent-soft);
  line-height: 1;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.work-section.in-view .project-number {
  opacity: 1;
  transform: translateX(0);
}

.project-title-anim {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.35;
  margin-bottom: 4px; /* Reduced to compensate for taller line-height */
  padding-bottom: 4px; /* Small padding internally to prevent clipping flat bottoms */
}

.project-category {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  color: var(--gray-400);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease 0.15s, transform 0.6s ease 0.15s;
}

.work-section.in-view .project-category {
  opacity: 1;
  transform: translateY(0);
}

.project-desc {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--gray-500);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s;
}

.work-section.in-view .project-desc {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCREENSHOT SHOWCASE
   ═══════════════════════════════════════════════════════════════════════════ */

.screenshot-showcase {
  flex: 0 0 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 500px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease 0.2s, transform 0.7s ease 0.2s;
  overflow: visible;
}

.work-section.in-view .screenshot-showcase {
  opacity: 1;
  transform: translateY(0);
}

/* Screenshot containers — stacked, toggle swaps visibility */
.screenshot-view {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.screenshot-view.active {
  display: flex;
}

/* Desktop screenshot */
.screenshot-desktop {
  width: 100%;
  max-width: 640px;
  position: relative;
}

.screenshot-desktop .screenshot-frame {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #1a1a1a;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.15),
    0 10px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}

.screenshot-frame .frame-topbar {
  height: 32px;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 7px;
}

.frame-topbar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #444;
}

.frame-topbar .dot:nth-child(1) { background: #ff5f57; }
.frame-topbar .dot:nth-child(2) { background: #febc2e; }
.frame-topbar .dot:nth-child(3) { background: #28c840; }

.frame-topbar .url-bar {
  flex: 1;
  height: 20px;
  background: #3a3a3a;
  border-radius: 4px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
}

.frame-topbar .url-bar::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #666;
  margin-right: 6px;
  flex-shrink: 0;
}

.frame-topbar .url-bar span {
  font-size: 9px;
  color: #777;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
}

.screenshot-frame .frame-content {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--gray-100);
}

.screenshot-frame .frame-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.screenshot-desktop:hover .frame-content img {
  transform: scale(1.02);
}

/* Mobile screenshot */
.screenshot-mobile {
  width: 220px;
  position: relative;
}

.screenshot-mobile .screenshot-frame {
  width: 100%;
  border-radius: 32px;
  overflow: hidden;
  background: #1a1a1a;
  padding: 8px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.18),
    0 10px 20px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}

.screenshot-mobile .frame-notch {
  position: absolute;
  top: 8px; /* Correctly aligned with the top bezel (which is 8px padding) */
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 18px;
  background: #1a1a1a;
  border-radius: 0 0 12px 12px;
  z-index: 5;
}

.screenshot-mobile .frame-notch::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #333;
  border-radius: 50%;
}

.screenshot-mobile .frame-content {
  width: 100%;
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
  border-radius: 24px;
  background: var(--gray-100);
}

.screenshot-mobile .frame-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.screenshot-mobile:hover .frame-content img {
  transform: scale(1.02);
}

/* Home indicator bar */
.screenshot-mobile .frame-home-bar {
  width: 100px;
  height: 4px;
  background: #555;
  border-radius: 4px;
  margin: 8px auto 4px;
}

/* Tablet screenshot */
.screenshot-tablet {
  width: 100%;
  max-width: 480px;
  position: relative;
}

.screenshot-tablet .screenshot-frame {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #1a1a1a;
  padding: 12px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.15),
    0 10px 20px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}

.screenshot-tablet .frame-content {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--gray-100);
}

.screenshot-tablet .frame-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.screenshot-tablet:hover .frame-content img {
  transform: scale(1.02);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEVICE TOGGLE (Liquid Glass)
   ═══════════════════════════════════════════════════════════════════════════ */

.device-toggle {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(145deg, rgba(255,255,255,0.85), rgba(255,255,255,0.55));
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.5) inset,
    0 4px 16px rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 6px;
  cursor: pointer;
  z-index: 15;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.device-toggle:hover {
  box-shadow:
    0 1px 0 0 rgba(255,255,255,0.5) inset,
    0 8px 24px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--gray-400);
  transition: background 0.3s ease, color 0.3s ease;
}

.toggle-icon.active {
  background: var(--black);
  color: var(--white);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLL REVEAL FOR WORK ITEMS
   ═══════════════════════════════════════════════════════════════════════════ */

.reveal-work {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.work-section.in-view .reveal-work {
  opacity: 1;
  transform: translateY(0);
}

.work-section.in-view .reveal-work:nth-child(1) { transition-delay: 0s; }
.work-section.in-view .reveal-work:nth-child(2) { transition-delay: 0.1s; }
.work-section.in-view .reveal-work:nth-child(3) { transition-delay: 0.2s; }
.work-section.in-view .reveal-work:nth-child(4) { transition-delay: 0.3s; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .work-section-inner {
    flex-direction: column;
    justify-content: center;
    padding: 100px 40px 40px;
    gap: 30px;
  }

  .work-info {
    flex: none;
    max-width: 100%;
    text-align: center;
  }

  .screenshot-showcase {
    flex: none;
    min-height: 350px;
  }

  .screenshot-desktop { max-width: 480px; }
  .screenshot-tablet { max-width: 360px; }
  .screenshot-mobile { width: 200px; }
}

@media (max-width: 768px) {
  .work-hero { padding: 120px 24px 40px; }
  .work-section-inner { padding: 100px 24px 40px; }
  .project-number { font-size: 2.5rem; }

  .screenshot-showcase { min-height: 280px; }
  .screenshot-desktop { max-width: 100%; }
  .screenshot-tablet { max-width: 100%; }
  .screenshot-mobile { width: 180px; }

  .device-toggle { bottom: 10px; right: 10px; }
}
