/* jsvaldez.com — sitio personal.
   Deliberadamente distinto de bytewonders.com: alli la identidad es corporativa,
   geometrica y fria (Space Grotesk, violeta/teal sobre crema). Aqui es editorial
   y calida: serif de titulares, papel hueso, acento terracota, sin tarjetas. */

/* ---------------------------------------------------------------- tokens */
:root {
  --ink: #241d18;
  --ink-2: #3f342c;
  --soft: #63554a;
  --muted: #8b7d70;
  --line: #e4d9cc;
  --line-2: #efe7dc;
  --bg: #fbf7f1;
  --surface: #fffdfa;
  --alt: #f4ede3;
  --accent: #b4491f;
  --accent-2: #1f6b5c;
  --accent-soft: rgba(180, 73, 31, 0.08);
  --ring: rgba(180, 73, 31, 0.45);
  --radius-s: 6px;
  --radius: 10px;
  --maxw: 1000px;
  --measure: 62ch;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f0e7dc;
    --ink-2: #ddd0c2;
    --soft: #b6a696;
    --muted: #8d7f70;
    --line: #352c24;
    --line-2: #2a221c;
    --bg: #17120e;
    --surface: #1e1813;
    --alt: #201a15;
    --accent: #e8825c;
    --accent-2: #5fc0aa;
    --accent-soft: rgba(232, 130, 92, 0.13);
    --ring: rgba(232, 130, 92, 0.5);
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 17.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.2rem, 1.3rem + 3.6vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.05rem); margin-bottom: 0.55em; }
h3 { font-size: 1.22rem; }

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; transition: color 0.16s ease; }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 3px; }

img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--accent-soft); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-2);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  flex: none;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--accent); }

/* Iniciales con subrayado de acento en vez de una caja con degradado:
   evita el parecido con el logotipo de Bytewonders. */
.brand-mark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1px;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.nav-links a {
  color: var(--soft);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: var(--radius-s);
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--alt); }

@media (max-width: 720px) {
  .nav-links {
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-inline: -4px;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 7px 9px; font-size: 0.85rem; }
  .site-nav { min-height: 56px; }
}

@media (max-width: 560px) { .brand span:not(.brand-mark) { display: none; } }

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(40px, 5.5vw, 78px) 0 clamp(26px, 3vw, 40px); }

.hero-grid { display: grid; gap: 26px; align-items: start; }

/* En movil la foto va primero; en escritorio vuelve a su columna. */
.hero-grid > .portrait { order: -1; }
.hero-grid > .hero-copy { order: 0; }

/* El retrato va arriba en movil y a la derecha a partir de tablet. */
.portrait {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(56, 40, 28, 0.13);
}

@media (min-width: 860px) {
  .hero-grid { grid-template-columns: 1fr auto; gap: 56px; }
  .hero-grid > .hero-copy { grid-column: 1; grid-row: 1; order: 0; }
  .hero-grid > .portrait {
    order: 0;
    grid-column: 2;
    grid-row: 1;
    width: 208px;
    height: 208px;
    border-radius: 4px;
    margin-top: 6px;
  }
}

.hero h1 em { font-style: italic; color: var(--accent); }

.eyebrow {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.lead {
  font-size: clamp(1.08rem, 1rem + 0.5vw, 1.28rem);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 46ch;
  margin-top: 22px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.93rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--ink); color: var(--bg); }

.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { color: var(--accent); border-color: var(--accent); }

.btn svg { width: 15px; height: 15px; flex: none; }

/* ---- datos en linea, sin cajas ---- */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 44px;
  margin-top: 42px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.stat b {
  display: block;
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 5px;
}

.stat span { font-size: 0.85rem; color: var(--muted); display: block; max-width: 21ch; }

/* ---------------------------------------------------------------- secciones */
section { padding: clamp(36px, 4.5vw, 60px) 0; }
.section-alt { background: var(--alt); border-block: 1px solid var(--line-2); }

.kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.prose { max-width: var(--measure); }
.prose p { color: var(--ink-2); }
.prose h2 { margin-top: 2.1rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.8rem 0 0.5rem; }
.prose ul { margin: 0 0 1.15rem 1.15rem; }
.prose li { margin-bottom: 0.45rem; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.pull {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  margin: 1.6rem 0;
  font-family: var(--display);
  font-size: 1.16rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink);
  max-width: 34ch;
}

/* ---------------------------------------------------------------- proyectos */
.projects { display: flex; flex-direction: column; margin-top: 8px; }

.project {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.project:last-child { border-bottom: 0; }

.project h3 { margin-bottom: 5px; }
.project h3 a { color: var(--ink); }
.project h3 a:hover { color: var(--accent); }
.project p { color: var(--soft); font-size: 0.99rem; max-width: 58ch; }

.project-note {
  display: block;
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 8px;
}

@media (min-width: 800px) {
  .project { display: grid; grid-template-columns: 210px 1fr; gap: 0 40px; }
  .project h3 { grid-column: 1; margin-bottom: 0; }
  .project .project-body { grid-column: 2; }
}

/* ---------------------------------------------------------------- articulos */
.posts { display: flex; flex-direction: column; margin-top: 6px; }

.post {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 22px;
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  transition: color 0.16s ease;
}
.post:hover { color: var(--accent); }
.post:last-child { border-bottom: 0; }

.post b { font-family: var(--display); font-weight: 600; font-size: 1.1rem; line-height: 1.3; }

.post time {
  font-size: 0.83rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) { .post { flex-direction: column; gap: 4px; } }

/* ---------------------------------------------------------------- articulo */
.article-head { padding: clamp(36px, 5vw, 56px) 0 4px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.87rem;
  margin-top: 16px;
}
.meta a { color: var(--soft); }
.meta a:hover { color: var(--accent); }

.article-img { width: 100%; border-radius: var(--radius); margin: 6px 0 32px; }

.article-foot {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  font-size: 0.78rem;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); padding: 38px 0 44px; margin-top: 20px; }

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  align-items: center;
  justify-content: space-between;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 4px; }

.footer-links a {
  color: var(--soft);
  font-size: 0.89rem;
  padding: 6px 10px;
  border-radius: var(--radius-s);
  transition: color 0.16s ease, background 0.16s ease;
}
.footer-links a:hover { color: var(--accent); background: var(--alt); }

.footer-note { color: var(--muted); font-size: 0.84rem; width: 100%; margin-top: 4px; }

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
