/* ========================================
   Quick Customize (font sizes / spacing)
   Edit these first when tuning the page.
   ======================================== */
:root {
  --reveal-distance: 30px;
  --project-stagger-step: 90ms;

  --font-size-hero: 1.25rem;
  --font-size-hero-location: 1rem;
  --font-size-type-line: 0.9rem;
  --font-size-project-title: 1.125rem;
  --font-size-project-meta: 0.875rem;
  --font-size-contact-link: 1.125rem;
  --font-size-section-heading: 0.75rem;
  --font-size-footer: 0.75rem;
  --hero-name-type-step-ms: 95;
  --hero-name-type-start-delay-ms: 150;
}

@media (min-width: 768px) {
  :root {
    --font-size-hero: 1.5rem;
    --font-size-hero-location: 1.125rem;
    --font-size-type-line: 1.5rem;
    --font-size-project-title: 1.25rem;
  }
}

.hero-title {
  font-size: var(--font-size-hero);
  line-height: 1.45;
}

.hero-meta-row {
  font-size: var(--font-size-hero-location);
}

.type-line {
  font-size: var(--font-size-type-line);
  line-height: 1.45;
}

.project-item-title {
  font-size: var(--font-size-project-title);
}

.project-item-stack,
.project-item-description {
  font-size: var(--font-size-project-meta);
}

.contact-link {
  font-size: var(--font-size-contact-link);
}

.section-heading {
  font-size: var(--font-size-section-heading);
}

.footer-meta {
  font-size: var(--font-size-footer);
}

.footer-date {
  flex: 0 0 auto;
  white-space: nowrap;
}

.footer-build {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-end;
  gap: 0 0.35rem;
  text-align: right;
  text-wrap: balance;
}

.footer-build-chunk {
  white-space: nowrap;
}

/* ========================================
   CRT Scanline Overlay
   ======================================== */
@keyframes scanline {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

.crt::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  pointer-events: none;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.05) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size:
    100% 2px,
    3px 100%;
}

.scanline-bar {
  width: 100%;
  height: 5px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 51;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.03);
  animation: scanline 8s linear infinite;
}

/* ========================================
   Project Item Hover
   ======================================== */
.project-title {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-item {
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-item.reveal {
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.project-item.reveal:not(.visible) {
  transition-delay: calc(var(--stagger-index, 0) * var(--project-stagger-step));
}

.project-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(22, 163, 74, 0.08);
}

.project-item:hover .project-title {
  color: #16a34a;
  transform: translateX(10px);
}

/* ========================================
   Scroll Reveal Animation
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(var(--reveal-distance));
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stagger delays for child elements */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.35s; }

/* ========================================
   Name Glow Pulse (Terminal Aesthetic)
   ======================================== */
@keyframes glowPulse {
  0%, 100% {
    text-shadow:
      0 0 4px rgba(22, 163, 74, 0),
      0 0 12px rgba(22, 163, 74, 0);
  }
  50% {
    text-shadow:
      0 0 6px rgba(22, 163, 74, 0.15),
      0 0 20px rgba(22, 163, 74, 0.08);
  }
}

.name-glow {
  animation: glowPulse 4s ease-in-out infinite;
}

.hero-name-selected {
  display: inline-block;
  margin-left: 0.18em;
  padding: 0.04em 0.24em 0.08em;
  background: #000;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
}

.hero-name-selected:empty {
  padding: 0;
  background: transparent;
}

/* ========================================
   Enhanced Typing Effect
   ======================================== */
@keyframes typewriter {
  from { max-width: 0; }
  to   { max-width: 100%; }
}

@keyframes blinkCaret {
  0%, 100% { border-right-color: transparent; }
  50%      { border-right-color: #22c55e; }
}

@keyframes line1Caret {
  0%, 96% { border-right-color: #22c55e; }
  100%    { border-right-color: transparent; }
}

@keyframes solidCaret {
  0%, 100% { border-right-color: #22c55e; }
}

.typing-line {
  display: block;
  width: fit-content;
  overflow: hidden;
  white-space: nowrap;
  max-width: 0;
  border-right: 18px solid transparent;
  padding-right: 0;
}

.typing-line-1 {
  animation:
    typewriter 2s steps(40, end) 0.6s forwards,
    line1Caret 2.6s linear 0s forwards;
}

.typing-line-2 {
  animation:
    typewriter 1.8s steps(35, end) 2.6s forwards,
    solidCaret 1.8s linear 2.6s forwards,
    blinkCaret 0.75s step-end 4.4s infinite;
}

/* ========================================
   Mobile tuning
   ======================================== */
@media (max-width: 767.98px) {
  .hero-title {
    line-height: 1.35;
  }

  .type-line {
    line-height: 1.4;
  }

  .typing-line,
  .typing-line-1,
  .typing-line-2 {
    border-right-width: 12px;
  }

  .scroll-hint-wrap {
    bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .scroll-hint-link {
    font-size: 0.68rem;
    padding: 0.42rem 0.64rem;
  }
}

/* ========================================
   Cursor Glow Follower
   ======================================== */
.cursor-glow {
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    circle,
    rgba(22, 163, 74, 0.06) 0%,
    rgba(22, 163, 74, 0.02) 40%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  opacity: 0;
}

.cursor-glow.active {
  opacity: 1;
}

/* ========================================
   Header entrance stagger
   ======================================== */
@keyframes headerFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-animate {
  animation: headerFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.header-animate-delay {
  animation: headerFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
  opacity: 0;
}

/* ========================================
   Availability dot enhanced
   ======================================== */
@keyframes dotPing {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  75%, 100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.availability-ring {
  position: relative;
}

.availability-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-color: #22c55e;
  animation: dotPing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ========================================
   Section divider subtle line
   ======================================== */
.section-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.08) 20%,
    rgba(22, 163, 74, 0.15) 50%,
    rgba(0, 0, 0, 0.08) 80%,
    transparent 100%
  );
  margin: 0 auto;
  max-width: 80%;
}

/* ========================================
   Scroll hint to works section
   ======================================== */
@keyframes scrollHintBounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.65;
  }
  50% {
    transform: translateY(5px);
    opacity: 1;
  }
}

.scroll-hint-wrap {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 30;
  transform: translateX(-50%);
  pointer-events: none;
}

.scroll-hint-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #6b7280;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(107, 114, 128, 0.35);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  transition: color 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
  pointer-events: auto;
}

.scroll-hint-link:hover {
  color: #16a34a;
}

.scroll-hint-link.is-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.scroll-hint-icon {
  font-size: 0.95rem;
  animation: scrollHintBounce 1.4s ease-in-out infinite;
}

/* ========================================
   Footer hover effect
   ======================================== */
footer span {
  transition: color 0.3s ease;
}

footer:hover span {
  color: #6b7280;
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .header-animate,
  .header-animate-delay {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  .typing-line,
  .typing-line-1,
  .typing-line-2,
  .name-glow,
  .scroll-hint-icon,
  .scanline-bar,
  .availability-ring::before {
    animation: none !important;
  }

  .typing-line {
    width: auto;
    max-width: none;
    border-right: 0;
  }

  .crt::before,
  .cursor-glow {
    display: none;
  }
}
