/* ==========================================================================
   soyarnoldo.tech — Estilos principales
   Paleta inspirada en el acabado plateado / gris espacial de Apple.
   Para cambiar colores, edita solo las variables de :root.
   ========================================================================== */

/* ---------- 1. Tokens de diseño ---------- */
:root {
    /* Plateado (modo claro) */
    --bg:            #f5f5f7;
    --bg-alt:        #e8e8ed;
    --surface:       #ffffff;
    --surface-2:     #fbfbfd;
    --border:        #d2d2d7;
    --text:          #1d1d1f;
    --text-2:        #6e6e73;
    --text-3:        #86868b;
    --accent:        #0071e3;
    --accent-hover:  #0077ed;
    --success:       #34c759;

    /* Metal */
    --silver-1: #f5f5f7;
    --silver-2: #e3e4e5;
    --silver-3: #c7c8ca;
    --silver-4: #a1a1a6;
    --silver-5: #6e6e73;
    --metal-gradient: linear-gradient(135deg, #8e8e93 0%, #d1d1d6 30%, #f5f5f7 50%, #c7c8ca 70%, #8e8e93 100%);
    --metal-text:     linear-gradient(180deg, #4a4a4f 0%, #9a9aa0 45%, #3a3a3c 100%);

    /* Tipografía */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
    --fs-hero:  clamp(2.75rem, 7vw, 5.5rem);
    --fs-h2:    clamp(2rem, 4.5vw, 3.5rem);
    --fs-h3:    1.25rem;
    --fs-lead:  clamp(1.125rem, 2vw, 1.5rem);

    /* Espaciado y forma */
    --space-section: clamp(4.5rem, 10vw, 8rem);
    --radius:    18px;
    --radius-sm: 12px;
    --container: 1120px;

    --shadow:    0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.04), 0 20px 48px rgba(0,0,0,.10);
    --ease:      cubic-bezier(.25, .1, .25, 1);
    --nav-bg:    rgba(245, 245, 247, .72);
}

/* Gris espacial (modo oscuro) */
:root[data-theme="dark"] {
    --bg:          #000000;
    --bg-alt:      #1c1c1e;
    --surface:     #1c1c1e;
    --surface-2:   #2c2c2e;
    --border:      #38383a;
    --text:        #f5f5f7;
    --text-2:      #a1a1a6;
    --text-3:      #86868b;
    --accent:      #2997ff;
    --accent-hover:#47a6ff;
    --metal-text:  linear-gradient(180deg, #ffffff 0%, #a1a1a6 55%, #e3e4e5 100%);
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    --shadow-lg:   0 20px 48px rgba(0,0,0,.6);
    --nav-bg:      rgba(22, 22, 23, .72);
}

/* Sigue la preferencia del sistema si el usuario no eligió */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:#000; --bg-alt:#1c1c1e; --surface:#1c1c1e; --surface-2:#2c2c2e; --border:#38383a;
        --text:#f5f5f7; --text-2:#a1a1a6; --accent:#2997ff; --accent-hover:#47a6ff;
        --metal-text: linear-gradient(180deg,#fff 0%,#a1a1a6 55%,#e3e4e5 100%);
        --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
        --shadow-lg: 0 20px 48px rgba(0,0,0,.6);
        --nav-bg: rgba(22,22,23,.72);
    }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background .4s var(--ease), color .4s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.08; letter-spacing: -.02em; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }

.icon { width: 1.1em; height: 1.1em; fill: currentColor; vertical-align: -.15em; flex-shrink: 0; }

.skip-link { position: absolute; left: -999px; top: 0; padding: .5rem 1rem; background: var(--surface); z-index: 100; }
.skip-link:focus { left: 1rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- 3. Utilidades metálicas ---------- */
.metal-text {
    background: var(--metal-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.eyebrow {
    font-size: .875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
    color: var(--text-3); margin-bottom: .75rem;
}

/* ---------- 4. Botones ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .8rem 1.5rem; border-radius: 980px; border: 0;
    background: var(--accent); color: #fff;
    font: 500 1rem var(--font); cursor: pointer;
    transition: background .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn--ghost {
    background: transparent; color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.btn--ghost:hover { background: var(--accent); color: #fff; }
.btn--small { padding: .4rem 1rem; font-size: .875rem; }

/* ---------- 5. Navegación (vidrio) ---------- */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav__brand { font-weight: 700; font-size: 1.125rem; color: var(--text); letter-spacing: -.02em; }
.nav__brand span { color: var(--text-3); font-weight: 500; }
.nav__brand:hover { text-decoration: none; }
.nav__menu { display: flex; align-items: center; gap: 1.75rem; }
.nav__menu a:not(.btn) { color: var(--text-2); font-size: .875rem; transition: color .2s; }
.nav__menu a:not(.btn):hover, .nav__menu a.is-current:not(.btn) { color: var(--text); text-decoration: none; }

.theme-toggle {
    display: grid; place-items: center; width: 34px; height: 34px;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--surface); color: var(--text-2); cursor: pointer;
}
.theme-toggle .icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon--moon { display: block; }

.nav__toggle { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; position: relative; }
.nav__toggle span { position: absolute; left: 10px; right: 10px; height: 1.5px; background: var(--text); transition: transform .3s var(--ease); }
.nav__toggle span:first-child { top: 16px; }
.nav__toggle span:last-child  { top: 23px; }
.nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child  { transform: translateY(-3.5px) rotate(-45deg); }

/* ---------- 6. Hero ---------- */
.hero {
    position: relative; overflow: hidden; text-align: center;
    padding: clamp(6rem, 16vw, 11rem) 0 clamp(5rem, 12vw, 9rem);
}
.hero__inner { position: relative; z-index: 1; }
.hero__title { font-size: var(--fs-hero); letter-spacing: -.035em; }
.hero__subtitle { font-size: var(--fs-lead); font-weight: 600; color: var(--text-2); margin-bottom: .5rem; }
.hero__lead { max-width: 36ch; margin: 0 auto 2.25rem; font-size: var(--fs-lead); color: var(--text-3); }
.hero__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero__shine {
    position: absolute; inset: -40% -10% auto; height: 120%;
    background: radial-gradient(ellipse at 50% 0%, var(--silver-3) 0%, transparent 60%);
    opacity: .55; pointer-events: none;
}
:root[data-theme="dark"] .hero__shine { opacity: .18; }

.badge {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .35rem .9rem; margin-bottom: 1.5rem;
    border-radius: 980px; font-size: .8125rem; font-weight: 500; color: var(--text-2);
    background: var(--surface); border: 1px solid var(--border);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(52,199,89,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(52,199,89,0); } 100% { box-shadow: 0 0 0 0 rgba(52,199,89,0); } }

/* ---------- 7. Secciones ---------- */
.section { padding: var(--space-section) 0; }
.section--alt { background: var(--bg-alt); }
.section__header { text-align: center; margin-bottom: 3.5rem; }
.section__title { font-size: var(--fs-h2); }
.section__lead { color: var(--text-2); font-size: 1.1875rem; max-width: 40ch; margin-inline: auto; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ---------- 8. Sobre mí ---------- */
.about { display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.about__photo img, .about__initials {
    height: auto; aspect-ratio: 1; width: 100%; border-radius: 32px; object-fit: cover;
    box-shadow: var(--shadow-lg);
}
.about__initials {
    display: grid; place-items: center;
    background: var(--metal-gradient);
    font-size: clamp(6rem, 14vw, 10rem); font-weight: 700; color: rgba(255,255,255,.85);
    text-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.about__text p { color: var(--text-2); font-size: 1.125rem; }
.about__location { display: flex; align-items: center; gap: .4rem; color: var(--text-3) !important; font-size: 1rem !important; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1.5rem; margin: 2rem 0 0; }
.stat { display: flex; flex-direction: column-reverse; border-top: 1px solid var(--border); padding-top: 1rem; }
.stat dd { margin: 0; font-size: 2.5rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stat dt { color: var(--text-3); font-size: .875rem; margin-top: .4rem; }

/* ---------- 9. Aptitudes ---------- */
.skills__toolbar { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.segmented {
    display: flex; flex-wrap: wrap; gap: 4px; padding: 4px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.segmented__btn {
    border: 0; background: transparent; color: var(--text-2);
    font: 500 .875rem var(--font); padding: .45rem .9rem; border-radius: 8px; cursor: pointer;
    transition: background .2s, color .2s;
}
.segmented__btn:hover { color: var(--text); }
.segmented__btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
:root[data-theme="dark"] .segmented__btn.is-active { background: #48484a; }

.search {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .9rem; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-3);
}
.search input { border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: .9375rem; width: 180px; }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.skill { display: flex; flex-direction: column; padding: 1.5rem; }
.skill[hidden] { display: none; }
.skill__head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.skill__name { font-size: var(--fs-h3); margin: 0; }
.skill__level { font-size: .875rem; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.skill__meta { font-size: .8125rem; color: var(--text-3); margin: .25rem 0 .75rem; }
.skill__detail { font-size: .9375rem; color: var(--text-2); }
.meter { margin-top: auto; height: 6px; border-radius: 6px; background: var(--bg-alt); overflow: hidden; }
.meter__fill {
    display: block; height: 100%; width: 0; border-radius: inherit;
    background: linear-gradient(90deg, var(--silver-4), var(--silver-2) 50%, var(--silver-4));
    background-size: 200% 100%;
    transition: width 1.2s var(--ease);
}
:root[data-theme="dark"] .meter { background: #2c2c2e; }
.is-visible .meter__fill { width: var(--nivel); animation: sheen 3s linear infinite; }
@keyframes sheen { to { background-position: -200% 0; } }
.skills__empty { text-align: center; color: var(--text-3); padding: 2rem 0; }

/* ---------- 10. Línea de tiempo ---------- */
.timeline { max-width: 760px; margin-inline: auto; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding-left: 2.5rem; margin-bottom: 2rem; }
.timeline__item::before {
    content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--metal-gradient); box-shadow: 0 0 0 4px var(--bg);
}
.timeline__period { display: block; font-size: .875rem; font-weight: 600; color: var(--text-3); margin-bottom: .6rem; }
.timeline__place { color: var(--text-3); font-size: .9375rem; margin-top: -.3rem; }
.timeline .card p { color: var(--text-2); }
.checklist li { position: relative; padding-left: 1.5rem; color: var(--text-2); margin-top: .35rem; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }

/* ---------- 11. Proyectos ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.project { display: flex; flex-direction: column; }
.project p { color: var(--text-2); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 1.25rem; }
.tags li { font-size: .75rem; font-weight: 500; padding: .25rem .65rem; border-radius: 980px; background: var(--bg-alt); color: var(--text-2); }
.project__links { margin-top: auto; display: flex; gap: 1.25rem; font-size: .9375rem; }
.project__links a { display: inline-flex; align-items: center; gap: .3rem; }

/* ---------- 12. Contacto ---------- */
.contact .form { max-width: 640px; margin-inline: auto; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; min-width: 0; }
.field input, .field textarea { width: 100%; }
.field span { font-size: .875rem; font-weight: 500; color: var(--text-2); }
.field input, .field textarea {
    font: inherit; color: var(--text);
    padding: .8rem 1rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface-2);
    transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.field .is-invalid { border-color: #ff3b30; }
.hp { position: absolute; left: -9999px; }
.form__status { margin: 1rem 0 0; font-size: .9375rem; min-height: 1.5em; }
.form__status.is-ok { color: var(--success); }
.form__status.is-error { color: #ff3b30; }
.form .btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- 13. Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 2rem 0; font-size: .8125rem; color: var(--text-3); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer p { margin: 0; }
.social { display: flex; gap: .75rem; }
.social a {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    color: var(--text-2); background: var(--surface); border: 1px solid var(--border);
    transition: color .2s, transform .2s;
}
.social a:hover { color: var(--text); transform: translateY(-2px); }

/* ---------- 14. Animaciones de aparición ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

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

/* ---------- 15. Responsive ---------- */
@media (max-width: 820px) {
    .nav__toggle { display: block; }
    .nav__menu {
        position: fixed; inset: 56px 0 auto; flex-direction: column; align-items: stretch; gap: 0;
        padding: .5rem 1.25rem 1.5rem; background: var(--nav-bg);
        -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 1px solid var(--border);
        transform: translateY(-8px); opacity: 0; visibility: hidden;
        transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
    }
    .nav__menu.is-open { opacity: 1; transform: none; visibility: visible; }
    .nav__menu a:not(.btn) { padding: .9rem 0; font-size: 1.0625rem; border-bottom: 1px solid var(--border); }
    .nav__menu .btn { margin-top: 1rem; justify-content: center; }
    .theme-toggle { margin-top: 1rem; align-self: center; }

    .about { grid-template-columns: 1fr; text-align: center; }
    .about__photo { max-width: 280px; margin-inline: auto; }
    .about__location { justify-content: center; }
    .skills__toolbar { flex-direction: column; align-items: stretch; }
    .search input { width: 100%; }
    .form__row { grid-template-columns: 1fr; }
    .footer__inner { justify-content: center; text-align: center; }

    .hero__langs { margin-top: 1.5rem; color: var(--text-2); }
}
