/* ============================================
   OSCAR RAMOS LOPEZ — Personal Site
   Dark Professional Theme — Mobile First
   ============================================ */

/* --- Variables --- */
:root {
  --bg:         #0f172a;
  --bg-alt:     #1e293b;
  --bg-card:    #1e293b;
  --accent:     #38bdf8;
  --accent-dim: #0ea5e9;
  --green:      #4ade80;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --border:     #334155;
  --platzi:     #98ca3f;
  --udemy:      #a435f0;

  --nav-h:      64px;
  --radius:     12px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(0,0,0,.35);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  /* Offset anchors so sticky nav doesn't cover them */
  scroll-padding-top: var(--nav-h);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* Prevent horizontal scroll from hover transforms */
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================
   NAVIGATION
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: 1rem;
}

.nav__logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  flex-shrink: 0;
}
.nav__logo span { color: var(--accent); }

/* Desktop links */
.nav__links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav__links a {
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav__links a:hover { color: var(--text); background: var(--bg-alt); }

/* Hamburger button */
.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}

.nav__burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}

/* Burger → X when open */
.nav--open .nav__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav--open .nav__burger span:nth-child(2) { opacity: 0; }
.nav--open .nav__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #0f172a;
}
.btn--primary:hover { background: var(--accent-dim); }

.btn--outline {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }

.btn--sm {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  align-self: flex-start;
}
.badge--green {
  background: rgba(74, 222, 128, 0.12);
  color: var(--green);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag--sm {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.hero__stack,
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: 3rem 0 2.5rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Subtle background grid */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.15;
  pointer-events: none;
}

/* Radial gradient overlay */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 30% 50%, rgba(56,189,248,.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

.hero__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.hero__name {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: clamp(-0.5px, -0.03em, -1.5px);
  color: var(--text);
}

.hero__title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
}

.hero__subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

.hero__location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.15rem;
}

.hero__stack {
  justify-content: center;
}

.hero__photo { flex-shrink: 0; }

.hero__photo img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--border);
  box-shadow: 0 0 0 6px rgba(56,189,248,.08), var(--shadow);
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
  padding: 3rem 0;
}

.section--alt {
  background: var(--bg-alt);
}

.section__title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
  position: relative;
  padding-bottom: 0.75rem;
}

.section__title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.section__subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* ============================================
   ABOUT
   ============================================ */
.about__grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1.75rem;
}

.about__text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.about__text p {
  color: var(--text-muted);
  line-height: 1.75;
  font-size: 0.95rem;
}

.about__text strong { color: var(--text); }

.about__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat__number {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
}

.timeline__item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 0 1rem;
}

.timeline__marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.4rem;
}

.timeline__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-alt);
  box-shadow: 0 0 0 3px rgba(56,189,248,.2);
  flex-shrink: 0;
}

.timeline__line {
  flex: 1;
  width: 2px;
  background: var(--border);
  margin-top: 6px;
  min-height: 1.5rem;
}

.timeline__item:last-child .timeline__line { display: none; }

.timeline__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  transition: border-color .2s;
  min-width: 0;
}
.timeline__card:hover { border-color: rgba(56,189,248,.35); }

.timeline__header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.timeline__company {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.timeline__role {
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 500;
}

.timeline__date {
  font-size: 0.77rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
  align-self: flex-start;
}

.timeline__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.9rem;
}
.timeline__desc strong { color: var(--text); }

/* ============================================
   CREDENTIALS (Formación y Registro)
   ============================================ */
.credentials {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.75rem;
}

.credential {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  align-items: center;
  min-width: 0;
  transition: border-color .2s;
}
.credential:hover { border-color: rgba(56,189,248,.3); }

.credential--official {
  border-color: rgba(74, 222, 128, 0.3);
  background: linear-gradient(135deg, rgba(74,222,128,.04) 0%, var(--bg-card) 60%);
}
.credential--official:hover { border-color: rgba(74, 222, 128, 0.6); }

.credential__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.3;
}

.credential__badge--edu {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.2);
  color: var(--accent);
}

.credential__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.credential__entity {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.credential__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.credential__sub {
  font-size: 0.83rem;
  color: var(--text-muted);
}
.credential__sub strong { color: var(--accent); }

.credential__desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 0.15rem;
}

@media (max-width: 560px) {
  .credential {
    grid-template-columns: 1fr;
  }
  .credential__badge {
    flex-direction: row;
    justify-content: flex-start;
    width: fit-content;
    padding: 0.3rem 0.75rem;
  }
}

/* ============================================
   CERTIFICATIONS
   ============================================ */
.certs {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.cert {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  align-items: center;
  transition: border-color .2s;
  min-width: 0;
}
.cert:hover { border-color: rgba(56,189,248,.3); }

/* Disable translateX on touch to avoid horizontal scroll */
@media (hover: hover) {
  .cert { transition: border-color .2s, transform .2s; }
  .cert:hover { transform: translateX(4px); }
}

.cert__platform {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  padding: 0.45rem 0.2rem;
  border-radius: var(--radius-sm);
  line-height: 1.2;
  flex-shrink: 0;
}

.cert__platform--platzi {
  background: rgba(152, 202, 63, 0.12);
  color: var(--platzi);
  border: 1px solid rgba(152, 202, 63, 0.3);
}

.cert__platform--udemy {
  background: rgba(164, 53, 240, 0.12);
  color: var(--udemy);
  border: 1px solid rgba(164, 53, 240, 0.3);
}

.cert__platform--ai {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.cert__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.cert__name {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text);
}

.cert__desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.cert__link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.1rem;
  transition: opacity .2s;
  align-self: flex-start;
}
.cert__link:hover { opacity: 0.7; }

/* ============================================
   CONTACT
   ============================================ */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 2rem;
}

.contact__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-muted);
  transition: border-color .2s, color .2s;
  min-width: 0;
}

@media (hover: hover) {
  .contact__card { transition: border-color .2s, color .2s, transform .2s; }
  .contact__card:hover { transform: translateY(-3px); }
}

.contact__card:hover {
  border-color: var(--accent);
  color: var(--text);
}

.contact__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.contact__value {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.4;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer__cv {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  transition: opacity .2s;
}
.footer__cv:hover { opacity: 0.75; }

/* ============================================
   TABLET — 640px+
   ============================================ */
@media (min-width: 640px) {
  .hero {
    padding: 4rem 0 3rem;
  }

  .hero__photo img {
    width: 220px;
    height: 220px;
  }

  .section {
    padding: 4rem 0;
  }

  .about__stats {
    gap: 1rem;
  }

  .stat__number { font-size: 2rem; }

  .timeline__item {
    grid-template-columns: 28px 1fr;
    gap: 0 1.25rem;
  }

  .timeline__card { padding: 1.5rem; }

  .timeline__header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .timeline__date {
    align-self: auto;
    white-space: nowrap;
  }

  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ============================================
   DESKTOP — 900px+
   ============================================ */
@media (min-width: 900px) {
  .nav__burger { display: none !important; }

  .nav__links {
    display: flex !important;
    position: static !important;
    flex-direction: row !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  /* Undo mobile menu styles */
  .nav--open .nav__links {
    position: static;
  }

  .hero {
    padding: 5rem 0 4rem;
  }

  .hero__inner {
    flex-direction: row;
    text-align: left;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
  }

  .hero__content {
    align-items: flex-start;
  }

  .hero__location { justify-content: flex-start; }
  .hero__actions  { justify-content: flex-start; }
  .hero__stack    { justify-content: flex-start; }
  .badge          { align-self: flex-start; }

  .hero__photo img {
    width: 280px;
    height: 280px;
  }

  .section { padding: 5rem 0; }

  .about__grid {
    display: grid;
    grid-template-columns: 1fr 220px;
    align-items: start;
    gap: 3rem;
  }

  .about__stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .stat { padding: 1.25rem 1.5rem; }
  .stat__number { font-size: 2.2rem; }
  .stat__label  { font-size: 0.78rem; }

  .timeline__item {
    grid-template-columns: 32px 1fr;
    gap: 0 1.5rem;
  }

  .timeline__dot  { width: 14px; height: 14px; }

  .contact__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .contact__card { padding: 2rem 1.5rem; }
}

/* ============================================
   MOBILE NAV MENU — max 899px
   ============================================ */
@media (max-width: 899px) {
  .nav__burger { display: flex; }

  .nav__links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem 1rem;
    gap: 0.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
  }

  .nav--open .nav__links {
    display: flex;
  }

  .nav__links a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    text-align: left;
  }

  /* Contactar button inside mobile menu */
  .nav__links .btn {
    display: block;
    text-align: center;
    padding: 0.75rem 1rem;
    margin-top: 0.25rem;
  }
}
