/* ═══════════════════════════════════════════════════════════
   TIANX STUDIO — Visuals: Device Mockups, Parallax, Scroll Reveal
   Premium interactive image presentation system
   ═══════════════════════════════════════════════════════════ */

/* ─── A) DEVICE MOCKUP FRAME ──────────────────────────── */

.device-frame {
  position: relative;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.device-frame__screen {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--primary);
  box-shadow:
    0 4px 6px rgba(0,0,0,0.04),
    0 20px 40px rgba(0,0,0,0.08),
    0 0 0 1px rgba(0,0,0,0.04);
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
  will-change: transform;
}

/* 3D tilt on hover */
.device-frame:hover .device-frame__screen {
  transform: rotateY(-3deg) rotateX(2deg) scale(1.01);
  box-shadow:
    0 8px 16px rgba(0,0,0,0.06),
    0 30px 60px rgba(0,0,0,0.12),
    0 0 0 1px rgba(0,0,0,0.06);
}

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

/* Laptop frame variant */
.device-frame--laptop .device-frame__screen {
  border-radius: 8px 8px 0 0;
  border: 2px solid rgba(0,0,0,0.08);
  border-bottom: none;
}

.device-frame--laptop::after {
  content: '';
  display: block;
  height: 14px;
  background: linear-gradient(180deg, #e0e0e0 0%, #d0d0d0 100%);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Tablet frame variant */
.device-frame--tablet .device-frame__screen {
  border: 6px solid #1a1a1a;
  border-radius: 16px;
}

/* Phone frame variant */
.device-frame--phone .device-frame__screen {
  border: 4px solid #1a1a1a;
  border-radius: 24px;
  max-width: 320px;
  margin: 0 auto;
}

/* Browser window variant */
.device-frame--browser .device-frame__screen {
  border-radius: 8px;
  border: 1px solid var(--border);
}

.device-frame--browser .device-frame__screen::before {
  content: '';
  display: block;
  height: 32px;
  background: linear-gradient(180deg, #f5f5f5 0%, #ebebeb 100%);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  position: relative;
}

.device-frame--browser .device-frame__screen::after {
  content: '● ● ●';
  position: absolute;
  top: 8px;
  left: 14px;
  font-size: 8px;
  letter-spacing: 4px;
  color: #ccc;
  z-index: 1;
}

/* Reflection under device */
.device-frame__reflection {
  height: 40px;
  background: linear-gradient(180deg, rgba(0,0,0,0.04) 0%, transparent 100%);
  filter: blur(8px);
  transform: scaleY(-0.3) translateY(-20px);
  opacity: 0.5;
  border-radius: 50%;
  margin: 0 10%;
}

/* Dark section variants */
.section--dark .device-frame__screen {
  box-shadow:
    0 4px 6px rgba(0,0,0,0.15),
    0 20px 40px rgba(0,0,0,0.25),
    0 0 80px rgba(74, 123, 247, 0.05);
}

.section--dark .device-frame:hover .device-frame__screen {
  box-shadow:
    0 8px 16px rgba(0,0,0,0.2),
    0 30px 60px rgba(0,0,0,0.35),
    0 0 100px rgba(74, 123, 247, 0.08);
}

/* ─── B) SCROLL REVEAL CLIPMASK ────────────────────────── */

.reveal {
  overflow: hidden;
}

.reveal__content {
  transition: clip-path 1s var(--ease), opacity 0.8s var(--ease);
  will-change: clip-path, opacity;
}

/* Left reveal */
.reveal--left .reveal__content {
  clip-path: inset(0 100% 0 0);
  opacity: 0;
}
.reveal--left.revealed .reveal__content {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

/* Right reveal */
.reveal--right .reveal__content {
  clip-path: inset(0 0 0 100%);
  opacity: 0;
}
.reveal--right.revealed .reveal__content {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

/* Bottom reveal */
.reveal--up .reveal__content {
  clip-path: inset(100% 0 0 0);
  opacity: 0;
}
.reveal--up.revealed .reveal__content {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

/* Diagonal reveal */
.reveal--diagonal .reveal__content {
  clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
  opacity: 0;
}
.reveal--diagonal.revealed .reveal__content {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  opacity: 1;
}

/* Zoom reveal */
.reveal--zoom .reveal__content {
  transform: scale(1.15);
  opacity: 0;
  transition: transform 1.2s var(--ease), opacity 0.6s var(--ease);
}
.reveal--zoom.revealed .reveal__content {
  transform: scale(1);
  opacity: 1;
}

/* ─── C) PARALLAX DEPTH ────────────────────────────────── */

.parallax-container {
  position: relative;
  overflow: hidden;
}

.parallax-layer {
  will-change: transform;
  transition: transform 0.1s linear;
}

.parallax-layer--slow {
  /* Moves at 30% speed — set via JS --scroll-y custom property */
}

.parallax-layer--medium {
  /* Moves at 60% speed */
}

/* Mouse-follow parallax for hero mockups */
.mouse-parallax {
  transition: transform 0.3s var(--ease-out);
  will-change: transform;
}

/* ─── D) IMAGE HOVER EFFECTS ──────────────────────────── */

/* Zoom + Pan on hover */
.img-hover-zoom {
  overflow: hidden;
  border-radius: var(--radius-md);
}

.img-hover-zoom img {
  transition: transform 0.6s var(--ease);
  will-change: transform;
}

.img-hover-zoom:hover img {
  transform: scale(1.06);
}

/* Ken Burns subtle animation */
.img-ken-burns {
  overflow: hidden;
}

.img-ken-burns img {
  animation: kenBurns 20s ease-in-out infinite alternate;
}

@keyframes kenBurns {
  0%   { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1%, -1%); }
}

/* ─── E) TERMINAL/CODE MOCK ────────────────────────────── */

.terminal-mock {
  background: #0d1117;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-mono);
}

.terminal-mock__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.terminal-mock__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-mock__dot--red    { background: #ff5f56; }
.terminal-mock__dot--yellow { background: #ffbd2e; }
.terminal-mock__dot--green  { background: #27c93f; }

.terminal-mock__title {
  flex: 1;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
}

.terminal-mock__body {
  padding: 20px;
  font-size: 0.82rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.7);
  min-height: 180px;
}

.terminal-mock__line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
}

.terminal-mock__prompt {
  color: #27c93f;
}

.terminal-mock__cmd {
  color: #e6edf3;
}

.terminal-mock__output {
  color: rgba(255,255,255,0.4);
}

.terminal-mock__comment {
  color: #6e7681;
}

/* Typing animation */
.terminal-mock__line--typing {
  width: 0;
  animation: terminalType 1.5s steps(40) forwards;
  animation-delay: var(--type-delay, 0s);
}

@keyframes terminalType {
  to { width: 100%; }
}

/* Cursor blink */
.terminal-mock__cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: #27c93f;
  animation: cursorBlink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

/* ─── F) GLOW EFFECTS ──────────────────────────────────── */

.glow-border {
  position: relative;
}

.glow-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--signal) 0%, var(--accent) 50%, var(--signal) 100%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
  filter: blur(8px);
}

.glow-border:hover::before {
  opacity: 0.3;
}

/* ─── G) RESPONSIVE ────────────────────────────────────── */

@media (max-width: 768px) {
  .device-frame:hover .device-frame__screen {
    transform: none; /* No 3D tilt on mobile */
  }

  .device-frame--phone .device-frame__screen {
    max-width: 100%;
  }

  .reveal__content {
    transition-duration: 0.6s;
  }

  .terminal-mock__body {
    font-size: 0.72rem;
    padding: 14px;
    min-height: 140px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .device-frame__screen,
  .reveal__content,
  .parallax-layer,
  .mouse-parallax,
  .img-hover-zoom img,
  .img-ken-burns img {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    clip-path: none !important;
    opacity: 1 !important;
  }
}
