/* ================================================
   JAIME GUTIÉRREZ — jaimegutierrez.net
   Estilo: Editorial · Periodismo de datos
   ================================================ */

/* ---- TOKENS ---- */
:root {
  --paper:   #F5F0E8;
  --ink:     #0F0E0C;
  --ink-2:   #2E2C28;
  --mid:     #8A8478;
  --rule:    #D8D1C8;
  --accent:  #C1440E;       /* terracota / naranja quemado */
  --teal:    #16706A;
  --dark:    #141210;

  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body:    'DM Sans', system-ui, sans-serif;

  /* Espaciado fluido */
  --sp-xs: clamp(0.5rem,  1vw,   0.75rem);
  --sp-sm: clamp(0.75rem, 2vw,   1.25rem);
  --sp-md: clamp(1.25rem, 3vw,   2rem);
  --sp-lg: clamp(2.5rem,  6vw,   5rem);
  --sp-xl: clamp(4rem,    9vw,   8rem);

  --max-w: 1280px;
  --pad:   clamp(1.25rem, 5vw, 5rem);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff-body);
  background: var(--paper);
  color: var(--ink);
  font-size: clamp(0.9375rem, 1.1vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; }

/* ---- UTILITIES ---- */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-sm);
  border-top: 1.5px solid var(--ink);
  padding-top: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}
.section-header--inv { border-top-color: rgba(255,255,255,0.15); }

.section-num {
  font-family: var(--ff-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  flex-shrink: 0;
}
.section-num--light { color: rgba(255,255,255,0.4); }

.section-title {
  font-family: var(--ff-display);
  font-size: clamp(2rem, 4.5vw, 3.75rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.025em;
}
.section-sub {
  margin-left: auto;
  max-width: 26ch;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  text-align: right;
}

/* ---- TAGS ---- */
.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 0.2em 0.55em;
  border-radius: 2px;
  line-height: 1.6;
}
.tag--teal   { color: var(--teal); }
.tag--orange { color: var(--accent); }
.tag--purple { color: #7C3AED; }
.tag--blue   { color: #2563EB; }
.tag--default { color: var(--ink-2); }
.tag--amber  { color: #B45309; }
.tag--pink   { color: #BE185D; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.7em 1.4em;
  border-radius: 2px;
  transition: background 0.22s, color 0.22s, border-color 0.22s;
  cursor: pointer;
}
.btn--dark {
  background: var(--ink);
  color: var(--paper);
  border: 1.5px solid var(--ink);
}
.btn--dark:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.btn--outline-dark {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.btn--outline-dark:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ================================================
   NAVIGATION
   ================================================ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  padding-inline: var(--pad);
  height: 3.25rem;
  display: flex;
  align-items: center;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}
.nav.is-scrolled {
  background: rgba(245,240,232,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--rule);
}
.nav__inner {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  font-family: var(--ff-display);
  font-size: 1.35rem;
  font-weight: 900;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
  z-index: 201;
}
.nav__list {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
}
.nav__link {
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  transition: opacity 0.2s;
}
.nav__link:hover { opacity: 1; }
.nav__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--mid);
  transition: border-color 0.2s, color 0.2s;
}
.nav__cta:hover { border-color: var(--ink); color: var(--ink); }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  z-index: 201;
}
.nav__toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

/* ================================================
   HERO
   ================================================ */
.hero {
  position: relative;
  min-height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(3.25rem + var(--sp-lg)) var(--pad) var(--sp-md);
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.28;
}
.hero__content {
  position: relative;
  max-width: var(--max-w);
  margin-inline: auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero__eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: var(--sp-sm);
}
.hero__name {
  font-family: var(--ff-display);
  font-size: clamp(4.5rem, 13vw, 15rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  display: flex;
  flex-direction: column;
  margin-bottom: var(--sp-md);
  overflow: hidden;
}
.hero__name-first {
  font-weight: 300;
  font-style: italic;
  color: var(--ink-2);
  opacity: 0;
  transform: translateY(100%);
  animation: slideUp 0.9s cubic-bezier(0.16,1,0.3,1) 0.1s forwards;
}
.hero__name-last {
  font-weight: 900;
  color: var(--ink);
  opacity: 0;
  transform: translateY(100%);
  animation: slideUp 0.9s cubic-bezier(0.16,1,0.3,1) 0.22s forwards;
}
@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); }
}
.hero__role {
  font-size: clamp(1rem, 1.8vw, 1.375rem);
  color: var(--mid);
  max-width: 44ch;
  opacity: 0;
  animation: fadeIn 0.8s ease 0.6s forwards;
}
.hero__role em {
  font-style: italic;
  color: var(--accent);
}
@keyframes fadeIn {
  to { opacity: 1; }
}

.hero__bottom {
  position: relative;
  max-width: var(--max-w);
  margin-inline: auto;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-md);
  margin-top: var(--sp-lg);
  opacity: 0;
  animation: fadeIn 0.8s ease 0.85s forwards;
}
.hero__stats {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.hero__stat {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.hero__stat-num {
  font-family: var(--ff-display);
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hero__stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mid);
  line-height: 1.45;
}
.hero__stat-div {
  width: 1px;
  height: 2.5rem;
  background: var(--rule);
  flex-shrink: 0;
}
.hero__scroll {
  color: var(--mid);
  animation: arrowBounce 2.2s ease-in-out infinite;
  transition: color 0.2s;
}
.hero__scroll:hover { color: var(--accent); }
@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(7px); }
}

/* ================================================
   ABOUT
   ================================================ */
.about {
  background: var(--dark);
  color: var(--paper);
  padding-block: var(--sp-xl);
}
.about .section-header {
  border-top-color: rgba(255,255,255,0.1);
}
.about .section-num { color: rgba(255,255,255,0.25); }
.about .section-title { color: var(--paper); }

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-xl);
  align-items: start;
}
.about__lead {
  font-family: var(--ff-display);
  font-size: clamp(1.2rem, 2.2vw, 1.875rem);
  font-weight: 400;
  line-height: 1.45;
  color: rgba(245,240,232,0.9);
  margin-bottom: var(--sp-md);
}
.about__lead strong { color: #fff; font-weight: 700; }
.about__text p {
  font-size: 0.9375rem;
  color: rgba(245,240,232,0.55);
  margin-bottom: var(--sp-sm);
  max-width: 52ch;
}
.about__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-block: var(--sp-md);
}
.about .tag {
  color: rgba(245,240,232,0.55);
  border-color: rgba(245,240,232,0.2);
  transition: color 0.2s, border-color 0.2s;
}
.about .tag:hover { color: #fff; border-color: rgba(245,240,232,0.6); }

.about__visual { display: flex; flex-direction: column; gap: var(--sp-md); }

.about__photo-wrap {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
}
.about__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(25%) contrast(1.05);
  transition: filter 0.5s ease;
  display: block;
}
.about__photo-wrap:hover .about__photo { filter: grayscale(0) contrast(1); }
.about__photo-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.65rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.7);
  background: linear-gradient(transparent, rgba(14,12,10,0.7));
}

/* Skill bars */
.about__skills { display: flex; flex-direction: column; gap: 0.9rem; }
.skill { display: flex; flex-direction: column; gap: 0.3rem; }
.skill__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.skill__name {
  font-size: 0.775rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(245,240,232,0.55);
}
.skill__years {
  font-size: 0.68rem;
  color: rgba(245,240,232,0.28);
  letter-spacing: 0.05em;
}
.skill__track {
  height: 2.5px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.skill__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1.3s cubic-bezier(0.16,1,0.3,1);
}

/* ================================================
   WORK
   ================================================ */
.work {
  background: var(--ink);
  color: var(--paper);
  padding-block: var(--sp-xl);
}
.work .section-title { color: var(--paper); }

.work__list { display: flex; flex-direction: column; }

.work-card {
  display: grid;
  grid-template-columns: 5.5rem 1fr 13rem;
  gap: var(--sp-md);
  align-items: center;
  padding-block: var(--sp-md);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background 0.25s ease;
}
.work-card:first-child { border-top: 1px solid rgba(255,255,255,0.07); }
.work-card:hover { background: rgba(255,255,255,0.025); }

.work-card__left {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}
.work-card__num {
  font-family: var(--ff-display);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 900;
  color: rgba(255,255,255,0.07);
  line-height: 1;
  transition: color 0.3s;
}
.work-card:hover .work-card__num { color: var(--accent); }
.work-card__tags { display: flex; flex-direction: column; gap: 0.3rem; }
.work-card .tag {
  color: rgba(245,240,232,0.35);
  border-color: rgba(245,240,232,0.15);
  font-size: 0.62rem;
}

.work-card__title {
  font-family: var(--ff-display);
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--paper);
  margin-bottom: 0.45rem;
}
.work-card__desc {
  font-size: 0.875rem;
  color: rgba(245,240,232,0.48);
  line-height: 1.6;
  max-width: 48ch;
}
.work-card__link {
  display: inline-block;
  margin-top: var(--sp-sm);
  font-size: 0.775rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  transition: letter-spacing 0.2s;
}
.work-card__link:hover { letter-spacing: 0.15em; }

/* Inline SVG data visualization thumbnails */
.work-card__vis {
  width: 13rem;
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}
.work-card:hover .work-card__vis { transform: scale(1.02); }
.work-card__vis--1 { background: #0d1b2a; color: #4299e1; }
.work-card__vis--2 { background: #1a0e05; color: var(--accent); }
.work-card__vis--3 { background: #071a12; color: #38a169; }
.work-card__vis--4 { background: #130d1f; color: #805ad5; }
.work-card__svg { width: 80%; height: auto; }

/* Trabajos destacados (lista de artículos) */
.featured { margin-top: var(--sp-lg); }
.featured__title {
  font-family: var(--ff-display);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--paper);
  padding-bottom: 0.75rem;
  border-bottom: 1.5px solid rgba(245,240,232,0.18);
  margin-bottom: var(--sp-sm);
}
.featured__list { display: flex; flex-direction: column; }
.featured-item {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: var(--sp-sm) var(--sp-md);
  align-items: baseline;
  padding-block: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.featured-item:last-child { border-bottom: none; }
.featured-item__date {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245,240,232,0.4);
  white-space: nowrap;
}
.featured-item__link {
  font-family: var(--ff-display);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--paper);
  transition: color 0.2s;
}
.featured-item__link:hover { color: var(--accent); }
.featured-item__desc {
  font-size: 0.875rem;
  color: rgba(245,240,232,0.48);
  line-height: 1.6;
  max-width: 60ch;
  margin-top: 0.4rem;
}

/* ================================================
   TEACHING
   ================================================ */
.teaching {
  background: var(--accent);
  color: var(--paper);
  padding-block: var(--sp-xl);
}
.teaching .section-header { border-top-color: rgba(255,255,255,0.25); }
.teaching .section-num { color: rgba(255,255,255,0.45); }
.teaching .section-title { color: var(--paper); }

.teaching__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-xl);
  align-items: start;
}
.teaching__org {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 0.6rem;
}
.teaching__course {
  font-family: var(--ff-display);
  font-size: clamp(1.4rem, 2.8vw, 2.25rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-sm);
}
.teaching__desc {
  font-size: 0.9375rem;
  opacity: 0.8;
  line-height: 1.65;
  max-width: 44ch;
  margin-bottom: var(--sp-md);
}

.teaching__items { display: flex; flex-direction: column; gap: var(--sp-sm); }
.teaching-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: var(--sp-sm);
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  transition: background 0.2s;
}
.teaching-item:hover { background: rgba(255,255,255,0.18); }
.teaching-item__icon {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.8;
}
.teaching-item strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.teaching-item p {
  font-size: 0.8125rem;
  opacity: 0.7;
  line-height: 1.5;
}
.teaching-item--link {
  display: flex;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.teaching-item--link:hover {
  background: rgba(255,255,255,0.22);
}
.teaching-item--link::after {
  content: '→';
  margin-left: auto;
  align-self: center;
  padding-left: 0.75rem;
  font-size: 1rem;
  opacity: 0.5;
  transition: transform 0.2s, opacity 0.2s;
}
.teaching-item--link:hover::after {
  transform: translateX(4px);
  opacity: 1;
}

/* ================================================
   CONTACT
   ================================================ */
.contact {
  background: var(--paper);
  padding-block: var(--sp-xl);
}
.contact__inner {
  text-align: center;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--pad);
}
.contact__eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: var(--sp-sm);
}
.contact__heading {
  font-family: var(--ff-display);
  font-size: clamp(3.5rem, 10vw, 11rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.88;
  color: var(--ink);
  margin-bottom: var(--sp-md);
}
.contact__sub {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: var(--sp-lg);
}
.contact__email {
  display: inline-block;
  font-family: var(--ff-display);
  font-size: clamp(1rem, 2vw, 1.625rem);
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
  margin-bottom: var(--sp-lg);
  transition: color 0.2s;
}
.contact__email:hover { color: var(--ink); }
.contact__socials {
  display: flex;
  gap: var(--sp-sm);
  justify-content: center;
}
.contact__social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  color: var(--mid);
  transition: border-color 0.22s, color 0.22s, transform 0.22s;
}
.contact__social:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-3px);
}

/* ================================================
   FOOTER
   ================================================ */
.footer {
  background: var(--ink);
  padding-block: var(--sp-md);
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}
.footer__name,
.footer__copy {
  font-size: 0.72rem;
  color: rgba(245,240,232,0.28);
  letter-spacing: 0.07em;
}

/* ================================================
   SCROLL REVEAL
   ================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
  .work-card {
    grid-template-columns: 4.5rem 1fr 10rem;
  }
  .work-card__vis { width: 10rem; }
}

@media (max-width: 860px) {
  .about__grid,
  .teaching__grid {
    grid-template-columns: 1fr;
  }
  .about__photo-wrap { aspect-ratio: 4 / 3; max-height: 22rem; }
  .work-card {
    grid-template-columns: 3.5rem 1fr;
  }
  .work-card__vis { display: none; }
  .section-sub { display: none; }
}

@media (max-width: 620px) {
  .nav__list {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--paper);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    z-index: 199;
  }
  .nav__list.is-open {
    display: flex;
  }
  .nav__list.is-open .nav__link {
    font-size: 1.35rem;
    letter-spacing: 0.06em;
    opacity: 1;
  }
  .nav__list.is-open .nav__cta {
    width: 2.5rem;
    height: 2.5rem;
  }
  .nav__toggle { display: flex; }

  .hero__name { font-size: clamp(3.5rem, 17vw, 6.5rem); }
  .hero__stats { gap: var(--sp-sm); }
  .hero__stat-num { font-size: 1.1rem; }

  .work-card {
    grid-template-columns: 1fr;
    gap: var(--sp-sm);
  }
  .work-card__left {
    flex-direction: row;
    align-items: center;
    gap: var(--sp-sm);
  }
  .work-card__num { font-size: 1.5rem; }
  .work-card__tags { flex-direction: row; flex-wrap: wrap; }

  .featured-item { grid-template-columns: 1fr; gap: 0.3rem; }

  .contact__heading { letter-spacing: -0.025em; }
}
