/* =====================================================================
   styles.css — Oscuro, espacial, con teclas de colores.
   ===================================================================== */

:root {
  --bg: #05060D;
  --surface: rgba(18, 22, 36, 0.72);
  --surface-solid: #111524;
  --line: rgba(255, 255, 255, 0.10);
  --text: #EEF1F8;
  --text-soft: #9AA3B8;
  --accent: #F97316;
  --accent-2: #8B5CF6;
  --live: #4ADE80;
  --wip: #FBBF24;

  --font-display: "Archivo Black", "Arial Black", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius-s: 8px;
  --radius-m: 18px;
  --container: 1180px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: min(100% - 40px, var(--container)); margin-inline: auto; position: relative; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-s); }
.skip:focus { top: 12px; }

/* ---------- Escena 3D ---------- */
.scene { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100lvh; z-index: 0; display: block; pointer-events: none; }
main, .site-footer { position: relative; z-index: 1; }

.stars-fallback { display: none; }
.no-webgl .stars-fallback {
  display: block; position: fixed; inset: 0; z-index: 0;
  background-image: radial-gradient(1px 1px at 20% 30%, #fff8, transparent), radial-gradient(1px 1px at 70% 60%, #fff6, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #fff7, transparent);
  background-size: 300px 300px;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 20;
  background: linear-gradient(to bottom, rgba(5,6,13,.85), rgba(5,6,13,0));
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 24px; }
.brand { font-family: var(--font-display); font-size: 1.05rem; text-decoration: none; letter-spacing: .01em; }
.nav { display: flex; gap: 24px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--text-soft); font-size: .95rem; font-weight: 600; transition: color .15s; }
.nav a:hover { color: var(--text); }
.lang-toggle {
  font: 700 .85rem var(--font-body); color: var(--text); cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px;
}
.lang-toggle:hover { border-color: var(--text-soft); }
@media (max-width: 820px) { .nav { display: none; } .lang-toggle { margin-left: auto; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 12px; font: 800 .98rem var(--font-body);
  text-decoration: none; border: 0; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background-color .15s;
}
/* Botón con forma de tecla: se hunde al presionarlo */
.btn-primary { background: var(--accent); color: #1A0B00; box-shadow: 0 5px 0 #9A3F06; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 0 #9A3F06; }
.btn-primary:active { transform: translateY(5px); box-shadow: 0 0 0 #9A3F06; }
.btn-ghost { background: #1E2533; color: var(--text); box-shadow: 0 5px 0 #0B0E16; }
.btn-ghost:hover { transform: translateY(-1px); box-shadow: 0 6px 0 #0B0E16; }
.btn-ghost:active { transform: translateY(5px); box-shadow: 0 0 0 #0B0E16; }

/* ---------- Hero ---------- */
.hero { min-height: 100svh; display: flex; align-items: center; padding: calc(var(--header-h) + 20px) 0 80px; position: relative; }
.hero-text { max-width: 620px; }
.hero-hello { color: var(--text-soft); font-weight: 700; font-size: 1.1rem; }
.hero-name {
  margin-top: 6px; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(3rem, 8.5vw, 6.6rem); line-height: .92; letter-spacing: -.02em;
  background: linear-gradient(180deg, #FFFFFF 30%, #8C95AB 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-role { margin-top: 20px; font-size: clamp(1.15rem, 2.2vw, 1.45rem); font-weight: 800; color: var(--accent); max-width: 30ch; line-height: 1.3; }
.hero-lead { margin-top: 14px; color: var(--text-soft); max-width: 52ch; }
.hero-actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 14px; }
.hero-status { margin-top: 26px; display: flex; align-items: center; gap: 10px; font-size: .95rem; color: var(--text-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(74,222,128,.2); animation: pulse 2.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(74,222,128,0); } }

@media (max-width: 820px) {
  .hero { align-items: flex-end; padding-bottom: 90px; }
}

/* Entrada orquestada al cargar */
.reveal { opacity: 0; transform: translateY(18px); }
.is-loaded .reveal { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.is-loaded .reveal:nth-child(2) { transition-delay: .08s; }
.is-loaded .reveal:nth-child(3) { transition-delay: .18s; }
.is-loaded .reveal:nth-child(4) { transition-delay: .28s; }
.is-loaded .reveal:nth-child(5) { transition-delay: .38s; }
.is-loaded .reveal:nth-child(6) { transition-delay: .48s; }
@media (prefers-reduced-motion: reduce) { .reveal, .is-loaded .reveal { opacity: 1; transform: none; transition: none; } .dot { animation: none; } }

.scroll-cue { position: absolute; bottom: 26px; left: 50%; translate: -50% 0; width: 26px; height: 42px; border: 2px solid var(--text-soft); border-radius: 14px; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; translate: -50% 0; border-radius: 2px; background: var(--text); animation: cue 1.6s infinite; }
@keyframes cue { 60% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .scroll-cue span { animation: none; } }

/* ---------- Títulos grandes ---------- */
.big-title {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(2.4rem, 6.5vw, 4.8rem); line-height: .95; letter-spacing: -.01em;
  background: linear-gradient(180deg, #FFFFFF 20%, #7E879C 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Secciones ---------- */
.section { padding: clamp(80px, 11vw, 140px) 0; }
.section > .container > .big-title { margin-bottom: 44px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 18px 32px; margin-bottom: 40px; }

/* Panel oscuro detrás del texto para leer bien sobre la escena */
#fortalezas .container, #experiencia .container { max-width: 900px; margin-left: max(20px, calc((100vw - var(--container)) / 2)); }

/* ---------- Fortalezas ---------- */
.strengths { display: grid; gap: 18px; }
.strength {
  background: var(--surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius-m); padding: 26px 28px;
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px 32px;
}
.strength-title { font-size: 1.4rem; font-weight: 800; line-height: 1.2; grid-row: span 2; }
.strength-text { color: var(--text); }
.strength-example { color: var(--text-soft); font-size: .95rem; padding-left: 14px; border-left: 3px solid var(--accent-2); }
@media (max-width: 760px) { .strength { grid-template-columns: 1fr; } .strength-title { grid-row: auto; } }

/* ---------- Skills 3D ---------- */
.skills-stage { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; }
.skills-head { text-align: center; padding-top: calc(var(--header-h) + 6px); position: relative; z-index: 2; pointer-events: none; }
.skills-title { font-size: clamp(3rem, 9vw, 6.5rem); }
.skills-hint { margin-top: 6px; color: var(--text-soft); font-weight: 700; }

.skill-callout {
  position: absolute; top: 30%; z-index: 2; width: min(46vw, 560px);
  left: max(20px, calc((100vw - var(--container)) / 2));
  pointer-events: none; transform: rotate(-18deg); transform-origin: left center; opacity: 0;
}
.skill-callout.is-visible { animation: callout .55s cubic-bezier(.2,.9,.25,1.2) forwards; }
@keyframes callout {
  from { opacity: 0; transform: rotate(-18deg) translateX(-40px) scale(.9); }
  to { opacity: 1; transform: rotate(-18deg) translateX(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .skill-callout.is-visible { animation: none; opacity: 1; } }
.skill-callout-name {
  font-family: var(--font-display); text-transform: uppercase; line-height: .9;
  font-size: clamp(2.6rem, 7vw, 5.5rem); color: var(--text);
  text-shadow: 0 0 40px color-mix(in srgb, var(--key) 55%, transparent);
  overflow-wrap: anywhere;
}
.skill-callout-phrase { margin-top: 10px; font-size: clamp(1.05rem, 2vw, 1.5rem); font-weight: 800; color: var(--text); max-width: 26ch; }
.skill-callout-level { display: inline-block; margin-top: 12px; font-size: .85rem; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: var(--key); color: #0A0B12; }

.skills-list-wrap { position: absolute; left: 0; right: 0; bottom: 20px; z-index: 3; }
.skills-details { background: var(--surface); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 22px; max-height: 70svh; overflow: auto; }
.skills-details summary { cursor: pointer; font-weight: 800; }
.skills-details[open] summary { margin-bottom: 16px; }

@media (max-width: 820px) {
  .skills-hint { font-size: .95rem; }
  .skill-callout { top: auto; bottom: 82px; width: calc(100vw - 40px); transform: none; }
  .skill-callout.is-visible { animation-name: callout-m; }
  @keyframes callout-m { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
  .skill-callout-name { font-size: 2.4rem; }
  .skill-callout-phrase { font-size: 1rem; }
  .skills-list-wrap { bottom: 14px; }
  .skills-details { padding: 10px 18px; }
}

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .9rem; color: var(--text-soft); margin-bottom: 10px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .chip { width: 22px; height: 14px; padding: 0; }
.skill-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.skill-group { font-size: 1rem; font-weight: 800; padding-top: 5px; }
.skill-items { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) { .skill-row { grid-template-columns: 1fr; } }
.chip { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: .9rem; font-weight: 700; border: 1.5px solid var(--accent); }
.chip-daily { background: var(--accent); color: #1A0B00; }
.chip-projects { background: transparent; color: var(--text); }
.chip-learning { color: var(--text-soft); border-style: dashed; border-color: var(--text-soft); }

/* ---------- Experiencia ---------- */
.timeline { list-style: none; position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2)); }
.job { position: relative; margin-bottom: 22px; background: var(--surface); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px 26px; }
.job::before { content: ""; position: absolute; left: -30px; top: 28px; width: 14px; height: 14px; border-radius: 4px; background: var(--accent); box-shadow: 0 3px 0 #9A3F06; }
.job:nth-child(2)::before { background: var(--accent-2); box-shadow: 0 3px 0 #4C2A9E; }
.job-role { font-size: 1.2rem; font-weight: 800; }
.job-meta { margin-top: 2px; color: var(--text-soft); font-size: .95rem; }
.job-points { margin-top: 12px; padding-left: 18px; display: grid; gap: 7px; }
.job-points li::marker { color: var(--accent); }

/* ---------- Proyectos ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { font: 700 .92rem var(--font-body); color: var(--text); cursor: pointer; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; }
.filter:hover { border-color: var(--text-soft); }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 22px; }
.project {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden;
  transition: transform .2s ease, border-color .2s;
}
.project:hover { transform: translateY(-4px); border-color: rgba(249,115,22,.6); }
.project:hover .mini-key { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--key) 55%, #000); }
@media (prefers-reduced-motion: reduce) { .project:hover { transform: none; } }

.project-cover { position: relative; aspect-ratio: 16 / 8; background: radial-gradient(circle at 50% 120%, #1c2340, #0A0C16 70%); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.project-cover img { width: 100%; height: 100%; object-fit: cover; }
.mini-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 16px; transform: rotateX(28deg) rotateZ(-8deg); }
.mini-key {
  --key: #F97316;
  font: 800 .78rem var(--font-body); color: #fff; padding: 12px 12px; min-width: 52px; text-align: center;
  background: var(--key); border-radius: 10px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--key) 55%, #000), inset 0 -3px 0 rgba(0,0,0,.12);
  transition: transform .15s ease, box-shadow .15s ease; transition-delay: calc(var(--i) * 40ms);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.project-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.project-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.project-name { font-size: 1.25rem; font-weight: 800; }
.project-summary { color: var(--text-soft); font-size: .97rem; }
.status { font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.status-live { color: var(--live); background: rgba(74,222,128,.12); }
.status-wip { color: var(--wip); background: rgba(251,191,36,.12); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tag { font-size: .8rem; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: rgba(255,255,255,.07); color: var(--text-soft); }
.empty { color: var(--text-soft); }

/* ---------- Modal ---------- */
.project-dialog { width: min(100% - 24px, 680px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface-solid); color: var(--text); }
.project-dialog::backdrop { background: rgba(3,4,10,.72); backdrop-filter: blur(4px); }
.project-dialog[open] { animation: pop .25s cubic-bezier(.2,.9,.3,1.15); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { .project-dialog[open] { animation: none; } }
.dialog-inner { padding: 0 0 26px; position: relative; }
.dialog-inner > :not(.project-cover):not(.dialog-close) { margin-inline: 26px; }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 2; font: 700 .88rem var(--font-body); background: rgba(0,0,0,.5); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.dialog-title { font-family: var(--font-display); font-weight: 400; font-size: 2.1rem; margin-top: 22px; margin-bottom: 10px; }
.dialog-desc { margin-top: 14px; }
.dialog-sub { margin-top: 22px; font-size: 1rem; font-weight: 800; }
.dialog-points { margin-top: 8px; padding-left: 44px !important; display: grid; gap: 6px; }
.dialog-points li::marker { color: var(--accent); }
.dialog-inner .tags { margin-top: 20px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.dialog-actions:empty { display: none; }
.dialog-note { margin-top: 18px; font-size: .9rem; color: var(--text-soft); }

/* ---------- Contacto ---------- */
.contact { min-height: 100svh; }
.contact-grid { max-width: 620px; margin-left: max(20px, calc((100vw - var(--container)) / 2)); }
.contact-title { font-size: clamp(2.6rem, 7vw, 5.4rem); }
.contact-text { margin-top: 18px; font-size: 1.15rem; color: var(--text-soft); max-width: 40ch; }
.contact-form { margin-top: 30px; display: grid; gap: 16px; background: var(--surface); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 26px; }
.contact-form label { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; }
.contact-form input, .contact-form textarea {
  font: 500 1rem var(--font-body); color: var(--text); background: rgba(0,0,0,.35);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(249,115,22,.18); }
.contact-form .btn { justify-self: start; margin-top: 4px; }
.contact-links { list-style: none; display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.contact-links a { display: inline-block; text-decoration: none; font-weight: 800; font-size: .92rem; padding: 9px 16px; border-radius: 10px; background: #1E2533; box-shadow: 0 4px 0 #0B0E16; transition: transform .12s, box-shadow .12s; }
.contact-links a:hover { transform: translateY(-1px); }
.contact-links a:active { transform: translateY(4px); box-shadow: none; }

@media (max-width: 820px) { .contact { padding-top: 45vh; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: .9rem; color: var(--text-soft); background: rgba(5,6,13,.8); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* ---------- Rendimiento en celulares ----------
   El desenfoque de fondo sobre una escena 3D animada es muy pesado en iPhone. */
@media (pointer: coarse), (max-width: 820px) {
  .strength, .job, .project, .skills-details, .contact-form {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: rgba(14, 17, 29, 0.92);
  }
  .project-dialog::backdrop { backdrop-filter: none; }
  .skill-callout-name { text-shadow: none; }
  .project:hover { transform: none; }
}
