/* ============================================================
   base.css — design tokens, reset, typography, utilities
   ============================================================ */

:root {
  /* Palette */
  --bg:          #050a14;
  --bg2:         #080f1e;
  --bg3:         #0b1628;
  --blue:        #1d7fff;
  --blue-dim:    #0f4a9e;
  --blue-glow:   rgba(29, 127, 255, 0.15);
  --cyan:        #00d4ff;
  --cyan-dim:    rgba(0, 212, 255, 0.1);
  --purple:      #7c3aed;
  --green:       #059669;
  --amber:       #f59e0b;
  --border:      rgba(29, 127, 255, 0.2);
  --border-sub:  rgba(29, 127, 255, 0.08);
  --grid-line:   rgba(29, 127, 255, 0.055);
  --text:        #ffffff;
  --text2:       #cbe0f5; /* Ice steel-blue for description texts (balanced contrast) */
  --text3:       #93b4d6; /* Muted blue-grey for secondary/comments metadata (balanced contrast) */

  /* Typography */
  --mono:   'Share Tech Mono', monospace;
  --sans:   'Rajdhani', sans-serif;
  --space:  'Space Mono', monospace;
  --body:   system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing */
  --gap-sm: 0.75rem;
  --gap-md: 1.5rem;
  --gap-lg: 3rem;
  --gap-xl: 5rem;

  /* Radius */
  --r: 0px; /* intentionally zero — sharp pixel aesthetic */
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.75;
  letter-spacing: 0.015em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .project-title, .exp-panel-role, .blog-card-title {
  font-family: var(--sans);
  letter-spacing: 0.02em;
}

/* ── CUSTOM CURSOR ── */
#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(29, 127, 255, 0.15), transparent);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
  transition: width 0.2s, height 0.2s, background 0.2s;
  will-change: transform;
}
/* When hovering over clickable elements */
body.hovering #custom-cursor {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle closest-side, rgba(0, 212, 255, 0.3), transparent);
}

/* Precise pointer dot */
#custom-cursor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.8);
  transition: width 0.2s, height 0.2s, background 0.2s;
}

body.hovering #custom-cursor::after {
  width: 8px;
  height: 8px;
  background: var(--cyan);
}

/* Hide the large glowing blob when reading blog posts */
body.reading-mode #custom-cursor {
  background: transparent;
}
body.reading-mode #custom-cursor::after {
  background: var(--blue);
  box-shadow: 0 0 8px rgba(29, 127, 255, 0.8);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; }

/* ── GRID BACKGROUND ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── SCANLINES ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 2px,
    rgba(29, 127, 255, 0.01) 2px, rgba(29, 127, 255, 0.01) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ── AMBIENT ORBS & 3D BG ── */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}

#mouse-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.15) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  filter: blur(40px);
  opacity: 0;
  transition: opacity 0.5s ease;
  will-change: transform;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.1;
}
.orb-1 { width: 600px; height: 600px; background: var(--blue);  top: -150px; left: -150px; }
.orb-2 { width: 400px; height: 400px; background: var(--cyan);  bottom: 5%;  right: -80px; }
.orb-3 { width: 300px; height: 300px; background: var(--purple); top: 50%;   left: 40%;    opacity: 0.05; }

/* ── LAYOUT ── */
section {
  position: relative;
  z-index: 2;
  padding: var(--gap-xl) 0;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 2rem;
}

.alt-bg { 
  background: rgba(8, 15, 30, 0.35); 
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-sub);
  border-bottom: 1px solid var(--border-sub);
  position: relative;
  overflow: hidden;
}

.alt-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 10% 50%, rgba(29, 127, 255, 0.04), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(124, 58, 237, 0.04), transparent 40%);
  z-index: 0;
  pointer-events: none;
}

.alt-bg .container {
  position: relative;
  z-index: 1;
}

/* ── SECTION LABELS ── */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::after {
  content: '';
  flex: 1;
  max-width: 60px;
  height: 1px;
  background: var(--blue-dim);
}

.section-title {
  font-family: var(--sans);
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--gap-lg);
  letter-spacing: -0.01em;
}

/* ── PIXEL CORNERS ── */
.px-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--blue);
  border-style: solid;
  opacity: 0.5;
  transition: opacity 0.3s, border-color 0.3s, box-shadow 0.3s, top 0.3s, left 0.3s, right 0.3s, bottom 0.3s;
}
.px-corner.tl { top: 0; left: 0;  border-width: 2px 0 0 2px; }
.px-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.px-corner.bl { bottom: 0; left: 0;  border-width: 0 0 2px 2px; }
.px-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

/* Explicit Hover Brackets Expansion (works 100% reliably on all elements and pages) */
.project-card:hover > .px-corner.tl,
.skill-card:hover > .px-corner.tl,
.terminal-card:hover > .px-corner.tl,
.blog-card:hover > .px-corner.tl,
.social-link:hover > .px-corner.tl {
  top: -4px;
  left: -4px;
}
.project-card:hover > .px-corner.tr,
.skill-card:hover > .px-corner.tr,
.terminal-card:hover > .px-corner.tr,
.blog-card:hover > .px-corner.tr,
.social-link:hover > .px-corner.tr {
  top: -4px;
  right: -4px;
}
.project-card:hover > .px-corner.bl,
.skill-card:hover > .px-corner.bl,
.terminal-card:hover > .px-corner.bl,
.blog-card:hover > .px-corner.bl,
.social-link:hover > .px-corner.bl {
  bottom: -4px;
  left: -4px;
}
.project-card:hover > .px-corner.br,
.skill-card:hover > .px-corner.br,
.terminal-card:hover > .px-corner.br,
.blog-card:hover > .px-corner.br,
.social-link:hover > .px-corner.br {
  bottom: -4px;
  right: -4px;
}
.project-card:hover > .px-corner,
.skill-card:hover > .px-corner,
.terminal-card:hover > .px-corner,
.blog-card:hover > .px-corner,
.social-link:hover > .px-corner {
  opacity: 1;
  border-color: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-dim);
}

/* ── BUTTONS ── */
.btn {
  display: inline-block;
  font-family: var(--space);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.7rem 1.75rem;
  color: var(--blue);
  background: transparent;
  border: none; /* remove default border that gets clipped */
  transition: color 0.2s;
  position: relative;
  z-index: 1;
}

/* Outer outline border layer */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--blue);
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  z-index: -2;
  transition: background 0.2s, box-shadow 0.2s;
}

/* Inner card body fill inset by 1px to create outline border */
.btn::after {
  content: '';
  position: absolute;
  inset: 1px;
  background: var(--bg);
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  z-index: -1;
  transition: background 0.2s;
}

.btn:hover {
  color: var(--bg);
}

.btn:hover::before {
  background: var(--blue);
  box-shadow: 0 0 24px rgba(29, 127, 255, 0.35);
}

.btn:hover::after {
  background: var(--blue);
}

/* Ghost Button Variations */
.btn-ghost {
  color: var(--text2);
}

.btn-ghost::before {
  background: rgba(29, 127, 255, 0.25); /* increased default visibility outline */
}

.btn-ghost::after {
  background: rgba(8, 15, 30, 0.6); /* subtle glass plate backdrop */
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-ghost:hover::before {
  background: var(--border);
  box-shadow: none;
}

.btn-ghost:hover::after {
  background: transparent;
}

/* ── TAG / CHIP ── */
.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  background: rgba(29, 127, 255, 0.03); /* subtle database chip background */
  border: 1px solid var(--border-sub);
  color: var(--text3);
  text-transform: uppercase;
  transition: all 0.15s;
}
.tag:hover {
  border-color: var(--blue);
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.05);
}

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── TYPOGRAPHY UTILS ── */
.mono  { font-family: var(--mono); }
.cyan  { color: var(--cyan); }
.blue  { color: var(--blue); }
.muted { color: var(--text2); }
.dim   { color: var(--text3); }

/* ── 3D TILT UTILS ── */
.project-card, .skill-card, .terminal-card, .blog-card, .social-link, .nav, .nav-links-group, .nav-logo {
  transform-style: preserve-3d;
}

/* Reset nested elements by default to preserve native subpixel antialiasing when stationary */
.project-title, .project-num, .skill-card-title, .skill-card-icon, .terminal-body, .blog-card-title, .blog-card-date,
.project-metrics, .blog-card-summary, .project-text, .social-icon,
.project-actions, .skill-tags, .terminal-bar, .blog-card-tags, .blog-card-read, .social-link-label {
  transform: translateZ(0px);
  transition: transform 0.25s ease-out;
}

/* Apply parallax depth only on hover to restore razor-sharp rendering in idle state */
.project-card:hover .project-title,
.project-card:hover .project-num,
.skill-card:hover .skill-card-title,
.skill-card:hover .skill-card-icon,
.terminal-card:hover .terminal-body,
.blog-card:hover .blog-card-title,
.blog-card:hover .blog-card-date {
  transform: translateZ(40px);
}

.project-card:hover .project-metrics,
.blog-card:hover .blog-card-summary,
.project-card:hover .project-text,
.social-link:hover .social-icon {
  transform: translateZ(28px);
}

.project-card:hover .project-actions,
.skill-card:hover .skill-tags,
.terminal-card:hover .terminal-bar,
.blog-card:hover .blog-card-tags,
.blog-card:hover .blog-card-read,
.social-link:hover .social-link-label {
  transform: translateZ(18px);
}
