/* ===== Base ===== */
:root {
  --text: #1f2328;
  --muted: #6a737d;
  --accent: #173f61;
  --rule: #e4e7ea;
  --bg: #ffffff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

main, header nav, footer p {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ===== Header / nav ===== */
header {
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

main section { scroll-margin-top: 4.5rem; }

nav {
  display: flex;
  gap: 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover { color: var(--accent); }
nav a.active { color: var(--text); font-weight: 600; }

/* ===== Main ===== */
main { padding-top: 2.5rem; padding-bottom: 3rem; }

h1 { font-size: 1.8rem; margin: 0 0 1rem; font-weight: normal; }

h2, h1.page-title {
  font-size: 1.9rem;
  margin: 3rem 0 1rem;
  color: #183b68;
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

h2::after, h1.page-title::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule);
}

/* Titulo de pagina interior: mismo aspecto que h2, pero sin hueco arriba */
h1.page-title { margin-top: 0; }

h3 {
  font-size: 1.35rem;
  margin: 3rem 0 1rem;
  color: #183b68;
  font-weight: 600;
}

h4 { font-size: 1.05rem; margin: 0 0 0.2rem; font-weight: 600; }

.paper h4 a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.paper h4 a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

a { color: var(--accent); }

/* ===== Home ===== */
.intro {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-photo {
  width: 170px;
  border-radius: 4px;
  flex-shrink: 0;
}

.intro-text { flex: 1; min-width: 260px; }
.affiliation { color: var(--muted); margin-top: 0.2rem; }

/* ===== Papers ===== */
.paper { margin-bottom: 1.75rem; }
.paper .meta { color: var(--muted); margin: 0 0 0.25rem; font-size: 0.95rem; }
.paper-links { margin: 0 0 0.25rem; font-size: 0.95rem; }

details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.95rem;
}

details p {
  margin: 0.5rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-size: 0.95rem;
}

/* ===== Etiquetas y notas ===== */
.title-links {
  font-weight: normal;
  font-size: 0.9rem;
}

/* Traduccion al ingles de los titulos en castellano */
.translation {
  display: block;
  font-weight: normal;
  font-size: 0.95rem;
  color: var(--muted);
}

.paper h4 .title-links a {
  border-bottom: none;
  color: var(--accent);
}

.tag {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
}

.note {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ===== Gallery ===== */
.masonry {
  columns: 3 200px;
  column-gap: 10px;
}

.masonry img {
  width: 100%;
  display: block;
  margin-bottom: 10px;
  border-radius: 3px;
  cursor: zoom-in;
}

.pano {
  width: 100%;
  display: block;
  border-radius: 3px;
  cursor: zoom-in;
}

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 18, 22, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  cursor: zoom-out;
}

#lightbox[hidden] { display: none; }

#lightbox img {
  max-width: 96vw;
  max-height: 96vh;
  object-fit: contain;
}

/* ===== Blog (posts) ===== */
.post-header { margin-bottom: 2rem; }

.post-header h1 {
  font-size: 2rem;
  line-height: 1.25;
  color: #183b68;
  margin: 0 0 0.5rem;
}

.post-date {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

.post p { margin: 0 0 1.1rem; }

.post h2 { font-size: 1.35rem; margin-top: 2.5rem; }

.post figure { margin: 2rem 0; }

.post figure.narrow {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.post figure img {
  width: 100%;
  display: block;
}

.post figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}

/* ===== Movil ===== */
@media (max-width: 640px) {
  nav {
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  main { padding-top: 1.5rem; }

  h2, h1.page-title { font-size: 1.6rem; margin-top: 2.25rem; }
  h1.page-title { margin-top: 0; }
  h3 { font-size: 1.25rem; margin-top: 2rem; }
  .post-header h1 { font-size: 1.6rem; }

  .masonry {
    columns: auto;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .masonry img {
    height: 240px;
    width: auto;
    flex: 0 0 auto;
    scroll-snap-align: start;
    margin-bottom: 0;
  }

  .pano { margin-top: 8px; }
}

/* ===== Footer ===== */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
}

footer p {
  padding-top: 1rem;
  padding-bottom: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
