/* Portafolio profesional · Julián Trujillo Restrepo
   Sistema visual: documento editorial, claro por defecto, oscuro automático. */

/* Fuentes autoalojadas (licencia SIL OFL, ver assets/fonts) */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); 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: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); 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; }


:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #14212b;
  --muted: #566573;
  --line: #ddd8ce;
  --accent: #0a6173;
  --accent-ink: #ffffff;
  --gold: #8a5a0b;
  --ok: #2e7d4f;
  --err: #b3402f;
  --pending-bg: #fff4d6;
  --pending-ink: #6b4a00;

  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: Inter, system-ui, "Segoe UI", Roboto, Arial, sans-serif;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 40px;
  --sp-6: 64px;
  --sp-7: 96px;
  --radius: 4px;
  --max: 1120px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1419;
    --surface: #151d25;
    --text: #e8edf2;
    --muted: #9aa7b4;
    --line: #25303a;
    --accent: #5bbccd;
    --accent-ink: #0e1419;
    --gold: #d9a441;
    --ok: #5cc08a;
    --err: #e5806f;
    --pending-bg: #2b2410;
    --pending-ink: #e7c46a;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1419;
  --surface: #151d25;
  --text: #e8edf2;
  --muted: #9aa7b4;
  --line: #25303a;
  --accent: #5bbccd;
  --accent-ink: #0e1419;
  --gold: #d9a441;
  --ok: #5cc08a;
  --err: #e5806f;
  --pending-bg: #2b2410;
  --pending-ink: #e7c46a;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 var(--sp-3); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: var(--sp-3);
  top: -60px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--sp-2) var(--sp-3);
  z-index: 100;
  border-radius: var(--radius);
}
.skip:focus { top: var(--sp-3); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.icon-btn { white-space: nowrap; }
.nav { display: flex; align-items: center; gap: var(--sp-4); }
.nav a.link {
  text-decoration: none;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav a.link:hover,
.nav a.link[aria-current="true"] { color: var(--text); border-color: var(--accent); }

.tools { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 36px;
  padding: 0 var(--sp-3);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.menu-btn { display: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  font: 600 15px/1 var(--font-body);
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-secondary:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn-sm { min-height: 36px; padding: 0 var(--sp-3); font-size: 13px; }

/* ---------- Tipografía de sección ---------- */
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 var(--sp-3);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(36px, 5.4vw, 60px); line-height: 1.08; }
h2 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.12; }
h3 { font-size: 22px; line-height: 1.2; }
.lead { font-size: 19px; color: var(--muted); max-width: var(--measure); }

.section { padding: var(--sp-7) 0; border-top: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: var(--sp-5); }
.section-head p { color: var(--muted); margin-top: var(--sp-3); }

/* ---------- Hero ---------- */
.hero { padding: var(--sp-7) 0 var(--sp-6); }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: var(--sp-6); align-items: center; }
.hero .role { color: var(--text); font-weight: 600; margin-bottom: var(--sp-3); }
.hero h1 { margin-bottom: var(--sp-4); }
.hero .lead { margin-bottom: var(--sp-5); }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.hero-note { font-size: 14px; color: var(--muted); margin-top: var(--sp-4); }

.ba { border: 1px solid var(--line); background: var(--surface); }
.ba-col { padding: var(--sp-4); }
.ba-col + .ba-col { border-top: 1px solid var(--line); }
.ba-label { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--sp-3); }
.ba-col.now .ba-label { color: var(--accent); }
.ba ul { list-style: none; margin: 0; padding: 0; }
.ba li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.ba li:first-child { border-top: 0; padding-top: 0; }
.ba-col.before li { color: var(--muted); }
.ba-foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- Qué resuelvo ---------- */
.problems { border-top: 1px solid var(--line); }
.problem { display: grid; grid-template-columns: 1fr 1.2fr; gap: var(--sp-5); padding: var(--sp-4) 0; border-bottom: 1px solid var(--line); }
.problem p { margin: 0; color: var(--muted); }

/* ---------- Casos ---------- */
.cases { border-top: 1px solid var(--line); }
.case-row {
  display: grid;
  grid-template-columns: 56px 1fr 220px;
  gap: var(--sp-4);
  align-items: start;
  padding: var(--sp-5) 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background .2s;
}
.case-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.case-row .num { font-family: var(--font-display); font-size: 28px; color: var(--gold); }
.case-row h3 { margin-bottom: var(--sp-2); }
.case-row p { margin: 0; color: var(--muted); max-width: 60ch; }
.case-meta { font-size: 14px; color: var(--muted); }
.case-meta strong { display: block; color: var(--text); font-weight: 600; }
.case-meta .go { display: block; margin-top: var(--sp-3); color: var(--accent); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.chip-main { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* ---------- Método ---------- */
.method-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--sp-6); }
.capabilities { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); counter-reset: cap; }
.capabilities li { padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); counter-increment: cap; display: grid; grid-template-columns: 36px 1fr; gap: var(--sp-2); }
.capabilities li::before { content: "0" counter(cap); font-family: var(--font-display); color: var(--gold); font-size: 18px; }
.capabilities b { display: block; }
.capabilities span { font-size: 14px; color: var(--muted); }
.stack-group { padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.stack-group:first-child { padding-top: 0; }
.stack-group h3 { font-family: var(--font-body); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--sp-2); }
.stack-group p { margin: 0; font-size: 15px; }

/* ---------- Trayectoria ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--sp-4); border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 var(--sp-5) var(--sp-4); }
.timeline li::before { content: ""; position: absolute; left: -29px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline li:last-child { padding-bottom: 0; }
.tl-when { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.timeline h3 { margin: 2px 0 2px; }
.tl-org { color: var(--accent); font-weight: 600; font-size: 15px; margin-bottom: var(--sp-2); }
.timeline p { color: var(--muted); max-width: var(--measure); margin: 0; }

/* ---------- Servicios ---------- */
.services { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.service { padding: var(--sp-4); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.service h3 { margin-bottom: var(--sp-3); }
.service dl { margin: 0; }
.service dt { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: var(--sp-3); }
.service dd { margin: 4px 0 0; }

/* ---------- Sobre mí ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: var(--sp-6); }
.edu { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.edu li { padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.edu b { display: block; }
.edu span { color: var(--muted); font-size: 14px; }

/* ---------- Contacto ---------- */
.contact { background: var(--surface); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); align-items: end; }
.contact-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.contact-list li { border-bottom: 1px solid var(--line); }
.contact-list a { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; text-decoration: none; }
.contact-list a:hover span:last-child { color: var(--accent); }
.contact-list span:first-child { color: var(--muted); font-size: 14px; }

footer { padding: var(--sp-4) 0 var(--sp-5); font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- Casos (página) ---------- */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 60; }
.case-hero { padding: var(--sp-6) 0 var(--sp-5); }
.back { font-size: 14px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: var(--sp-4); }
.back:hover { color: var(--accent); }
.case-hero h1 { max-width: 20ch; margin-bottom: var(--sp-3); font-size: clamp(34px, 4.8vw, 52px); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: var(--sp-5) 0; }
.facts div { padding: var(--sp-3) var(--sp-3) var(--sp-3) 0; }
.facts div + div { padding-left: var(--sp-3); border-left: 1px solid var(--line); }
.facts dt { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-size: 15px; }
.case-body { display: grid; grid-template-columns: 200px 1fr; gap: var(--sp-5); padding: var(--sp-4) 0; border-top: 1px solid var(--line); }
.case-body h2 { font-size: 15px; font-family: var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.case-body .text { max-width: var(--measure); }
.case-body .text p:last-child { margin-bottom: 0; }
.result { font-family: var(--font-body); font-size: 18px; font-weight: 500; line-height: 1.55; padding-left: var(--sp-3); border-left: 3px solid var(--gold); }
.demo-list { list-style: none; padding: 0; margin: var(--sp-3) 0 0; border-top: 1px solid var(--line); }
.demo-list li { border-bottom: 1px solid var(--line); }
.demo-list a { display: flex; justify-content: space-between; padding: var(--sp-3) 0; text-decoration: none; }
.demo-list a:hover { color: var(--accent); }
.demo-note { font-size: 14px; color: var(--muted); margin-top: var(--sp-3); }
.next { display: flex; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-5) 0; border-top: 1px solid var(--line); }
.next a { text-decoration: none; }
.next small { display: block; color: var(--muted); font-size: 13px; }
.next strong { font-family: var(--font-display); font-size: 20px; font-weight: 600; }

mark.pending { background: var(--pending-bg); color: var(--pending-ink); padding: 1px 6px; border-radius: 3px; font-size: .88em; }

/* ---------- CTA móvil fijo ---------- */
.sticky-cta { display: none; }

/* ---------- Revelado ---------- */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .hero-grid, .method-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; gap: var(--sp-5); }
  .case-row { grid-template-columns: 48px 1fr; }
  .case-row .case-meta { grid-column: 2; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts div:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- Móvil ---------- */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .section { padding: var(--sp-6) 0; }
  .hero { padding: var(--sp-5) 0; }
  .ba { display: none; }
  .hero .lead { font-size: 17px; }
  .cta-row .btn { width: 100%; }
  .problem { grid-template-columns: 1fr; gap: var(--sp-2); }
  .services { grid-template-columns: 1fr; }
  .case-body { grid-template-columns: 1fr; gap: var(--sp-2); }
  .menu-btn { display: inline-flex; align-items: center; }
  .icon-btn { min-height: 44px; padding: 0 12px; }
  .site-header .wrap { gap: 8px; }
  .tools { gap: 6px; }
  .nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: var(--sp-2) 16px var(--sp-3);
  }
  .nav.open { display: flex; }
  .nav a.link { padding: 14px 0; font-size: 16px; border-bottom: 1px solid var(--line); }
  .tools .btn { display: none; }
  .contact-list a { min-height: 44px; }
  .next { flex-direction: column; }
  .sticky-cta {
    position: fixed;
    left: 16px; right: 16px; bottom: 16px;
    z-index: 40;
    transform: translateY(140%);
    transition: transform .25s ease;
    display: flex;
  }
  .sticky-cta.show { transform: none; }
  .sticky-cta .btn { width: 100%; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
  body { padding-bottom: 76px; }
}

@media print {
  .site-header, .sticky-cta, .progress { display: none; }
  .reveal { opacity: 1; transform: none; }
}

/* ---- Mi trabajo en cifras (agrupadas por trabajo) ---- */
.band { padding: var(--sp-5) 0; border-top: 1px solid var(--line); }
.stat-groups { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; grid-template-rows: auto 1fr; column-gap: var(--sp-5); row-gap: 0; margin-top: var(--sp-3); }
.sgroup { border-top: 2px solid var(--accent); padding-top: var(--sp-3); display: grid; grid-template-rows: subgrid; grid-row: span 2; row-gap: 0; }
.sg-title { margin: 0 0 var(--sp-3); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sg-items { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-4); }
.sg-items .stat + .stat { border-left: 1px solid var(--line); padding-left: var(--sp-4); }
.stat b { display: block; font: 600 30px/1.1 var(--font-display); color: var(--text); white-space: nowrap; }
.stat span { display: block; margin-top: 8px; font-size: 14px; line-height: 1.4; color: var(--muted); }
@media (max-width: 900px) { .stat-groups { grid-template-columns: 1fr; grid-template-rows: none; row-gap: var(--sp-4); } .sgroup { grid-template-rows: none; grid-row: auto; display: block; } .band { padding: var(--sp-4) 0; } }
@media (max-width: 480px) { .sg-items { grid-auto-flow: row; gap: var(--sp-3); } .sg-items .stat + .stat { border-left: 0; padding-left: 0; } }

/* ---- Proyectos independientes (línea secundaria) ---- */
.pro-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pro-list li { display: grid; grid-template-columns: 280px 1fr; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.pro-list b { font-weight: 600; }
.pro-list span { color: var(--muted); }
@media (max-width: 768px) { .pro-list li { grid-template-columns: 1fr; gap: 4px; } }

/* ---- Habilidades en los casos ---- */
.case-body .chips { margin-top: 0; }
