/* joelrodelo.com — sistema tipográfico editorial
   Helvetica Neue + Inconsolata · paleta Flexoki · un acento: naranja */

/* --- Fuentes --- */

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/geist-mono-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inconsolata";
  src: url("../fonts/inconsolata-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inconsolata";
  src: url("../fonts/inconsolata-400-ext.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inconsolata";
  src: url("../fonts/inconsolata-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inconsolata";
  src: url("../fonts/inconsolata-700-ext.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Reset (mínimo) --- */
*, *::before, *::after { box-sizing: inherit; }
html { box-sizing: border-box; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; }
img { max-width: 100%; display: block; }
b, strong { font-weight: 600; }

/* --- Tokens --- */
:root {
  color-scheme: light;

  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-heading: var(--font-sans);
  --font-mono: "Helvetica Neue", sans-serif;

  /* Paleta Flexoki (stephango.com/flexoki) */
  --bg-page:    #fffcf0;
  --bg-surface: #f2f0e5;
  --tx-1:       #100f0f;
  --tx-2:       #6f6e69;
  --tx-3:       #878580;
  --border:     #dad8ce;

  /* Un solo acento */
  --accent: #bc5215;

  --selection: rgba(188, 82, 21, 0.16);

  --radius: 3px;

  --page-max: 960px;
  --prose-max: 680px;

  /* Escala tipográfica */
  --text-xs: .75rem;
  --text-xs--line-height: calc(1 / .75);
  --text-sm: .875rem;
  --text-sm--line-height: calc(1.25 / .875);
  --text-base: 1rem;
  --text-base--line-height: calc(1.5 / 1);
  --text-2xl: 1.5rem;
  --text-2xl--line-height: calc(2 / 1.5);
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --tracking-tight: -.025em;
  --leading-snug: 1.375;
  --leading-relaxed: 1.625;

  /* Escala de radios */
  --radius-md: .375rem;
  --radius-lg: .5rem;
  --radius-xl: .75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;

  /* Easing */
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);

  /* Blur */
  --blur-xs: 4px;
  --blur-sm: 8px;
  --blur-lg: 16px;
  --blur-3xl: 64px;
}

.theme-dark {
  color-scheme: dark;
  --bg-page:    #100f0f;
  --bg-surface: #1c1b1a;
  --tx-1:       #fffcf0;
  --tx-2:       #b7b5ac;
  --tx-3:       #6f6e69;
  --border:     #282726;
  --accent:     #da702c;
  --selection:  rgba(218, 112, 44, 0.22);
}

/* --- Base --- */
::selection { background: var(--selection); color: var(--tx-1); }

body {
  margin: 0 auto;
  padding: 0 24px 96px;
  max-width: var(--page-max);
  background: var(--bg-page);
  color: var(--tx-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Tipografía --- */
h1, h2, h3, h4 {
  font-weight: 700;
  color: var(--tx-1);
  text-wrap: balance;
}

h1, h2 {
  font-family: var(--font-heading);
}

h1 {
  font-size: clamp(2rem, 1.25rem + 2.5vw, 2.875rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0.5em 0 0.35em;
}

h2 {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.4em 0 0.5em;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 1.8em 0 0.5em;
}

h4 {
  font-size: 1.0625rem;
  line-height: 1.4;
  margin: 1.6em 0 0.4em;
}

p {
  max-width: var(--prose-max);
  margin: 1em 0;
}

/* --- Enlaces --- */
a {
  color: var(--tx-1);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

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

h1 a, h2 a, h3 a, h4 a {
  text-decoration: none;
  color: var(--tx-1);
}

h2 a:hover, h3 a:hover, h4 a:hover { color: var(--accent); }

/* --- Separador --- */
hr {
  width: 48px;
  border: 0;
  height: 2px;
  margin: 64px 0;
  background: var(--tx-1);
}

article hr { margin: 80px 0; }

/* --- Cita --- */
blockquote {
  margin: 40px 0;
  padding-left: 24px;
  border-left: 2px solid var(--accent);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.015em;
  max-width: var(--prose-max);
}

blockquote p { margin: 0; max-width: none; }

/* --- Listas --- */
ol, ul {
  padding-left: 1.25em;
  margin: 16px 0;
  max-width: var(--prose-max);
}

ol > li, ul > li { padding: 4px 0; }

ol > li::marker, ul > li::marker { color: var(--tx-3); }

/* --- Código --- */
code, kbd {
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--radius);
  font-size: 13.5px;
}

pre {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  white-space: pre;
}

pre code { background: transparent; padding: 0; }

/* --- Tabla --- */
table {
  width: 100%;
  margin: 32px 0;
  border-collapse: collapse;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

table tr { border-bottom: 1px solid var(--border); }

table th {
  text-align: left;
  font-weight: 600;
  padding: 12px 8px;
  color: var(--tx-2);
}

table td { padding: 12px 8px; line-height: 1.45; }

/* --- Layout --- */
main {
  margin: 0 auto;
  padding-top: 72px;
}

/* La prosa se contiene a 66ch; los titulares y módulos usan el ancho completo */

/* --- Skip nav --- */
.skip-nav {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 18px;
  background: var(--tx-1);
  color: var(--bg-page);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
}

.skip-nav:focus-visible { left: 16px; top: 16px; }

/* --- Header --- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  min-height: 68px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.site-header > a {
  text-decoration: none;
  color: var(--tx-1);
  white-space: nowrap;
}

.site-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1;
  margin: 0;
}

.site-header__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
}

.site-header nav a {
  text-decoration: none;
  font-size: 15px;
  color: var(--tx-2);
}

.site-header nav a:hover { color: var(--tx-1); }

.site-header nav a[aria-current="page"] {
  color: var(--tx-1);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.site-header__tools {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

/* --- Selector de idioma --- */
.lang-switch a {
  color: var(--tx-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.lang-switch a:hover { color: var(--tx-1); }

/* --- Toggle de tema --- */
#theme-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease;
}

#theme-toggle:hover { background: var(--bg-surface); }

.theme-toggle-switch {
  --icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z' clip-rule='evenodd'/%3E%3C/svg%3E");
  --icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' viewBox='0 0 24 24'%3E%3Cpath d='M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z'/%3E%3C/svg%3E");
  width: 16px;
  height: 16px;
  background-color: var(--tx-2);
  -webkit-mask-size: 16px;
  mask-size: 16px;
  -webkit-mask-position: 50% 50%;
  mask-position: 50% 50%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-image: var(--icon-sun);
  mask-image: var(--icon-sun);
  transition: background-color 0.18s ease;
}

.theme-dark .theme-toggle-switch {
  -webkit-mask-image: var(--icon-moon);
  mask-image: var(--icon-moon);
}

#theme-toggle:hover .theme-toggle-switch { background-color: var(--tx-1); }

/* --- Footer --- */
.site-footer {
  margin-top: 120px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  color: var(--tx-2);
  font-size: 14px;
}

.site-footer p { margin: 0; }

.site-footer a {
  color: var(--tx-2);
  text-decoration: none;
}

.site-footer a:hover { color: var(--tx-1); }

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--tx-3);
}

/* --- Tagline (hero de inicio) --- */
.tagline {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--tx-1);
  max-width: 21em;
  margin: 0 0 72px;
}

/* --- Métricas --- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 32px;
  padding: 28px 0 0;
  margin: 0 0 88px;
  border-top: 1px solid var(--border);
}

.metrics dt {
  font-size: clamp(2rem, 1.25rem + 2vw, 2.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--tx-1);
}

.metrics dd {
  margin: 6px 0 0;
  color: var(--tx-2);
  font-size: 13.5px;
  line-height: 1.45;
}

/* --- Lista de proyectos --- */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0 0 64px;
  max-width: none;
}

.project-list li {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.project-list li:first-child { border-top: 1px solid var(--border); }

.project-list a {
  text-decoration: none;
  color: var(--tx-1);
  font-weight: 600;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.625rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition: color 0.18s ease;
}

.project-list a:hover { color: var(--accent); }

.project-list__meta,
.project-list__summary {
  display: block;
  margin-top: 8px;
  max-width: var(--prose-max);
}

.project-list__summary {
  font-size: 14px;
  color: var(--tx-2);
}

.project-list__meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--tx-3);
  max-width: none; /* metadata, no prosa: que no envuelva a 66ch */
}

/* --- Lista de escritos --- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 48px;
  max-width: none;
}

.post-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}

.post-list li:first-child { border-top: 1px solid var(--border); }

.post-list a {
  text-decoration: none;
  color: var(--tx-1);
  font-weight: 500;
  font-size: 17px;
  flex: 1;
  min-width: 0;
  transition: color 0.18s ease;
}

.post-list a:hover { color: var(--accent); }

.post-list time {
  color: var(--tx-3);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Archivo agrupado por año --- */
.post-year {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px 48px;
  margin: 56px 0 0;
}

.post-year:first-of-type { margin-top: 48px; }

.post-year__label {
  font-size: clamp(1.75rem, 1.25rem + 1.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 8px 0 0;
  color: var(--tx-3);
  font-variant-numeric: tabular-nums;
}

.post-year .post-list { margin-bottom: 0; }

/* --- Leyendo ahora --- */
.reading {
  margin: 4em auto;
  padding: 2em;
  background: var(--bg-surface);
  display: inline-block;
      max-width: var(--prose-max);
  /* border: 1px solid var(--border); */
}

.reading h2 { margin: 0 0 1em; }

.reading__inner {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  max-width: var(--prose-max);
}

.reading__cover {
  width: 104px;
  height: auto;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.reading__body p { max-width: none; }

.reading__title {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0;
}

.reading__author {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--tx-3);
  margin: 4px 0 0;
}

.reading__note {
  font-size: 15px;
  line-height: 1.55;
  color: var(--tx-2);
  margin: 12px 0 0;
  max-width: 52ch;
}

/* --- Cabecera de artículo --- */
article > header {
  margin-bottom: 56px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

article > header h1 { margin-top: 0.25em; }

article > header time,
article > header p,
.project-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--tx-3);
  margin: 12px 0 0;
  max-width: none;
}

/* --- Cierre de contacto --- */
/* Cierra la página con el mismo peso con el que abre (.metrics): regla de 2px */
.contact {
  margin-top: 4em;
  padding-top: 36px;
}

.contact__ask {
  font-size: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 28px;
}

.contact-cta {
  margin: 0;
  font-size: 15px;
  color: var(--tx-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  max-width: none;
}

.contact__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
  background: var(--tx-1);
  color: var(--bg-page);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.contact__btn:hover { opacity: 0.9; transform: translateY(-1px); color: var(--bg-page); }
.contact__btn:active { transform: translateY(0) scale(0.98); }

/* --- Botón CV --- */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  margin: 24px 0 8px;
  border: 1px solid var(--tx-1);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  color: var(--tx-1);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn-outline:hover {
  background: var(--tx-1);
  color: var(--bg-page);
}

.btn-outline svg { width: 14px; height: 14px; flex-shrink: 0; }

/* --- Foco --- */
:focus-visible {
  outline: 2px solid var(--tx-1);
  outline-offset: 2px;
}

a:focus:not(:focus-visible) {
  outline: none;
  background-color: var(--selection);
}

/* --- Movimiento (solo si el sistema lo permite) --- */
@media (prefers-reduced-motion: no-preference) {
  /* Entrada sutil del contenido: jerarquiza la lectura al cargar */
  main > article > *:nth-child(-n+4) {
    animation: rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  main > article > *:nth-child(2) { animation-delay: 0.06s; }
  main > article > *:nth-child(3) { animation-delay: 0.12s; }
  main > article > *:nth-child(4) { animation-delay: 0.18s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Inconsolata para detalles --- */
.metrics dd,
.site-footer {
  font-family: "Inconsolata", var(--font-mono);
  font-size: 13px;
}

/* --- Móvil --- */
@media (max-width: 720px) {
  body { padding: 0 16px 64px; font-size: 16px; }

  main { padding-top: 40px; }

  .site-header {
    padding: 16px 0;
    gap: 12px 24px;
  }

  .site-header__right { gap: 16px; }
  .site-header nav { gap: 16px; }
  .site-header__tools { padding-left: 16px; gap: 8px; }

  .tagline { margin-bottom: 48px; }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 64px;
  }

  .project-list li { padding: 20px 0; }

  .post-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .post-year {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 40px;
  }

  .reading__inner { gap: 20px; }
  .reading__cover { width: 84px; }

  .post-year__label { margin-top: 0; }

  hr { margin: 48px 0; }
  article hr { margin: 64px 0; }

  .contact { margin-top: 72px; padding-top: 28px; }

  blockquote { font-size: 19px; padding-left: 18px; }

  .site-footer { margin-top: 80px; }
}
