/* javiermolina.dev
   Layout: un solo scroll; hero a dos columnas con red de nodos en canvas,
   luego bandas de contenido sobre una rejilla técnica tenue. Diseño oscuro único. */

@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains"; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains"; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #070b09;
  --surface: #0c1310;
  --surface-2: #111b16;
  --line: #1c2a23;
  --fg: #e7efe9;
  --muted: #93a79c;
  --accent: #3ee08f;
  --accent-ink: #04140c;
  --accent-soft: rgba(62, 224, 143, 0.12);

  --display: "Bricolage", "Arial Narrow", system-ui, sans-serif;
  --body: "Plex", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step--1: clamp(0.8rem, 0.78rem + 0.1vw, 0.86rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem);
  --step-4: clamp(2.8rem, 1.6rem + 5.6vw, 6.4rem);

  --radius: 6px;
  --wrap: 1180px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--step-0)/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
h2 { font-size: var(--step-2); max-width: 22ch; }
h3 { font-size: var(--step-1); }
p { margin: 0; }
.eyebrow, .label, .meta, .mono, .when, .state, .trait-file, .project-index, .status, figcaption {
  font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0.04em;
}
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 14px; }
.eyebrow::before { content: "// "; opacity: 0.6; }
.lead { font-size: var(--step-1); line-height: 1.5; color: var(--muted); max-width: 58ch; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink);
  font: 600 var(--step-0)/1 var(--body); text-decoration: none;
  border: 1px solid var(--accent);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px var(--accent); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn-small { padding: 9px 14px; font-size: var(--step--1); }
.btn-big { margin-top: 40px; padding: 18px 28px; font-size: var(--step-1); }

/* Top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: rgba(7, 11, 9, 0.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--mono); font-size: 0.95rem; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--accent); color: var(--accent); border-radius: 4px; font-weight: 500; }
.brand-name span { color: var(--accent); }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-size: 0.92rem; transition: color .2s; }
.nav a:hover, .nav a.active { color: var(--fg); }
.nav a.active { box-shadow: 0 2px 0 var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.lang { font-family: var(--mono); font-size: 0.85rem; text-decoration: none; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px; }
.lang:hover { color: var(--fg); border-color: var(--muted); }
@media (max-width: 860px) {
  .nav { display: none; }
  .topbar-actions { margin-left: auto; }
}
@media (max-width: 420px) { .brand-name { display: none; } }

/* Hero */
.hero { position: relative; padding-block: clamp(48px, 9vw, 110px) 48px; overflow: hidden; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; opacity: 0.35;
  mask-image: radial-gradient(ellipse 80% 70% at 60% 30%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 30%, #000 30%, transparent 80%);
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.hero-text { display: grid; gap: 26px; min-width: 0; }
.status { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); border: 1px solid var(--line); background: rgba(12, 19, 16, 0.7); padding: 7px 12px; border-radius: 999px; width: fit-content; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62,224,143,.6); } 70% { box-shadow: 0 0 0 9px rgba(62,224,143,0); } 100% { box-shadow: 0 0 0 0 rgba(62,224,143,0); } }
h1 { font-size: var(--step-4); font-weight: 720; letter-spacing: -0.035em; line-height: 0.92; font-variation-settings: "wdth" 85; }
.role { font-family: var(--mono); font-size: var(--step-1); color: var(--fg); min-height: 1.6em; }
.role-prefix { color: var(--muted); }
.typed { color: var(--accent); }
.caret { display: inline-block; width: 0.55em; height: 1.1em; background: var(--accent); vertical-align: -0.18em; margin-left: 3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cta { display: flex; flex-wrap: wrap; gap: 14px; }

.portrait { margin: 0; display: grid; gap: 12px; justify-self: end; width: 100%; max-width: 420px; }
.portrait-frame { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); aspect-ratio: 1; }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.95) contrast(1.03); transition: transform .6s ease; }
.portrait:hover img { transform: scale(1.03); }
.portrait-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(62,224,143,.10) 50%, transparent 52%);
  background-size: 100% 220%; animation: scan 5s linear infinite;
}
@keyframes scan { from { background-position: 0 -120%; } to { background-position: 0 120%; } }
.corner { position: absolute; width: 18px; height: 18px; border-color: var(--accent); border-style: solid; z-index: 2; }
.corner.tl { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.corner.tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }
.corner.br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }
figcaption { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: clamp(48px, 7vw, 80px) 0 0; border-top: 1px solid var(--line); }
.fact { padding: 22px 18px 0 0; }
.fact + .fact { padding-left: 18px; border-left: 1px solid var(--line); }
.fact dt { font-family: var(--display); font-size: var(--step-2); font-weight: 700; color: var(--fg); line-height: 1; }
.fact dd { margin: 8px 0 0; color: var(--muted); font-size: var(--step--1); }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { justify-self: start; max-width: 240px; order: -1; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(3) { border-left: 0; padding-left: 0; }
  .fact:nth-child(n+3) { padding-top: 22px; }
}

/* Sections */
.section { padding-block: clamp(72px, 10vw, 128px); border-top: 1px solid var(--line); }
.section h2 { margin-bottom: clamp(32px, 4vw, 52px); }
.split { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(28px, 6vw, 90px); align-items: start; }
.split h2 { margin-bottom: 0; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.prose { display: grid; gap: 18px; color: var(--muted); max-width: 62ch; }
.prose p:first-child { color: var(--fg); font-size: var(--step-1); line-height: 1.5; }

/* Traits */
.traits-section { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); }
.traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.trait { background: var(--surface); padding: clamp(24px, 3vw, 36px); display: grid; gap: 14px; align-content: start; transition: background .3s; }
.trait:hover { background: var(--surface-2); }
.trait h3 { font-size: var(--step-2); }
.trait p { color: var(--muted); }
.trait-file { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.trait-file .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
@media (max-width: 860px) { .traits { grid-template-columns: 1fr; } }

/* Projects */
.projects { display: grid; gap: 0; border-top: 1px solid var(--line); }
.project { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(20px, 5vw, 72px); padding-block: clamp(32px, 4vw, 48px); border-bottom: 1px solid var(--line); position: relative; }
.project::before { content: ""; position: absolute; left: 0; top: -1px; height: 1px; width: 0; background: var(--accent); transition: width .5s ease; }
.project:hover::before { width: 100%; }
.project-head { display: grid; gap: 14px; align-content: start; }
.project-index { color: var(--accent); }
.project h3 { font-size: var(--step-2); }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; }
.project-body { display: grid; gap: 14px; color: var(--muted); min-width: 0; max-width: 62ch; }
.challenge { color: var(--fg); font-size: var(--step-1); line-height: 1.45; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-family: var(--mono); font-size: 0.8rem; }
.flow .node { background: var(--accent-soft); color: var(--accent); padding: 5px 10px; border-radius: 4px; border: 1px solid rgba(62,224,143,.25); }
.flow .arrow { color: var(--muted); }
.project:hover .flow .node { animation: lit .9s ease both; }
.project:hover .flow .node:nth-of-type(2) { animation-delay: .12s; }
.project:hover .flow .node:nth-of-type(3) { animation-delay: .24s; }
.project:hover .flow .node:nth-of-type(4) { animation-delay: .36s; }
.project:hover .flow .node:nth-of-type(5) { animation-delay: .48s; }
.project-link { justify-self: start; font-family: var(--mono); font-size: 0.85rem; color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(62,224,143,.35); padding-bottom: 2px; transition: border-color .2s ease; }
.project-link:hover { border-bottom-color: var(--accent); }
@keyframes lit { 40% { background: var(--accent); color: var(--accent-ink); } }
@media (max-width: 860px) { .project { grid-template-columns: 1fr; } }

.subhead { font-size: var(--step-1); margin: clamp(56px, 7vw, 80px) 0 24px; }
.subhead.small { margin: 36px 0 14px; }
.others { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 0 32px; }
.others li { padding-block: 20px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.others h4 { font-size: 1.15rem; }
.others .meta { color: var(--accent); }
.others p { color: var(--muted); font-size: 0.95rem; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-left: 1px solid var(--line); }
.job { display: grid; gap: 8px; padding: 0 0 40px 28px; position: relative; }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: -5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.job:first-child::before { background: var(--accent); }
.when { color: var(--accent); }
.job h3 { font-size: var(--step-1); }
.org { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.job ul { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 8px; color: var(--muted); }
.job li::marker { color: var(--accent); }

/* Stack */
.stack-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 48px); align-items: start; }
.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.stack-group h3 { font-size: 1.1rem; margin-bottom: 14px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; font-size: 0.88rem; color: var(--fg); transition: border-color .2s, color .2s; }
.chips li:hover { border-color: var(--accent); color: var(--accent); }
.learning { border: 1px solid rgba(62,224,143,.35); background: var(--surface); border-radius: var(--radius); padding: 24px; }
.learning h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin-bottom: 14px; }
.learning ul { list-style: none; padding: 0; margin: 0; }
.learning li { display: flex; justify-content: space-between; gap: 12px; padding-block: 10px; border-top: 1px dashed var(--line); }
.learning .state { color: var(--accent); white-space: nowrap; }
@media (max-width: 860px) { .stack-layout { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .stack { grid-template-columns: 1fr; } }

.edu-block { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(28px, 6vw, 90px); margin-top: clamp(72px, 9vw, 110px); padding-top: clamp(56px, 7vw, 80px); border-top: 1px solid var(--line); }
.edu-block h2 { margin-bottom: 0; }
.edu { list-style: none; padding: 0; margin: 0; }
.edu li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 20px; padding-block: 16px; border-bottom: 1px solid var(--line); }
.edu h4 { font-family: var(--body); font-weight: 500; font-size: 1rem; letter-spacing: 0; line-height: 1.4; }
.edu p { color: var(--muted); font-size: 0.92rem; grid-column: 1; }
.edu .meta { color: var(--accent); grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.edu li:first-child h4 { color: var(--accent); }
.langs { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; color: var(--muted); }
.langs strong { color: var(--fg); font-weight: 500; }
@media (max-width: 860px) { .edu-block { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .edu li { grid-template-columns: 1fr; } .edu .meta { grid-column: 1; grid-row: auto; text-align: left; } }

/* Contact */
.contact { background: radial-gradient(ellipse 70% 60% at 20% 100%, rgba(62,224,143,.12), transparent 70%), var(--bg); }
.contact h2 { font-size: clamp(2rem, 1.4rem + 3vw, 3.8rem); max-width: 20ch; margin-bottom: 22px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 40px; }
.contact-item { background: var(--surface); padding: 22px; display: grid; gap: 6px; align-content: start; position: relative; min-width: 0; }
.contact-item .label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.contact-item a { font-size: 1.05rem; text-decoration: none; overflow-wrap: anywhere; }
.contact-item a:hover { color: var(--accent); }
.copy { position: absolute; top: 16px; right: 16px; background: transparent; border: 1px solid var(--line); color: var(--muted); font: 500 0.72rem var(--mono); padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.copy:hover { color: var(--accent); border-color: var(--accent); }

.footer { border-top: 1px solid var(--line); padding-block: 28px calc(28px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 0.85rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }

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

.h1-sub { display: block; margin-top: 18px; font-family: var(--mono); font-size: var(--step--1); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.5; }
.section.personal { padding-block: clamp(40px, 6vw, 72px); }
.section.personal .subhead { margin-top: 0; }
.others h4 a { color: inherit; text-decoration: none; }
.others h4 a:hover, .others h4 a:focus-visible { color: var(--accent); }
.section.personal .others li { align-content: start; }
