/* ---------- Paleta y base ---------- */
:root {
    --bg: #f6f3ee;
    --bg-alt: #ece7df;
    --surface: #fbfaf7;
    --ink: #1f1d1a;
    --ink-soft: #57524b;
    --muted: #8a847a;
    --line: #dcd5ca;
    --accent: #9a7b55;
    --accent-dark: #7b6142;
    --dark: #23211e;
    --radius: 14px;
    --serif: 'Fraunces', Georgia, serif;
    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --nav-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-h);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 500;
    line-height: 1.15;
    margin: 0;
    letter-spacing: -.01em;
}

a { color: inherit; }

.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

.eyebrow {
    margin: 0 0 1rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .85rem 1.6rem;
    border-radius: 999px;
    font: 500 .95rem var(--sans);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible, .nav a:focus-visible, .nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
.btn-primary { background: var(--dark); color: var(--bg); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- Navbar ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--nav-h);
    background: rgba(246, 243, 238, .82);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.nav-inner {
    max-width: 1140px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--ink);
}
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-ink { fill: var(--ink); }
.logo-accent { fill: var(--accent); }
.logo-word {
    font: 500 1.45rem/1 'Jost', var(--sans);
    letter-spacing: -.01em;
    padding-bottom: 2px;
}
.logo-sm .logo-mark { width: 22px; height: 22px; }
.logo-sm .logo-word { font-size: 1.1rem; }
.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.nav-links a {
    font-size: .93rem;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-cta {
    padding: .55rem 1.15rem;
    border-radius: 999px;
    background: var(--dark);
    color: var(--bg);
}
.nav-links .nav-cta:hover { color: var(--bg); background: var(--accent-dark); }

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 10px;
}
.nav-toggle span {
    display: block;
    height: 2px;
    margin: 5px 0;
    background: var(--ink);
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.nav.open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav.open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 960px) {
    .nav-toggle { display: block; }
    .nav-links {
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: .5rem 24px 1.25rem;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 12px 24px rgba(31, 29, 26, .06);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .2s, transform .2s, visibility .2s;
    }
    .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; }
    .nav-links a { padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
    .nav-links .nav-cta { margin-top: 1rem; text-align: center; border-bottom: 0; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: clamp(5rem, 14vh, 9rem) 0 clamp(4.5rem, 12vh, 8rem);
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    right: -12%;
    top: -30%;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(154, 123, 85, .16), transparent 65%);
    pointer-events: none;
}
.hero-inner { position: relative; }
h1:focus { outline: none; }

.hero h1 {
    font-size: clamp(2.4rem, 6vw, 4.6rem);
    max-width: 16ch;
}
.hero h1 em {
    font-style: italic;
    color: var(--accent);
}
.lead {
    margin: 1.75rem 0 2.5rem;
    max-width: 58ch;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--ink-soft);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

/* Entrada suave del hero */
.reveal {
    opacity: 0;
    animation: rise .9s cubic-bezier(.2, .7, .2, 1) forwards;
}
.d1 { animation-delay: .1s; }
.d2 { animation-delay: .25s; }
.d3 { animation-delay: .4s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Secciones ---------- */
.section { padding: clamp(4rem, 10vw, 7rem) 0; }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); max-width: 20ch; }
.section-head { margin-bottom: 3rem; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}
.card {
    padding: 2rem 1.75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card:hover {
    transform: translateY(-4px);
    border-color: #cfc6b8;
    box-shadow: 0 18px 40px rgba(31, 29, 26, .07);
}
.card-num {
    display: block;
    margin-bottom: 1.5rem;
    font: 500 .85rem var(--serif);
    color: var(--accent);
}
.card h3 { font-size: 1.35rem; margin-bottom: .6rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: .96rem; }

.split {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: clamp(2rem, 6vw, 5rem);
}
.split-text p { margin: 0 0 1.2rem; color: var(--ink-soft); font-size: 1.05rem; }
.values {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    border-top: 1px solid var(--line);
}
.values li {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 1rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
}
.values strong { font: 500 1.1rem var(--serif); }
.values span { color: var(--ink-soft); }


@media (max-width: 820px) {
    .split { grid-template-columns: 1fr; }
    .values li { grid-template-columns: 1fr; gap: .2rem; }
}

/* ---------- Proyectos ---------- */
.project {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
.browser {
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 30px 60px rgba(31, 29, 26, .14);
    transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s;
}
.browser:hover { transform: translateY(-4px); box-shadow: 0 36px 70px rgba(31, 29, 26, .18); }
.browser-bar {
    display: flex;
    gap: 6px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
}
.browser-bar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--line);
}
.browser img { width: 100%; height: auto; }
.project-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.tag {
    padding: .3rem .75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: var(--surface);
}
.project h3 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: 1rem; }
.project-info > p { margin: 0 0 1.5rem; color: var(--ink-soft); font-size: 1.05rem; }
.project-points {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}
.project-points li {
    position: relative;
    padding: .8rem 0 .8rem 1.4rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: .96rem;
}
.project-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 1.35rem;
    width: 7px;
    height: 7px;
    background: var(--accent);
}
@media (max-width: 820px) {
    .project { grid-template-columns: 1fr; }
}

/* ---------- Contacto ---------- */
.contact {
    padding: clamp(4rem, 9vw, 6.5rem) 0;
    background: var(--dark);
    color: var(--bg);
}
.contact .eyebrow { color: #c8a97e; }
.contact h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
.contact p:not(.eyebrow) { margin: 1rem 0 0; color: #bdb5a9; font-size: 1.05rem; }
.contact-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2rem 3rem;
}
.contact-action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .9rem;
}
.btn-light { background: var(--bg); color: var(--ink); }
.btn-light:hover { background: #c8a97e; }
.btn-light:focus-visible { outline-color: #c8a97e; }
.contact-mail {
    color: #bdb5a9;
    text-decoration: none;
    border-bottom: 1px solid rgba(189, 181, 169, .4);
    word-break: break-all;
    transition: color .2s, border-color .2s;
}
.contact-mail:hover { color: var(--bg); border-color: var(--bg); }
.footer-mail { color: var(--ink-soft); text-decoration: none; }
.footer-mail:hover { color: var(--accent); }

/* ---------- Animaciones al hacer scroll ---------- */
:root { --ease-out: cubic-bezier(.16, 1, .3, 1); }

.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 36px, 0);
    transition:
        opacity .9s var(--ease-out),
        transform 1.1s var(--ease-out),
        clip-path 1.2s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 90ms);
    will-change: opacity, transform;
}
.js [data-reveal="right"] { transform: translate3d(40px, 0, 0); }

/* Titulos: suben y se revelan como detras de una linea */
.js [data-reveal="mask"] {
    opacity: 1;
    transform: none;
}
.js [data-reveal="mask"] > span {
    display: block;
    opacity: 0;
    transform: translate3d(0, .5em, 0);
    clip-path: inset(0 0 100% 0);
    transition:
        opacity .9s var(--ease-out),
        transform 1.1s var(--ease-out),
        clip-path 1.2s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 90ms + .1s);
}
.js [data-reveal="mask"].in > span {
    opacity: 1;
    transform: none;
    clip-path: inset(-.2em -.2em -.3em -.2em);
}

/* Imagen del proyecto: se abre desde el centro con un leve zoom */
.js [data-reveal="image"] {
    transform: translate3d(0, 48px, 0) scale(.96);
    clip-path: inset(10% 10% 10% 10% round 12px);
    transition-duration: .9s, 1.4s, 1.4s;
}
.js [data-reveal="image"].in { clip-path: inset(-20% -20% -20% -20% round 12px); }

/* Filas de valores: la linea inferior se dibuja de izquierda a derecha */
.js [data-reveal="line"] { transform: translate3d(0, 18px, 0); }
.values li { position: relative; }
.js .values li[data-reveal="line"] { border-bottom-color: transparent; }
.js .values li[data-reveal="line"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--line);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1.2s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 90ms + .15s);
}
.js .values li[data-reveal="line"].in::after { transform: scaleX(1); }

.js [data-reveal].in {
    opacity: 1;
    transform: none;
}

/* Barra de progreso bajo el navbar */
.nav::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(var(--scroll, 0));
    transform-origin: left;
}

/* ---------- Footer ---------- */
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .88rem;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
    justify-content: space-between;
    align-items: center;
}

/* ---------- Pantalla de carga ---------- */
.boot {
    position: fixed;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 1rem;
}
.boot-mark { width: 56px; height: 56px; animation: boot-pulse 1.4s ease-in-out infinite; }
@keyframes boot-pulse { 50% { opacity: .45; } }
.boot-bar {
    width: 140px;
    height: 2px;
    background: var(--line);
    position: relative;
    overflow: hidden;
}
.boot-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: var(--blazor-load-percentage, 10%);
    background: var(--accent);
    transition: width .15s;
}

/* ---------- Errores de Blazor ---------- */
#blazor-error-ui {
    background: #fff4e5;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}
.blazor-error-boundary::after { content: "Ocurrió un error."; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
