/* 
  Phase 5: The Lusion Mechanics
  Parallax grid staggering, cursor overrides, extreme cinematic constraints.
*/

:root {
  --bg-color: #0a0a0a;
  --text-muted: #888888;
  --text-dark: #ffffff;
  --accent-color: #00ff41;
  --surface: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --container-max-width: 1440px;
}


body.is-scrolling {
  pointer-events: none !important;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: pan-y;
  /* Locks pinch-to-zoom completely natively */
  overflow-x: hidden;
  /* Fix viewport stretching when GSAP sweeps from off-screen */
  cursor: none;
  /* Phase 5 Custom Pointer Override */
}


/* ===========================
   Tactile Custom Cursor
   =========================== */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background-color: #fff;
  border-radius: 50%;
  z-index: 99999;
  pointer-events: none;
  mix-blend-mode: difference;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Centering adjustment internally. QuickSetter sets exact matrix positions */
  transform: translate(-50%, -50%);
  will-change: width, height, background-color;
}

#cursor-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #000;
  /* Contrast against expanded white cursor */
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
}

/* Override cursor globally over buttons/links */
a,
button,
.project-card,
.user-bio {
  cursor: none !important;
}


/* ===========================
   1. The Background (Ambient Cinematic Grain)
   =========================== */
.noise-svg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
  /* Under cursor */
  opacity: 0.05;
  mix-blend-mode: color-dodge;
}

.background-mesh {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  background: radial-gradient(circle at 50% 0%, rgba(30, 30, 35, 0.6) 0%, var(--bg-color) 60%);
  z-index: -1;
  transition: background 0.6s ease;
}

/* ===========================
   Preloader Overlay & Base
   =========================== */
.preloader {
  position: fixed;
  inset: 0;
  background-color: var(--bg-color);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader-content {
  overflow: hidden;
  position: relative;
  text-align: center;
}

.preloader-text {
  font-size: 1.5rem;
  letter-spacing: 4px;
  font-weight: 500;
  color: var(--text-dark);
  text-transform: uppercase;
  margin: 0;
}

.role-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}


/* ===========================
   Floating Navigation
   =========================== */
.top-nav {
  position: fixed;
  top: 40px;
  right: 40px;
  display: flex;
  gap: 12px;
  z-index: 100;
}

.pill-btn {
  border-radius: 40px;
  padding: 14px 28px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.8s ease, color 0.5s ease;
  will-change: transform;
}

/* Hard-kill the JS Magnetic Interaction specifically for the top-nav text buttons */
.top-nav .pill-btn {
  transform: none !important;
}

/* Lusion.co Premium Expanding Circle Effect */
.pill-btn::before {
  content: "";
  position: absolute;
  top: 100%; 
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  width: 150%;
  padding-bottom: 150%;
  border-radius: 50%;
  z-index: -1;
  transition: top 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.pill-btn:hover {
  letter-spacing: 0.8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.pill-btn:hover::before {
  top: -25%; 
}

/* Light / Dark Mode Color Inversions */
.dark-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dark);
  border: 1px solid var(--border);
}

.dark-btn::before {
  background-color: var(--text-dark); /* Fills with bright white */
}

.dark-btn:hover {
  color: var(--bg-color) !important; /* Text flips to black */
}

.light-btn {
  background: var(--text-dark);
  color: var(--bg-color);
}

.light-btn::before {
  background-color: var(--bg-color); /* Fills with deep black */
}

.light-btn:hover {
  color: var(--text-dark) !important; /* Text flips to bright white */
}

/* ===========================
   Typography Masks setup
   =========================== */
.line-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  margin-right: 0.25em;
}

.line-content {
  display: inline-block;
  transform: translateY(110%);
  /* Stays at 110 initially */
  will-change: transform;
}


/* ===========================
   Main Layout & Hero
   =========================== */
.portfolio-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 140px 60px 100px 60px;
  transition: filter 1.0s cubic-bezier(0.16, 1, 0.3, 1), transform 1.0s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.0s ease;
}

.portfolio-container.is-blurred {
  filter: blur(12px) brightness(0.5);
  transform: scale(0.97);
  pointer-events: none;
}

.hero-section {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 120px;
  /* Space before grid */
}

.profile-wrapper {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  will-change: transform;
  /* Neutralize JS Magnetic Interaction & Setup Frame Zoom Overflow */
  transform: translate(0, 0) !important;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
}

.profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
}

.profile-mystery {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  font-family: 'JetBrains Mono', monospace;
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent-color);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
}

.bio-wrapper {
  max-width: 650px;
}

.user-name {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1.1;
  letter-spacing: -1.5px;
}

.user-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.user-bio {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  transition: color 0.8s ease, filter 0.8s ease;
}

.user-bio:hover {
  color: var(--text-dark);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}


/* ===========================
   Parallax Project Grid
   =========================== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 60px 40px;
}

.grid-second {
  margin-top: 60px;
}

/* ===========================
   Phase 14: Horizontal Film-Strip
   =========================== */
.film-strip-section {
  /* Escape the container on both sides */
  width: 100vw;
  margin-left: calc(-1 * ((100vw - 100%) / 2));
  overflow: hidden;
  position: relative;
  /* Fill the pinned viewport cleanly */
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.film-strip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 60px 24px 60px;
  flex-shrink: 0;
}

.film-strip-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.film-strip-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 2px;
  color: var(--text-muted);
  opacity: 0.5;
}

.film-track {
  display: flex;
  gap: 24px;
  padding: 0 60px;
  will-change: transform;
  align-items: center;
  flex-shrink: 0;
}

.film-card {
  flex-shrink: 0;
  width: 38vw;
  height: 52vh;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  cursor: none;
}

.film-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  .film-card:hover .film-img {
    transform: scale(1.04);
  }
}

.film-card-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 50px 28px 24px 28px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.fc-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 2px;
}

.fc-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Disable Magnetic JS interactions completely for text fields so they don't jitter */
input, textarea, .beast-input {
  transform: none !important;
}
/* Mobile: disable GSAP pinning & switch to vertical scroll */
@media (max-width: 768px) {
  .film-strip-section {
    margin-left: 0;
    width: 100%;
    /* Remove the 100vh lock — let content define height */
    height: auto;
    /* Allow natural vertical overflow */
    overflow: visible;
    padding-bottom: 60px;
  }

  .film-strip-header {
    padding: 0 24px 20px 24px;
  }

  .film-strip-hint {
    display: none;
  }

  .film-track {
    /* Stack vertically instead of horizontal scroll */
    flex-direction: column;
    padding: 0 24px;
    gap: 20px;
    /* Remove any GSAP inline transform that may have been applied */
    transform: none !important;
  }

  .film-card {
    width: 100%;
    /* Use a portrait-friendly aspect ratio on mobile */
    height: 55vw;
    min-height: 220px;
    border-radius: 16px;
  }
}

.project-card:nth-child(even) {
  margin-top: 150px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: filter 0.15s ease-out;
  will-change: filter, transform;
  position: relative;
  z-index: 1;
}

/* Phase 11 & 13: Elevate hovered card past bleed intersections */
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .project-card:hover {
    z-index: 50;
  }

  /* Standard Front Page Blur (Heavy pull, strictly triggered by the physical image perimeter) */
  .grid:not(#split-right-gallery):has(.image-wrapper:hover) .project-card:not(:has(.image-wrapper:hover)) {
    filter: blur(8px) brightness(0.6);
  }

  /* Second Page Blur (Softer pull, strictly triggered by the image perimeter) */
  #split-right-gallery:has(.image-wrapper:hover) .project-card:not(:has(.image-wrapper:hover)) {
    filter: blur(3px) brightness(0.85);
  }
}

.flip-wrapper-origin {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
}

.image-wrapper {
  border-radius: 20px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  aspect-ratio: 16/9;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  will-change: width, height, top, left;
  position: relative;
}

.image-wrapper.is-expanded {
  border-radius: 24px;
}

/* Phase 12 Parallax Layer */
.parallax-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;
  will-change: transform;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center;
  transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

/* Phase 11: Scale up the image inside hovered card */
@media (hover: hover) and (pointer: fine) {
  .project-card:hover .project-img {
    transform: scale(1.03);
  }
}

.project-meta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.project-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.5px;
}


/* ===========================
   3. The Split-Screen View (Phase 6)
   =========================== */
.page-wipe {
  position: fixed;
  top: 100%;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--bg-color);
  z-index: 10000;
  will-change: top;
}

.split-screen-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--bg-color);
  z-index: 5000;
  transition: background-color 0.5s ease;
  /* Flex removed so internal wrapper handles layout */
}

/* Base states overwritten by block layout */
.split-left {
  display: block;
}

/* New Responsive Second Page Hero Structure */
.split-hero-layout {
  margin-bottom: 120px;
  display: flex !important;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 60px;
  padding: 0;
  width: 100%;
  border: none;
  overflow: visible;
}

.split-hero-img-box {
  flex: 1;
  max-width: 45%;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.back-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s;
}

/* Cleaned empty split-title rule */

.split-right {
  display: block;
}

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

/* Inherit raw typography */
.story-prompt-clean {
  display: block;
}

/* Neutralize the terminal box */
.prompt-container-box {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  cursor: none;
}

.prompt-header {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.prompt-cursor {
  color: var(--accent-color, #00ff41);
  font-weight: bold;
  animation: blink 1s step-end infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}


/* ===========================
   Responsive
   =========================== */
@media (max-width: 1024px) {
  .split-screen-view {
    flex-direction: column;
    position: relative;
    padding-bottom: 60px;
  }

  /* Cleaned up old split layout constraints */
  .split-left {
    display: block;
  }

  .back-btn {
    top: 30px;
    right: 40px; /* Aligned properly */
    z-index: 5010;
  }

  /* Mobile Stack Transformation for Second Page Hero */
  .split-hero-layout {
    flex-direction: column-reverse !important;
    gap: 30px;
    margin-bottom: 80px;
  }

  .split-hero-img-box {
    max-width: 100%;
    justify-content: flex-start;
    width: 100%;
  }

  .split-title {
    font-size: 2.5rem;
    padding: 0;
    margin-bottom: 8px;
  }
}

@media (max-width: 768px) {
  body {
    cursor: auto;
  }

  #custom-cursor {
    display: none;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .project-card:nth-child(even) {
    margin-top: 0;
  }

  .hero-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }

  .user-name {
    font-size: 2.5rem;
  }

  .portfolio-container {
    padding: 100px 24px 60px 24px;
  }

  .split-title {
    font-size: 2.5rem;
  }
}

/* ===========================
   Phase 10: Admin Panel & States
   =========================== */
:root {
  --accent-color: #00ff41;
}

/* Glass Modal */
.glass-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(15px);
  z-index: 15000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: rgba(10, 10, 10, 0.9);
  padding: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 400px;
}

.login-box input {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 15px;
  color: #fff;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
}

.login-box input:focus {
  border-color: var(--accent-color);
}

/* Command Center */
#command-center {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #050505;
  z-index: 20000;
  overflow-y: auto;
  padding: 60px 10vw;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: auto;
}

.cc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
}

.cc-header h2 {
  margin: 0;
  font-size: 2rem;
}

.cc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.cc-module {
  background: #111;
  padding: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cc-module.cc-full {
  grid-column: 1 / -1;
}

.cc-module h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--accent-color);
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

.cc-module label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: #888;
  text-transform: uppercase;
}

.cc-module select,
.cc-module input[type="text"],
.cc-module textarea {
  width: 100%;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 15px;
  color: #fff;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
  font-size: 1rem;
}

.cc-module select:focus,
.cc-module input:focus,
.cc-module textarea:focus {
  border-color: var(--accent-color);
}

.cc-module input[type="color"] {
  padding: 0;
  width: 60px;
  height: 60px;
  border: none;
  background: none;
  cursor: none !important;
  border-radius: 8px;
  overflow: hidden;
}

.cc-module input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.cc-module input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

/* Image Style Engine Classes */
img {
  transition: filter 0.5s ease, border-radius 0.5s ease;
}

.style-noir {
  filter: grayscale(100%) contrast(120%) !important;
}

.style-dream {
  filter: sepia(30%) blur(1px) !important;
  border-radius: 30px !important;
}

.style-brutalist {
  border: 4px solid var(--accent-color) !important;
  filter: saturate(150%) !important;
  border-radius: 0 !important;
}

/* Glitch Animation */
@keyframes cyber-glitch {
  0% {
    transform: translate(0);
  }

  20% {
    transform: translate(-2px, 2px);
    filter: drop-shadow(2px 0 red) drop-shadow(-2px 0 cyan);
  }

  40% {
    transform: translate(-2px, -2px);
  }

  60% {
    transform: translate(2px, 2px);
    filter: drop-shadow(2px 0 red) drop-shadow(-2px 0 cyan);
  }

  80% {
    transform: translate(2px, -2px);
  }

  100% {
    transform: translate(0);
  }
}

.style-glitch {
  animation: cyber-glitch 0.2s infinite !important;
  mix-blend-mode: screen;
}

/* =========================================================
   Module F: Beast Text Editor
   ========================================================= */
.beast-field-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.beast-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 2px;
  color: #666;
  padding-top: 8px;
  text-transform: uppercase;
}

.beast-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 8px 12px;
  outline: none;
  width: 100%;
  resize: none;
  transition: border-color 0.2s;
}

.beast-input:focus {
  border-color: var(--accent-color, #00ff41);
  box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.08);
}