/**
 * PERSONAL.SPACE — CORE LAYOUT & TYPOGRAPHIC HIERARCHY
 */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background-color: var(--bg-void);
  line-height: 1.65;
}

img, canvas, svg, video {
  max-width: 100%;
}

/* Subtle Film Grain / Scanline Overlay */
.scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 998;
  opacity: 0.02;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.15) 2px,
    rgba(255, 255, 255, 0.15) 4px
  );
}

/* Background Interactive Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Atmospheric Ambient Spotlight */
.cursor-spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    700px circle at var(--mouse-x, 50vw) var(--mouse-y, 50vh),
    rgba(56, 189, 248, 0.028),
    transparent 65%
  );
  transition: opacity 0.4s ease;
}

/* High-Performance Canvas Particle Trail Overlay */
.cursor-particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9998;
}

/* Cursor Type Presets */
html[data-cursor-type="default"], body[data-cursor-type="default"] {
  cursor: default;
}

html[data-cursor-type="crosshair"], html[data-cursor-type="crosshair"] body {
  cursor: crosshair;
}

html[data-cursor-type="minimal"], html[data-cursor-type="minimal"] body {
  cursor: default;
}

html[data-cursor-type="circle"], html[data-cursor-type="circle"] body {
  cursor: cell;
}

/* Touch devices: disable particle canvas */
@media (hover: none) and (pointer: coarse) {
  .cursor-particles-canvas,
  .cursor-spotlight {
    display: none !important;
  }
}

/* Main Content Wrapper */
.content-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 680px) {
  .content-wrapper {
    padding: 0 16px;
  }
}

/* Optimized Section Spacing (Dense & Rich Digital Space, -25% Vertical Gap) */
section {
  padding: 72px 0;
  position: relative;
}

@media (max-width: 680px) {
  section {
    padding: 48px 0;
  }
}

.section-header {
  margin-bottom: 38px;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}

.section-tag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
}

.section-title {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
}

/* Body Text Sizing Increased by ~15% for High Legibility */
.section-desc {
  font-size: 1.12rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin-top: 12px;
  line-height: 1.7;
}

/* Accessibility Focus States */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

/* Typography Helpers */
.mono {
  font-family: var(--font-mono);
}

.text-cyan { color: var(--accent-cyan); }
.text-amber { color: var(--accent-amber); }
.text-emerald { color: var(--accent-emerald); }
.text-magenta { color: var(--accent-magenta); }
.text-gold { color: var(--accent-gold); }

/* Delicate Click Ripple */
.click-ripple {
  position: absolute;
  border: 1px solid var(--accent-cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: rippleSpread 0.45s cubic-bezier(0, 0.4, 0.6, 1) forwards;
  z-index: 9990;
}

@keyframes rippleSpread {
  0% {
    width: 0;
    height: 0;
    opacity: 0.7;
  }
  100% {
    width: 75px;
    height: 75px;
    opacity: 0;
  }
}

/* Motion & Scroll Reveal Language */
.reveal-init {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(3px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform, filter;
}

.reveal-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}
