/* ==========================================================================
   VARIABLES & BASE RESETS
   ========================================================================== */
:root {
  --ink: #0d0406;
  --ink-2: #14070a;
  --ink-3: #1c0a0e;
  --bone: #f7f1ed;
  --smoke: #9e908b;
  --maroon: #a31d2c;
  --maroon-light: #d63c4e;
  --maroon-deep: #4a0a12;
  --maroon-glow: rgba(163, 29, 44, 0.4);
  --hair: rgba(247, 241, 237, 0.06);
  --glass: rgba(20, 7, 10, 0.7);
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Inter", sans-serif;
  background: var(--ink);
  color: var(--bone);
  overflow-x: hidden;
}
.font-display {
  font-family: "Fraunces", serif;
}
::selection {
  background: var(--maroon);
  color: var(--bone);
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--ink);
}
::-webkit-scrollbar-thumb {
  background: var(--maroon-deep);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--maroon-light);
}

/* ==========================================================================
   GLOBAL UTILITIES & INTERACTION DECORATIONS
   ========================================================================== */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--maroon), var(--maroon-light));
  z-index: 100;
  transition: width 0.1s linear;
}
#grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Custom Fine Pointer Devices Cursor */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition:
    opacity 0.3s ease,
    width 0.3s,
    height 0.3s;
}
.cursor-dot {
  width: 5px;
  height: 5px;
  background: var(--maroon-light);
}
.cursor-ring {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(214, 60, 78, 0.3);
}
body:not(.fine-pointer) .cursor-dot,
body:not(.fine-pointer) .cursor-ring {
  display: none;
}
.cursor-active .cursor-ring {
  width: 60px;
  height: 60px;
  background: rgba(214, 60, 78, 0.05);
  border-color: var(--maroon-light);
}

/* Nav Links & Custom Buttons */
.nav-link {
  position: relative;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  height: 1px;
  width: 0;
  background: var(--maroon-light);
  transform: translateX(-50%);
  transition: width 0.35s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}
.nav-link:hover,
.nav-link.active {
  color: var(--maroon-light);
}

.btn-maroon {
  background: linear-gradient(135deg, var(--maroon-light), var(--maroon));
  color: var(--bone);
  font-weight: 500;
  letter-spacing: 0.05em;
  box-shadow: 0 10px 30px -10px var(--maroon-glow);
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}
.btn-maroon:hover {
  box-shadow: 0 15px 35px -5px var(--maroon-glow);
}
.btn-ghost {
  border: 1px solid rgba(247, 241, 237, 0.15);
  color: var(--bone);
  letter-spacing: 0.05em;
  transition:
    border-color 0.3s,
    background 0.3s;
}
.btn-ghost:hover {
  border-color: var(--maroon-light);
  background: rgba(163, 29, 44, 0.08);
}
.magnetic {
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Section Headings Decorator */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--maroon-light);
  font-weight: 600;
}
.eyebrow::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--maroon-light);
}

/* General Cards & Interactive Tech Chips */
.card {
  background: linear-gradient(180deg, var(--ink-2), var(--ink-3));
  border: 1px solid var(--hair);
  backdrop-filter: blur(10px);
  transition:
    border-color 0.5s ease,
    transform 0.5s ease,
    box-shadow 0.5s ease;
}
.card:hover {
  border-color: rgba(214, 60, 78, 0.3);
  transform: translateY(-6px);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8);
}

.chip {
  font-size: 0.75rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(247, 241, 237, 0.02);
  border: 1px solid var(--hair);
  color: var(--smoke);
  transition: all 0.3s ease;
}
.chip:hover {
  color: var(--bone);
  border-color: rgba(214, 60, 78, 0.4);
  background: rgba(163, 29, 44, 0.15);
  transform: scale(1.05);
}

/* ==========================================================================
   PORTFOLIO ADVANCED FILTER BUTTONS & ACTIONS
   ========================================================================== */
.filter-btn {
  padding: 0.6rem 1.5rem;
  border: 1px solid rgba(247, 241, 237, 0.1);
  border-radius: 999px;
  color: var(--smoke);
  transition: all 0.4s ease;
}
.filter-btn:hover,
.filter-btn.active {
  color: var(--bone);
  border-color: var(--maroon-light);
  background: rgba(163, 29, 44, 0.12);
}

/* Action Project Buttons */
.btn-project-detail {
  flex: 1;
  padding: 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  background: rgba(247, 241, 237, 0.04);
  border: 1px solid var(--hair);
  color: var(--bone);
  transition:
    background 0.3s,
    border-color 0.3s;
}
.btn-project-detail:hover {
  background: rgba(247, 241, 237, 0.09);
  border-color: rgba(247, 241, 237, 0.2);
}

.btn-project-live {
  flex: 1;
  padding: 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  background: var(--maroon);
  color: var(--bone);
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.3s;
}
.btn-project-live:hover {
  background: var(--maroon-light);
}

/* ==========================================================================
   HIGH-END GLASSMORPHISM POP-UP MODAL OVERLAY
   ========================================================================== */
.project-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(13, 4, 6, 0.75);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.project-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.project-modal-box {
  transform: translateY(30px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.project-modal-overlay.active .project-modal-box {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 2rem;
  color: var(--smoke);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  z-index: 10;
  transition: color 0.2s;
}
.modal-close-btn:hover {
  color: var(--maroon-light);
}

/* Marquee & Sections Decorator Track */
.marquee-row {
  overflow: hidden;
  white-space: nowrap;
}
.marquee-track {
  display: flex;
  width: max-content;
  gap: 4rem;
  animation: marquee 28s linear infinite;
}
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(35px);
  transition:
    opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.d1 {
  transition-delay: 0.1s;
}
.d2 {
  transition-delay: 0.2s;
}
.d3 {
  transition-delay: 0.3s;
}

.timeline-line {
  background: linear-gradient(
    180deg,
    var(--maroon-light) 0%,
    rgba(214, 60, 78, 0.05) 100%
  );
}
.timeline-node {
  box-shadow:
    0 0 0 4px var(--ink),
    0 0 20px var(--maroon-glow);
}

.avatar-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px dashed rgba(214, 60, 78, 0.3);
  animation: spin 40s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.avatar-core {
  background: radial-gradient(
    circle at 35% 30%,
    var(--maroon-light),
    var(--maroon) 60%,
    #2b0409 100%
  );
}

.tile-art {
  background:
    radial-gradient(
      circle at 10% 10%,
      rgba(214, 60, 78, 0.15),
      transparent 50%
    ),
    var(--ink-3);
}
.tile-icon {
  transition: transform 0.8s ease;
}
.project-card:hover .tile-icon {
  transform: scale(1.1) rotate(-2deg);
}

.field {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(247, 241, 237, 0.1);
  padding: 0.9rem 0.25rem;
  width: 100%;
  color: var(--bone);
  font-size: 0.95rem;
  transition: border-color 0.4s;
}
.field:focus {
  outline: none;
  border-color: var(--maroon-light);
}

#back-to-top {
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition:
    opacity 0.4s,
    transform 0.4s;
}
#back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#mobile-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}
#mobile-panel.open {
  max-height: 340px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
