/* CV Minimalista estilo Harvard — Accesible con temas día/noche */

:root {
  /* Tema claro (por defecto) */
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666666;
  --border: #d0d0d0;
  --accent: #0066cc;
  --focus: #0066cc;
}

body.dark-mode {
  /* Tema oscuro */
  --bg: #1a1a1a;
  --text: #f5f5f5;
  --text-muted: #b0b0b0;
  --border: #333333;
  --accent: #66b3ff;
  --focus: #fbbf24;
}

* {
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html {
  background-color: var(--bg);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Georgia', 'Garamond', serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

p {
  line-height: 1.5;
}

main {
  background-color: var(--bg);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* Botón de tema */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: transform 0.2s, box-shadow 0.2s;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Foco visible global */
*:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* Header minimalista */
.hero {
  border-bottom: 1px solid var(--border);
  padding: 60px 0 0px;
}

.hero-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.hero-text {
  text-align: center;
  flex: 1;
}

.hero h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--text);
}

.hero-image {
  width: 280px;
  height: 280px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.subtitle {
  margin: 12px 0 0 0;
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

/* Responsive */
@media (max-width: 900px) {
  .hero-content {
    flex-direction: column;
    gap: 32px;
    align-items: center;
  }

  .hero-image {
    width: 240px;
    height: 240px;
  }
}

@media (max-width: 600px) {
  .hero-image {
    width: 200px;
    height: 200px;
  }

  .hero h1 {
    font-size: 2rem;
  }
}

/* Tabla de contenidos / Navegación */
.toc {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: -40px 0 16px 0;
  padding: 0;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--border);
  padding-top: 8px;
  padding-bottom: 8px;
}

.toc a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 0;
  position: relative;
  transition: color 0.3s ease;
}

.toc a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.3s ease;
}

.toc a:hover::after {
  width: 100%;
}

.toc a:hover {
  color: var(--accent);
}

/* Secciones */
section {
  margin: 48px 0;
  padding: 0;
}

section:first-of-type {
  margin-top: 32px;
}

section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 24px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.3px;
}

section p {
  margin: 16px 0;
  color: var(--text);
}

/* Artículos de experiencia */
.job {
  margin: 28px 0;
  padding: 0;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.job h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.job-period {
  color: var(--text-muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.job-title {
  margin: 6px 0 12px 0;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.job p {
  margin: 12px 0;
}

/* Habilidades */
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  margin: 16px 0;
  padding: 0;
}

.skills li {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: transparent;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s, background-color 0.2s;
}

.skills li:hover {
  border-color: var(--accent);
  background-color: var(--accent);
  color: var(--bg);
}

.contact-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.contact-link {
  text-decoration: none;
}

.contact-link:hover svg {
  fill: var(--accent);
}

.social-icon {
  width: 24px;
  height: 24px;
  fill: var(--text);
  transition: fill 0.3s ease;
}

/* Enlaces */
a {
  color: var(--accent);
  text-decoration: underline;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 60px;
  background-color: var(--bg);
  width: 100%;
}

body.dark-mode .footer {
  background-color: #0f0f0f;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--accent);
  text-decoration: underline;
}

.footer a:hover {
  opacity: 0.8;
}

.download-icon {
  margin-left: 4px;
  display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 24px 16px;
  }

  .hero {
    padding: 40px 0 30px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .toc {
    gap: 16px;
    margin: 24px 0;
  }

  .toc a {
    font-size: 0.9rem;
  }

  section h2 {
    font-size: 1.3rem;
    margin-bottom: 18px;
  }

  .job-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .job-period {
    white-space: normal;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 16px 12px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .toc {
    gap: 12px;
    margin: 20px 0;
  }

  .toc a {
    font-size: 0.85rem;
  }

  section h2 {
    font-size: 1.2rem;
  }

  .skills {
    gap: 8px;
  }

  .skills li {
    padding: 4px 8px;
    font-size: 0.9rem;
  }
}

/* Modal de imagen */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-in-out;
}

.modal[hidden] {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: var(--bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background-color: var(--border);
}

.modal-close:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.modal-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  max-height: calc(90vh - 140px);
}

.modal-image {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  transition: width 0.2s ease-out, height 0.2s ease-out;
}

.modal-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.modal-controls button {
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.modal-controls button:hover {
  transform: scale(1.05);
}

.modal-controls button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

#zoomLevel {
  min-width: 60px;
  text-align: center;
  color: var(--text);
  font-weight: 500;
}

/* Hacer la imagen clickeable */
.hero-image {
  cursor: pointer;
  transition: transform 0.2s;
}

.hero-image:hover {
  transform: scale(1.05);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Modo de alto contraste */
@media (prefers-contrast: more) {
  :root {
    --border: #000000;
  }

  body.dark-mode {
    --border: #ffffff;
  }

  .toc a {
    text-decoration: underline;
  }

  section h2 {
    border-bottom-width: 2px;
  }
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Impresión */
@media print {
  .theme-toggle,
  .skip-link,
  .toc {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  section {
    page-break-inside: avoid;
  }
}

