/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Colors */
  --bg: #0a0a0a;
  --bg-card: #111;
  --bg-hover: #1a1a1a;
  --text: #fff;
  --text-dim: #777;
  --accent: #00b5e2;

  /* Typography */
  --font: "Outfit", system-ui, sans-serif;

  /* Spacing */
  --section-padding: 100px;
  --container-padding: clamp(20px, 5vw, 40px);

  /* Transitions - Apple-like cubic-bezier curves */
  --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-apple-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 0.25s var(--ease-apple);
  --transition-normal: 0.35s var(--ease-apple);
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-dim);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Hide scrollbars globally */
* {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

*::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* Utility classes */
.accent {
  color: var(--accent);
}

.white {
  color: var(--text);
}

/* ============================================
   MOUSE GLOW EFFECT
   Follows cursor with smooth interpolation
   Optimized for Safari with transforms
   ============================================ */
.mouse-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 181, 226, 0.2) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  /* Centering handled in JS via transform now, but keeping base here */
  transform: translate(-50%, -50%);
  filter: blur(80px);
  will-change: transform;
  /* Changed from left, top */
  opacity: 0;
  transition: opacity 0.6s var(--ease-apple);
}

.mouse-glow.visible {
  opacity: 1;
}

/* ============================================
   DECORATIVE GLOWS
   Static ambient lighting throughout the page
   ============================================ */
.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(120px);
  -webkit-filter: blur(120px);
  z-index: 0;
}

/* Loader glow - centered, pulsing (same as mouse glow) */
.glow--loader {
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(0, 181, 226, 0.2) 0%,
    transparent 70%
  );
  top: 50%;
  left: 50%;
  /* Original transform */
  transform: translate(-50%, -50%);
  filter: blur(80px);
  /* Added -webkit- prefix for animation */
  -webkit-animation: glowPulse 4s cubic-bezier(0.42, 0, 0.58, 1) infinite;
  animation: glowPulse 4s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

/* Hero glow - near calendar, coming from edge */
.glow--hero {
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(0, 181, 226, 0.2) 0%,
    transparent 70%
  );
  top: 50%;
  right: -250px;
  transform: translateY(-50%) translateZ(0);
}

/* About glow - left side */
.glow--about {
  width: 450px;
  height: 450px;
  background: radial-gradient(
    circle,
    rgba(0, 181, 226, 0.2) 0%,
    transparent 70%
  );
  top: 50%;
  left: -150px;
  transform: translateY(-50%) translateZ(0);
}

/* Contact glow - centered behind heading */
.glow--contact {
  width: 600px;
  height: 400px;
  background: radial-gradient(
    ellipse,
    rgba(0, 181, 226, 0.2) 0%,
    transparent 70%
  );
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(0);
}

/* Safari / WebKit Keyframes */
@-webkit-keyframes glowPulse {
  0%,
  100% {
    opacity: 0.6;
    -webkit-transform: translate(-50%, -50%) scale(1);
  }

  50% {
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale(1.1);
  }
}

/* Standard Keyframes */
@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* ============================================
   LOADER
   Shows aaa. logo on page load
   ============================================ */
body.loading,
html:has(body.loading) {
  overflow: hidden !important;
  height: 100%;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.5s var(--ease-apple),
    visibility 0.5s var(--ease-apple);
}

.loader.done {
  opacity: 0;
  visibility: hidden;
}

.loader__logo {
  font-size: clamp(48px, 12vw, 90px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

/* ============================================
   SITE CONTAINER
   ============================================ */
.site {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.5s var(--ease-apple);
}

.site.visible {
  opacity: 1;
}

/* ============================================
   NAVIGATION
   Fixed header with gradient shadow
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--container-padding);
}

/* Gradient shadow from top */
.nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(
    to bottom,
    var(--bg) 0%,
    var(--bg) 50%,
    transparent 100%
  );
  z-index: -1;
}

.nav__logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav__lang {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 8px;
  transition: background var(--transition-fast);
}

.nav__lang:hover {
  background: var(--bg-hover);
}

.nav__lang-option {
  color: var(--text-dim);
  transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav__lang-divider {
  color: rgba(255, 255, 255, 0.2);
}

/* Active language state */
[data-lang="es"] .nav__lang-option[data-lang-value="es"],
[data-lang="en"] .nav__lang-option[data-lang-value="en"] {
  color: var(--accent);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
  padding: 120px var(--container-padding) var(--section-padding);
}

.hero__content {
  max-width: 600px;
}

.hero__greeting {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.hero__title {
  font-size: clamp(64px, 16vw, 150px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin-bottom: 28px;
}

/* Name hover animation */
.name-hover {
  cursor: pointer;
  display: inline-block;
}

.name-extra {
  display: block;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.name-hover:hover .name-extra {
  max-height: 200px;
}

.hero__cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  max-width: 400px;
}

.hero__social {
  display: flex;
  gap: 16px;
}

.hero__social a {
  color: var(--text-dim);
  transition: color var(--transition-fast);
}

.hero__social a:hover {
  color: var(--accent);
}

.hero__social svg {
  width: 24px;
  height: 24px;
}

/* GitHub Contributions Calendar */
.contrib-calendar {
  display: block;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px 20px;
  flex-shrink: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.contrib-calendar__months {
  display: flex;
  gap: 52px;
  margin-bottom: 8px;
  margin-left: 36px;
  font-size: 12px;
}

.contrib-calendar__wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.contrib-calendar__scrollable {
  display: inline-block;
  min-width: 100%;
}

.contrib-calendar__inner {
  display: flex;
  gap: 6px;
}

.contrib-calendar__days {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  width: 30px;
  text-align: right;
  padding-right: 4px;
}

.contrib-calendar__days span {
  height: 12px;
  line-height: 12px;
  margin-bottom: 3px;
}

.contrib-calendar__grid {
  display: flex;
  gap: 4px;
}

.contrib-calendar__week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contrib-calendar__day {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #161b22;
}

/* Custom tooltip */

.contrib-calendar__day[data-level="1"] {
  background: rgba(0, 181, 226, 0.3);
}

.contrib-calendar__day[data-level="2"] {
  background: rgba(0, 181, 226, 0.5);
}

.contrib-calendar__day[data-level="3"] {
  background: rgba(0, 181, 226, 0.75);
}

.contrib-calendar__day[data-level="4"] {
  background: #00b5e2;
}

.contrib-calendar__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
}

.contrib-calendar__legend {
  display: flex;
  align-items: center;
  gap: 4px;
}

.contrib-calendar__level {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #161b22;
}

.contrib-calendar__level[data-level="1"] {
  background: rgba(0, 181, 226, 0.3);
}

.contrib-calendar__level[data-level="2"] {
  background: rgba(0, 181, 226, 0.5);
}

.contrib-calendar__level[data-level="3"] {
  background: rgba(0, 181, 226, 0.75);
}

.contrib-calendar__level[data-level="4"] {
  background: #00b5e2;
}

/* ============================================
   CARDS
   Unified card design for all info cards
   ============================================ */
.card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.card:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.card svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Availability dot animation */
.card__dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2.5s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

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

  50% {
    opacity: 0.4;
  }
}

/* Email card variant - primary */
.card--email {
  font-size: clamp(14px, 2.5vw, 20px);
  font-weight: 600;
  padding: 12px 24px;
}

/* Form card variant - secondary but prominent */
.card--form {
  font-size: clamp(13px, 2vw, 16px);
  font-weight: 600;
  padding: 10px 20px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 8px;
  transition:
    box-shadow var(--transition-normal),
    background var(--transition-fast),
    color var(--transition-fast);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover {
  box-shadow: 0 10px 35px rgba(0, 181, 226, 0.35);
}

.btn--secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

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

/* ============================================
   SECTIONS
   Consistent padding across all sections
   ============================================ */
.section {
  position: relative;
  padding: var(--section-padding) var(--container-padding);
}

.section__tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 20px;
  padding: 5px 12px;
  background: rgba(0, 181, 226, 0.1);
  border-radius: 4px;
}

.section__heading {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 24px;
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about__content {
  max-width: 560px;
}

.about__text {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 14px;
}

.about__text:last-child {
  margin-bottom: 0;
}

/* Experience Section */
.experience {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.experience__item {
  display: block;
  padding: 20px 24px;
  background: var(--bg-card);
  border-radius: 10px;
  transition: background var(--transition-fast);
}

.experience__item:hover {
  background: var(--bg-hover);
}

.experience__item:hover .experience__company {
  color: var(--accent);
}

.experience__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.experience__row:last-of-type {
  margin-bottom: 10px;
}

.experience__company {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition-fast);
}

.experience__location {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.experience__role {
  font-size: 14px;
  color: var(--accent);
}

.experience__date {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.experience__desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Projects Section */
.projects {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.project {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 10px;
  transition: background var(--transition-fast);
  min-width: 0;
  overflow: hidden;
}

.project:hover {
  background: var(--bg-hover);
}

.project:hover .project__title {
  color: var(--accent);
}

.project:hover .project__arrow {
  opacity: 1;
  transform: translateX(0);
}

.project__info {
  flex: 1;
  min-width: 0;
}

.project__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.project__arrow {
  font-size: 11px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition-fast);
}

.project__desc {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project__lang {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  background: rgba(0, 181, 226, 0.1);
  color: var(--accent);
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================
   CONTACT SECTION
   ============================================ */
#contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.contact__heading {
  font-size: clamp(40px, 10vw, 80px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 32px;
}

.contact__form-link {
  display: block;
  margin-top: 24px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition-fast);
}

.contact__form-link:hover {
  color: var(--accent);
}

.contact__links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.contact__links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: color var(--transition-fast);
}

.contact__links a:hover {
  color: var(--text);
}

/* ============================================
   FOOTER
   Gradient shadow from bottom
   ============================================ */
.footer {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 100px var(--container-padding) 24px;
  font-size: 12px;
}

/* Gradient shadow from bottom */
.footer::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    var(--bg) 30%,
    transparent 100%
  );
  z-index: -1;
  pointer-events: none;
}

.footer__logo {
  font-size: 18px;
  font-weight: 800;
}

.footer__tagline {
  color: var(--text-dim);
  transition: color var(--transition-fast);
}

.footer__tagline:hover {
  color: var(--accent);
}

.footer__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.footer__infra {
  font-family: "Red Hat Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.footer__infra:hover {
  opacity: 1;
}

.footer__year {
  color: var(--text-dim);
  text-align: right;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
  }

  /* Calendar: respect margins when stacked */
  .contrib-calendar {
    width: calc(100vw - 2 * var(--container-padding));
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  :root {
    --section-padding: 80px;
  }

  .hero__cards {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Calendar: use same padding as container */
  .contrib-calendar {
    width: calc(100vw - 2 * var(--container-padding));
  }

  /* Only hide mouse glow on mobile, keep decorative glows at full size */
  .mouse-glow {
    display: none;
  }

  .project {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .project__desc {
    white-space: normal;
  }

  .contact__links {
    flex-direction: column;
    gap: 12px;
  }

  /* Footer: keep 3-column grid on mobile (same as links page) */
  .footer__year {
    text-align: right;
  }
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .mouse-glow {
    display: none;
  }
}
