/* =========================================================
   Portfolio · Pedro Morales — estilo escritorio / ventanas
   ========================================================= */
:root {
  --bg: #070b14;
  --bg2: #0b1222;
  --win: rgba(15, 22, 40, .82);
  --win-solid: #0f1628;
  --bar: rgba(24, 33, 56, .9);
  --line: rgba(148, 170, 220, .14);
  --line2: rgba(148, 170, 220, .24);
  --fg: #dfe7f5;
  --muted: #8d9bb8;
  --accent: #5ee1b0;   /* verde terminal */
  --accent2: #6aa8ff;  /* azul */
  --warn: #ffc261;
  --red: #ff6b6b;
  --radius: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  font: 16px/1.6 var(--sans);
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 85% -10%, rgba(106, 168, 255, .18), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(94, 225, 176, .12), transparent 60%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
  background-attachment: fixed;
}
a { color: var(--accent2); }
code { font-family: var(--mono); font-size: .88em; background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; }
p { margin: 0 0 .8em; }
::selection { background: rgba(94, 225, 176, .3); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #000; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--muted); }
.muted { color: var(--muted); }
.ok { color: var(--accent); }
.warn { color: var(--warn); }

/* ---------- Barra superior ---------- */
.menubar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  height: 52px; padding: 0 20px;
  background: rgba(7, 11, 20, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 600; }
.brand-logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #06101c; font-weight: 800; font-size: 13px;
}
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; transition: color .15s, background .15s; }
.nav a:hover, .nav a:focus-visible, .nav a.active { color: var(--fg); background: rgba(255, 255, 255, .07); outline: none; }
.nav a.active { color: var(--accent); }
.tray { display: flex; align-items: center; gap: 8px; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.tray-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.menu-toggle { display: none; }

/* ---------- Layout ---------- */
.desktop { max-width: 1160px; margin: 0 auto; padding: 0 20px 40px; }
.section { padding: 72px 0 8px; }
.section-head { margin-bottom: 24px; }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: .04em; }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin-top: 6px; letter-spacing: -.01em; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.mt { margin-top: 20px; }

/* ---------- Ventanas ---------- */
.window {
  background: var(--win);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.window:hover { border-color: rgba(106, 168, 255, .38); }
.titlebar {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 12px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  user-select: none;
}
.lights { display: flex; gap: 7px; }
.lights i { display: block; width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.wtitle { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 150px); }
.wmin {
  margin-left: auto; width: 26px; height: 22px; border-radius: 5px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
.wmin:hover, .wmin:focus-visible { border-color: var(--line2); color: var(--fg); outline: none; }
.wbody { padding: 22px 24px; }
.window.collapsed .wbody { display: none; }
.window h3 { font-size: 1.15rem; margin-bottom: 6px; }
.window h4 { font-size: .8rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent2); margin: 22px 0 10px; }
.tag-line { font-family: var(--mono); font-size: 12.5px; margin-bottom: 8px; }
.mini .wbody { padding: 18px 20px; }
.mini p { color: var(--muted); font-size: .95rem; margin: 0; }
.mini h3 { font-size: 1.02rem; margin-bottom: 8px; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center;
  min-height: calc(100vh - 52px); min-height: calc(100svh - 52px); padding: 48px 0;
}
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 13px; color: var(--muted); border: 1px solid var(--line2); border-radius: 999px; padding: 5px 14px; margin-bottom: 22px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94,225,176,.6); } 70% { box-shadow: 0 0 0 10px rgba(94,225,176,0); } 100% { box-shadow: 0 0 0 0 rgba(94,225,176,0); } }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); letter-spacing: -.03em; font-weight: 800; margin-bottom: 20px; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.13rem; color: #c4cee2; max-width: 34em; }
.lead strong { color: var(--fg); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.chips span { font-family: var(--mono); font-size: 12.5px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); color: #c9d4ea; }
.chips.small { margin: 14px 0 0; gap: 6px; }
.chips.small span { font-size: 11.5px; padding: 2px 8px; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 14px var(--mono); text-decoration: none; cursor: pointer;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line2);
  background: rgba(255, 255, 255, .04); color: var(--fg);
  transition: transform .15s, background .15s, border-color .15s;
}
.btn:hover, .btn:focus-visible { transform: translateY(-1px); border-color: var(--accent2); background: rgba(106, 168, 255, .1); outline: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #06101c; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }

/* Terminal */
.term { background: rgba(6, 10, 18, .9); }
.term .wbody { padding: 18px 20px; min-height: 300px; }
.typed, .neo { margin: 0; font: 14px/1.7 var(--mono); color: #cfe1d8; white-space: pre-wrap; overflow-wrap: anywhere; }
.typed .p, .neo .p { color: var(--accent); font-weight: 700; }
.typed .c, .neo .c { color: var(--accent2); }
.typed .g, .neo .g { color: var(--accent); }
.typed .o { color: #fff; }
.typed .w { color: var(--warn); }
.cursor { display: inline-block; width: .6em; height: 1.1em; vertical-align: -2px; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Actualidad: pasos ---------- */
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.steps li > span {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  font: 700 13px var(--mono); border: 1px solid var(--line2); color: var(--muted);
}
.steps li.done > span { background: rgba(94, 225, 176, .15); border-color: var(--accent); color: var(--accent); }
.steps li.now > span { background: rgba(255, 194, 97, .15); border-color: var(--warn); color: var(--warn); }
.steps p { color: var(--muted); font-size: .93rem; margin: 2px 0 0; }

/* ---------- Experiencia: timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 30px 28px; border-left: 2px solid var(--line2); margin-left: 6px; }
.timeline > li:last-child { padding-bottom: 4px; border-left-color: transparent; }
.timeline > li::before {
  content: ""; position: absolute; left: -8px; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--win-solid); border: 2px solid var(--accent2);
}
.timeline > li:first-child::before { border-color: var(--accent); box-shadow: 0 0 12px rgba(94, 225, 176, .6); }
.tl-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.company { color: var(--accent2); font-weight: 600; margin: 2px 0 0; }
.period { flex: none; font: 12.5px var(--mono); color: var(--muted); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 9px; }
.period.now { color: var(--accent); border-color: rgba(94, 225, 176, .5); }
.bullets { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 7px; }
.bullets li { position: relative; padding-left: 20px; color: #c4cee2; }
.bullets li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }
.bullets strong { color: var(--fg); }

/* ---------- Proyectos: explorador ---------- */
.explorer-body { display: grid; grid-template-columns: 200px 1fr; padding: 0; }
.sidebar { padding: 20px 16px; border-right: 1px solid var(--line); background: rgba(0, 0, 0, .15); font: 13px var(--mono); }
.sidebar a { display: block; color: var(--muted); text-decoration: none; padding: 5px 8px; border-radius: 6px; }
.sidebar a:hover, .sidebar a:focus-visible { color: var(--fg); background: rgba(255, 255, 255, .06); outline: none; }
.side-title { font-size: 11px; letter-spacing: .1em; color: #5f6d8a; margin: 4px 8px 8px; }
.sidebar .side-title:not(:first-child) { margin-top: 22px; }
.side-status { margin: 0 8px 6px; color: var(--muted); }
.project { padding: 24px 26px; min-width: 0; }
.project > h3 { font-size: 1.35rem; margin-bottom: 10px; }
.project > p { color: #c4cee2; }

.arch { border: 1px dashed var(--line2); border-radius: 10px; padding: 18px; background: rgba(0, 0, 0, .18); display: grid; gap: 12px; }
.arch-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.node {
  flex: 1 1 110px; min-width: 110px; text-align: center; padding: 10px 8px; border-radius: 8px;
  border: 1px solid rgba(106, 168, 255, .45); background: rgba(106, 168, 255, .08);
  font: 600 13px/1.35 var(--mono);
}
.node small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.node.user { border-color: var(--line2); background: rgba(255, 255, 255, .03); }
.node.db { border-color: rgba(255, 194, 97, .5); background: rgba(255, 194, 97, .08); }
.arrow { align-self: center; font: 12px var(--mono); color: var(--muted); }
.arch-band { font: 13px/1.5 var(--mono); padding: 9px 12px; border-radius: 8px; color: #c4cee2; }
.arch-band.mon { border: 1px solid rgba(94, 225, 176, .45); background: rgba(94, 225, 176, .07); }
.arch-band.ctl { border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); }

.vm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.vm { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: rgba(255, 255, 255, .02); }
.vm p { margin: 6px 0 0; font-size: .88rem; color: var(--muted); }
.vm-id { font: 700 12px var(--mono); color: var(--accent); }

/* ---------- Stack: grupos estilo código ---------- */
.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 36px; font-family: var(--mono); }
.stack-group { min-width: 0; }
.stack-comment { margin: 0 0 2px; font-size: 13px; color: #5f7a6b; font-style: italic; }
.stack-title { font: 600 14px var(--mono); margin: 0 0 12px; }
.stack-title .kw { color: #c792ea; }
.stack-title .id { color: var(--accent2); }
.op { color: var(--muted); }
.stack-close { margin: 8px 0 0; font-size: 14px; }
.stack .apps { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 14px 6px; }
.stack .app-icon { width: 50px; height: 50px; border-radius: 12px; font-size: 14px; }
.stack .app-icon img { width: 27px; height: 27px; }
.stack .apps li { font-size: 12px; }
.stack .apps { padding-left: 2ch; border-left: 1px dashed var(--line2); margin-left: 4px; }

/* ---------- Stack: iconos de aplicación ---------- */
.apps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 18px 10px; }
.apps li { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 12.5px; color: #c4cee2; }
.app-icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px;
  font: 800 16px var(--mono); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .2s;
}
.apps li:hover .app-icon { transform: translateY(-4px) scale(1.05); }
.i-os   { background: linear-gradient(135deg, #3a7bd5, #1d3f8f); }
.i-lin  { background: linear-gradient(135deg, #f0a030, #a85d00); }
.i-net  { background: linear-gradient(135deg, #22b5a5, #0d6b62); }
.i-ms   { background: linear-gradient(135deg, #5b5fc7, #2d307a); }
.i-ops  { background: linear-gradient(135deg, #e0583c, #8f2614); }
.i-ctr  { background: linear-gradient(135deg, #2496ed, #0b5aa1); }
.i-itsm { background: linear-gradient(135deg, #7a8699, #3d4657); }
.app-icon img { display: block; width: 30px; height: 30px; }
/* Colores oficiales de cada marca */
.b-linux      { background: linear-gradient(135deg, #fcc624, #d9a400); }
.b-ubuntu     { background: linear-gradient(135deg, #f26a35, #c7410f); }
.b-rocky      { background: linear-gradient(135deg, #10b981, #0a7f58); }
.b-debian     { background: linear-gradient(135deg, #c42a4a, #84162b); }
.b-fedora     { background: linear-gradient(135deg, #51a2da, #2a6fa3); }
.b-bash       { background: linear-gradient(135deg, #4eaa25, #2f7414); }
.b-vmware     { background: linear-gradient(135deg, #78898f, #4b585e); }
.b-docker     { background: linear-gradient(135deg, #2496ed, #0d62a8); }
.b-nginx      { background: linear-gradient(135deg, #00a847, #00702f); }
.b-mariadb    { background: linear-gradient(135deg, #0b4f61, #002a33); }
.b-git        { background: linear-gradient(135deg, #f05133, #b8260f); }
.b-ansible    { background: linear-gradient(135deg, #ee0000, #a30000); }
.b-prometheus { background: linear-gradient(135deg, #e6522c, #a8320f); }
.b-grafana    { background: linear-gradient(135deg, #f46800, #b54a00); }
.b-bmc        { background: linear-gradient(135deg, #fe5000, #b83a00); }
.b-mysql      { background: linear-gradient(135deg, #4479a1, #2a5070); }
.b-oracle     { background: linear-gradient(135deg, #e0362c, #9b1c14); }
.b-jira       { background: linear-gradient(135deg, #2684ff, #0052cc); }

/* ---------- Formación / contacto ---------- */
.edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.edu li { display: flex; flex-direction: column; }
.edu span { color: var(--muted); font-size: .92rem; }
.contact { max-width: 760px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.email-out { font-family: var(--mono); }
.small-text { font-size: .9rem; margin: 0; }

.footer { text-align: center; color: #5f6d8a; font: 13px var(--mono); padding: 40px 20px 50px; border-top: 1px solid var(--line); margin-top: 60px; }

/* ---------- Aparición al hacer scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 56px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stack { grid-template-columns: 1fr; }
  .vm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explorer-body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
@media (max-width: 860px) {
  .menu-toggle {
    display: block; margin-left: auto; font: 13px var(--mono); color: var(--fg);
    background: transparent; border: 1px solid var(--line2); border-radius: 6px; padding: 5px 12px; cursor: pointer;
  }
  .tray { display: none; }
  .nav {
    position: absolute; top: 52px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: rgba(7, 11, 20, .97); border-bottom: 1px solid var(--line); padding: 8px 12px 14px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 10px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .desktop { padding: 0 14px 30px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wbody { padding: 18px 16px; }
  .project { padding: 18px 16px; }
  .tl-head { flex-direction: column; gap: 6px; }
  .timeline > li { padding-left: 20px; }
  .arch-row { flex-direction: column; }
  .arrow { font-size: 0; }
  .arrow::after { content: "↓"; font-size: 15px; }
  .wtitle { position: static; transform: none; flex: 1; min-width: 0; max-width: none; text-align: center; }
  .node { flex: none; }
  .section { padding-top: 56px; }
}

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