/* ═══════════════════════════════════════════════════════
   MAIN STYLES — Portfolio Site V3 (Immersive / 3D)
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Baseline ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.8;
  cursor: none;
  min-height: 100vh;
  margin: 0;
}

/* ── Canvas Background ── */
#canvas-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* Base Grain Texture */
.noise-overlay {
  content: ""; position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  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.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03; pointer-events: none; z-index: 50; mix-blend-mode: overlay;
}

/* ── Smooth Scroll Wrapper ── */
#smooth-wrapper {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  z-index: 10;
}
#smooth-content {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  will-change: transform;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: var(--accent-gold); color: var(--bg); }

/* ── Custom Cursor ── */
.cursor-dot {
  position: fixed; width: 4px; height: 4px; border-radius: 50%;
  background-color: var(--accent-gold);
  pointer-events: none; z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background-color 0.3s;
}
.cursor-ring {
  position: fixed; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease-out, width 0.3s, height 0.3s, border-color 0.3s;
}
.cursor-hover .cursor-dot { background-color: transparent; border: 1px solid var(--accent-gold); width: 60px; height: 60px; mix-blend-mode: overlay; }
.cursor-hover .cursor-ring { width: 80px; height: 80px; border-color: rgba(212, 175, 55, 0.4); }

/* ── Loader ── */
.loader {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: #000; z-index: 99999;
  display: flex; justify-content: center; align-items: center;
  flex-direction: column; color: var(--text-primary);
  font-family: var(--font-subhead); text-transform: uppercase; letter-spacing: 0.4em;
  transition: opacity 1.5s cubic-bezier(0.77, 0, 0.175, 1);
}
.loader.hide { opacity: 0; pointer-events: none; }
.loader-glitch { font-size: 14px; margin-bottom: 20px; position: relative; color: var(--text-muted); }
.loader-glitch::before, .loader-glitch::after {
  content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #000;
}
.loader-glitch::before { left: 2px; text-shadow: -1px 0 red; clip: rect(24px, 550px, 90px, 0); animation: glitch-anim 3s infinite linear alternate-reverse; }
.loader-glitch::after { left: -2px; text-shadow: -1px 0 blue; clip: rect(85px, 550px, 140px, 0); animation: glitch-anim 2.5s infinite linear alternate-reverse; }
@keyframes glitch-anim {
  0% { clip: rect(10px, 9999px, 83px, 0); }
  20% { clip: rect(65px, 9999px, 18px, 0); }
  40% { clip: rect(4px, 9999px, 45px, 0); }
  60% { clip: rect(28px, 9999px, 78px, 0); }
  80% { clip: rect(98px, 9999px, 32px, 0); }
  100% { clip: rect(56px, 9999px, 11px, 0); }
}

.loader-counter { font-size: 32px; font-weight: 300; font-family: var(--font-display); }
.loader-bar { width: 200px; height: 1px; background: #222; margin-top: 20px; position: relative; overflow: hidden; }
.loader-progress { position: absolute; top: 0; left: 0; height: 100%; background: var(--accent-gold); width: 0%; transition: width 0.1s; }


/* ── Layout & Content ── */
.section { padding: var(--section-pad) 24px; position: relative; z-index: 10; perspective: 1000px; }
.section__inner { max-width: var(--content-max); margin: 0 auto; transform-style: preserve-3d; }


/* ── 3D Typography & Elements ── */
.text-3d {
  position: relative;
  display: inline-block;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
/* Creates layered text shadows for 3D extrusion on hover/move */
.text-3d::before {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.1);
  transform: translateZ(-10px) translateY(2px);
  opacity: 0.5;
  transition: transform 0.4s ease;
  pointer-events: none;
}
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0.2, 1);
  will-change: transform;
}

/* ═══════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════ */
.hero { height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; position: relative; padding: 0 24px; }
.hero__title-wrapper { perspective: 1200px; transform-style: preserve-3d; }
.hero__name {
  font-family: var(--font-display); font-size: var(--text-hero);
  font-weight: 300; letter-spacing: var(--tracking-hero);
  line-height: 0.9; color: var(--text-primary);
  text-transform: uppercase;
  transform: translateY(100px) rotateX(20deg);
  opacity: 0;
  transition: transform 1.8s cubic-bezier(0.19, 1, 0.22, 1), opacity 1.8s ease;
  transform-style: preserve-3d;
}
.hero.loaded .hero__name { transform: translateY(0) rotateX(0deg); opacity: 1; }

.hero__descriptor {
  font-family: var(--font-subhead); font-size: 14px;
  letter-spacing: var(--tracking-subhead); text-transform: uppercase;
  color: var(--text-muted); margin-top: 50px;
  opacity: 0; transform: translateY(20px);
  transition: opacity 1s ease 1s, transform 1s ease 1s;
}
.hero.loaded .hero__descriptor { opacity: 1; transform: translateY(0); }
.hero__descriptor span { color: var(--accent-jade); }

.hero__scroll { position: absolute; bottom: 40px; right: 40px; opacity: 0; transition: opacity 1s ease 1.8s; }
.hero.loaded .hero__scroll { opacity: 1; }
.hero__scroll-line { width: 1px; height: 80px; background: linear-gradient(to bottom, transparent, var(--accent-gold), transparent); animation: scanline 2.5s infinite linear; }
@keyframes scanline { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }

/* ═══════════════════════════════════════════════════════
   THESIS
   ═══════════════════════════════════════════════════════ */
.thesis__grid { display: grid; grid-template-columns: 1fr; gap: 80px; }
@media(min-width: 900px) { .thesis__grid { grid-template-columns: 4fr 5fr; } }
.thesis__header h2 { font-family: var(--font-display); font-size: var(--text-h1); font-weight: 300; line-height: 1.1; }
.thesis__header p { font-family: var(--font-subhead); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent-gold); margin-top: 24px; }
.thesis__content { border-left: 1px solid rgba(255,255,255,0.05); padding-left: 40px; position: relative; }
.thesis__content::before { content: ''; position: absolute; top: 0; left: -1px; width: 2px; height: 0; background: var(--accent-gold); transition: height 2s var(--ease-reveal); }
.thesis.visible .thesis__content::before { height: 100%; }
.thesis__body p { font-size: var(--text-body); color: #999; margin-bottom: 24px; }
.thesis__body p strong { color: var(--text-primary); font-weight: normal; }


/* ═══════════════════════════════════════════════════════
   EXPERIENCE / TIMELINE
   ═══════════════════════════════════════════════════════ */
.section-header { margin-bottom: 100px; display: flex; align-items: baseline; gap: 24px; }
.section-header h2 { font-family: var(--font-display); font-size: var(--text-h2); font-weight: 300; }
.section-header span { font-family: var(--font-subhead); font-size: 10px; letter-spacing: 0.3em; color: var(--text-muted); text-transform: uppercase; }

.timeline-item { display: grid; gap: 16px; padding: 40px 0; border-bottom: 1px solid rgba(255,255,255,0.05); position: relative; }
@media(min-width: 768px) { .timeline-item { grid-template-columns: 200px 1fr; gap: 60px; padding: 60px 0; } }
.timeline-meta { font-family: var(--font-body); font-size: 13px; color: var(--text-muted); }
.timeline-role { font-family: var(--font-display); font-size: var(--text-h3); color: var(--text-primary); margin-bottom: 12px; transform: translateZ(20px); }
.timeline-company { font-family: var(--font-subhead); font-size: 12px; letter-spacing: 0.1em; color: var(--accent-jade); text-transform: uppercase; margin-bottom: 20px; transform: translateZ(10px); }
.timeline-desc { font-size: 14px; color: #888; max-width: 500px; }


/* ═══════════════════════════════════════════════════════
   ARTIFACTS / PROJECTS
   ═══════════════════════════════════════════════════════ */
.projects-grid { display: grid; grid-template-columns: 1fr; gap: 32px; perspective: 2000px; }
@media(min-width: 768px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); gap: 40px; }
}

.project-card {
  position: relative; padding: 50px; border-radius: 12px;
  background: rgba(15, 15, 15, 0.95); border: 1px solid rgba(255,255,255,0.04);
  transform-style: preserve-3d;
}
.project-card-bg {
  position: absolute; top:0; left:0; width:100%; height:100%; border-radius: 12px;
  background: radial-gradient(circle 600px at var(--mouse-x, 0) var(--mouse-y, 0), rgba(212,175,55,0.05), transparent 40%);
  opacity: 0; transition: opacity 0.5s; pointer-events: none; z-index: 1;
}
.project-card:hover .project-card-bg { opacity: 1; }
.project-card-content { position: relative; z-index: 2; transform: translateZ(30px); }
@media(min-width: 900px) {
  .project-card-content.wide-card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: start; }
}

.project-meta { font-family: var(--font-body); font-size: 12px; color: var(--text-muted); margin-bottom: 20px; display: block; }
.project-title { font-family: var(--font-display); font-size: 36px; margin-bottom: 20px; line-height: 1.1; }
.project-desc { font-size: 14px; color: #999; margin-bottom: 32px; }
.project-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; transform: translateZ(10px); }
.tag { font-family: var(--font-subhead); font-size: 10px; padding: 6px 14px; border-radius: 100px; background: rgba(255,255,255,0.03); color: #CCC; letter-spacing: 0.1em; text-transform: uppercase; border: 1px solid rgba(255,255,255,0.05); }

.project-link { font-family: var(--font-subhead); font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-primary); display: inline-flex; align-items: center; gap: 8px; position: relative; }
.project-link::after { content: '→'; transition: transform 0.3s; color: var(--accent-jade); }
.project-link::before { content: ''; position: absolute; bottom: -4px; left: 0; width: 0%; height: 1px; background: var(--accent-gold); transition: width 0.3s; }
.project-link:hover::before { width: 100%; }
.project-link:hover::after { transform: translateX(6px); }


/* ═══════════════════════════════════════════════════════
   STACK
   ═══════════════════════════════════════════════════════ */
.stack-grid { display: grid; grid-template-columns: 1fr; gap: 60px; perspective: 1000px; }
@media(min-width: 768px) { .stack-grid { grid-template-columns: repeat(3, 1fr); gap: 60px; } }
.stack-category-title { font-family: var(--font-subhead); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 32px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 16px; }
.stack-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px dotted rgba(255,255,255,0.05); transform-style: preserve-3d; transition: transform 0.3s, color 0.3s; }
.stack-item:hover { color: var(--accent-gold); transform: translateZ(20px) translateX(10px); border-color: transparent; }
.stack-item:hover .stack-level { color: var(--text-primary); }
.stack-name { font-family: var(--font-display); font-size: 22px; }
.stack-level { font-family: var(--font-body); font-size: 12px; color: var(--accent-jade); transition: color 0.3s; }


/* ═══════════════════════════════════════════════════════
   SIGNAL & FOOTER
   ═══════════════════════════════════════════════════════ */
.signal { border-top: 1px solid rgba(255,255,255,0.05); text-align: center; padding: 250px 24px; }
.signal__sub { font-family: var(--font-subhead); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 30px; display: block; }
.signal__heading { font-family: var(--font-display); font-size: var(--text-contact); font-weight: 300; line-height: 1.1; margin-bottom: 80px; }
.signal__email { font-family: var(--font-body); font-size: clamp(20px, 2.5vw, 32px); color: var(--text-primary); position: relative; padding-bottom: 12px; display: inline-block; transition: color 0.3s; transform: translateZ(40px); }
.signal__email::before { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 1px; background: rgba(255,255,255,0.1); }
.signal__email::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 1px; background: var(--accent-gold); transition: width 0.6s cubic-bezier(0.19, 1, 0.22, 1); }
.signal__email:hover { color: var(--accent-gold); }
.signal__email:hover::after { width: 100%; }

.footer { border-top: 1px solid rgba(255,255,255,0.05); padding: 50px 24px; background: #000; }
.footer__inner { max-width: var(--content-max); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer__mark { font-family: var(--font-subhead); font-size: var(--text-footer); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-muted); }
.footer__links { display: flex; gap: 40px; }
.footer__link { font-family: var(--font-subhead); font-size: var(--text-footer); letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); transition: color 0.3s; }
.footer__link:hover { color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */
.reveal-up { opacity: 0; transform: translateY(60px); transition: opacity var(--duration-reveal) var(--ease-reveal), transform var(--duration-reveal) var(--ease-reveal); }
.reveal-up.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 768px) {
  .cursor-dot, .cursor-ring { display: none !important; }
  body { cursor: auto; }
  .tilt-card { transform: none !important; } /* disable heavy 3D on mobile for perf */
}
