@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&family=Oswald:wght@500;700&family=JetBrains+Mono:wght@400&display=swap");

:root {
  /* === WARM MODE (Molten Core) === */
  --text-primary: #fff7ed;
  --text-secondary: #fdba74;
  --card-bg: rgba(66, 32, 6, 0.3);
  --card-hover: rgba(146, 64, 14, 0.4);
  --border-color: rgba(251, 191, 36, 0.3);
  --accent: #fbbf24;
  --accent-dim: rgba(251, 191, 36, 0.2);
  --cursor-color: #f59e0b;
  --btn-text-hover: #451a03;
}

[data-theme="dark"] {
  /* === DARK MODE (Cyber Void) === */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --card-bg: rgba(15, 23, 42, 0.4);
  --card-hover: rgba(30, 41, 59, 0.6);
  --border-color: rgba(255, 255, 255, 0.15);
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.2);
  --cursor-color: #67e8f9;
  --btn-text-hover: #020617;
}

/* === LENIS & CORE SMOOTH SCROLL === */
html.lenis, html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}
.lenis.lenis-smooth iframe {
  pointer-events: none;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Remove Windows cursor completely across all elements and tags */
html,
body,
*,
*::before,
*::after {
  cursor: none !important;
}

/* Fallback only for purely touch-operated screens with coarse pointer */
@media (hover: none) and (pointer: coarse) {
  html,
  body,
  *,
  *::before,
  *::after {
    cursor: auto !important;
  }
  #cursor-dot,
  #cursor-ring {
    display: none !important;
  }
}


body {
  font-family: "Inter", sans-serif;
  color: var(--text-primary);
  background-color: #f9f8f6;
  transition: background-color 0.5s ease;
  overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1,
h2,
h3,
h4 {
  font-family: "Oswald", sans-serif;
  text-transform: uppercase;
}
.font-mono {
  font-family: "JetBrains Mono", monospace;
}
h1[data-scramble] {
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.section-title {
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: clamp(2rem, 5vw, 3rem);
  opacity: 0.15;
  transition: opacity 0.5s;
}
.section-title:hover {
  opacity: 0.8;
}

/* === UTILS === */
.text-accent {
  color: var(--accent);
}
.content-wrapper {
  position: relative;
  z-index: 2;
  will-change: transform;
  transform-origin: center center;
  transition: transform 0.1s linear;
}
#webgl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* === CARDS === */
.project-card,
.info-card,
.skill-tag,
input,
textarea {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  transition: transform 0.1s ease-out, background 0.3s ease,
    border-color 0.3s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.project-card:hover,
.info-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  box-shadow: 0 10px 30px -10px var(--accent-dim);
  transform: translateY(-4px);
}
.project-card:hover h3,
.info-card:hover h4 {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-dim);
  transition: color 0.3s ease;
}
.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--card-hover);
}

/* === BUTTONS & INPUTS === */
.btn-minimal {
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  padding: 1rem 2rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  background: transparent;
}
.btn-minimal:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-text-hover);
  box-shadow: 0 0 20px var(--accent);
  font-weight: 700;
}

input:not(.modal-input),
textarea:not(.modal-input) {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  outline: none;
}
input:focus,
textarea:focus {
  border-color: var(--accent);
}

/* Hardened Form Validation States */
input:not(:placeholder-shown):valid,
textarea:not(:placeholder-shown):valid {
  border-color: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
  transition: all 0.3s ease;
}

input:not(:placeholder-shown):invalid,
textarea:not(:placeholder-shown):invalid {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
  transition: all 0.3s ease;
}

/* === NAV & SIDEBAR === */
.nav-item {
  position: relative;
}
.nav-item::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.nav-item:hover::after {
  transform: scaleX(1);
}
.nav-item.active-link {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent);
}
.nav-item.active-link::after {
  transform: scaleX(1);
}

.side-nav {
  position: fixed;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.theme-toggle {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.5rem;
  opacity: 0.4;
}
.theme-toggle:hover {
  opacity: 1;
  color: var(--accent);
  transform: translateX(2px);
}
.theme-toggle.active {
  opacity: 1;
  color: var(--text-primary);
  border-left: 1px solid var(--accent);
  padding-left: 1rem;
}

/* === EFFECTS: GRAIN, CURSOR, SCROLLBAR === */
.film-grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  animation: grainAnimation 8s steps(10) infinite;
}
@keyframes grainAnimation {
  0%,
  100% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-5%, -5%);
  }
  90% {
    transform: translate(10%, 5%);
  }
}

/* === WEBSITE CUSTOM CURSOR === */
#cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2147483647;
  transform: translate3d(-100px, -100px, 0) translate(-50%, -50%);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
  will-change: transform;
  opacity: 0;
  transition: width 0.2s cubic-bezier(0.2, 0.9, 0.3, 1),
              height 0.2s cubic-bezier(0.2, 0.9, 0.3, 1),
              background-color 0.2s ease,
              box-shadow 0.2s ease,
              opacity 0.2s ease;
}

#cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--accent);
  background-color: var(--accent-dim);
  border-radius: 50%;
  pointer-events: none;
  z-index: 2147483646;
  transform: translate3d(-100px, -100px, 0) translate(-50%, -50%);
  box-shadow: 0 0 16px var(--accent-dim);
  will-change: transform;
  opacity: 0;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.25s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              opacity 0.2s ease;
}

#cursor-dot.is-active,
#cursor-ring.is-active {
  opacity: 1;
}

#cursor-dot.hovered {
  width: 12px;
  height: 12px;
  background-color: #ffffff;
  box-shadow: 0 0 14px #ffffff, 0 0 24px var(--accent);
}

#cursor-ring.hovered {
  width: 58px;
  height: 58px;
  border-color: var(--accent);
  background-color: rgba(251, 191, 36, 0.15);
  box-shadow: 0 0 25px var(--accent), inset 0 0 12px var(--accent-dim);
}

[data-theme="dark"] #cursor-ring.hovered {
  background-color: rgba(34, 211, 238, 0.15);
}

#cursor-dot.clicked {
  width: 5px;
  height: 5px;
}

#cursor-ring.clicked {
  width: 28px;
  height: 28px;
  border-width: 2px;
}

/* === HIDE SCROLLBAR BUT KEEP SCROLLING === */
::-webkit-scrollbar {
  width: 0px;
  background: transparent;
  display: none;
}
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
::selection {
  background: var(--accent);
  color: var(--card-bg);
}

/* === ANIMATIONS & MICRO-INTERACTIONS === */
.magnetic-wrap {
  display: inline-block;
  position: relative;
  touch-action: none;
}
.click-ripple {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 9998;
  animation: rippleAnim 0.6s linear forwards;
}
@keyframes rippleAnim {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
    border-width: 2px;
  }
  100% {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
    border-width: 0px;
  }
}

/* === DELETE MODAL (Mirrors Edit Modal) === */
#delete-modal {
  display: none;
}


.reveal-text {
  overflow: hidden;
  display: block;
  line-height: 1.2;
}
.reveal-text span {
  display: block;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}
.reveal-text.is-visible span {
  transform: translateY(0);
  opacity: 1;
}

#submit-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
}
#submit-btn.loading {
  color: transparent;
  pointer-events: none;
}
#submit-btn.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background: var(--accent);
  opacity: 0.2;
  animation: loadProgress 2s ease forwards;
}
#submit-btn.success {
  background: var(--accent);
  color: var(--btn-text-hover);
  border-color: var(--accent);
}
@keyframes loadProgress {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 5px #22c55e;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}


@media (max-width: 1024px) {
  .side-nav {
    top: auto;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    width: auto;
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    z-index: 100;
  }
  .theme-toggle {
    writing-mode: horizontal-tb;
    border-left: none;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
  }
  .theme-toggle.active {
    border-left: none;
    border-bottom: 2px solid var(--accent);
    padding-left: 0.75rem;
  }
}

/* === DYNAMIC PROGRESS BARS (MOVED TO BOTTOM FOR SAFETY) === */
#scroll-progress,
#loader-bar {
  background-color: var(--accent) !important;
  box-shadow: 0 0 15px var(--accent) !important;
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

#preloader ::selection {
  background: var(--accent);
  color: black;
}

/* ... (Keep existing CSS) ... */

/* === LOADING STATE === */
body.loading {
  overflow: hidden; /* Prevent scrolling */
}

/* Blink Animation for the Start Prompt */
.blink {
  animation: blinker 1s linear infinite;
}
@keyframes blinker {
  50% {
    opacity: 0;
  }
}

/* ... (Keep existing CSS) ... */

/* === FIX: INTRO BUTTON STYLE === */
.btn-intro {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transition: all 0.3s ease;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.btn-intro:hover {
  background: var(--accent);
  color: #000; /* Black text on hover for contrast */
  box-shadow: 0 0 20px var(--accent);
}

/* ... (Keep existing CSS) ... */

/* === CRT TERMINAL EFFECTS === */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px; /* Scanline size */
  z-index: 10;
  pointer-events: none;
}

/* Make the terminal text glow */
#preloader {
  text-shadow: 0 0 5px var(--accent);
}

/* The "TV Turn Off" White Flash */
.tv-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: translate(-50%, -50%);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
}

/* ... (Keep existing CSS) ... */

/* === HOLOGRAPHIC SPOTLIGHT (The Final Polish) === */
.project-card,
.info-card {
  position: relative;
  overflow: hidden; /* Keep glow inside */
}

/* The Glow Layer */
.project-card::before,
.info-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    800px circle at var(--mouse-x) var(--mouse-y),
    var(--accent-dim),
    transparent 40%
  );
  opacity: 0; /* Hidden by default */
  transition: opacity 0.5s ease;
  pointer-events: none; /* Let clicks pass through */
  z-index: 0;
}

/* Reveal on Hover */
.project-card:hover::before,
.info-card:hover::before {
  opacity: 1;
}

/* Ensure text stays on top of the glow */
.project-card > *,
.info-card > * {
  position: relative;
  z-index: 1;
}



/* Button Text Color Fix */
.text-btn-text {
  color: var(--accent);
}

.slashed-btn { position: relative; }
.slashed-btn::after { 
  content: ""; 
  position: absolute; 
  top: 50%; 
  left: 50%; 
  width: 120%; 
  height: 2px; 
  background-color: var(--text-secondary); 
  transform: translate(-50%, -50%) rotate(-45deg); 
  pointer-events: none; 
  z-index: 10; 
  opacity: 0.7; 
}

/* === OVERDRIVE === */
.project-card, .info-card, .skill-tag {
  will-change: transform, filter; /* Opt for hardware acceleration on overdrive target */
}

.is-tearing {
  filter: url('#crt-tear');
  position: relative;
  z-index: 50; /* Bring torn element to top to avoid clipping */
}

/* === VIEW TRANSITIONS OVERDRIVE === */
::view-transition-group(modal-morph) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); /* expo.out equivalent */
}


