/* ============================================
   CSS Variables & Theme Configuration
   ============================================ */

:root {
  /* Brand Colors */
  --yellow: #ffd24c;
  --light-yellow: #ffe69a;
  --blue: #92b4ec;
  --white: #ffffff;
  --black: #2e2b28;
  --grey: #f2f2f2;

  /* Light Theme */
  --bg-primary: var(--white);
  --bg-secondary: var(--grey);
  --text-primary: var(--black);
  --text-secondary: #666666;
  --card-bg: var(--white);
  --card-shadow: rgba(46, 43, 40, 0.08);
  --card-hover-shadow: rgba(46, 43, 40, 0.15);
  --border-color: rgba(46, 43, 40, 0.1);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Animation */
  --transition-speed: 0.3s;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #1a1816;
  --bg-secondary: #2e2b28;
  --text-primary: #f2f2f2;
  --text-secondary: #b8b5b2;
  --card-bg: #2e2b28;
  --card-shadow: rgba(0, 0, 0, 0.3);
  --card-hover-shadow: rgba(0, 0, 0, 0.5);
  --border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Montserrat — Fuentes locales
   ============================================ */

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  src: url("../fonts/montserrat/montserrat-v31-latin-regular.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: italic;
  font-weight: 400;
  src: url("../fonts/montserrat/montserrat-v31-latin-italic.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500;
  src: url("../fonts/montserrat/montserrat-v31-latin-500.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600;
  src: url("../fonts/montserrat/montserrat-v31-latin-600.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  src: url("../fonts/montserrat/montserrat-v31-latin-700.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 800;
  src: url("../fonts/montserrat/montserrat-v31-latin-800.woff2") format("woff2");
}

/* ============================================
   Reset & Base Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition:
    background-color var(--transition-speed) var(--transition-smooth),
    color var(--transition-speed) var(--transition-smooth);
  overflow-x: hidden;
}

/* ============================================
   Theme Toggle Button
   ============================================ */

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 50px;
  height: 50px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all var(--transition-speed) var(--transition-smooth);
  box-shadow: 0 4px 12px var(--card-shadow);
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 6px 20px var(--card-hover-shadow);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  position: absolute;
  transition: all var(--transition-speed) var(--transition-smooth);
  color: var(--text-primary);
}

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

.moon-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .sun-icon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

[data-theme="dark"] .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ============================================
   Container & Layout
   ============================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .container {
    padding: 3rem 2rem;
  }
}

/* ============================================
   Profile Section
   ============================================ */

.profile-section {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  animation: fadeInDown 0.8s var(--transition-smooth);
}

.avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--spacing-md);
  background: linear-gradient(135deg, var(--blue), var(--yellow));
  border-radius: 50%;
  padding: 4px;
  animation: pulse 2s ease-in-out infinite;
  overflow: hidden;
}

.avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.logo {
  position: relative;
  display: inline-block;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: var(--spacing-sm);
  padding-bottom: 8px;
}

.logo span {
  color: var(--blue);
}

.logo::before {
  content: "";
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 12px;
  background-color: var(--light-yellow);
  opacity: 0.75;
  z-index: -1;
  animation: slideIn 0.6s var(--transition-smooth) 0.3s backwards;
}

@media (min-width: 768px) {
  .logo {
    font-size: 3.5rem;
  }

  .logo::before {
    height: 15px;
    bottom: 22px;
    width: 220px;
  }
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-md);
}

@media (min-width: 768px) {
  .subtitle {
    font-size: 1.125rem;
  }
}

/* ============================================
   Social Links (perfil)
   ============================================ */

.social-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition-speed) var(--transition-smooth);
  box-shadow: 0 2px 6px var(--card-shadow);
}

.social-link:hover {
  transform: translateY(-4px);
  border-color: var(--yellow);
  box-shadow: 0 6px 16px var(--card-hover-shadow);
}

.social-link img {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) saturate(100%);
}

[data-theme="dark"] .social-link img {
  filter: brightness(0) saturate(100%) invert(90%);
}

/* ============================================
   Projects Section
   ============================================ */

.projects-section {
  animation: fadeInUp 0.8s var(--transition-smooth) 0.2s backwards;
}

.section-heading {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--yellow), transparent);
  border-radius: 2px;
}

/* ============================================
   Projects Grid
   ============================================ */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ============================================
   Project Card
   ============================================ */

.project-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: all var(--transition-speed) var(--transition-smooth);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px var(--card-hover-shadow);
  border-color: var(--yellow);
}

.project-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Thumbnail */
.project-thumbnail {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: var(--bg-secondary);
  position: relative;
}

.project-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.project-card:hover .project-thumbnail img {
  transform: scale(1.05);
}

.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--yellow) 100%);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--black);
  opacity: 0.8;
  letter-spacing: 3px;
}

/* Card Body */
.project-body {
  padding: 1.375rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.625rem;
}

.project-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.25px;
}

.project-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

/* Tech Badges */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-wordpress {
  background: rgba(33, 117, 155, 0.12);
  color: #21759B;
  border: 1px solid rgba(33, 117, 155, 0.3);
}

[data-theme="dark"] .badge-wordpress {
  color: #4aabcf;
  border-color: rgba(74, 171, 207, 0.3);
  background: rgba(74, 171, 207, 0.1);
}

.badge-php {
  background: rgba(136, 146, 191, 0.18);
  color: #8892BF;
  border: 1px solid rgba(136, 146, 191, 0.4);
}

.badge-mysql {
  background: rgba(0, 117, 143, 0.12);
  color: #00758F;
  border: 1px solid rgba(0, 117, 143, 0.3);
}

[data-theme="dark"] .badge-mysql {
  color: #00a8cc;
  border-color: rgba(0, 168, 204, 0.3);
  background: rgba(0, 168, 204, 0.1);
}

.badge-js {
  background: rgba(247, 223, 30, 0.18);
  color: #9c7a00;
  border: 1px solid rgba(247, 223, 30, 0.5);
}

[data-theme="dark"] .badge-js {
  color: #F7DF1E;
  border-color: rgba(247, 223, 30, 0.4);
  background: rgba(247, 223, 30, 0.1);
}

/* Arrow indicator */
.project-arrow {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.5rem;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 600;
  gap: 0.375rem;
  opacity: 0;
  transform: translateX(-6px);
  transition: all var(--transition-speed) var(--transition-smooth);
}

.project-card:hover .project-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   Disclaimer
   ============================================ */

.disclaimer {
  margin-top: 1.5rem;
  padding: 0.875rem 1.125rem;
  background: var(--bg-secondary);
  border-left: 3px solid var(--yellow);
  border-radius: 0 10px 10px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.disclaimer strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
  animation: fadeIn 1s var(--transition-smooth) 0.8s backwards;
}

.footer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ============================================
   Background Decoration
   ============================================ */

.background-decoration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.background-decoration::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--light-yellow) 0%, transparent 70%);
  opacity: 0.15;
  animation: float 20s ease-in-out infinite;
}

.background-decoration::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--blue) 0%, transparent 70%);
  opacity: 0.1;
  animation: float 25s ease-in-out infinite reverse;
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { width: 0; opacity: 0; }
  to { width: 160px; opacity: 0.75; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(146, 180, 236, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(146, 180, 236, 0); }
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 480px) {
  .theme-toggle {
    width: 44px;
    height: 44px;
    top: 1rem;
    right: 1rem;
  }

  .logo {
    font-size: 2rem;
  }
}

/* ============================================
   Accessibility
   ============================================ */

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

.theme-toggle:focus-visible,
.project-card:focus-visible,
.social-link:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
