/* ==========================================================================
   Blog de Viajes — Hoja de estilos principal
   Identidad visual: "Documento de viaje" (Pasaporte / Billete de embarque)
   ========================================================================== */

:root {
  /* Paleta de colores — Tinta marino, papel pergamino, sello rojo, latón */
  --ink: #1b2333;
  --ink-soft: #303c54;
  --paper: #faf6ea;
  --paper-dim: #f1ead8;
  --cover: #11182a;
  --cover-soft: #1b2440;
  --stamp: #a83b2e;
  --stamp-dark: #7f2c22;
  --brass: #b08d4f;
  --brass-soft: rgba(176, 141, 79, 0.35);
  --muted: #6b6355;

  /* Tipografía: Dividida en 3 roles principales */
  --font-display: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-data: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Radios de borde — El borde pequeño simula un corte perforado o un ticket */
  --radius-sm: 4px;
  --radius: 8px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(17, 24, 42, 0.08);
  --shadow-md: 0 6px 20px rgba(17, 24, 42, 0.12);
  --shadow-lg: 0 14px 34px rgba(17, 24, 42, 0.18);

  --max-width: 880px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Accesibilidad: Reducir animaciones si el usuario lo prefiere en su SO */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--paper-dim);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

/* Foco accesible y temático (color del sello) */
:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------- */
/* Barra de navegación — Estilo "Talón de billete"                        */
/* ---------------------------------------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  padding: 14px 22px;
  background: var(--cover);
  border-bottom: 2px dashed var(--brass-soft);
  transition: transform 0.3s ease;
}

.nav-links {
  justify-self: center;
  display: inline-flex;
  gap: 4px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--paper);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animación del menú hamburguesa a la 'X' */
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--paper);
  text-decoration: none;
  flex: 0 0 auto;
}

.nav-brand .plane {
  width: 20px;
  height: 20px;
  display: inline-block;
  transform: rotate(45deg);
}

.nav-item {
  font-family: var(--font-data);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(250, 246, 234, 0.7);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease;
  flex: 0 0 auto;
}

.nav-item:hover,
.nav-item:focus-visible {
  color: var(--paper);
  background: rgba(250, 246, 234, 0.08);
}

.nav-item.active {
  color: var(--cover);
  background: var(--brass);
  font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/* Contenedor principal                                                   */
/* ---------------------------------------------------------------------- */

.content {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 80px;
  flex: 1 0 auto;
  animation: page-in 0.35s ease;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-data);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 10px;
}

.hero h1,
.content h1 {
  font-family: var(--font-display);
  font-size: 2.3rem;
  line-height: 1.15;
  margin: 0 0 0.4em;
  color: var(--ink);
}

.hero-quote {
  border-left: 3px solid var(--stamp);
  padding: 4px 0 4px 18px;
  margin: 0 0 1.4em;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.hero-lede {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 2.2em;
}

/* ---------------------------------------------------------------------- */
/* Separadores de año — Estilo "Ruta de vuelo"                            */
/* ---------------------------------------------------------------------- */

.year-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2.6em 0 1.3em;
}

.year-divider:first-of-type {
  margin-top: 0.4em;
}

.year-divider h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
  white-space: nowrap;
  color: var(--ink);
}

.year-divider .route {
  flex: 1;
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    var(--brass) 0,
    var(--brass) 6px,
    transparent 6px,
    transparent 12px
  );
  position: relative;
}

/* Icono del avión al final de la línea */
.year-divider .route::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%) rotate(90deg);
  background: var(--brass);
  -webkit-mask: url('../assets/plane-icon.svg') center / contain no-repeat;
  mask: url('../assets/plane-icon.svg') center / contain no-repeat;
}

/* ---------------------------------------------------------------------- */
/* Tarjetas de viaje — Estilo "Postal / Talón de equipaje"                */
/* ---------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border-top: 3px dashed var(--brass);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: var(--shadow-lg);
}

.card-image {
  background-size: cover;
  background-position: center;
  height: 190px;
  position: relative;
}

.card-image .stamp-date {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-data);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--paper);
  background: rgba(17, 24, 42, 0.62);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.card-image .draft-stamp {
  position: absolute;
  left: -8px;
  top: 14px;
  padding: 5px 14px;
  background: var(--stamp);
  color: var(--paper);
  font-family: var(--font-data);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  transform: rotate(-8deg);
  box-shadow: var(--shadow-sm);
  border-radius: 2px;
}

.card-body {
  padding: 14px 16px 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}

.card-date {
  font-family: var(--font-data);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------------- */
/* Filtro de navegación por año (Chips)                                   */
/* ---------------------------------------------------------------------- */

.year-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.6em;
}

.chip {
  font-family: var(--font-data);
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid rgba(27, 35, 51, 0.12);
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.chip:hover,
.chip:focus-visible {
  border-color: var(--stamp);
  color: var(--stamp);
}

.chip.active {
  background: var(--stamp);
  border-color: var(--stamp);
  color: var(--paper);
}

/* ---------------------------------------------------------------------- */
/* Entrada de viaje (Artículo / Diario)                                   */
/* ---------------------------------------------------------------------- */

.entry-wrapper {
  background: var(--paper);
  border-radius: var(--radius);
  border-top: 3px dashed var(--brass);
  box-shadow: var(--shadow-md);
  padding: 8px 32px 40px;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  margin: 20px 0 6px;
  padding: 6px 0;
}

.breadcrumb:hover {
  color: var(--stamp);
}

.entry-body h1 {
  font-size: 1.9rem;
  border-bottom: 1px solid rgba(27, 35, 51, 0.1);
  padding-bottom: 0.35em;
}

.entry-body h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-top: 1.6em;
  color: var(--ink);
}

.entry-body h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-top: 1.3em;
  color: var(--ink);
}

.entry-body p {
  line-height: 1.65;
  color: var(--ink-soft);
}

.entry-body ul,
.entry-body ol {
  padding-left: 22px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.entry-body li {
  margin: 0.4em 0;
}

.entry-body a {
  color: var(--stamp-dark);
  text-decoration: underline;
  text-decoration-color: var(--brass-soft);
  text-underline-offset: 2px;
}

.entry-body a:hover {
  text-decoration-color: currentColor;
}

.entry-body code {
  font-family: var(--font-data);
  background: var(--paper-dim);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.entry-body strong {
  color: var(--ink);
}

.entry-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}

.entry-body th {
  background: var(--paper-dim);
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid var(--brass-soft);
  font-weight: 700;
  font-family: var(--font-data);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.entry-body td {
  padding: 10px;
  border-bottom: 1px solid rgba(27, 35, 51, 0.08);
}

.entry-body blockquote {
  border-left: 3px solid var(--stamp);
  background: var(--paper-dim);
  padding: 10px 20px;
  margin: 1.5em 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
}

.entry-body img {
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.entry-body hr {
  border: none;
  border-top: 2px dashed var(--brass-soft);
  margin: 2em 0;
}

/* Mapas embebidos (Google Maps) integrados en el HTML del markdown */
.entry-body .iframe-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 1.4em 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.entry-body .iframe-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
}

.entry-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.entry-empty .stamp-big {
  display: inline-block;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  font-family: var(--font-data);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 10px 22px;
  transform: rotate(-6deg);
  border-radius: 6px;
  margin-bottom: 16px;
}

/* Botón flotante para volver arriba (FAB) */
.scroll-fab {
  position: fixed;
  right: 22px;
  bottom: 34px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--stamp);
  color: var(--paper);
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.2s ease;
}

.scroll-fab.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-fab:hover,
.scroll-fab:focus-visible {
  background: var(--stamp-dark);
}

@media (max-width: 640px) {
  .scroll-fab {
    right: 14px;
    bottom: 18px;
    width: 42px;
    height: 42px;
  }
}

/* ---------------------------------------------------------------------- */
/* Mapa y progreso de países                                              */
/* ---------------------------------------------------------------------- */

.map-container {
  height: 480px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 1.8em;
  border: 3px dashed var(--brass);
  isolation: isolate;
}

.map-container #map {
  height: 100%;
  width: 100%;
}

.progress-wrapper {
  background: var(--paper);
  border-radius: var(--radius);
  border-top: 3px dashed var(--brass);
  box-shadow: var(--shadow-md);
  padding: 22px 24px;
}

.progress-row {
  margin-bottom: 1.1em;
}

.progress-row:last-child {
  margin-bottom: 0;
}

.progress-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.progress-label.clickable {
  cursor: pointer;
}

.progress-label .arrow {
  font-size: 0.7em;
  color: var(--brass);
  transition: transform 0.2s ease;
}

.progress-bar {
  background: var(--paper-dim);
  border-radius: 999px;
  overflow: hidden;
  height: 22px;
  position: relative;
}

.progress-bar-fill {
  background: linear-gradient(90deg, var(--brass) 0%, var(--stamp) 100%);
  height: 100%;
  transition: width 0.7s ease;
}

.progress-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  mix-blend-mode: multiply;
}

.country-list {
  margin: 8px 0 0 4px;
  padding-left: 18px;
  list-style: disc;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------- */
/* Estados de carga y error                                               */
/* ---------------------------------------------------------------------- */

.state-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-family: var(--font-data);
}

/* ---------------------------------------------------------------------- */
/* Pie de página                                                          */
/* ---------------------------------------------------------------------- */

.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 26px 10px 34px;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--font-data);
}

.footer p {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--stamp-dark);
}

.footer .icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  fill: currentColor;
}

/* ---------------------------------------------------------------------- */
/* Ajustes para dispositivos móviles (Responsive Design)                    */
/* ---------------------------------------------------------------------- */

@media (max-width: 640px) {
  .navbar {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }

  .navbar.nav-hidden {
    transform: translateY(-100%);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    justify-self: unset;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    order: 3;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--brass-soft);
  }

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

  .nav-item {
    width: 100%;
    padding: 10px 12px;
  }

  .content {
    padding: 28px 16px 60px;
  }

  .hero h1,
  .content h1 {
    font-size: 1.8rem;
  }

  .entry-wrapper {
    padding: 4px 18px 28px;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .card-image {
    height: 130px;
  }

  .card-body {
    padding: 10px 12px 12px;
  }

  .card-title {
    font-size: 0.92rem;
  }
}

@media (max-width: 420px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}