/* ════════════════════════════════════════════════════════════
   AF Developer — "Diagrama de sistemas"
   Tú eres el nodo central; todo lo demás está conectado.
   ════════════════════════════════════════════════════════════ */
:root {
    --paper: #f5f7fa;
    --paper-2: #eaeff5;
    --grid: #dce3ec;
    --wire: #a9b6c8;
    --ink: #0f1e33;
    --ink-2: #2b3a50;
    --muted: #5a6a80;
    --signal: #2546ff;
    --signal-soft: #e3e8ff;
    --live: #0fb37e;
    --danger: #d83a52;

    --f-sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

    --wrap: 1180px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --space: clamp(5rem, 11vw, 8.5rem);
    --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1.0625rem/1.65 var(--f-sans);
    font-variation-settings: 'wdth' 100;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--signal); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .75rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; }

/* ── Tipografía ─────────────────────────────────────────── */
.display {
    font-weight: 700;
    font-variation-settings: 'wdth' 118;
    letter-spacing: -.025em;
    line-height: .98;
    margin: 0;
}
h1.display { font-size: clamp(2.3rem, 4.4vw, 3.9rem); line-height: 1.02; }
h2.display { font-size: clamp(2rem, 4.2vw, 3.2rem); }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-2); max-width: 34rem; line-height: 1.6; }
.muted { color: var(--muted); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 2rem; margin-bottom: 3rem; }
.section-head p { margin: .9rem 0 0; color: var(--muted); max-width: 34rem; }

/* ── Botones y enlaces ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .55rem;
    font: 600 .98rem/1 var(--f-sans);
    padding: .95rem 1.4rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--ink);
    text-decoration: none; cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-primary:hover { background: #1733d6; border-color: #1733d6; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn[disabled] { opacity: .6; cursor: wait; }
.link { color: var(--signal); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid transparent; transition: border-color .15s; }
.link:hover { border-color: currentColor; }

/* ── Navegación ─────────────────────────────────────────── */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(245, 247, 250, .86);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.nav.is-scrolled { border-color: var(--grid); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; font-weight: 700; font-variation-settings: 'wdth' 115; letter-spacing: -.01em; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid var(--ink); position: relative; flex: none;
}
.brand-mark::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--signal); }
.nav-links { display: flex; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; font-weight: 500; color: var(--ink-2); padding: .4rem 0; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a[aria-current='page'] { color: var(--ink); border-color: var(--signal); }
.nav-cta { display: inline-flex; }
.nav-toggle { display: none; background: none; border: 0; padding: .5rem; cursor: pointer; color: var(--ink); }
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .nav-cta { display: none; }
    .nav-links {
        position: fixed; inset: 68px 0 auto 0;
        flex-direction: column; gap: 0;
        background: var(--paper); border-bottom: 1px solid var(--grid);
        padding: .5rem var(--gutter) 1.5rem;
        transform: translateY(-120%); transition: transform .25s ease;
    }
    .nav-links.is-open { transform: none; }
    .nav-links a { display: block; padding: .9rem 0; border-bottom: 1px solid var(--grid); }
}

/* ── Hero: el diagrama ──────────────────────────────────── */
.hero {
    position: relative;
    padding: clamp(3rem, 7vw, 5.5rem) 0 var(--space);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: -1px -1px;
    border-bottom: 1px solid var(--grid);
}
.hero::after { /* desvanece la retícula hacia abajo */
    content: ''; position: absolute; inset: auto 0 0 0; height: 40%;
    background: linear-gradient(transparent, var(--paper)); pointer-events: none;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 12fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero h1 { margin-bottom: 1.5rem; }
.hero h1 span { color: var(--signal); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2.2rem; }
.status {
    display: inline-flex; align-items: center; gap: .55rem;
    font-size: .92rem; font-weight: 500; color: var(--ink-2);
    background: #fff; border: 1px solid var(--grid); border-radius: 999px;
    padding: .4rem .9rem .4rem .7rem; margin-bottom: 1.75rem;
}
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(15, 179, 126, .18); }

.diagram { width: 100%; height: auto; overflow: visible; }
.diagram .edge { fill: none; stroke: var(--wire); stroke-width: 1.5; }
.diagram .edge.is-hot { stroke: var(--signal); stroke-width: 2; }
.diagram .packet { fill: var(--signal); }
.diagram .node rect { fill: #fff; stroke: var(--ink); stroke-width: 1.5; rx: 6; }
.diagram .node text { font: 500 13px var(--f-mono); fill: var(--ink); }
.diagram .node .kind { font-size: 10.5px; fill: var(--muted); }
.diagram .node:hover rect, .diagram .node:focus rect { stroke: var(--signal); }
.diagram .core rect { fill: var(--ink); stroke: var(--ink); }
.diagram .core text { fill: #fff; font-size: 15px; font-weight: 600; }
.diagram .core .kind { fill: #9fb0c8; }
.diagram .port { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.diagram .core-ring { fill: none; stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 4 5; }
@media (prefers-reduced-motion: reduce) { .diagram .packet { display: none; } }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } .hero-grid > div:last-child { max-width: 560px; } }

/* ── Secciones ──────────────────────────────────────────── */
.section { padding: var(--space) 0; }
.section + .section { border-top: 1px solid var(--grid); }
.section-dark { background: var(--ink); color: #e8eef6; }
.section-dark .muted, .section-dark .section-head p { color: #9fb0c8; }

/* ── Proyectos como nodos con su pipeline ───────────────── */
.projects { display: grid; gap: 0; border-top: 1px solid var(--grid); }
.project {
    display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 2rem; align-items: center;
    padding: 1.75rem 0; border-bottom: 1px solid var(--grid);
    text-decoration: none; color: inherit;
}
.project-thumb { aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); border: 1px solid var(--grid); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.project:hover .project-thumb img { transform: scale(1.04); }
.project h3 { margin: 0 0 .4rem; font-size: 1.5rem; font-weight: 700; font-variation-settings: 'wdth' 112; letter-spacing: -.015em; line-height: 1.15; }
.project:hover h3 { color: var(--signal); }
.project p { margin: 0; color: var(--muted); max-width: 40rem; }
.project-go { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; transition: background .18s, color .18s, border-color .18s; }
.project:hover .project-go { background: var(--signal); border-color: var(--signal); color: #fff; }
.project-go svg { width: 18px; height: 18px; }

/* pipeline: el stack del proyecto como nodos conectados */
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 1rem 0 0; padding: 0; list-style: none; }
.pipeline li {
    position: relative; font-size: .82rem; font-weight: 600; color: var(--ink-2);
    background: #fff; border: 1.5px solid var(--ink); border-radius: 4px; padding: .22rem .6rem;
    margin: .25rem 1.4rem .25rem 0;
}
.pipeline li:not(:last-child)::after {
    content: ''; position: absolute; left: 100%; top: 50%; width: calc(1.4rem + 1.5px); height: 1.5px; background: var(--wire);
}
.pipeline li:first-child { background: var(--ink); color: #fff; }

@media (max-width: 760px) {
    .project { grid-template-columns: 1fr; gap: 1rem; }
    .project-go { display: none; }
}

/* ── Cómo trabajo: proceso secuencial ───────────────────── */
.process { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; list-style: none; padding: 0; margin: 0; counter-reset: step; }
.process li { position: relative; padding: 2.25rem 1.75rem 0 0; counter-increment: step; }
.process li::before {
    content: counter(step); display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%;
    border: 1.5px solid #fff; color: #fff; font-weight: 700; margin-bottom: 1.25rem;
    position: relative; z-index: 1; background: var(--ink);
}
.process li::after { content: ''; position: absolute; top: calc(2.25rem + 19px); left: 38px; right: 0; height: 1.5px; background: #3a4c66; }
.process li:last-child::after { display: none; }
.process h3 { margin: 0 0 .5rem; font-size: 1.2rem; font-weight: 700; font-variation-settings: 'wdth' 110; }
.process p { margin: 0; color: #9fb0c8; font-size: .98rem; }
@media (max-width: 860px) {
    .process { grid-template-columns: 1fr; }
    .process li { padding: 0 0 2rem 3.75rem; }
    .process li::before { position: absolute; left: 0; top: 0; margin: 0; }
    .process li::after { top: 38px; bottom: 0; left: 18px; right: auto; width: 1.5px; height: auto; }
}

/* ── Sobre mí ───────────────────────────────────────────── */
.about { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.about-photo { position: relative; }
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); border: 1.5px solid var(--ink); }
.about-photo::after { /* "puerto" de conexión del nodo */
    content: ''; position: absolute; right: -9px; top: 50%; width: 16px; height: 16px; border-radius: 50%;
    background: var(--paper); border: 1.5px solid var(--ink); transform: translateY(-50%);
}
.about-text { font-size: 1.1rem; color: var(--ink-2); }
.about-text p { margin: 0 0 1.1rem; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--grid); border: 1px solid var(--grid); border-radius: var(--radius); overflow: hidden; margin-top: 2rem; }
.facts div { background: var(--paper); padding: 1.1rem 1.2rem; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { margin: .2rem 0 0; font-weight: 700; font-size: 1.1rem; font-variation-settings: 'wdth' 110; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } .about-photo { max-width: 320px; } .facts { grid-template-columns: 1fr; } }

/* ── Testimonios ────────────────────────────────────────── */
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2.5rem 3rem; }
.quote { margin: 0; padding-left: 1.4rem; border-left: 2px solid var(--signal); }
.quote blockquote { margin: 0 0 1.25rem; font-size: 1.12rem; line-height: 1.6; color: var(--ink); }
.quote figcaption { display: flex; align-items: center; gap: .8rem; }
.quote img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 1px solid var(--grid); }
.quote strong { display: block; font-weight: 600; }
.quote span { font-size: .9rem; color: var(--muted); }

/* ── Blog ───────────────────────────────────────────────── */
.posts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--grid); }
.posts li { border-bottom: 1px solid var(--grid); }
.posts a { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: 2rem; align-items: baseline; padding: 1.6rem 0; text-decoration: none; }
.posts time { color: var(--muted); font-size: .92rem; }
.posts h3 { margin: 0; font-size: 1.3rem; font-weight: 600; line-height: 1.3; }
.posts p { margin: .35rem 0 0; color: var(--muted); }
.posts a:hover h3 { color: var(--signal); }
.posts .read { color: var(--muted); font-size: .9rem; white-space: nowrap; }
@media (max-width: 760px) { .posts a { grid-template-columns: 1fr; gap: .3rem; } }

/* ── Contacto ───────────────────────────────────────────── */
.contact { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2rem, 6vw, 5rem); }
.channels { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .85rem; }
.channels a { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; font-weight: 500; color: #e8eef6; }
.channels a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.channels i { width: 1.2rem; text-align: center; color: #8fa6ff; }
.form { display: grid; gap: 1.1rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.field label { display: block; font-size: .92rem; font-weight: 600; margin-bottom: .45rem; color: #e8eef6; }
.field label small { font-weight: 400; color: #9fb0c8; }
.field input, .field textarea {
    width: 100%; font: inherit; color: #fff;
    background: #16294a; border: 1.5px solid #2c4166; border-radius: var(--radius);
    padding: .85rem 1rem; transition: border-color .15s, background .15s;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #6c80a0; }
.field input:focus, .field textarea:focus { outline: none; border-color: #8fa6ff; background: #1a3157; }
.field.has-error input, .field.has-error textarea { border-color: #ff8095; }
.field-error { display: block; margin-top: .4rem; font-size: .88rem; color: #ffb3bf; min-height: 0; }
.form-status { font-weight: 500; margin: 0; }
.form-status.ok { color: #6ee7b7; }
.form-status.err { color: #ffb3bf; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 860px) { .contact, .form .row { grid-template-columns: 1fr; } }

/* ── Footer ─────────────────────────────────────────────── */
.footer { padding: 3rem 0; border-top: 1px solid var(--grid); font-size: .95rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; align-items: center; }
.socials { display: flex; gap: .5rem; list-style: none; margin: 0; padding: 0; }
.socials a { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--grid); border-radius: 50%; color: var(--ink); text-decoration: none; transition: border-color .15s, color .15s; }
.socials a:hover { border-color: var(--signal); color: var(--signal); }
.footer a.quiet { color: var(--muted); text-decoration: none; }
.footer a.quiet:hover { color: var(--ink); }

/* ── Páginas internas ───────────────────────────────────── */
.page-head { padding: clamp(3rem, 7vw, 5rem) 0 3rem; border-bottom: 1px solid var(--grid); }
.page-head .lead { margin-top: 1.25rem; }
.crumb { display: inline-block; margin-bottom: 1.5rem; color: var(--muted); text-decoration: none; font-weight: 500; }
.crumb:hover { color: var(--signal); }

.case { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.case-aside { position: sticky; top: 96px; border: 1.5px solid var(--ink); border-radius: var(--radius); background: #fff; }
.case-aside dl { margin: 0; }
.case-aside div { padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--grid); }
.case-aside div:last-child { border-bottom: 0; }
.case-aside dt { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.case-aside dd { margin: 0; font-weight: 600; }
.case-aside .actions { display: grid; gap: .6rem; padding: 1.3rem; }
.case-cover { border-radius: var(--radius); border: 1px solid var(--grid); margin-bottom: 2.5rem; width: 100%; }
@media (max-width: 860px) { .case { grid-template-columns: 1fr; } .case-aside { position: static; } }

.prose { font-size: 1.1rem; line-height: 1.8; color: var(--ink-2); max-width: 42rem; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3 { color: var(--ink); line-height: 1.25; font-variation-settings: 'wdth' 110; letter-spacing: -.01em; margin: 2.4rem 0 .9rem; }
.prose h2 { font-size: 1.75rem; } .prose h3 { font-size: 1.35rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.3rem; }
.prose a { color: var(--signal); }
.prose img { border-radius: var(--radius); margin: 1.75rem 0; height: auto; }
.prose blockquote { margin: 1.75rem 0; padding-left: 1.25rem; border-left: 2px solid var(--signal); color: var(--ink); }
.prose code { font-family: var(--f-mono); font-size: .88em; background: var(--paper-2); padding: .12em .4em; border-radius: 3px; }
.prose pre { background: var(--ink); color: #e8eef6; padding: 1.25rem 1.4rem; border-radius: var(--radius); overflow-x: auto; font-size: .9rem; line-height: 1.6; margin: 0 0 1.5rem; }
.prose pre code { background: none; padding: 0; color: inherit; }

.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2rem; list-style: none; padding: 0; margin: 0; }
.team img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--grid); margin-bottom: 1rem; }
.team h3 { margin: 0; font-size: 1.15rem; }
.team p { margin: .2rem 0 0; color: var(--muted); }

.empty { padding: 3rem 0; color: var(--muted); }
.pager { display: flex; justify-content: space-between; margin-top: 2.5rem; }

/* ── WhatsApp flotante ──────────────────────────────────── */
.wa {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
    width: 54px; height: 54px; border-radius: 50%;
    display: grid; place-items: center;
    background: #25d366; color: #fff; font-size: 1.55rem; text-decoration: none;
    box-shadow: 0 6px 20px rgba(15, 30, 51, .22);
    transition: transform .18s;
}
.wa:hover { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Pipeline vertical (columna lateral del proyecto): nunca deja conectores colgando */
.pipeline-v { flex-direction: column; align-items: flex-start; }
.pipeline-v li { margin: 0 0 1.1rem 0; }
.pipeline-v li:last-child { margin-bottom: 0; }
.pipeline-v li:not(:last-child)::after { left: 1rem; top: 100%; width: 1.5px; height: calc(1.1rem + 1.5px); }
