/* ==========================================================================
   Theme variables & tokens
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #0f0f0f;
  --card: #111111;
  --card-hover: #141414;
  --text: #f2f2f2;
  --text-muted: #8a8a8a;
  --text-dim: #5c5c5c;
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --dot-grid: rgba(255, 255, 255, 0.035);
  --font: "JetBrains Mono", "IBM Plex Mono", "Space Mono", ui-monospace, monospace;
}

.light {
  --bg: #f4f4f0;
  --bg-elevated: #ecece8;
  --card: #ffffff;
  --card-hover: #fafafa;
  --text: #0d0d0d;
  --text-muted: #5a5a5a;
  --text-dim: #888888;
  --accent: #0d0d0d;
  --accent-dim: rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --dot-grid: rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   Dot grid background
   ========================================================================== */

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(circle, var(--dot-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ==========================================================================
   Theme toggle icon morph animation
   ========================================================================== */

.theme-toggle__icon {
  position: absolute;
  width: 18px;
  height: 18px;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.25s ease;
}

:not(.light) .theme-toggle__icon--moon,
.dark .theme-toggle__icon--moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

:not(.light) .theme-toggle__icon--sun,
.dark .theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(90deg) scale(0);
  pointer-events: none;
}

.light .theme-toggle__icon--sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.light .theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
  pointer-events: none;
}

/* ==========================================================================
   Hero cursor blinking animation
   ========================================================================== */

.hero__cursor {
  display: inline-block;
  margin-left: 2px;
  font-weight: 400;
  user-select: none;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* ==========================================================================
   Portrait frame corner brackets
   ========================================================================== */

.portrait-frame__corners::before,
.portrait-frame__corners::after,
.portrait-frame::after,
.portrait-frame::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(255, 255, 255, 0.2);
  border-style: solid;
  pointer-events: none;
}

.light .portrait-frame__corners::before,
.light .portrait-frame__corners::after,
.light .portrait-frame::after,
.light .portrait-frame::before {
  border-color: rgba(0, 0, 0, 0.2);
}

.portrait-frame::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.portrait-frame::after {
  top: -1px;
  right: -1px;
  border-width: 1px 1px 0 0;
}

.portrait-frame__corners::before {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 1px 1px;
}

.portrait-frame__corners::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 1px 1px 0;
}

@media (max-width: 767px) {
  .portrait-frame__corners::before,
  .portrait-frame__corners::after,
  .portrait-frame::after,
  .portrait-frame::before {
    width: 12px;
    height: 12px;
  }
}

/* ==========================================================================
   Tech marquee infinite scroll & masks
   ========================================================================== */

.tech-marquee__row {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  display: flex;
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 1) 4%,
    rgba(0, 0, 0, 1) 96%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 1) 4%,
    rgba(0, 0, 0, 1) 96%,
    transparent 100%
  );
}

.tech-marquee__track {
  display: flex;
  width: max-content;
  user-select: none;
}

.tech-marquee__group {
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
  padding-right: 16px;
  flex-shrink: 0;
  animation: techMarqueeScroll 40s linear infinite;
  will-change: transform;
}

.tech-marquee__group--reverse {
  animation-name: techMarqueeScrollReverse;
  animation-duration: 40s;
}

.tech-marquee__row:hover .tech-marquee__group,
.tech-marquee__row:active .tech-marquee__group,
.tech-marquee__row:focus-within .tech-marquee__group {
  animation-play-state: paused;
}

@keyframes techMarqueeScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

@keyframes techMarqueeScrollReverse {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@media (max-width: 767px) {
  .tech-marquee__group {
    gap: 12px;
    padding-right: 12px;
    animation-duration: 30s;
  }
}

.nextjs-badge-circle {
  fill: #000000;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 3px;
}

.light .nextjs-badge-circle {
  stroke: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Subtle reveal animation
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .tech-marquee__group {
    animation-play-state: paused;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}