/* =========================
   Variables
========================= */
:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --text-main: #f8fafc;
  --text-dim: #cbd5e1;

  --radius: 12px;
  --shadow-soft: 0 4px 15px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 16px rgba(56, 189, 248, 0.55);

  --container: 900px;
}

/* =========================
   Reset / Base
========================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a {
  text-decoration: none;
  color: var(--primary);
  transition: color 0.25s ease;
}
a:hover { color: var(--primary-hover); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 10px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--bg-card);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  z-index: 2000;
}
.skip-link:focus { left: 12px; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* =========================
   Layout
========================= */
.section {
  padding: 4rem 2rem;
  max-width: var(--container);
  margin: auto;
}

.section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--primary);
  text-shadow: 0 0 10px rgba(0, 171, 250, 0.8);
}

p + p { margin-top: 1.25rem; }

.justificado { text-align: justify; }

/* =========================
   Navbar
========================= */
.site-header { position: sticky; top: 0; z-index: 1000; }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem;
  background-color: var(--bg-card);
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(0, 171, 250, 0.8);
}
.logo a { color: var(--primary); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  display: inline-block;
  font-weight: 700;
  color: inherit;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
  transition: transform 0.25s ease, color 0.25s ease, text-shadow 0.25s ease;
}
.nav-links a:hover {
  text-shadow: 0 0 10px rgba(0, 171, 250, 0.8);
  color: #00abfa;
  transform: translateY(-1px);
}

/* Hamburger button (desktop hidden) */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  position: relative;
  cursor: pointer;
  border: 0;
  background: transparent;
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.hamburger:hover { box-shadow: 0 0 14px rgba(56, 189, 248, 0.45); }
.hamburger:active { transform: scale(0.96); }

.hamburger span {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  border-radius: 3px;
  background: #ffffff;
  transition: transform 0.35s ease, opacity 0.25s ease, top 0.35s ease;
}
.hamburger span:nth-child(1) { top: 14px; }
.hamburger span:nth-child(2) { top: 21px; }
.hamburger span:nth-child(3) { top: 28px; }

/* Open state -> X */
.hamburger.is-open { box-shadow: var(--shadow-glow); }
.hamburger.is-open span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* Mobile menu */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-card);

    display: flex;
    flex-direction: column;
    gap: 0;

    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;

    padding: 0 2rem;
    transition:
      max-height 0.45s cubic-bezier(0.2, 0.9, 0.2, 1),
      opacity 0.25s ease,
      transform 0.25s ease,
      padding 0.25s ease;
  }

  .nav-links li {
    margin: 0;
    padding: 0.9rem 0;
    border-top: 1px solid rgba(56, 189, 248, 0.12);
  }
  .nav-links li:first-child { border-top: none; }

  .nav-links.is-open {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    padding: 0.6rem 2rem 1rem 2rem;
  }
}

/* =========================
   Hero
========================= */
.hero {
  text-align: center;
  padding: 3rem 2rem;
  color: #f1f5f9;
  text-shadow: 0 0 10px rgba(0, 171, 250, 0.8);
  background: linear-gradient(-45deg, #1e3a8a, #0ea5e9, #1e3a8a, #0ea5e9, #1e3a8a);
  background-size: 400% 400%;
  animation: gradientShift 10s ease infinite, shadowPulse 10s ease infinite;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  margin-bottom: 0.5rem;
}
.hero p { font-size: 1.1rem; color: rgba(248,250,252,0.9); }

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes shadowPulse {
  0% { box-shadow: 0 4px 15px rgba(30, 58, 138, 0.5); }
  50% { box-shadow: 0 4px 15px rgba(34, 211, 238, 0.6); }
  100% { box-shadow: 0 4px 15px rgba(30, 58, 138, 0.5); }
}

/* =========================
   Cards (Proyectos)
========================= */
.card {
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  margin-bottom: 2rem;
  border: 1px solid transparent;
  color: var(--text-main);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 171, 250, 0.35);
  border-color: var(--primary);
  background-color: #243146;
}

.card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.card-text { flex: 1; min-width: 200px; }
.card-text h3 { margin-bottom: 0.5rem; }
.card,
.card:hover {
  color: var(--text-main);
}

.card .card-text,
.card:hover .card-text,
.card .card-text h3,
.card:hover .card-text h3,
.card .card-text p,
.card:hover .card-text p {
  color: var(--text-main);
}

@media (max-width: 600px) {
  .card { flex-direction: column; text-align: center; }
  .card img { width: 80px; height: 80px; }
  .card-text { min-width: 0; }
}

/* =========================
   Contact
========================= */
.socials {
  margin-top: 1.5rem;
  display: flex;
  gap: 2rem;
  justify-content: center;
}

.socials img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.socials img:hover {
  transform: scale(1.07);
  box-shadow: 0 8px 20px rgba(0, 171, 250, 0.35);
}

/* =========================
   Footer
========================= */
footer {
  background-color: var(--bg-card);
  color: #94a3b8;
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
}

/* =========================
   Animations
========================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.9s ease forwards; }

/* =========================
   RapidRide layout helpers
========================= */
.page-container { display: flex; flex-direction: column; min-height: 100vh; }
.content { flex: 1; }

.project-details {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  flex-wrap: wrap;
}

.project-details img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: var(--radius);
}

.project-info ul { list-style: none; padding-left: 0; }
.project-info li { margin-bottom: 0.5rem; }

@media (max-width: 600px) {
  .project-details { flex-direction: column; align-items: center; text-align: center; }
  .project-details img { width: 110px; height: 110px; }
}

/* Back button */
.button-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.back-button {
  background-color: var(--primary-hover);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.back-button:hover {
  background-color: #ffffff;
  color: var(--bg-dark);
  transform: translateY(-2px) scale(1.06);
}

.icon-house { width: 1.75rem; height: 1.75rem; }

/* =========================
   Timeline
========================= */
.timeline-container {
  margin-top: 3rem;
  padding: 1rem;
  background-color: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.timeline-container h3 {
  color: var(--primary);
  text-shadow: 0 0 8px rgba(0, 171, 250, 0.8);
  margin-bottom: 2rem;
  text-align: center;
}

.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.timeline::after {
  content: '';
  position: absolute;
  width: 4px;
  background: linear-gradient(to bottom, var(--primary), var(--primary-hover), var(--primary));
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -2px;
  box-shadow: 0 0 10px rgba(0, 171, 250, 0.8);
}

.timeline-item {
  padding: 10px 0;
  position: relative;
  width: 50%;
  opacity: 0;
  transform: translateY(20px);
  animation: slideIn 0.8s ease forwards;
}

.timeline-item:nth-child(odd) { animation-delay: 0.15s; }
.timeline-item:nth-child(even) { animation-delay: 0.3s; }

@keyframes slideIn {
  to { opacity: 1; transform: translateY(0); }
}

.timeline-item:nth-child(odd) { left: 0; padding-right: 30px; }
.timeline-item:nth-child(even) { left: 50%; padding-left: 30px; }

.timeline-content {
  padding: 15px;
  background-color: var(--bg-dark);
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  border: 1px solid var(--primary);
  transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}

.timeline-content:hover,
.timeline-content:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 15px rgba(56, 189, 248, 0.35);
  background-color: var(--bg-card);
}

.timeline-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.timeline-content:hover .timeline-details,
.timeline-content:focus-visible .timeline-details {
  max-height: 1000px;
  opacity: 1;
  padding-top: 15px;
  padding-bottom: 10px;
}

.timeline-details hr {
  border: none;
  border-top: 1px solid rgba(56, 189, 248, 0.25);
  margin: 10px 0;
}

.timeline-details ul { list-style: none; padding-left: 0; font-size: 0.9rem; }
.timeline-details li { margin-bottom: 5px; color: var(--text-dim); }

.timeline-content h4 {
  display: flex;
  align-items: center;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.timeline-content p { font-size: 0.95rem; color: var(--text-dim); margin-top: 0.25rem; }

.timeline-dates { font-weight: 700; color: var(--primary); font-size: 0.9rem; }

.timeline-logo { width: 24px; height: 24px; margin-right: 0.5rem; border-radius: 50%; }

.timeline-dot {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: var(--primary-hover);
  border: 3px solid var(--bg-card);
  top: 30px;
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 0 10px var(--primary-hover), 0 0 20px var(--primary-hover);
}

.timeline-item:nth-child(odd) .timeline-dot { right: -8px; }
.timeline-item:nth-child(even) .timeline-dot { left: -8px; }

.tech-pill-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
}

.tech-pill {
  background-color: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  padding: 4px 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.tech-pill:hover {
  background-color: var(--primary);
  color: var(--bg-dark);
  transform: translateY(-1px);
}

/* Mobile timeline */
@media (max-width: 768px) {
  .timeline {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .timeline::after { left: 20px; z-index: 1; }

  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    width: 100%;
    left: 0 !important;
    padding-left: 50px;
    padding-right: 20px;
  }

  .timeline-item:nth-child(odd) .timeline-dot,
  .timeline-item:nth-child(even) .timeline-dot {
    left: 12px;
    right: auto;
  }

  .timeline-content { width: 100%; }
}
